mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 13:19:02 +08:00
feat: 快捷脚本支持 await; 脚本操作支持 produceArtifact
This commit is contained in:
parent
3aacd26b79
commit
164ae9a7a8
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.148",
|
"version": "2.14.149",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -7,6 +7,8 @@ import lodash from 'lodash';
|
|||||||
import $ from '@/core/app';
|
import $ from '@/core/app';
|
||||||
import { hex_md5 } from '@/vendor/md5';
|
import { hex_md5 } from '@/vendor/md5';
|
||||||
import { ProxyUtils } from '@/core/proxy-utils';
|
import { ProxyUtils } from '@/core/proxy-utils';
|
||||||
|
import { produceArtifact } from '@/restful/sync';
|
||||||
|
|
||||||
import env from '@/utils/env';
|
import env from '@/utils/env';
|
||||||
import { getFlowHeaders, parseFlowHeaders, flowTransfer } from '@/utils/flow';
|
import { getFlowHeaders, parseFlowHeaders, flowTransfer } from '@/utils/flow';
|
||||||
|
|
||||||
@ -319,11 +321,12 @@ function ScriptOperator(script, targetPlatform, $arguments, source) {
|
|||||||
`async function operator(input = []) {
|
`async function operator(input = []) {
|
||||||
let proxies
|
let proxies
|
||||||
if (Array.isArray(input)) {
|
if (Array.isArray(input)) {
|
||||||
proxies = input
|
let list = []
|
||||||
return proxies.map(($server = {}) => {
|
for await (let $server of input) {
|
||||||
${script}
|
${script}
|
||||||
return $server
|
list.push($server)
|
||||||
})
|
}
|
||||||
|
return list
|
||||||
} else {
|
} else {
|
||||||
let { $content, $files } = input
|
let { $content, $files } = input
|
||||||
${script}
|
${script}
|
||||||
@ -783,6 +786,7 @@ function createDynamicFunction(name, script, $arguments) {
|
|||||||
'ProxyUtils',
|
'ProxyUtils',
|
||||||
'scriptResourceCache',
|
'scriptResourceCache',
|
||||||
'flowUtils',
|
'flowUtils',
|
||||||
|
'produceArtifact',
|
||||||
`${script}\n return ${name}`,
|
`${script}\n return ${name}`,
|
||||||
)(
|
)(
|
||||||
$arguments,
|
$arguments,
|
||||||
@ -797,6 +801,7 @@ function createDynamicFunction(name, script, $arguments) {
|
|||||||
ProxyUtils,
|
ProxyUtils,
|
||||||
scriptResourceCache,
|
scriptResourceCache,
|
||||||
flowUtils,
|
flowUtils,
|
||||||
|
produceArtifact,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return new Function(
|
return new Function(
|
||||||
@ -806,8 +811,17 @@ function createDynamicFunction(name, script, $arguments) {
|
|||||||
'ProxyUtils',
|
'ProxyUtils',
|
||||||
'scriptResourceCache',
|
'scriptResourceCache',
|
||||||
'flowUtils',
|
'flowUtils',
|
||||||
|
'produceArtifact',
|
||||||
|
|
||||||
`${script}\n return ${name}`,
|
`${script}\n return ${name}`,
|
||||||
)($arguments, $, lodash, ProxyUtils, scriptResourceCache, flowUtils);
|
)(
|
||||||
|
$arguments,
|
||||||
|
$,
|
||||||
|
lodash,
|
||||||
|
ProxyUtils,
|
||||||
|
scriptResourceCache,
|
||||||
|
flowUtils,
|
||||||
|
produceArtifact,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user