mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 09:09:00 +08:00
feat: 脚本筛选的快捷操作支持 await
This commit is contained in:
parent
164ae9a7a8
commit
aff7ddf41e
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.14.149",
|
||||
"version": "2.14.150",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -319,10 +319,10 @@ function ScriptOperator(script, targetPlatform, $arguments, source) {
|
||||
const operator = createDynamicFunction(
|
||||
'operator',
|
||||
`async function operator(input = []) {
|
||||
let proxies
|
||||
if (Array.isArray(input)) {
|
||||
let proxies = input
|
||||
let list = []
|
||||
for await (let $server of input) {
|
||||
for await (let $server of proxies) {
|
||||
${script}
|
||||
list.push($server)
|
||||
}
|
||||
@ -622,10 +622,16 @@ function ScriptFilter(script, targetPlatform, $arguments, source) {
|
||||
await (async function () {
|
||||
const filter = createDynamicFunction(
|
||||
'filter',
|
||||
`async function filter(proxies = []) {
|
||||
return proxies.filter(($server = {}) => {
|
||||
${script}
|
||||
})
|
||||
`async function filter(input = []) {
|
||||
let proxies = input
|
||||
let list = []
|
||||
const fn = async ($server) => {
|
||||
${script}
|
||||
}
|
||||
for await (let $server of proxies) {
|
||||
list.push(await fn($server))
|
||||
}
|
||||
return list
|
||||
}`,
|
||||
$arguments,
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user