diff --git a/NobyDa_BoxJs.json b/NobyDa_BoxJs.json index 43144f3..0497b35 100644 --- a/NobyDa_BoxJs.json +++ b/NobyDa_BoxJs.json @@ -452,7 +452,7 @@ }, { "id": "@TESTFLIGHT-ACCOUNT.EnableCache", "name": "启用缓存", - "val": false, + "val": true, "type": "boolean", "desc": "用于缓存APP列表, 改善列表页面加载过慢,需与\"请求超时\"配合使用。开启缓存并刷新列表后,可适当调小超时" }, { diff --git a/Surge/Module/TestFlightAccount.sgmodule b/Surge/Module/TestFlightAccount.sgmodule index 2fd2bf9..92e18a9 100644 --- a/Surge/Module/TestFlightAccount.sgmodule +++ b/Surge/Module/TestFlightAccount.sgmodule @@ -1,14 +1,14 @@ #!name=TestFlight账户管理 #!desc=自动存储/合并多个TestFlight账户列表, 并可导出/分享TestFlight APP. -#!arguments=请求超时:30,列表缓存:0,使用iOS列表:0,调试模式:0 -#!arguments-desc=请求超时:单位:秒\n\n列表缓存:1/0,开启/关闭。用于缓存APP列表,改善列表页面加载过慢。一般与"请求超时"配合使用,开启缓存并刷新列表后,可适当调小超时。\n\n使用iOS列表:1/0,开启/关闭。强制使用iOS应用列表,用于改善 macOS TestFlight 加载过慢。iOS用户无需开启。\n\n调试模式:1/0,开启/关闭。用于调试脚本。 +#!arguments=请求超时:30,启用缓存:1,使用iOS列表:0,调试模式:0 +#!arguments-desc=请求超时:单位:秒。默认30秒。\n\n启用缓存:1/0,开启/关闭,默认开启。用于缓存APP列表,改善列表页面加载过慢。一般与"请求超时"配合使用,开启缓存并刷新列表后,可适当调小超时。\n\n使用iOS列表:1/0,开启/关闭。强制使用iOS应用列表,用于改善 macOS TestFlight 加载过慢。iOS用户无需开启。\n\n调试模式:1/0,开启/关闭。用于调试脚本。 #!category=🐻 NobyDa [General] skip-proxy = %APPEND% iosapps.itunes.apple.com [Script] -TestFlight账户管理 = type=http-request,pattern=^https:\/\/testflight\.apple\.com\/v\d\/(app|account|invite)s\/,requires-body=1,timeout=180,script-path=https://raw.githubusercontent.com/NobyDa/Script/master/TestFlight/TestFlightAccount.js,debug={{{调试模式}}},argument="timeout={{{请求超时}}}&enableCache={{{列表缓存}}}&forceIOSlist={{{使用iOS列表}}}&debug={{{调试模式}}}" +TestFlight账户管理 = type=http-request,pattern=^https:\/\/testflight\.apple\.com\/v\d\/(app|account|invite)s\/,requires-body=1,timeout=180,script-path=https://raw.githubusercontent.com/NobyDa/Script/master/TestFlight/TestFlightAccount.js,debug={{{调试模式}}},argument="timeout={{{请求超时}}}&enableCache={{{启用缓存}}}&forceIOSlist={{{使用iOS列表}}}&debug={{{调试模式}}}",engine=jsc [MITM] hostname = %APPEND% testflight.apple.com \ No newline at end of file diff --git a/TestFlight/TestFlightAccount.js b/TestFlight/TestFlightAccount.js index b766aaf..16c3a09 100644 --- a/TestFlight/TestFlightAccount.js +++ b/TestFlight/TestFlightAccount.js @@ -3,7 +3,7 @@ TestFlight账户管理脚本 脚本作者: @NobyDa 脚本兼容: Surge4、QuantumultX、Loon(2.1.20 413+) -更新时间: 2024/04/05 +更新时间: 2024/04/06 主要功能: 1. 自动存储多个TestFlight账户,并自动合并APP列表,避免切换账户。 @@ -52,7 +52,7 @@ const [obj, req, rsp] = [new Map(), $request, {}]; const [k1, k2, k3] = ['x-session-id', 'x-request-id', 'x-session-digest']; const [list, appList] = [$.read('AccountList') || {}, $.read('AppList') || {}]; $.debug = Number(args.debug) || ($.read('Debug') === 'true'); -$.EnableCache = Number(args.enableCache) || ($.read('EnableCache') === 'true'); +$.EnableCache = !(Number(args.enableCache) === 0) || !($.read('EnableCache') === 'false'); $.ForceIOSlist = Number(args.forceIOSlist) || ($.read('ForceIOSlist') === 'true'); const cache = $.EnableCache && JSON.parse($.read('#TESTFLIGHT-ACCOUNT-CACHE') || '{}'); @@ -207,7 +207,7 @@ function QueryRequest(o) { if ($.EnableCache && cache[option.url] && !(e).includes('key expired')) { cache[option.url].lastUsed = Date.now(); $.log(`Account "${o}" URL "${option.url}" Using cached data`); - $.write($.stringify(cache), '#TESTFLIGHT-ACCOUNT-CACHE'); + $.write(JSON.stringify(cache), '#TESTFLIGHT-ACCOUNT-CACHE'); return { ...cache[option.url].response, account: o } } $.error(`Account "${o}" response failed: ${e}`);