shadowsocks / shadowsocks-windows

A C# port of shadowsocks
Other
58.47k stars 16.4k forks source link

The settings in the "gui-config.json" file are reset when Shadowsocks is enabled or disabled #3323

Closed preegnees closed 2 years ago

preegnees commented 2 years ago

Describe the bug

When I changed the "user-agent" in the "gui-config.json" file and started Shadowsocks, then settings reset. The same thing happens when you disable the app. I mean that I can't change the default settings. I couldn't find where exactly in the code this happens. At the same time, after changing the source code, I noticed that in order for the settings to change, you also need to change the name of the configuration file "gui-config.json" (for example, to "gui_config.json"). I don't know why it happens, but it's not the main bug.

Environment

Steps you have tried

  1. Opened the file "gui-config.json".
  2. Registered custom "user-agent".
  3. Saved the file.
  4. Launched Shadowsocks.
  5. Then I opened the file "gui-config.json" and saw the default settings there.

What did you expect to see?

I expected the settings to be saved.

What did you see instead?

I saw the default settings.

chenshaoju commented 2 years ago

Where did you add this line? In my case, looks fine: image

preegnees commented 2 years ago

gth This is what my config looks like, I have now done everything again, and it is also reset. I don't understand why this is happening, it's weird. That is, it generates it again at startup and does not remember my changes.

chenshaoju commented 2 years ago

It should be User-Agent, not userAgent.

preegnees commented 2 years ago

Are you using version 4.4.1.0 and running it creates a "gui-config.json" file with a "User-Agent" field? It's just that I have a "userAgent" field created and I can't change it, because the application updates "gui-config.json" with default values on every launch.

chenshaoju commented 2 years ago

I think I figured out what had happened here: I'm still using 4.3.3.0 version.

Can you try this version? https://github.com/shadowsocks/shadowsocks-windows/releases/tag/4.3.3.0

preegnees commented 2 years ago

Lol doesn't work either. I don't understand how such an error can occur. I have also tried older versions and nothing has changed.

chenshaoju commented 2 years ago

Update: Can you try this?

  "userAgent": "test/$version",

GIF 2022-06-20 13-16-36

preegnees commented 2 years ago

Thank you very much, it worked, I just disabled "Shadowsocks" through another button. HeM-q2Nrmm0