Skip to content

Commit

Permalink
Merge branch 'release/1.1.29'
Browse files Browse the repository at this point in the history
  • Loading branch information
canton7 committed Aug 7, 2021
2 parents b746bf1 + eb10c10 commit 1ec7e4f
Show file tree
Hide file tree
Showing 19 changed files with 182 additions and 82 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
Changelog
=========

v1.1.19
-------

- Don't crash in rare cases trying to detect if Intel Xe Graphics in use (#626)
- Make it clearer that balloon settings are on the Folders tab (#613)
- Don't show device connectivity balloons by default
- Uninstaller: try to shut down running SyncTrayzor instances (#516)

v1.1.28
-------

- Work around Intel X2 Graphics driver bug which causes Syncthing's UI to appear blank (#606)
- Work around Intel Xe Graphics driver bug which causes Syncthing's UI to appear blank (#606)
- Fix chocolatey package (#614)

v1.1.27
Expand Down
9 changes: 2 additions & 7 deletions chocolatey/synctrayzor.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>0.0.0</version>
<authors>Antony Male</authors>
<owners>Antony Male</owners>
<summary>Windows tray utility / filesystem watcher / launcher for syncthing</summary>
<summary>Windows tray utility / launcher for Syncthing</summary>
<description>SyncTrayzor is a little tray utility for [Syncthing](http://syncthing.net/) on Windows.
It hosts and wraps Syncthing, making it behave more like a native Windows application and less like a command-line utility with a web browser interface.

Expand All @@ -23,11 +23,6 @@ Features include:
- One of your folders is out of sync
- Folders finish syncing
- Devices connect / disconnect
- Can watch your folders for changes, so you don't have to poll them frequently:
- Syncthing on its own has to poll your folders, in order to see if any files have changed.
- SyncTrayzor will watch your folders for changes, and alert Syncthing the second anything changes.
- This means you can increase the polling interval in Syncthing, avoiding the resource usage of high-frequency polling, but still have any changes propagated straight away.
- Folder watching respects the ignores configured in Syncthing.
- Has a tool to help you resolve file conflicts
- Contains translations for many languages
</description>
Expand All @@ -43,7 +38,7 @@ Features include:
<iconUrl>https://cdn.statically.io/gh/canton7/SyncTrayzor/develop/SyncTrayzor.png</iconUrl>
<dependencies>
<!-- Chocolatey 0.9.9 required in order to access the chocolateyPackageName and chocolateyPackageVersion environment variables -->
<dependency id="chocolatey" version="0.9.9" />
<dependency id="chocolatey" version="0.9.10" />
<!-- Make sure that .Net 4.7.2 or better is installed -->
<dependency id="dotnetfx" version="4.7.2" />
</dependencies>
Expand Down
83 changes: 75 additions & 8 deletions chocolatey/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,80 @@
$ErrorActionPreference = 'Stop'; # stop on all errors

# Copied from https://github.com/chocolatey-community/chocolatey-coreteampackages/blob/a2371345f182da74589897055e3b3703deb0cce3/extensions/chocolatey-core.extension/extensions/Get-UninstallRegistryKey.ps1
function Get-UninstallRegistryKeySilent {
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[string] $SoftwareName,
[parameter(ValueFromRemainingArguments = $true)]
[Object[]] $IgnoredArguments
)
Write-Debug "Running 'Get-UninstallRegistryKey' for `'$env:ChocolateyPackageName`' with SoftwareName:`'$SoftwareName`'";

$ErrorActionPreference = 'Stop'
$local_key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'

Write-Verbose "Retrieving all uninstall registry keys"
[array]$keys = Get-ChildItem -Path @($machine_key6432, $machine_key, $local_key) -ea 0
Write-Debug "Registry uninstall keys on system: $($keys.Count)"

Write-Debug "Error handling check: `'Get-ItemProperty`' fails if a registry key is encoded incorrectly."
[int]$maxAttempts = $keys.Count
for ([int]$attempt = 1; $attempt -le $maxAttempts; $attempt++)
{
$success = $false

$keyPaths = $keys | Select-Object -ExpandProperty PSPath
try {
[array]$foundKey = Get-ItemProperty -Path $keyPaths -ea 0 | ? { $_.DisplayName -like $SoftwareName }
$success = $true
} catch {
Write-Debug "Found bad key."
foreach ($key in $keys){ try{ Get-ItemProperty $key.PsPath > $null } catch { $badKey = $key.PsPath }}
Write-Verbose "Skipping bad key: $badKey"
[array]$keys = $keys | ? { $badKey -NotContains $_.PsPath }
}

if ($success) { break; }
if ($attempt -eq 10) {
Write-Warning "Found more than 10 bad registry keys. Run command again with `'--verbose --debug`' for more info."
Write-Debug "Each key searched should correspond to an installed program. It is very unlikely to have more than a few programs with incorrectly encoded keys, if any at all. This may be indicative of one or more corrupted registry branches."
}
}

Write-Debug "Found $($foundKey.Count) uninstall registry key(s) with SoftwareName:`'$SoftwareName`'";
return $foundKey
}

$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$file = (Join-Path $toolsDir 'SyncTrayzorSetup-x86.exe')
$file64 = (Join-Path $toolsDir 'SyncTrayzorSetup-x64.exe')

$packageArgs = @{
packageName = 'SyncTrayzor'
file = $file
file64 = $file64
silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /SkipDotNetInstall'
fileType = 'exe'
validExitCodes = @(0)
}

$packageName= 'SyncTrayzor'
$file = (Join-Path $toolsDir 'SyncTrayzorSetup-x86.exe')
$file64 = (Join-Path $toolsDir 'SyncTrayzorSetup-x64.exe')
$silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /SkipDotNetInstall'
$fileType = 'exe'
$validExitCodes = @(0)
# Version 1.1.28 had a bug which installed x86 on x64 machines. Forcefully transitioning someone from
# x86 to x64 is risky, as it potentially loses their config, Syncthing version, etc.
# Therefore if they've got the x86 version and not the x64 version, upgrade using the x86 version to
# avoid breaking them.
if ((Get-OSArchitectureWidth -compare 64) -and ($env:chocolateyForceX86 -ne $true) -and (Get-UninstallRegistryKeySilent -SoftwareName 'SyncTrayzor (x86)*')) {
if (Get-UninstallRegistryKeySilent -SoftwareName 'SyncTrayzor (x64)*') {
Write-Host -ForegroundColor green "Both the 32-bit and 64-bit versions of SyncTrayzor are installed. Upgrading the 64-bit version."
} else {
Write-Host -ForegroundColor green "You have the 32-bit version of SyncTrayzor installed, so upgrading this. If you intended to install the 64-bit version, please uninstall the 32-bit version first."
# null out the 64 bit file parameter, so only the 32 bit file is available to install
$packageArgs['file64'] = $null
}
}

Install-ChocolateyInstallPackage $packageName $fileType $silentArgs $file $file64 -validExitCodes $validExitCodes
Install-ChocolateyInstallPackage @packageArgs

Remove-Item -Force -ea 0 $file, $file64
Remove-Item -Force -ea 0 $file, $file64
34 changes: 0 additions & 34 deletions chocolatey/tools/chocolateyuninstall.ps1

This file was deleted.

5 changes: 5 additions & 0 deletions installer/common.iss
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,14 @@ begin
end;
end;
[UninstallRun]
Filename: "{app}\SyncTrayzor.exe"; Parameters: "--shutdown"; RunOnceId: "ShutdownSyncTrayzor"; Flags: skipifdoesntexist

[UninstallDelete]
Type: files; Name: "{app}\ProcessRunner.exe.old"
Type: files; Name: "{app}\InstallCount.txt"
; Not sure why this gets left behind, but it does. Clean it up...
Type: filesandordirs; Name: "{app}\locales"
Type: filesandordirs; Name: "{userappdata}\{#AppDataFolder}"
Type: filesandordirs; Name: "{localappdata}\{#AppDataFolder}"

5 changes: 3 additions & 2 deletions server/version_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function get_with_wildcard($src, $value, $default = null)
}

$versions = [
'1.1.28' => [
'1.1.29' => [
'base_url' => 'https://github.com/canton7/SyncTrayzor/releases/download',
'installed' => [
'direct_download_url' => [
Expand All @@ -82,7 +82,7 @@ function get_with_wildcard($src, $value, $default = null)
'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' => "Add a workaround for an Intel Xe graphics driver bug which causes Syncthing's UI to appear blank.\n\nIf you are not affected by this, you do not need to upgrade.",
'release_notes' => "- Don't crash in rare cases trying to detect if Intel Xe Graphics in use (#626)\n- Make it clearer that balloon settings are on the Folders tab (#613)\n- Don't show device connectivity balloons by default\n- Uninstaller: try to shut down running SyncTrayzor instances (#516)",
],
'1.1.21' => [
'base_url' => 'https://synctrayzor.antonymale.co.uk/download',
Expand All @@ -106,6 +106,7 @@ function get_with_wildcard($src, $value, $default = null)
];

$upgrades = [
// Currently no need to upgrade people on 1.1.28 or 1.1.29
'1.1.27' => ['to' => 'latest', 'formatter' => '5'],
'1.1.26' => ['to' => 'latest', 'formatter' => '5'],
'1.1.25' => ['to' => 'latest', 'formatter' => '5'],
Expand Down
2 changes: 1 addition & 1 deletion src/SyncTrayzor/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<ShowTrayIconOnlyOnClose>false</ShowTrayIconOnlyOnClose>
<MinimizeToTray>false</MinimizeToTray>
<CloseToTray>true</CloseToTray>
<ShowDeviceConnectivityBalloons>true</ShowDeviceConnectivityBalloons>
<ShowDeviceConnectivityBalloons>false</ShowDeviceConnectivityBalloons>
<ShowSynchronizedBalloonEvenIfNothingDownloaded>false</ShowSynchronizedBalloonEvenIfNothingDownloaded>
<SyncthingAddress>localhost:8384</SyncthingAddress>
<StartSyncthingAutomatically>true</StartSyncthingAutomatically>
Expand Down
23 changes: 22 additions & 1 deletion src/SyncTrayzor/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ protected override void Configure()
{
try
{
if (this.options.Shutdown)
{
client.Shutdown();
// Give it some time to shut down
var elapsed = Stopwatch.StartNew();
while (elapsed.Elapsed < TimeSpan.FromSeconds(10) &&
this.Container.Get<IIpcCommsClientFactory>().TryCreateClient() != null)
{
Thread.Sleep(100);
}
// Wait another half-second -- it seems it can take the browser process a little longer to exit
Thread.Sleep(500);
Environment.Exit(0);
}

if (this.options.StartSyncthing || this.options.StopSyncthing)
{
if (this.options.StartSyncthing)
Expand All @@ -142,6 +157,12 @@ protected override void Configure()
logger.Error(e, $"Failed to talk to {client}: {e.Message}. Pretending that it doesn't exist...");
}
}

// If we got this far, there probably isn't another instance running, and we should just shut down
if (this.options.Shutdown)
{
Environment.Exit(0);
}

var configurationProvider = this.Container.Get<IConfigurationProvider>();
configurationProvider.Initialize(AppSettings.Instance.DefaultUserConfiguration);
Expand Down Expand Up @@ -346,7 +367,7 @@ protected override void OnExit(ExitEventArgs e)
this.exiting = true;

// Try and be nice and close SyncTrayzor gracefully, before the Dispose call on SyncthingProcessRunning kills it dead
this.Container.Get<ISyncthingManager>().StopAsync().Wait(500);
this.Container.Get<ISyncthingManager>().StopAndWaitAsync().Wait(2000);
}

public override void Dispose()
Expand Down
12 changes: 6 additions & 6 deletions src/SyncTrayzor/NotifyIcon/NotifyIconViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,21 @@ public async void Start()
}

public bool CanStop => this.SyncthingState == SyncthingState.Running;
public void Stop()
public async void Stop()
{
this.syncthingManager.StopAsync();
await this.syncthingManager.StopAsync();
}

public bool CanRestart => this.SyncthingState == SyncthingState.Running;
public void Restart()
public async void Restart()
{
this.syncthingManager.RestartAsync();
await this.syncthingManager.RestartAsync();
}

public bool CanRescanAll => this.SyncthingState == SyncthingState.Running;
public void RescanAll()
public async void RescanAll()
{
this.syncthingManager.ScanAsync(null, null);
await this.syncthingManager.ScanAsync(null, null);
}

public void Exit()
Expand Down
6 changes: 3 additions & 3 deletions src/SyncTrayzor/Pages/Settings/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@

<GroupBox DockPanel.Dock="Top" Header="{l:Loc SettingsView_Section_TrayIcon}">
<DockPanel>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowTrayIconOnlyOnClose.Value}" Content="{l:Loc SettingsView_OnlyShowTrayIconOnClose}"/>
<TextBlock DockPanel.Dock="Top" Margin="0,0,0,5" TextWrapping="Wrap"
Text="{l:Loc SettingsView_Alerts_SeeFolders}"/>
<Grid DockPanel.Dock="Top">
<CheckBox IsChecked="{Binding ShowSynchronizedBalloonEvenIfNothingDownloaded.Value}"
Width="{Binding Parent.ActualWidth, RelativeSource={RelativeSource Self}}"
Content="{l:Loc SettingsView_ShowSynchronizedBalloonIfNoFilesTransferred}"/>
</Grid>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowDeviceConnectivityBalloons.Value}" Content="{l:Loc SettingsView_ShowDeviceConnectivityBalloons}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowDeviceOrFolderRejectedBalloons.Value}" Content="{l:Loc SettingsView_ShowDeviceOrFolderRejectedBalloons}"/>
<TextBlock DockPanel.Dock="Top" Margin="0,5,0,0" TextWrapping="Wrap"
Text="{l:Loc SettingsView_Alerts_SeeFolders}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowTrayIconOnlyOnClose.Value}" Content="{l:Loc SettingsView_OnlyShowTrayIconOnClose}"/>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,5,0,0">
<Label Padding="0,0,5,0" Target="{Binding ElementName=IconAnimationModeSelect}" VerticalAlignment="Center" Content="{l:Loc SettingsView_AnimateTrayIcon}"/>
<ComboBox x:Name="IconAnimationModeSelect" ItemsSource="{Binding IconAnimationModes}" SelectedValuePath="Value" SelectedValue="{Binding IconAnimationMode.Value}"/>
Expand Down
4 changes: 4 additions & 0 deletions src/SyncTrayzor/Pages/Settings/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,12 @@ private void LoadFromSyncthingStartupData()
}

this.FolderSettings.AddRange(folderSettings.OrderBy(x => x.FolderLabel));

this.IsAnyFolderWatchEnabledInSyncthing = this.FolderSettings.Any(x => !x.IsWatchAllowed);

this.UpdateAreAllFoldersWatched();
this.UpdateAreAllFoldersNotified();

this.NotifyOfPropertyChange(nameof(this.FolderSettings));
}

Expand Down
8 changes: 4 additions & 4 deletions src/SyncTrayzor/Pages/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ public async void Start()
}

public bool CanStop => this.SyncthingState == SyncthingState.Running;
public void Stop()
public async void Stop()
{
this.syncthingManager.StopAsync();
await this .syncthingManager.StopAsync();
}

public bool CanRestart => this.SyncthingState == SyncthingState.Running;
public void Restart()
public async void Restart()
{
this.syncthingManager.RestartAsync();
await this.syncthingManager.RestartAsync();
}

public bool CanRefreshBrowser => this.SyncthingState == SyncthingState.Running;
Expand Down
2 changes: 1 addition & 1 deletion src/SyncTrayzor/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/SyncTrayzor/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ This risks corrupting Syncthing's database. ONLY do this if you are unable to st

Please read the log to determine the cause.

If "FATAL: Cannot open database" appears, please close any other open instances of Syncthing. If SyncTrayzor crashed previously, there may still be zombine Syncthing processes alive. Please use the menu option "Syncthing -&gt; Kill all Syncthing processes" to stop them, then use "Syncthing -&gt; Start" to start Syncthing again.</value>
If "FATAL: Cannot open database" appears, please close any other open instances of Syncthing. If SyncTrayzor crashed previously, there may still be zombie Syncthing processes alive. Please use the menu option "Syncthing -&gt; Kill all Syncthing processes" to stop them, then use "Syncthing -&gt; Start" to start Syncthing again.</value>
<comment>Content of the dialog shown when Syncthing couldn't be started (and exited with an error). Instructs the user on how to proceed.

"FATAL: Cannot Open Database" should remain in English
Expand Down Expand Up @@ -873,7 +873,7 @@ Please donate to my charity fundraising campaign.</value>
<value>Metered Networks</value>
</data>
<data name="SettingsView_Alerts_SeeFolders" xml:space="preserve">
<value>See the 'Folders' tab for per-folder notification settings.</value>
<value>Disable balloon messages entirely on the 'Folders' tab</value>
</data>
<data name="ViewerView_BrowseToFolder" xml:space="preserve">
<value>Browse</value>
Expand Down Expand Up @@ -1002,4 +1002,4 @@ Please donate to my charity fundraising campaign.</value>
<data name="BarAlertsView_IntelXeGraphics_DismissLink" xml:space="preserve">
<value>Dismiss</value>
</data>
</root>
</root>

0 comments on commit 1ec7e4f

Please sign in to comment.