spencerwooo / mihoro

Mihomo CLI client on Linux. Formerly `clashrup`.
MIT License
24 stars 3 forks source link

[Subscription] Support decoding after fetching config. #162

Open Pairman opened 1 month ago

Pairman commented 1 month ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

My subscription links returns a base64 encoded file, rather than plain text. This is causing mihoro setup, or mihomo test to fail.

Describe the solution you'd like

Add a config entry like remote_config_encoding or something. If it's base64, I can manually set it to base64 and mihoro will decode that for me ,automatically.

Describe alternatives you've considered Currently I'm manually doing curl <sub_url> | base64 -d -.

Additional context

[pairman@fedora Downloads]$ mihoro setup
mihoro: Setting up mihomo's binary, config, and systemd service...
mihoro: Assuming mihomo binary already installed at /home/pairman/.local/bin/mihomo, skipping setup
download: Downloaded to /home/pairman/.config/mihomo/config.yaml
          00:00:00 - Download speed 0 B/s                                                               
error: invalid type: string "<br /> <b>Warning</b>", expected struct MihomoYamlConfig
[pairman@fedora Downloads]$ mihomo test
FATA[2024-07-21T14:53:05.364926708+08:00] Parse config error: yaml: line 2: mapping values are not allowed in this context 
spencerwooo commented 1 month ago

Noted, the base64 crate should suffice. Would appreciate a PR if possible ;)