Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

生成clash配置中的代理格式化方式选功能,是否有相应的选择器可选 #189

Open
fbigun opened this issue May 1, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@fbigun
Copy link

fbigun commented May 1, 2022

我的clash模板相应片段

proxies: {{ getClashNodes(nodeList) | json }}

选择yaml,结果有异常。

proxies: {{ getClashNodes(nodeList) | yaml }}

默认生成clash配置文件的的代理格式化形式为

proxies: [{"type":"ss","cipher":"chacha20-ietf-poly1305","name":"🇭🇰HKG ********","password":"9e35519d-c736-4f4f-809f-09b8776a6518","port":21001,"server":"***************","udp":true},{"type":"ss","cipher":"chacha20-ietf-poly1305","name":"🇭🇰HKG CM.B ******","password":"9e35519d-c736-4f4f-809f-09b8776a6518","port":21001,"server":"******","udp":true},{"type":"ss","cipher":"chacha20-ietf-poly1305","name":"🇭🇰HKG CM.C/01 x0.3","password":"9e35519d-c736-4f4f-809f-09b8776a6518","port":21001,"server":"******","udp":true},{"type":"ss","cipher":"chacha20-ietf-poly1305","name":"🇭🇰HKG CN2/01 x0.3","password":"9e35519d-c736-4f4f-809f-09b8776a6518","port":21001,"server":"******","udp":true}]

有没有有格式化为这种的

proxies:
- {"type":"ss","cipher":"chacha20-ietf-poly1305","name":"🇭🇰HKG CM.A HKBN******","password":"9e35519d-c736-4f4f-809f-09b8776a6518","port":21001,"server":"******","udp":true}
- {"type":"ss","cipher":"chacha20-ietf-poly1305","name":"🇭🇰HKG CM.B HKBN******","password":"9e35519d-c736-4f4f-809f-09b8776a6518","port":21001,"server":"******","udp":true}
- {"type":"ss","cipher":"chacha20-ietf-poly1305","name":"🇭🇰HKG CM.C/01 x0.3","password":"9e35519d-c736-4f4f-809f-09b8776a6518","port":21001,"server":"******","udp":true}
- {"type":"ss","cipher":"chacha20-ietf-poly1305","name":"🇭🇰HKG CN2/01 x0.3","password":"9e35519d-c736-4f4f-809f-09b8776a6518","port":21001,"server":"******","udp":true}
@geekdada
Copy link
Member

因为你指出的这种各式存在缩进的问题,所以我采用了写在一行里的形式。这里不可以使用 yaml。请问为什么要格式化成后面这种各式?

@fbigun
Copy link
Author

fbigun commented May 10, 2022

前一种方式不便于查看配置问题,在部分编辑器打开时也容易完成编辑器卡顿。
主要的优点在于
1 查看配置节点清晰
2 编辑器打开速度快

@geekdada
Copy link
Member

一开始我的考虑是订阅一般不存在二次编辑的情况,因为编辑会在下次刷新订阅时丢失。我再考虑一下有没有更好的办法支持这个格式。

@geekdada geekdada added the enhancement New feature or request label May 10, 2022
@miniers
Copy link

miniers commented May 20, 2022

把 | json 替换为 | dump(4) 就可以了

@fbigun
Copy link
Author

fbigun commented Jul 7, 2022

把 | json 替换为 | dump(4) 就可以了

你说的这个方法实际上一些情况下,基本无法使用

@miniers
Copy link

miniers commented Jul 7, 2022

把 | json 替换为 | dump(4) 就可以了

你说的这个方法实际上一些情况下,基本无法使用

需求不同吧,暂时对我来说还算可用,你可以等等大佬的优化,或者可以使用自定义函数自己实现输出也是可以的

@joeblowout
Copy link

同求,我也发现自建节点用你说的方法输出来的clash.yaml不能导入到clash for android, windows 没问题

把 | json 替换为 | dump(4) 就可以了

你说的这个方法实际上一些情况下,基本无法使用

@fbigun
Copy link
Author

fbigun commented May 2, 2024

没有办法可以改进

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants