surgioproject / surgio

Generating rules for Surge, Clash, Quantumult like a PRO
https://surgio.js.org
MIT License
1.62k stars 138 forks source link

請問生成clash規則時如何消除yaml文件中rule中的空格? #239

Closed StevenKai20 closed 1 year ago

StevenKai20 commented 1 year ago

tpl模板相關code

rules:
{% filter clash %}
{{ remoteSnippets.apple.main('Proxy', 'DIRECT', 'US') }}
{{ remoteSnippets.google.main('Google') }}
{{ remoteSnippets.netflix.main('Netflix') }}
{{ remoteSnippets.disney.main('Disney') }}
{{ remoteSnippets.hbo.main('HBO') }}
{{ remoteSnippets.amazonPrimeVideo.main('PrimeVideo') }}
{{ remoteSnippets.paramountPlus.main('Paramount') }}
{{ remoteSnippets.youtube.main('Youtube') }}
{{ remoteSnippets.telegram.main('Telegram') }}
{{ remoteSnippets.globalMedia.main('GlobalMedia') }}
{{ remoteSnippets.openAI.main('OpenAI') }}
{{ remoteSnippets.chinaIPs.main('DIRECT') }}
{{ remoteSnippets.advertising.main('REJECT') }}
{% endfilter %}
- DOMAIN-SUFFIX,cn,DIRECT
- DOMAIN-KEYWORD,-cn,DIRECT
- DOMAIN,injections.adguard.org,DIRECT
- DOMAIN,local.adguard.org,DIRECT
- DOMAIN-SUFFIX,local,DIRECT
- IP-CIDR,127.0.0.0/8,DIRECT
- IP-CIDR,172.16.0.0/12,DIRECT
- IP-CIDR,192.168.0.0/16,DIRECT
- IP-CIDR,10.0.0.0/8,DIRECT
- IP-CIDR,17.0.0.0/8,DIRECT
- IP-CIDR,100.64.0.0/10,DIRECT
- IP-CIDR,224.0.0.0/4,DIRECT
- IP-CIDR6,fe80::/10,DIRECT
- GEOIP,CN,DIRECT
- MATCH,Proxy

surgio.conf.js相關code

remoteSnippets: [
    {
      name: 'google',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Google/Google.list',
    },
    {
      name: 'advertising',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Advertising/Advertising.list',
    },
    {
      name: 'chinaIPs',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/ChinaIPs/ChinaIPs.list',
    },
    {
      name: 'apple', 
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Apple/Apple.list',
    },
    {
      name: 'telegram',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Telegram/Telegram.list',
    },
    {
      name: 'netflix',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Netflix/Netflix.list',
    },
    {
      name: 'youtube',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.list',
    },
    {
      name: 'hbo',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list',
    },
    {
      name: 'disney', 
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list',
    },
    {
      name: 'amazonPrimeVideo',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/AmazonPrimeVideo/AmazonPrimeVideo.list',
    },
    {
      name: 'paramountPlus',
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/ParamountPlus/ParamountPlus.list',
    },
    {
      name: 'globalMedia', 
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GlobalMedia/GlobalMedia.list',
    },
    {
      name: 'openAI', 
      url: 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/OpenAI/OpenAI.list',
    },
  ]

得到最終的yaml文件並導入clash提示 error_info1

檢查yaml定位到指定行 clash_error1 把多餘空行刪除后正常使用,但每次都需手動操作,翻閲相關文檔并沒有找到解決方案,是否考慮在輸出文件時提供相應的檢查動作已避免輸出空行?

此外基於最新的V3版本,本地終端執行npx surgio generate并無任何問題,但在Netlify上進行遠程部署,已經指定Node為18,會提示找不到/var/task/xxx/node_modules/surgio/build/index.js,懷疑是cache搗亂,但重新執行clean cache&rebuild依舊如此,無奈repo回滾至2.x,只能本地run v3

geekdada commented 1 year ago

请问你的 clash 版本是多少

StevenKai20 commented 1 year ago

Clash for Windows 0.20.34

geekdada commented 1 year ago

确认空格识别是没问题的。请检查你的配置文件,13 万行看起来有点夸张。