Adds self-hosted update system
Implements a self-hosted update mechanism, allowing the application to be updated from a corporate network share without relying on third-party services. This includes: - Functionality to check for updates - Download installers - Verify checksums - Install updates with UAC elevation Configuration is managed via the config.ini file, with automatic checks on startup. A new settings UI is also included.
This commit is contained in:
@@ -5,13 +5,18 @@
|
||||
[Setup]
|
||||
AppName={#ApplicationName}
|
||||
AppVersion={#ApplicationVersion}
|
||||
; Default directory (will be adjusted in code based on installation mode)
|
||||
; Admin mode: C:\Program Files\EMLy
|
||||
; User mode: C:\Users\{username}\AppData\Local\Programs\EMLy
|
||||
DefaultDirName={autopf}\EMLy
|
||||
OutputBaseFilename={#ApplicationName}_Installer_{#ApplicationVersion}
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
DisableProgramGroupPage=yes
|
||||
; Request administrative privileges for HKA to write to HKLM if needed,
|
||||
; or use "lowest" if purely per-user, but file associations usually work better with admin rights or proper HKA handling.
|
||||
PrivilegesRequired=admin
|
||||
; Allow user to choose between admin (system-wide) and user-only install
|
||||
; "lowest" = does not require admin privileges by default (user mode)
|
||||
; "dialog" = shows a dialog asking user to choose installation mode
|
||||
PrivilegesRequired=lowest
|
||||
PrivilegesRequiredOverridesAllowed=dialog
|
||||
SetupIconFile=..\build\windows\icon.ico
|
||||
UninstallDisplayIcon={app}\{#ApplicationName}.exe
|
||||
AppVerName={#ApplicationName} {#ApplicationVersion}
|
||||
@@ -22,6 +27,12 @@ Source: "..\build\bin\{#ApplicationName}.exe"; DestDir: "{app}"; Flags: ignoreve
|
||||
Source: "..\build\bin\config.ini"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
[Registry]
|
||||
; File associations using HKA (HKEY_AUTO) registry root
|
||||
; HKA automatically selects the appropriate registry hive:
|
||||
; - HKLM (HKEY_LOCAL_MACHINE) for admin/system-wide installations
|
||||
; - HKCU (HKEY_CURRENT_USER) for user-only installations
|
||||
; This ensures file associations work correctly for both installation modes
|
||||
|
||||
; 1. Register the .eml extension and point it to our internal ProgID "EMLy.EML"
|
||||
Root: HKA; Subkey: "Software\Classes\.eml"; ValueType: string; ValueName: ""; ValueData: "{#ApplicationName}.EML"; Flags: uninsdeletevalue
|
||||
Root: HKA; Subkey: "Software\Classes\.msg"; ValueType: string; ValueName: ""; ValueData: "{#ApplicationName}.MSG"; Flags: uninsdeletevalue
|
||||
@@ -44,3 +55,26 @@ Root: HKA; Subkey: "Software\Classes\{#ApplicationName}.MSG\shell\open"; ValueTy
|
||||
|
||||
[Icons]
|
||||
Name: "{autoprograms}\{#ApplicationName}"; Filename: "{app}\{#ApplicationName}.exe"
|
||||
|
||||
[Code]
|
||||
// Override default directory based on installation mode
|
||||
function GetDefaultDirName(Param: string): string;
|
||||
begin
|
||||
// If installing with admin privileges (system-wide), use Program Files
|
||||
if IsAdminInstallMode then
|
||||
Result := ExpandConstant('{autopf}\{#ApplicationName}')
|
||||
// If installing for current user only, use AppData\Local\Programs
|
||||
else
|
||||
Result := ExpandConstant('{localappdata}\Programs\{#ApplicationName}');
|
||||
end;
|
||||
|
||||
procedure CurPageChanged(CurPageID: Integer);
|
||||
begin
|
||||
// Update the directory when the directory selection page is shown
|
||||
if CurPageID = wpSelectDir then
|
||||
begin
|
||||
// Only set if user hasn't manually changed it
|
||||
if WizardForm.DirEdit.Text = ExpandConstant('{autopf}\{#ApplicationName}') then
|
||||
WizardForm.DirEdit.Text := GetDefaultDirName('');
|
||||
end;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user