Martchus / syncthingtray

Tray application and Dolphin/Plasma integration for Syncthing
https://martchus.github.io/syncthingtray/
Other
1.66k stars 44 forks source link

Improve behavior when HTTPS is enabled for Syncthing's GUI but Syncthing Tray is setup to use HTTP #200

Closed c0wb0y54mur41 closed 1 year ago

c0wb0y54mur41 commented 1 year ago

Garuda i3WM

I installed on Garuda Qtile Linux. It installed and configured fine.

Problem arose when syncing a folder.

In mid sync I deleted a whole folder. Then it said out of sync on that folder and was stuck at a percentage.

I deleted/removed the folder from syncthing and the physical file location.

Now Syncthingtray won't auto start. it says:

(A) Syncthing Tray - internal error Unable to parse Syncthing config: illegal value (at offset 1)

(A) Synchthing Tray Disconnected from Syncthing

I tried removing the device and adding it back but that didn't work either.

I tried removing the package with yay -Rns syncthingtray and reinstalling it with yay -S syncthingtray but get the same message with no setup.

How can this be fixed?

Martchus commented 1 year ago

To investigate this, start Syncthing Tray in a way that allows you to see stdout/stderr, e.g. in a terminal. Also set environment variables for logging for more verbose output (see https://github.com/Martchus/syncthingtray#logging).

c0wb0y54mur41 commented 1 year ago

Okay, when I select Actions/Settings/GUI & then select the box of Use HTTPS for GUI the problem happens. When I unselect it, it goes away.

Martchus commented 1 year ago

Ah, that makes sense. So this is actually not a bug then. You simply need to set the Syncthing-URL in Syncthing Tray's settings in accordance to whether you enabled HTTPs in Syncthing or not. If you use HTTPs then make sure to also set Syncthing's certificate as it is probably a self-signed one.

I guess it would still be worthwhile to produce a better error message if it is not set in accordance.

Martchus commented 1 year ago

Looks like Syncthing now does a redirect when HTTPs is enabled. This error is actually also visible directly in Syncthing Tray's error details (no need to set any environment variables for extra logging):

[2023-09-03T14:07:26] Fehler beim Auslesen der Syncthing-Konfiguration: Ungültiger Wert (bei Zeichen 1)
URL der Anfrage: http://127.0.0.1:8384/rest/system/config
Antwort:
<a href="https://127.0.0.1:8384/rest/system/config">Temporary Redirect</a>.

I suppose I need to make it follow redirections for a better experience.

c0wb0y54mur41 commented 1 year ago

Note: When you select Use HTTPS for GUI it's difficult to view the logs & even to unselect Use HTTPS for GUI. Lot's of exiting out of windows & opening them back up & even restarting. At least on Garuda Qtile Linux.

Martchus commented 1 year ago

You should always be able to open Syncthing Tray's error log from the context menu of the tray icon if there's at least on error.

To unselect HTTPS, simply open Syncthing's GUI in a normal browser.

And as I already said, I suppose the solution here is to follow the redirection Syncthing itself provides (instead of trying to parse it as JSON).

c0wb0y54mur41 commented 1 year ago

They would open but wouldn't load anything in either window.

Also for the browser it took it a bit to load. Had to close and reopen several times for it to load, but the error log never loaded.

Martchus commented 1 year ago

They would open but wouldn't load anything in either window.

Not sure what you mean by that.

Also for the browser it took it a bit to load. Had to close and reopen several times for it to load, but the error log never loaded.

That would be an issue of Syncthing or the web browser (and not Syncthing Tray). However, for me the Syncthing GUI just load fine in the web browser as long as the used protocol matches Syncthing's settings. So not sure what's wrong in your case.

c0wb0y54mur41 commented 1 year ago

The error logs opens a window that should be able to view the logs but it doesn't load to view it. Same with the browser. Takes a bit of opening and closing, exiting and opening to finally view.

Martchus commented 1 year ago

HTTPS should now be handled better. Now redirections are followed also when using Qt 5 (so if you had it configured for HTTP and change the setting in Syncthing itself to HTTPS it will still work). I also ensured that the wizard is configuring HTTPS when it is enabled and that it configures the certificate in any case.

With that the main problem here should be fixed.