Commit Graph

27 Commits

Author SHA1 Message Date
Martchus 5ac40a2924 Fix error message of requests with callback 2024-05-05 13:39:05 +02:00
Martchus ecece11df3 Introduce basic test setup for models
This test setup utilizes the "mocked" configuration so far only used for
manual testing. This allows adding unit tests for models without having to
run Syncthing itself. The test is pretty basic itself at this point.
2024-04-26 23:04:47 +02:00
Martchus d99fadd1f1 Allow stopping the systemd service automatically on metered connections
This is the same as the feature already present in the launcher and
connection settings. Not sure how much sense it makes for systemd services
as they run rather independently from the UI but maybe it is useful.
2024-04-19 00:04:48 +02:00
Martchus f2210a5691 Avoid warnings of network information backend showing in CLI
Lazy-initialize the network information backend so warnings it possibly
shows don't disturb the output of the CLI (which does not need the network
information backend anyway).
2024-02-29 13:46:42 +01:00
Martchus 572e82cec0 Fix resuming devs when network not metered anymore after 57d47de7 2024-02-18 00:53:28 +01:00
Martchus 00d3a8198a Fix crash when network information backend is not available 2024-02-17 01:41:23 +01:00
Martchus 30fa37f048 Allow to pause automatically on metered network connections
* Allow to pause all devices on metered network connections (devices will
  be automatically resumed when network is no longer metered)
* Allow to stop Syncthing when it was started via the built-in launcher
  on metered network connections (it will be automatically started again
  when the network connection is no longer metered)
* See https://github.com/Martchus/syncthingtray/issues/231
2024-02-15 21:02:18 +01:00
Martchus 76b406f4e1 Adapt tests to recent changes in certificate handling 2024-01-28 21:35:54 +01:00
Martchus 07ff8a5c1b Avoid TLS errors on Syncthing's automatic certificate renewal
* Reload the certificate when running into TLS errors an it looks like the
  certificate was renewed
* See https://github.com/Martchus/syncthingtray/issues/226
2024-01-15 21:29:24 +01:00
Martchus 18d90163ab Change code for certificate handling to use the current coding style 2023-12-30 20:38:58 +01:00
Martchus e45db9d668 Fix certificate errors when Schannel TLS backend is used
* Unify code paths for compiling expected SSL errors so in any case the
  expected errors are including the error types emitted by the Schannel
  backend
* See https://github.com/Martchus/syncthingtray/issues/223
2023-12-30 20:38:15 +01:00
Martchus c1284331be Handle redirections more nicely
* Log redirections in accordance with logging settings
* Load self-signed certificate as needed
2023-12-30 20:11:34 +01:00
Martchus fada3c98dd Allow configuring long-polling timeout 2023-11-06 15:06:40 +01:00
Martchus aa524aa8b7 Make event handling of `syncthingctl wait-for-idle` more efficient
Don't go though the list of dirs/devs for every dir/dev change event. Just
go though the list once after receiving new events. This makes also the
code a little bit easier to follow.
2023-09-20 18:12:55 +02:00
John Veness c2a0eee029 Change Directory to Folder in user-facing strings 2023-09-17 19:33:31 +01:00
Martchus 5fa69e4f5a Rename `SyncthingDevStatus::OwnDevice` in accordance with UI change 2023-09-16 22:28:35 +02:00
Martchus 968fcb988c Fix finding Syncthing dir by path on Windows
The path needs to be normalized so inconsistent uses of `/` and `\` are not
a problem.
2023-08-19 19:16:16 +02:00
Martchus 69568ea6dd Set default transfer timeout to infinity
Apparently the default before introducing the request timeout was not 30000
(which is the value of QNetworkRequest::TransferTimeoutConstant). There was
actually no timeout. So let's restore this behavior for now as the main
intention was to make the timeout configurable but not change any defaults.
2023-07-04 19:33:30 +02:00
Martchus 690804be5c Add the request timeout to SyncthingConnectionSettings 2023-07-04 19:01:08 +02:00
Martchus ac07982596 Allow setting transfer timeout for network requests of SyncthingConnection 2023-07-04 18:39:14 +02:00
Martchus c6a5b40a1d Re-connect when event ID is decreasing 2023-04-15 22:25:12 +02:00
Martchus c07f9345b1 Improve wording of comment 2023-04-15 22:25:07 +02:00
Martchus fc8ab2e845 Improve coding style
Improve coding style, mainly in SynctingConnection, for better
consistency with more recently added code.
2023-04-15 20:28:51 +02:00
Martchus d3901cee37 Don't reset last event IDs when connecting again
When connecting again, no data is cleared. Since we now keep
track of event IDs and not just timestamps it makes sense to not
forget what the last event IDs were. To still run into the
"limit" case the flags for having events at all can be used
(which is also reset on just `connect()`).
2023-04-15 20:08:21 +02:00
Martchus 843f164df1 Avoid potentially losing events
I have observed that Syncthing Tray can get stuck thinking a remote device
still needs data. Likely the update got lost. The code contains certain
conditions in which folder completion events and requesting completion are
supressed. Those conditions are based on timestamps. That is not ideal as
the accuracy is only one second (so different timestamps might be
considered equal as they are rounded to be the same). Additionally, it
makes no sense to assume a timestamp upon receiving a response as the
information might be older than the time it was received.

This change avoids those conditions. It rather uses the event ID to
decide what event/reply is newer.

This change also uses quint64 instead of int for event IDs to avoid running
into an overflow (or rather conversion error) when deserializing the ID
which might be bigger than int. (Not sure how big the ID can become; this
is to be on the safe side.)
2023-04-15 16:18:23 +02:00
Martchus f524a18b83 Fix condition for triggering connection once service is back
Skipping the connection attempt if the timer interval is lower
anyways only makes sense if the timer is also active.
2023-04-03 18:47:50 +02:00
Martchus 96e92f13a3 Avoid relying on symlink for include directories
Symlinks aren't working very well with Git under Windows so better avoid
them.
2023-02-27 18:27:33 +01:00