#!name=Loon 面板 #!desc=给 Scripting「Loon 面板」小组件提供数据:定时体检节点(延迟、出口、解锁),网络切换后自动复测,节点挂了发通知或自动切换,锁定的策略组被还原时改回来;小组件可切换模式和节点。数据地址 http://1.1.1.1/loon-panel/data #!author=MaYIHEI #!homepage=https://github.com/MaYIHEI/patch/tree/main/scripting/loon-panel #!icon=https://raw.githubusercontent.com/MaYIHEI/patch/refs/heads/main/scripting/loon-panel/loon/icon.png #!loon_version = 3.5.1(983) #!tag=小组件, 节点 [Argument] cron = input,"*/30 * * * *",tag=体检频率,desc=Cron 表达式,默认每 30 分钟一次。其余设置都在 Scripting 的「Loon 面板」里 [Script] cron ${cron} then script("https://raw.githubusercontent.com/MaYIHEI/patch/refs/heads/main/scripting/loon-panel/loon/loon-panel.js") with tag="节点体检", img_url="stethoscope.system", timeout=120 network-changed then script("https://raw.githubusercontent.com/MaYIHEI/patch/refs/heads/main/scripting/loon-panel/loon/loon-panel.js") with tag="网络切换复测", img_url="wifi.system", timeout=60 # 小组件数据和操作: 请求 http://1.1.1.1/loon-panel/data 或 /set 时直接返回 JSON request if ${url} ~= /^http:\/\/(1\.1\.1\.1|8\.8\.8\.8)\/loon-panel\/(data|set|clear)(\?|$)/i then script("https://raw.githubusercontent.com/MaYIHEI/patch/refs/heads/main/scripting/loon-panel/loon/loon-panel.js") with tag="Loon 面板数据", img_url="gauge.with.dots.needle.67percent.system", timeout=30 # 深度检测: App 手动触发, 耗时较长 request if ${url} ~= /^http:\/\/(1\.1\.1\.1|8\.8\.8\.8)\/loon-panel\/deep(\?|$)/i then script("https://raw.githubusercontent.com/MaYIHEI/patch/refs/heads/main/scripting/loon-panel/loon/loon-panel.js") with tag="Loon 面板深度检测", img_url="shield.lefthalf.filled.system", timeout=90 # 保存 App 里的设置: 密钥放在正文里, 不进 URL request if ${url} ~= /^http:\/\/(1\.1\.1\.1|8\.8\.8\.8)\/loon-panel\/opts$/i && ${request.method} == "POST" then script("https://raw.githubusercontent.com/MaYIHEI/patch/refs/heads/main/scripting/loon-panel/loon/loon-panel.js") with tag="Loon 面板设置", img_url="gearshape.system", timeout=30, requires_body=true