Compare commits

...

2 Commits

Author SHA1 Message Date
NobyDa 346b68af17
add debug script. 2024-03-25 18:46:29 +08:00
NobyDa 8f5f61e1c1
add support for mac force ios headers. 2024-03-25 14:43:17 +08:00
4 changed files with 175 additions and 114 deletions

64
Debug/Real-time-debug.js Normal file
View File

@ -0,0 +1,64 @@
/*
* LAN script real-time debug
*
* PC: Use "Live Server" plugin in VSCode to create a LAN backend
* APP: After backend address is modified in script, use this script as script path
*/
!async function() {
const _$ = new nobyda();
const _r = await new Promise(e => {
_$.get({
url: 'http://192.168.1.66:5500/debug.js' // LAN backend address
}, (t, c, o) => {
if (c && c.status == 200 && o) {
_$.write(o, 'Real-time-debug');
e(o);
}
});
setTimeout(e, 100);
});
if (_r) {
console.log("🌐 Run local network script...");
eval(_r);
} else {
console.log("⚠️ Run cache script...");
eval(_$.read('Real-time-debug'))
}
function nobyda() {
const isSurge = typeof $httpClient != "undefined";
const isQuanX = typeof $task != "undefined";
const adapterStatus = (response) => {
if (response) {
if (response.status) {
response["statusCode"] = response.status
} else if (response.statusCode) {
response["status"] = response.statusCode
}
}
return response
};
this.write = (value, key) => {
if (isQuanX) return $prefs.setValueForKey(value, key);
if (isSurge) return $persistentStore.write(value, key);
};
this.read = (key) => {
if (isQuanX) return $prefs.valueForKey(key);
if (isSurge) return $persistentStore.read(key);
};
this.get = (options, callback) => {
if (isQuanX) {
$task.fetch(options).then(response => {
callback(null, adapterStatus(response), response.body)
}, reason => callback(reason.error, null, null))
}
if (isSurge) {
$httpClient.get(options, (error, response, body) => {
callback(error, adapterStatus(response), body)
})
}
};
this.done = (value = {}) => $done(value)
}
}();

View File

@ -462,6 +462,12 @@
"type": "number",
"placeholder": "30",
"desc": "默认为30, 单位: 秒"
}, {
"id": "@TESTFLIGHT-ACCOUNT.ForceIOSlist",
"name": "使用iOS应用列表",
"val": false,
"type": "boolean",
"desc": "强制使用iOS应用列表, 用于改善 macOS TestFlight 加载过慢, iOS用户无需开启"
}],
"scripts": [{
"name": "清除缓存",

View File

@ -1,13 +1,14 @@
#!name=TestFlight账户管理
#!desc=自动存储/合并多个TestFlight账户列表, 并可导出/分享TestFlight APP.
#!arguments=请求超时:30,列表缓存:0
#!arguments-desc=请求超时:单位秒\n列表缓存1/0分别为开启/关闭
#!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开启/关闭。用于调试脚本。
#!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, argument="timeout={{{请求超时}}}&enableCache={{{列表缓存}}}"
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={{{调试模式}}}"
[MITM]
hostname = %APPEND% testflight.apple.com

File diff suppressed because one or more lines are too long