Skip to content

Commit

Permalink
1.23.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill-Stewart committed Aug 11, 2023
1 parent e9a398b commit 84010f8
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 51 deletions.
26 changes: 15 additions & 11 deletions Messages-en.isl
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,31 @@ TasksStartAtLogon=&Start Syncthing automatically when logging on
RunStatusMsg=Completing setup tasks...
RunPostInstallStartServiceDescription=&Start Syncthing service
RunPostInstallStartDescription=&Start Syncthing
; Configuration page
ConfigPageCaption=Select Configuration Settings
ConfigPageDescription=How should Setup configure Syncthing?
ConfigPageSubCaption=Specify Syncthing configuration settings, then click Next.
ConfigPageItem0=Automatic &upgrade interval, in hours (0 to disable; default is %1):
ConfigPageItem1=GUI configuration page listen &address (default is %1):
ConfigPageItem2=GUI configuration page listen &port (default is %1):
; Configuration pages
ConfigPage0Caption=Select Configuration Settings
ConfigPage0Description=How should Setup configure Syncthing?
ConfigPage0SubCaption=Specify Syncthing configuration settings, then click Next.
ConfigPage0Item0=Automatic &upgrade interval, in hours (0 to disable; default is %1):
ConfigPage0Item1=GUI configuration page listen &address (default is %1):
ConfigPage0Item2=GUI configuration page listen &port (default is %1):
ConfigPage0Item3=Relays enabled ('false' or 'true', default is '%1'):
; Configuration page errors
ConfigPageItem0NotValid=The automatic upgrade interval must be in the range 0 through 65535.
ConfigPageItem1Empty=You must specify a listen address.
ConfigPageItem2NotValid=The listen port must be in the range 1024 through 65535.
ConfigPage0Item0NotValid=The automatic upgrade interval must be in the range 0 through 65535.
ConfigPage0Item1Empty=You must specify a listen address.
ConfigPage0Item2NotValid=The listen port must be in the range 1024 through 65535.
ConfigPage0Item3NotValid=The relays value must be 'false' or 'true'.
; Ready memo page
ReadyMemoInstallInfo=Installation mode:
ReadyMemoInstallAdmin=Install for all users as Windows service
ReadyMemoInstallAdminServiceAccountUserName=Service account user name: %1
ReadyMemoInstallCurrentUser=Install for current user (%1)
ReadyMemoConfigInfo=Configuration settings:
ReadyMemoConfigItem0Enabled=Automatic upgrade check occurs every %1 hours
ReadyMemoConfigItem0Disabled=Automatic upgrades are disabled
ReadyMemoConfigItem0Enabled=Automatic upgrade check occurs every %1 hours
ReadyMemoConfigItem1=GUI configuration page listen address is
ReadyMemoConfigItem2=GUI configuration page listen port is
ReadyMemoConfigItem3Disabled=Relays are disabled
ReadyMemoConfigItem3Enabled=Relays are enabled
; Configuration migration messages
MigrationNeededMessage=Setup has detected that the Syncthing configuration should be migrated from "%1" to "%2"
MigrationSucceededMessage=Setup successfully migrated the Syncthing configuration from "%1" to "%2"
Expand Down
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Syncthing Windows Setup is a lightweight yet full-featured Windows installer for
- [Background](#background)
- [Version History](#version-history)
- [Upgrading Administrative Installations from Version 1.19.1 or Older](#upgrading-administrative-installations-from-version-1191-or-older)
- [Relays and Upgrading from Version 1.23.6 or Older](#relays-and-upgrading-from-version-1236-or-older)
- [Setup Command Line Parameters](#setup-command-line-parameters)
- [Administrative vs. Non Administrative Installation Mode](#administrative-vs-non-administrative-installation-mode)
- [Administrative (All Users) Installation Mode](#administrative-all-users-installation-mode)
Expand Down Expand Up @@ -80,14 +81,32 @@ When upgrading from version 1.19.1 or older, Setup automatically migrates the Sy

After upgrading from version 1.19.1 or older, you must follow the steps in [Granting Folder Permissions for the Service Account](#granting-folder-permissions-for-the-service-account) to grant the local service user account permission to each synchronized folder in your Syncthing configuration. Until you do so, the Syncthing GUI configuration page will report "access denied" errors because the local service user account does not have "Modify" permissions to the folder(s).

## Relays and Upgrading from Version 1.23.6 or Older

If you installed Syncthing using Setup version 1.23.6 or older, Setup did not specify whether relays are enabled. Effectively, this meant relays were enabled because Syncthing enables relays by default.

In versions newer than 1.23.6, Setup disables relays by default. This change was made because of persistent security software false-positives that detect outbound connections to shared IPs potentially used by "dangerous" IP addresses.

If you use relays and use Setup to upgrade from version 1.23.6 or older, you will need to do one of the following:

* Change the **Relays enabled** settiing on the configuration page to `true`, or

* specify `/relaysenabled=true` on the Setup command line.

Once you configure your preferred setting, Setup will remember it for the next upgrade.

For more information about Syncthing relays, see the following page in the Syncthing documentation:

https://docs.syncthing.net/users/relaying.html

## Setup Command Line Parameters

The following table lists the most common Setup command line parameters:

Parameter | Description
--------- | -----------
`/allusers` | Runs Setup in administrative (all users) installation mode (see [Administrative vs. Non Administrative Installation Mode](#administrative-vs-non-administrative-installation-mode)).
`/currentuser` | Runs Setup in non-administrative (current user) installation mode (see [Administrative vs. Non Administrative Installation Mode](#administrative-vs-non-administrative-installation-mode)).
`/allusers` | Runs Setup in administrative (all users) installation mode (see [Administrative vs. Non Administrative Installation Mode](#administrative-vs-non-administrative-installation-mode)).
`/dir="`_location_`"` | Specifies the installation folder. The default installation folder depends on whether Setup runs in administrative (all users) or non administrative (current user) installation mode.
`/group="`_name_`"` | Specifies the Start Menu group name. The default group name is **Syncthing**.
`/tasks="`_tasks_`"` | Specifies the tasks for the **Select Additional Tasks** wizard page (see [Setup Tasks](#setup-tasks)).
Expand All @@ -105,6 +124,7 @@ Parameter | Description
`/autoupgradeinterval=`_interval_ | **[*]** Specifies the number of hours that Syncthing should check for upgrades and automatically upgrade itself. The default value is 12 hours. Specify **0** to disable automatic upgrades.
`/listenaddress=`_address_ | **[*]** Specifies the listen address for the web GUI configuration page. The default listen address is **127.0.0.1**.
`/listenport=`_port_ | **[*]** Specifies the TCP port number for the web GUI configuration page. The default port number is **8384**.
`/relaysenabled=`_value_ | **[*]** Specifies whether relays are enabled (_value_ must be either **true** or **false**). The default value is **false** (i.e., relays are disabled).
`/serviceaccountusername=`_username_ | For administrative installation mode, specifies the local service user account user name. The default user name is **SyncthingServiceAcct**.
`/nostart` | Prevents Syncthing from starting automatically after the installation completes. The default is to start Syncthing when installation completes.

Expand All @@ -116,7 +136,7 @@ Please note the following:

## Administrative vs. Non Administrative Installation Mode

Setup supports both administrative (all users) and non administrative (current user) installation modes. For an initial installation (not a reinstall or upgrade), Setup displays a dialog box requesting whether you want to install for all users (administrative installation mode) or for the current user (non administrative installation mode). You can bypass the dialog by specifying either `/allusers` or `/currentuser` on Setup's command line (see [Setup Command Line Parameters](#setup-command-line-parameters)). When you run a newer version of Setup (i.e., an upgrade) or reinstall the current version, Setup does does not display the dialog.
Setup supports both non administrative (current user) and administrative (all users) installation modes. For an initial installation (not a reinstall or upgrade), Setup displays a dialog box requesting whether you want to install for the current user only (non administrative installation mode) or for all users (administrative installation mode). You can bypass the dialog by specifying either `/currentuser` or `/allusers` on Setup's command line (see [Setup Command Line Parameters](#setup-command-line-parameters)). When you run a newer version of Setup (i.e., an upgrade) or reinstall the current version, Setup does does not display the dialog. An initial installation in silent mode will install for the current user by default unless you specify `/allusers` on Setup's command line.

The main advantage of installing in administrative (all users) installation mode is that Syncthing runs as a Windows service and runs without any users being logged on; however, you must manually configure folder permissions to add folders to the Syncthing configuration (see [Granting Folder Permissions for the Service Account](#granting-folder-permissions-for-the-service-account)).

Expand Down Expand Up @@ -317,7 +337,7 @@ Syncthing requires permission to communicate through the Windows firewall. Creat

* If you run Setup in non administrative (current user) installation mode, Setup prompts to create a firewall rule for Syncthing if it doesn't exist (requires administrative permissions).

* When you specify both the `/currentuser` and `/silent` parameters (see [Setup Command Line Parameters](#setup-command-line-parameters)), Setup does not create a firewall rule for Syncthing, and you must create it manually.
* If you perform a silent install in non administrative installation mode (see [Setup Command Line Parameters](#setup-command-line-parameters)), Setup does not create a firewall rule for Syncthing, and you must create it manually.

### Creating the Firewall Rule Manually

Expand Down
102 changes: 65 additions & 37 deletions Syncthing.iss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define DefaultAutoUpgradeInterval "12"
#define DefaultListenAddress "127.0.0.1"
#define DefaultListenPort "8384"
#define DefaultRelaysEnabled "false"
#define DefaultServiceAccountUserName "SyncthingServiceAcct"
#define ConfigurationPageName "ConfigurationPage"
#define ScriptNameConfigSyncthingService "ConfigSyncthingService.js"
Expand All @@ -46,7 +47,7 @@ DefaultDirName={autopf}\{#AppName}
DefaultGroupName={#AppName}
DisableWelcomePage=yes
AllowNoIcons=yes
PrivilegesRequired=admin
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputDir=.
OutputBaseFilename=syncthing-{#AppVersion}-setup
Expand Down Expand Up @@ -234,8 +235,8 @@ type
// Global variables
var
ConfigPage: TInputQueryWizardPage; // Custom wizard page
AutoUpgradeInterval, ListenAddress, ListenPort: string; // Configuration page values
ConfigPage0: TInputQueryWizardPage; // Custom wizard page
AutoUpgradeInterval, ListenAddress, ListenPort, RelaysEnabled: string; // Configuration page values
ServiceAccountUserName: string;
// Windows API functions
Expand Down Expand Up @@ -338,6 +339,8 @@ begin
Trim(ExpandConstant('{param:listenaddress|{#DefaultListenAddress}}')));
ListenPort := GetPreviousData('ListenPort',
Trim(ExpandConstant('{param:listenport|{#DefaultListenPort}}')));
RelaysEnabled := GetPreviousData('RelaysEnabled',
Trim(ExpandConstant('{param:relaysenabled|{#DefaultRelaysEnabled}}')));
if IsAdminInstallMode() then
begin
ServiceAccountUserName := GetPreviousData('ServiceAccountUserName',
Expand All @@ -348,16 +351,18 @@ end;
procedure InitializeWizard();
begin
// Custom configuration page
ConfigPage := CreateInputQueryPage(wpSelectProgramGroup,
CustomMessage('ConfigPageCaption'),
CustomMessage('ConfigPageDescription'),
CustomMessage('ConfigPageSubCaption'));
ConfigPage.Add(FmtMessage(CustomMessage('ConfigPageItem0'), ['{#DefaultAutoUpgradeInterval}']), false);
ConfigPage.Add(FmtMessage(CustomMessage('ConfigPageItem1'), ['{#DefaultListenAddress}']), false);
ConfigPage.Add(FmtMessage(CustomMessage('ConfigPageItem2'), ['{#DefaultListenPort}']), false);
ConfigPage.Values[0] := AutoUpgradeInterval;
ConfigPage.Values[1] := ListenAddress;
ConfigPage.Values[2] := ListenPort;
ConfigPage0 := CreateInputQueryPage(wpSelectProgramGroup,
CustomMessage('ConfigPage0Caption'),
CustomMessage('ConfigPage0Description'),
CustomMessage('ConfigPage0SubCaption'));
ConfigPage0.Add(FmtMessage(CustomMessage('ConfigPage0Item0'), ['{#DefaultAutoUpgradeInterval}']), false);
ConfigPage0.Add(FmtMessage(CustomMessage('ConfigPage0Item1'), ['{#DefaultListenAddress}']), false);
ConfigPage0.Add(FmtMessage(CustomMessage('ConfigPage0Item2'), ['{#DefaultListenPort}']), false);
ConfigPage0.Add(FmtMessage(CustomMessage('ConfigPage0Item3'), ['{#DefaultRelaysEnabled}']), false);
ConfigPage0.Values[0] := AutoUpgradeInterval;
ConfigPage0.Values[1] := ListenAddress;
ConfigPage0.Values[2] := ListenPort;
ConfigPage0.Values[3] := RelaysEnabled;
WizardForm.LicenseAcceptedRadio.Checked := true;
end;
Expand All @@ -375,6 +380,7 @@ begin
SetPreviousData(PreviousDataKey, 'AutoUpgradeInterval', AutoUpgradeInterval);
SetPreviousData(PreviousDataKey, 'ListenAddress', ListenAddress);
SetPreviousData(PreviousDataKey, 'ListenPort', ListenPort);
SetPreviousData(PreviousDataKey, 'RelaysEnabled', RelaysEnabled);
if IsAdminInstallMode() then
begin
SetPreviousData(PreviousDataKey, 'ServiceAccountUserName', ServiceAccountUserName);
Expand All @@ -384,58 +390,74 @@ end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
UpgradeInterval, Port: Integer;
Relays: string;
begin
result := true;
if CurPageID = ConfigPage.ID then
if CurPageID = ConfigPage0.ID then
begin
//-------------------------------------------------------------------------
// 0 - Validate auto upgrade interval (>= 0 and <= 65535)
UpgradeInterval := StrToIntDef(Trim(ConfigPage.Values[0]), -1);
UpgradeInterval := StrToIntDef(Trim(ConfigPage0.Values[0]), -1);
result := (UpgradeInterval >= 0) and (UpgradeInterval <= 65535);
if not result then
begin
Log(CustomMessage('ConfigPageItem0NotValid'));
Log(CustomMessage('ConfigPage0Item0NotValid'));
if not WizardSilent() then
MsgBox(CustomMessage('ConfigPageItem0NotValid'), mbError, MB_OK);
WizardForm.ActiveControl := ConfigPage.Edits[0];
ConfigPage.Values[0] := '{#DefaultAutoUpgradeInterval}';
ConfigPage.Edits[0].SelectAll();
MsgBox(CustomMessage('ConfigPage0Item0NotValid'), mbError, MB_OK);
WizardForm.ActiveControl := ConfigPage0.Edits[0];
ConfigPage0.Values[0] := '{#DefaultAutoUpgradeInterval}';
ConfigPage0.Edits[0].SelectAll();
exit;
end;
// Update global based on page
AutoUpgradeInterval := Trim(ConfigPage.Values[0]);
AutoUpgradeInterval := Trim(ConfigPage0.Values[0]);
//-------------------------------------------------------------------------
// 1 - Validate listen address (not empty)
result := Trim(ConfigPage.Values[1]) <> '';
result := Trim(ConfigPage0.Values[1]) <> '';
if not result then
begin
Log(CustomMessage('ConfigPageItem1Empty'));
Log(CustomMessage('ConfigPage0Item1Empty'));
if not WizardSilent() then
MsgBox(CustomMessage('ConfigPageItem1Empty'), mbError, MB_OK);
WizardForm.ActiveControl := ConfigPage.Edits[1];
ConfigPage.Values[1] := '{#DefaultListenAddress}';
ConfigPage.Edits[1].SelectAll();
MsgBox(CustomMessage('ConfigPage0Item1Empty'), mbError, MB_OK);
WizardForm.ActiveControl := ConfigPage0.Edits[1];
ConfigPage0.Values[1] := '{#DefaultListenAddress}';
ConfigPage0.Edits[1].SelectAll();
exit;
end;
// Update global based on page
ListenAddress := Trim(ConfigPage.Values[1]);
ListenAddress := Trim(ConfigPage0.Values[1]);
//-------------------------------------------------------------------------
// 2 - Validate listen port (>= 1024 and <= 65535)
Port := StrToIntDef(Trim(ConfigPage.Values[2]), -1);
Port := StrToIntDef(Trim(ConfigPage0.Values[2]), -1);
result := (Port >= 1024) and (Port <= 65535);
if not result then
begin
Log(CustomMessage('ConfigPageItem2NotValid'));
Log(CustomMessage('ConfigPage0Item2NotValid'));
if not WizardSilent() then
MsgBox(CustomMessage('ConfigPageItem2NotValid'), mbError, MB_OK);
WizardForm.ActiveControl := ConfigPage.Edits[2];
ConfigPage.Values[2] := '{#DefaultListenPort}';
ConfigPage.Edits[2].SelectAll();
MsgBox(CustomMessage('ConfigPage0Item2NotValid'), mbError, MB_OK);
WizardForm.ActiveControl := ConfigPage0.Edits[2];
ConfigPage0.Values[2] := '{#DefaultListenPort}';
ConfigPage0.Edits[2].SelectAll();
exit;
end;
// Update global based on page
ListenPort := Trim(ConfigPage.Values[2]);
ListenPort := Trim(ConfigPage0.Values[2]);
//-------------------------------------------------------------------------
// 3 - Validate relays enabled ('true' or 'false')
Relays := Lowercase(Trim(ConfigPage0.Values[3]));
result := (Relays = 'false') or (Relays = 'true');
if not result then
begin
Log(CustomMessage('ConfigPage0Item3NotValid'));
if not WizardSilent() then
MsgBox(CustomMessage('ConfigPage0Item3NotValid'), mbError, MB_OK);
WizardForm.ActiveControl := ConfigPage0.Edits[3];
ConfigPage0.Values[3] := '{#DefaultRelaysEnabled}';
ConfigPage0.Edits[3].SelectAll();
exit;
end;
// Update global based on page
RelaysEnabled := Relays;
end;
end;
Expand Down Expand Up @@ -494,6 +516,11 @@ begin
Info := Info + NewLine;
Info := Info + Space + CustomMessage('ReadyMemoConfigItem1') + ' ' + ListenAddress + NewLine
+ Space + CustomMessage('ReadyMemoConfigItem2') + ' ' + ListenPort;
Info := Info + NewLine;
if RelaysEnabled = 'false' then
Info := Info + Space + CustomMessage('ReadyMemoConfigItem3Disabled')
else
Info := Info + Space + CustomMessage('ReadyMemoConfigItem3Enabled');
if MemoTasksInfo <> '' then
begin
if Info <> '' then
Expand Down Expand Up @@ -600,8 +627,9 @@ begin
Params := Params + ' /service'
else
Params := Params + ' /currentuser';
Params := Params + ' /autoupgradeinterval:' + AutoUpgradeInterval + ' /guiaddress:"'
+ ListenAddress + ':' + ListenPort + '"';
Params := Params + ' /autoupgradeinterval:' + AutoUpgradeInterval
+ ' /guiaddress:"' + ListenAddress + ':' + ListenPort + '"' +
+ ' /relaysenabled:' + RelaysEnabled;
if WizardSilent() then
Params := Params + ' /silent';
result := ExecEx(FileName, Params, true);
Expand Down
16 changes: 16 additions & 0 deletions en-SetSyncthingConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ function paramIsEmpty(paramName) {
return (Args.Named.Item(paramName) == "") || (Args.Named.Item(paramName) == null);
}

function getBoolStringParam(paramName) {
if ( paramIsEmpty(paramName) ) {
return "false";
}
return Args.Named.Item(paramName).toLowerCase() == "true" ? "true" : "false";
}

function main() {
// Following depend on /currentuser or /service parameter
var configPath = null; // Syncthing config file path
Expand Down Expand Up @@ -107,6 +114,15 @@ function main() {
xmlElement.text = paramIsEmpty("autoupgradeinterval") ? "12" : configValue;
XMLDOMDocument.save(configFileName);
}
// Configure relaysEnabled
if ( Args.Named.Exists("relaysenabled") ) {
xmlElement = XMLDOMDocument.selectSingleNode("//configuration/options/relaysEnabled");
configValue = getBoolStringParam("relaysenabled");
if ( xmlElement.text != configValue ) {
xmlElement.text = configValue;
XMLDOMDocument.save(configFileName);
}
}
// Configure setLowPriority
xmlElement = XMLDOMDocument.selectSingleNode("//configuration/options/setLowPriority");
if ( xmlElement.text.toLowerCase() != "false" ) {
Expand Down
Loading

0 comments on commit 84010f8

Please sign in to comment.