Minor improvements.

This commit is contained in:
NobyDa 2024-04-07 21:11:59 +08:00
parent 458659b257
commit 6137b5add4
No known key found for this signature in database
GPG Key ID: E6B0AC788D373C5B
2 changed files with 6 additions and 6 deletions

View File

@ -1,14 +1,14 @@
#!name=TestFlight账户管理
#!desc=自动存储/合并多个TestFlight账户列表, 并可导出/分享TestFlight APP.
#!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开启/关闭。用于调试脚本。
#!arguments=请求超时:30,启用缓存:1,使用iOS列表:0,脚本引擎:jsc,调试模式:0
#!arguments-desc=请求超时单位秒。默认30秒。\n\n启用缓存1/0开启/关闭默认开启。用于缓存APP列表改善列表页面加载过慢。一般与"请求超时"配合使用,开启缓存并刷新列表后,可适当调小超时。\n\n使用iOS列表1/0开启/关闭。强制使用iOS应用列表用于改善 macOS TestFlight 加载过慢。iOS用户无需开启。\n\n脚本引擎jsc/webview/auto默认为jsc如遇内存超限问题可调整为 auto 或 webview\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={{{调试模式}}}",engine=jsc
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={{{脚本引擎}}}
[MITM]
hostname = %APPEND% testflight.apple.com

View File

@ -3,7 +3,7 @@ TestFlight账户管理脚本
脚本作者: @NobyDa
脚本兼容: Surge4QuantumultXLoon(2.1.20 413+)
更新时间: 2024/04/06
更新时间: 2024/04/07
主要功能
1. 自动存储多个TestFlight账户并自动合并APP列表避免切换账户
@ -80,7 +80,7 @@ async function runs() {
} else if (/\/install$/.test(req.url) && req.body) {
req.body = JSON.parse(req.body);
req.body.storefrontId = '143441-19,29'; //prevent regional restrictions
req.body = $.stringify(req.body);
req.body = JSON.stringify(req.body);
} else if (/\/[A-Z]{200,}\/redeem$/.test(req.url)) {
return { body: ExternalAccount(req.url.split(/\/([A-Z]+)\/redeem$/)[1]) };
}
@ -199,7 +199,7 @@ function QueryRequest(o) {
$.log(`Account "${o}" URL "${option.url}" Write data to cache`);
cache[option.url] = { response: r, lastUsed: Date.now() };
Object.keys(cache).forEach((i) => (Date.now() - (cache[i].lastUsed || 0) > 864e5 * 7) && delete cache[i]);
$.write($.stringify(cache), '#TESTFLIGHT-ACCOUNT-CACHE');
$.write(JSON.stringify(cache), '#TESTFLIGHT-ACCOUNT-CACHE');
}
return { ...r, account: o }
})