From e59f8dd2486d662100addde3684e9fcf4b6c9d6f Mon Sep 17 00:00:00 2001 From: Antony Male Date: Wed, 28 Feb 2018 16:13:54 +0000 Subject: [PATCH 1/6] Grr, missed quotes in update_version.php --- server/version_check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/version_check.php b/server/version_check.php index 875555e4..413990e1 100644 --- a/server/version_check.php +++ b/server/version_check.php @@ -71,7 +71,7 @@ function get_with_wildcard($src, $value, $default = null) 'installed' => [ 'direct_download_url' => [ 'x64' => "$base/v{version}/SyncTrayzorSetup-x64.exe", - 'x86' => '$base/v{version}/SyncTrayzorSetup-x86.exe', + 'x86' => "$base/v{version}/SyncTrayzorSetup-x86.exe", ], ], 'portable' => [ From b6adc85e9f3c6f844f8562df3c1c8048059a789c Mon Sep 17 00:00:00 2001 From: Antony Male Date: Mon, 5 Mar 2018 12:23:31 +0000 Subject: [PATCH 2/6] Don't try and restart Syncthing if Windows kills it during shutdown Fixes #438 --- src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs b/src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs index cf208a65..fe2577f4 100644 --- a/src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs +++ b/src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs @@ -72,6 +72,7 @@ public class SyncthingProcessRunner : ISyncthingProcessRunner private Process process; private const int numRestarts = 4; + private const int systemShutdownExitStatus = 0x40010004; private static readonly TimeSpan restartThreshold = TimeSpan.FromMinutes(1); private readonly List starts = new List(); private bool isKilling; @@ -244,7 +245,7 @@ private void OnProcessExited() this.OnProcessRestarted(); this.Start(); } - else if (exitStatus != SyncthingExitStatus.Success && !this.isKilling) + else if (exitStatus != SyncthingExitStatus.Success && (int)exitStatus != systemShutdownExitStatus && !this.isKilling) { if (this.starts.Count >= numRestarts && DateTime.UtcNow - this.starts[0] < restartThreshold) { From f184b56004bdead810d6df0ff2837700fae44729 Mon Sep 17 00:00:00 2001 From: Antony Male Date: Mon, 5 Mar 2018 12:26:04 +0000 Subject: [PATCH 3/6] Make sure we set configuration if we fail to create the config dir Fixes #439 --- src/SyncTrayzor/Services/Config/ConfigurationProvider.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SyncTrayzor/Services/Config/ConfigurationProvider.cs b/src/SyncTrayzor/Services/Config/ConfigurationProvider.cs index c678d610..9ade9670 100644 --- a/src/SyncTrayzor/Services/Config/ConfigurationProvider.cs +++ b/src/SyncTrayzor/Services/Config/ConfigurationProvider.cs @@ -83,13 +83,13 @@ public void Initialize(Configuration defaultConfiguration) if (defaultConfiguration == null) throw new ArgumentNullException("defaultConfiguration"); - if (!this.filesystem.DirectoryExists(Path.GetDirectoryName(this.paths.ConfigurationFilePath))) - this.filesystem.CreateDirectory(Path.GetDirectoryName(this.paths.ConfigurationFilePath)); - // If this fails, then we're going to show an error. However, other parts of the application may still try and load the configuration. // Therefore ensure that *something* is in place! try { + if (!this.filesystem.DirectoryExists(Path.GetDirectoryName(this.paths.ConfigurationFilePath))) + this.filesystem.CreateDirectory(Path.GetDirectoryName(this.paths.ConfigurationFilePath)); + this.currentConfig = this.LoadFromDisk(defaultConfiguration, out bool hadToCreateConfiguration); this.HadToCreateConfiguration = hadToCreateConfiguration; } From d3861a920a79d499b3249296092b68d17d5d931d Mon Sep 17 00:00:00 2001 From: Antony Male Date: Mon, 5 Mar 2018 12:28:29 +0000 Subject: [PATCH 4/6] Handle any exceptions when resolving conflicts Fixes #440 --- .../Pages/ConflictResolution/ConflictResolutionViewModel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SyncTrayzor/Pages/ConflictResolution/ConflictResolutionViewModel.cs b/src/SyncTrayzor/Pages/ConflictResolution/ConflictResolutionViewModel.cs index 27e607da..439b474f 100644 --- a/src/SyncTrayzor/Pages/ConflictResolution/ConflictResolutionViewModel.cs +++ b/src/SyncTrayzor/Pages/ConflictResolution/ConflictResolutionViewModel.cs @@ -172,8 +172,10 @@ private bool ResolveConflict(ConflictSet conflictSet, string filePath) this.conflictFileManager.ResolveConflict(conflictSet, filePath, this.DeleteToRecycleBin); return true; } - catch (IOException e) + catch (Exception e) { + // So far I've seen IOExeption (no longer exists) and UnauthorizedAccessException + // Just in case there are any others, be pokemon this.windowManager.ShowMessageBox( Localizer.F(Resources.ConflictResolutionView_Dialog_Failed_Message, e.Message), Resources.ConflictResolutionView_Dialog_Failed_Title, From 60d02e17d605feb3a6fdd1a69e96f4eb2c8ebf47 Mon Sep 17 00:00:00 2001 From: Antony Male Date: Mon, 5 Mar 2018 12:44:35 +0000 Subject: [PATCH 5/6] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6949fab..24d07b33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +v1.1.21 +------- + + - Fix "Syncthing failed to start correctly" message when shutting down Windows (#438) + - Handle "Access denied" errors when resolving conflicts (#440) + v1.1.20 ------- From cd55ece0730c652b9465eb04a389a67d4b190db7 Mon Sep 17 00:00:00 2001 From: Antony Male Date: Mon, 5 Mar 2018 12:58:42 +0000 Subject: [PATCH 6/6] Update version_check.php --- server/version_check.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/server/version_check.php b/server/version_check.php index 413990e1..cdefbaa3 100644 --- a/server/version_check.php +++ b/server/version_check.php @@ -64,30 +64,32 @@ function get_with_wildcard($src, $value, $default = null) return $default; } -$base = "https://synctrayzor.antonymale.co.uk/download"; - $versions = [ - '1.1.20' => [ + '1.1.21' => [ + 'base_url' => 'https://synctrayzor.antonymale.co.uk/download', 'installed' => [ 'direct_download_url' => [ - 'x64' => "$base/v{version}/SyncTrayzorSetup-x64.exe", - 'x86' => "$base/v{version}/SyncTrayzorSetup-x86.exe", + 'x64' => "{base_url}/v{version}/SyncTrayzorSetup-x64.exe", + 'x86' => "{base_url}/v{version}/SyncTrayzorSetup-x86.exe", ], ], 'portable' => [ 'direct_download_url' => [ - 'x64' => "$base/v{version}/SyncTrayzorPortable-x64.zip", - 'x86' => "$base/v{version}/SyncTrayzorPortable-x86.zip", + 'x64' => "{base_url}/v{version}/SyncTrayzorPortable-x64.zip", + 'x86' => "{base_url}/v{version}/SyncTrayzorPortable-x86.zip", ], ], - 'sha1sum_download_url' => "$base/v{version}/sha1sum.txt.asc", - 'sha512sum_download_url' => "$base/v{version}/sha512sum.txt.asc", + 'sha1sum_download_url' => "{base_url}/v{version}/sha1sum.txt.asc", + 'sha512sum_download_url' => "{base_url}/v{version}/sha512sum.txt.asc", 'release_page_url' => 'https://github.com/canton7/SyncTrayzor/releases/tag/v{version}', - 'release_notes' => "!!!!!\nYou must upgrade to v1.1.20 now, otherwise auto-upgrades will stop working!\n!!!!!\n\n- Fix to allow SyncTrayzor to download updates from GitHub, after they made changes\n- Disable the built-in filesystem watcher if Syncthing's watcher is enabled\n- Retry starting Syncthing if it crashed (#421)\n- Make it clearer that multiple items in the Conflict Resolver window can be selected at once (#359)\n- Expose the setting to change the location of syncthing.exe (#386)\n- Fix issue where \"Syncthing is starting\" would appear forever (#420)\n- Fix crash when pausing/unpausing devices (#435)\n- Fix a rare condition when trying to enable auto-start would crash (#407)\n- Remove support for debug facilities, since Syncthing has this built in", + 'release_notes' => "!!!!!\nYou must upgrade to v1.1.21 now, otherwise auto-upgrades will stop working!\n!!!!!\n\n- Fix \"Syncthing failed to start correctly\" message when shutting down Windows (#438)\n- Handle \"Access denied\" errors when resolving conflicts (#440)", ] ]; $upgrades = [ + // Github start supporting tls3 only, and versions prior to 1.1.20 didn't support this. 1.1.20 and 1.1.21 are hosted on my server. 1.1.20 can download + // directly from github, but versions prior have to use my server. + '1.1.20' => ['to' => 'latest', 'formatter' => '5', 'overrides' => ['base_url' => 'https://github.com/canton7/SyncTrayzor/releases/download', 'release_notes' => "- Fix \"Syncthing failed to start correctly\" message when shutting down Windows (#438)\n- Handle \"Access denied\" errors when resolving conflicts (#440)"]], '1.1.19' => ['to' => 'latest', 'formatter' => '5'], '1.1.18' => ['to' => 'latest', 'formatter' => '5'], '1.1.17' => ['to' => 'latest', 'formatter' => '5'], @@ -232,10 +234,15 @@ function get_with_wildcard($src, $value, $default = null) $to_version = $upgrades[$version]['to']; if ($to_version == 'latest') $to_version = array_keys($versions)[0]; + $formatter = $response_formatters[$upgrades[$version]['formatter']]; $overrides = isset($upgrades[$version]['overrides']) ? $upgrades[$version]['overrides'] : []; - array_walk_recursive($versions[$to_version], function(&$value, $key) use ($to_version) { + + $base_url = isset($overrides['base_url']) ? $overrides['base_url'] : $versions[$to_version]['base_url']; + + array_walk_recursive($versions[$to_version], function(&$value, $key) use ($to_version, $base_url) { $value = str_replace('{version}', $to_version, $value); + $value = str_replace('{base_url}', $base_url, $value); }); $to_version_info = $versions[$to_version];