帖子内容
🔗 Sub-Store 文件动态生成 📦 sing-box 配置示例 🆕查看最新版带参数规则的脚本 ——— 💃亚托莉佬的模板和远程脚本 远程文件填 链接1 或 链接2 脚本操作填链接 https://raw.githubusercontent.com/xishang0128/sub-store-template/main/sing-box.js#type=1&name=name // "1" 表示组合订阅, name 为订阅的 "名称", 具体看文件中的说明 ⚠️ 此脚本与此模板配套 如果要用自定义模板/有自定义脚本的需求 可使用👇🏻的方案自己动手 或者 查看最新版带参数规则的脚本 1.1 使用远程模板 远程链接 中 第一行为 sing-box 模板文件链接 例: https://a.com/sing-box.tpl.json 1.2 或者使用本地模板 本地文本 中为 sing-box 模板文件的内容 假设 你的 sing-box 模板文件中的 outbounds 是这样的: { "outbounds": [ { "tag": "全部节点", "type": "selector", "default": "urltest", "outbounds": [ "美国节点" ] }, { "tag": "美国节点", "type": "urltest", "outbounds": [] } ] } 脚本操作: let config = JSON.parse($files[0]) // 文件中的第一个 let proxies = await produceArtifact({ type: 'subscription', // 如果是组合订阅 就是 'collection' name: '订阅的name', // 订阅的"名称", 不是"显示名称" platform: 'sing-box', produceType: 'internal' }) // 先将全部节点结构插到 outbounds config.outbounds.push(...proxies) config.outbounds.map(i => { // 在 全部节点 中插入全部节点名 if (['全部节点'].includes(i.tag)) { i.outbounds.push(...proxies.map(p => p.tag)) } // 在 美国节点 中插入全部美国节点名 if (['美国节点'].includes(i.tag)) { i.outbounds.push(...proxies.filter(p => /美国|🇺🇸|us|united states/i.test(p.tag)).map(p => p.tag)) } }) $content = JSON.stringify(config, null, 2) ▎其他示例(YAML, JSON): let singboxProxies = await produceArtifact({ type: 'subscription', // type: 'subscription' 或 'collection' name: 'sub', // subscription name platform: 'sing-box', // target platform produceType: 'internal' // 'internal' produces an Array, otherwise produces a String( JSON.parse('JSON String') ) }) let clashMetaProxies = await produceArtifact({ type: 'subscription', name: 'sub', platform: 'ClashMeta', produceType: 'internal' // 'internal' produces an Array, otherwise produces a String( ProxyUtils.yaml.safeLoad('YAML String').proxies ) })) // YAML $content = ProxyUtils.yaml.safeDump({}) // JSON $content = JSON.stringify({}, null, 2) 🎲Sub-Store 代理 App 版安装下载 🛠Sub-Store 服务器/云平台/Docker/Android 版的相关教程