Skip to content

Commit dcbac28

Browse files
authored
Allow user-only install on Windows (#149)
* User-only installation * Allow user to proceed or cancel user-only installation * Move to CRAWLEE_SYSTEM_INFO_V2 explicitly to avoid wmic dependency
1 parent bda737f commit dcbac28

File tree

2 files changed

+81
-24
lines changed

2 files changed

+81
-24
lines changed

a11y_for_windows.iss

Lines changed: 78 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
; Script generated by the Inno Setup Script Wizard.
2-
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3-
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
4-
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
5-
[SETUP]
1+
; --- Setup ---
2+
[Setup]
63
AppId={{cc9a344d-66b1-4f2d-844e-0b939cf31959}
74
AppName=Oobee Desktop
85
AppVersion=0.10.0
@@ -11,42 +8,101 @@ AppPublisher=GovTech
118
AppPublisherURL=https://github.com/GovTechSG/oobee-desktop
129
AppSupportURL=https://github.com/GovTechSG/oobee-desktop
1310
AppUpdatesURL=https://github.com/GovTechSG/oobee-desktop
14-
DefaultDirName=C:\Program Files\Oobee Desktop
11+
12+
; Never force UAC; Program Files only if launched elevated
13+
PrivilegesRequired=lowest
14+
PrivilegesRequiredOverridesAllowed=dialog
1515
DisableDirPage=yes
16-
ChangesAssociations=yes
17-
DisableProgramGroupPage=yes
18-
; LicenseFile=Oobee-win32-x64\LICENSE
19-
; Uncomment the following line to run in non administrative install mode (install for current user only.)
20-
;PrivilegesRequired=lowest
16+
DefaultDirName={code:GetDefaultDir}
17+
2118
Compression=lzma
2219
SolidCompression=yes
2320
WizardStyle=modern
21+
ChangesAssociations=yes
2422

2523
[Languages]
2624
Name: "english"; MessagesFile: "compiler:Default.isl"
2725

26+
; --- Tasks ---
2827
[Tasks]
2928
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
3029

30+
; --- Files (use \\?\ for long-path-safe copy) ---
3131
[Files]
3232
Source: "Oobee-win32-x64\*"; DestDir: "\\?\{app}\Oobee Frontend"; Flags: ignoreversion recursesubdirs createallsubdirs
3333
Source: "D:\a\Oobee Backend\*"; DestDir: "\\?\{app}\Oobee Backend"; Flags: ignoreversion recursesubdirs createallsubdirs
34-
Source: "Install-WMIC.ps1"; DestDir: "\\?\{app}"; Flags: ignoreversion
35-
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
34+
; Source: "Install-WMIC.ps1"; DestDir: "\\?\{app}"; Flags: ignoreversion
3635

36+
; --- Shortcuts (both reflect "(User)" when not elevated) ---
3737
[Icons]
38-
Name: "{autoprograms}\Oobee Desktop"; Filename: "C:\Program Files\Oobee Desktop\Oobee Frontend\Oobee.exe"
39-
Name: "{autodesktop}\Oobee Desktop"; Filename: "C:\Program Files\Oobee Desktop\Oobee Frontend\Oobee.exe"; Tasks: desktopicon
38+
Name: "{autoprograms}\{code:GetShortcutName}"; Filename: "{app}\Oobee Frontend\Oobee.exe"
39+
Name: "{autodesktop}\{code:GetShortcutName}"; Filename: "{app}\Oobee Frontend\Oobee.exe"
4040

41+
; --- Optional post-install (guard if needs admin; NO \\?\ here) ---
4142
[Run]
42-
; Filename: "C:\Program Files\Oobee\Oobee Frontend\Oobee.exe"; Description: "{cm:LaunchProgram,Oobee Desktop}"; Flags: nowait postinstall skipifsilent
43-
; Add WMIC installation before running your application
44-
Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""C:\Program Files\Oobee Desktop\Install-WMIC.ps1"""; Description: "{cm:LaunchProgram,Install required Windows features}"; Flags: postinstall waituntilterminated
43+
; Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\Install-WMIC.ps1"""
44+
; Flags: postinstall waituntilterminated; Check: IsAdmin
4545

46+
; --- Clean up (use \\?\ so delete handles long paths too) ---
4647
[UninstallDelete]
47-
Type: filesandordirs; Name: "C:\Program Files\Oobee\Oobee Frontend"
48-
Type: filesandordirs; Name: "C:\Program Files\Oobee\Oobee Backend"
48+
Type: filesandordirs; Name: "\\?\{app}\Oobee Frontend"
49+
Type: filesandordirs; Name: "\\?\{app}\Oobee Backend"
4950

5051
[InstallDelete]
51-
Type: filesandordirs; Name: "C:\Program Files\Oobee\Oobee Frontend"
52-
Type: filesandordirs; Name: "C:\Program Files\Oobee\Oobee Backend"
52+
Type: filesandordirs; Name: "\\?\{app}\Oobee Frontend"
53+
Type: filesandordirs; Name: "\\?\{app}\Oobee Backend"
54+
55+
; --- Code: choose base dir based on elevation ---
56+
[Code]
57+
const
58+
AppIdUninstallKey = '{cc9a344d-66b1-4f2d-844e-0b939cf31959}_is1';
59+
60+
function MachineInstallExists(): Boolean;
61+
begin
62+
Result :=
63+
RegKeyExists(HKLM64, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' + AppIdUninstallKey) or
64+
RegKeyExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' + AppIdUninstallKey);
65+
end;
66+
67+
function InitializeSetup(): Boolean;
68+
var
69+
Choice: Integer;
70+
begin
71+
// If there is an existing per-machine install and we're not elevated,
72+
// inform the user and offer only user-mode install or exit.
73+
if (not IsAdmin) and MachineInstallExists() then
74+
begin
75+
Choice := MsgBox(
76+
'A system-wide installation of Oobee Desktop already exists.'#13#10#13#10 +
77+
'Without administrator rights, this setup will install a separate copy for your user only.'#13#10 +
78+
'Shortcuts will be named "Oobee Desktop (User)".'#13#10#13#10 +
79+
'Click "Yes" to proceed with user-only installation (recommended),'#13#10 +
80+
'or "No" to cancel the installation.',
81+
mbConfirmation, MB_YESNO);
82+
83+
if Choice = IDNO then
84+
begin
85+
Result := False; // Close installer
86+
exit;
87+
end;
88+
// If "Yes", fall through and proceed with per-user install
89+
end;
90+
91+
Result := True;
92+
end;
93+
94+
function GetDefaultDir(Param: string): string;
95+
begin
96+
if IsAdmin then
97+
Result := ExpandConstant('{autopf}\Oobee Desktop') // Program Files (admin)
98+
else
99+
Result := ExpandConstant('{userappdata}\Oobee Desktop'); // AppData\Roaming (per-user)
100+
end;
101+
102+
function GetShortcutName(Param: string): string;
103+
begin
104+
if IsAdmin then
105+
Result := 'Oobee Desktop'
106+
else
107+
Result := 'Oobee Desktop (User)';
108+
end;

public/electron/scanManager.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ const startScan = async (scanDetails, scanEvent) => {
224224
cwd: resultsPath,
225225
env: {
226226
...process.env,
227-
OOBEE_VERBOSE: true,
228-
OOBEE_FAST_CRAWLER: true,
227+
OOBEE_VERBOSE: '1',
228+
OOBEE_FAST_CRAWLER: '1',
229+
CRAWLEE_SYSTEM_INFO_V2: '1',
229230
PLAYWRIGHT_BROWSERS_PATH: `${playwrightBrowsersPath}`,
230231
PATH: getPathVariable(),
231232
},

0 commit comments

Comments
 (0)