From 726a5b922bed306e09db95cb91eb781b3fcf1b3b Mon Sep 17 00:00:00 2001 From: Brian Hursey Date: Sat, 28 Nov 2026 23:03:51 +0000 Subject: [PATCH] Fix direct window launch when VBScript is disabled The window now starts Luminary.ps1 through a hidden PowerShell process instead of relying on the VBS entry point, and the installer defaults to Luminary.cmd. Bump the beta to 0.5.1. --- package-lock.json | 4 +- package.json | 2 +- server/index.mjs | 2 +- src/lib/about.ts | 2 +- windows/README.md | 18 +++--- windows/SEPARATE-REPO.md | 4 +- windows/installer.iss | 9 +-- windows/launcher/DESIGN.md | 12 ++-- .../launcher/webview2/LuminaryWindow.csproj | 2 +- windows/launcher/webview2/Program.cs | 60 ++++++++++++++++--- windows/releases/SHA256SUMS.txt | 2 +- 11 files changed, 84 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 14e2b88..4ad05e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "luminary", - "version": "0.5.0", + "version": "0.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "luminary", - "version": "0.5.0", + "version": "0.5.1", "license": "MIT", "dependencies": { "exifr": "^7.1.3", diff --git a/package.json b/package.json index adbcd42..280c0f4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "luminary", "private": true, "license": "MIT", - "version": "0.5.0", + "version": "0.5.1", "type": "module", "scripts": { "dev": "vite", diff --git a/server/index.mjs b/server/index.mjs index 888c2ae..c0ecb85 100644 --- a/server/index.mjs +++ b/server/index.mjs @@ -126,7 +126,7 @@ import { startImmichImport, } from './immich.mjs'; -const VERSION = '0.5.0'; +const VERSION = '0.5.1'; const COOKIE = 'lumen_session'; /** Self-only policy; must allow the wasm engines and React inline styles. */ diff --git a/src/lib/about.ts b/src/lib/about.ts index db7e624..f973e6d 100644 --- a/src/lib/about.ts +++ b/src/lib/about.ts @@ -2,6 +2,6 @@ * Versions shown in the About panel. APP_VERSION mirrors package.json; the * guide values are bumped when docs/user-guide/guide.html is republished. */ -export const APP_VERSION = '0.5.0'; +export const APP_VERSION = '0.5.1'; export const GUIDE_VERSION = '0.5'; export const GUIDE_UPDATED = 'November 2026'; diff --git a/windows/README.md b/windows/README.md index e84c7c7..fa35bef 100644 --- a/windows/README.md +++ b/windows/README.md @@ -84,7 +84,7 @@ Output: ``` / - Luminary-0.5.0-win-x64.zip the deliverable + Luminary-0.5.1-win-x64.zip the deliverable stage/Luminary/ the unpacked bundle (kept for inspection) cache/node-v24.22.2-win-x64.exe pinned runtime, reused next time cache/SHASUMS256-v24.22.2.txt @@ -125,7 +125,7 @@ the context; the app's own `Dockerfile` is unaffected. Inno Setup 6 on any Windows machine (or a Windows CI runner): ```bat -iscc /DAppVersion=0.5.0 /DLauncher=Luminary.vbs ^ +iscc /DAppVersion=0.5.1 /DLauncher=Luminary.cmd ^ /DSourceDir="C:\builds\luminary\stage\Luminary" windows\installer.iss ``` @@ -221,9 +221,11 @@ Evergreen installer. The exe adds roughly 70 MB to the zip, which is why it is opt-in rather than always shipped. Double-clicking `LuminaryWindow.exe` directly is safe too. Without `--url` it -starts the bundle launcher (`Luminary.cmd`, `Luminary.vbs` or `Luminary.exe`) -and exits; the launcher then starts desktop mode and reopens the window with -`--url`. If the exe is copied out of a complete bundle, it explains that it is +starts the bundle launcher and exits; the launcher then starts desktop mode and +reopens the window with `--url`. It uses `Luminary.exe` when the Go build ships +one, otherwise it runs `Luminary.ps1` through a hidden PowerShell process. That +avoids `Luminary.vbs` and Windows Script Host, which some machines disable by +policy. If the exe is copied out of a complete bundle, it explains that it is only the window rather than showing a signed-out page. `Luminary.cmd -Verify` checks the bundle. `Luminary.cmd -Repair` re-downloads @@ -248,9 +250,9 @@ Full behaviour, edge cases and the test checklist: [launcher/DESIGN.md](launcher ```bash cd -sha256sum Luminary-0.5.0-win-x64.zip -unzip -t Luminary-0.5.0-win-x64.zip | tail -1 -unzip -l Luminary-0.5.0-win-x64.zip | grep -E 'node.exe|Luminary\.(exe|cmd|vbs)|app/server/index.mjs' +sha256sum Luminary-0.5.1-win-x64.zip +unzip -t Luminary-0.5.1-win-x64.zip | tail -1 +unzip -l Luminary-0.5.1-win-x64.zip | grep -E 'node.exe|Luminary\.(exe|cmd|vbs)|app/server/index.mjs' ``` On Windows, the real test is the checklist in `launcher/DESIGN.md` §15, diff --git a/windows/SEPARATE-REPO.md b/windows/SEPARATE-REPO.md index e6b9d2e..2bef7c4 100644 --- a/windows/SEPARATE-REPO.md +++ b/windows/SEPARATE-REPO.md @@ -40,9 +40,9 @@ second implementation to drift. ``` repo=https://git.maple-street.net/bhursey/luminary.git -tag=v0.5.0 +tag=v0.5.1 commit=fb43ca8f1c2d… # full sha -version=0.5.0 # package.json version, checked after fetch +version=0.5.1 # package.json version, checked after fetch node=v24.22.2 ``` diff --git a/windows/installer.iss b/windows/installer.iss index 064e72a..240cd0f 100644 --- a/windows/installer.iss +++ b/windows/installer.iss @@ -2,7 +2,7 @@ ; ; Build the bundle first: node windows/build.mjs ; Then, from the output directory: -; iscc /DAppVersion=0.5.0 /DSourceDir="" \ +; iscc /DAppVersion=0.5.1 /DSourceDir="" \ ; \windows\installer.iss ; ; The default SourceDir is relative to this script and only works when iscc is @@ -13,11 +13,12 @@ ; %LOCALAPPDATA%\Luminary\data and is kept on uninstall. #ifndef AppVersion - #define AppVersion "0.5.0" + #define AppVersion "0.5.1" #endif #ifndef Launcher - ; Luminary.vbs for the PowerShell launcher build, Luminary.exe for the Go one. - #define Launcher "Luminary.vbs" + ; Luminary.cmd works even when Windows Script Host is disabled; Luminary.exe + ; for the Go launcher build. + #define Launcher "Luminary.cmd" #endif #ifndef SourceDir #define SourceDir "stage\Luminary" diff --git a/windows/launcher/DESIGN.md b/windows/launcher/DESIGN.md index 78b0fd5..704fb08 100644 --- a/windows/launcher/DESIGN.md +++ b/windows/launcher/DESIGN.md @@ -279,7 +279,10 @@ uses `runtime.json`, and the browser window remains the fallback when the exe is absent or fails to start. A direct launch without `--url` forwards to the bundle launcher and exits immediately; that closes the old hole where double-clicking the window opened port 8787 directly and showed a login page -(or a dead URL) because no desktop-mode server was running. +(or a dead URL) because no desktop-mode server was running. The handoff prefers +the Go `Luminary.exe`, then runs `Luminary.ps1` in a hidden PowerShell process; +it does not use `Luminary.vbs`, because Windows Script Host can be disabled on +managed machines even when the bundle is healthy. ## 12. Runtime resolution and repair @@ -355,9 +358,10 @@ module, which needs the type-stripping runtime. bundle" message, not a missing-file crash. 12. On a machine with Node 24 installed: delete `node.exe` → the launcher warns, starts on the system Node and `-Status` names that path; `-Stop` still works. -13. Double-click `LuminaryWindow.exe` with no arguments → it exits, the bundle - launcher starts desktop mode, and the reopened window is signed in; no login - screen appears. +13. Double-click `LuminaryWindow.exe` with no arguments on a machine where + VBScript is disabled → it exits, the hidden PowerShell launcher starts + desktop mode, and the reopened window is signed in; no login screen and no + Windows Script Host error appear. 14. On a machine with no Node: delete `node.exe` → the launch offers the 90 MB download; Yes installs and starts, No exits 3; `-Repair` works as well. 15. Truncate `node.exe` (keep the first 100 kB) → `-Verify` reports `damaged`, diff --git a/windows/launcher/webview2/LuminaryWindow.csproj b/windows/launcher/webview2/LuminaryWindow.csproj index 2bb984a..f4e158e 100644 --- a/windows/launcher/webview2/LuminaryWindow.csproj +++ b/windows/launcher/webview2/LuminaryWindow.csproj @@ -32,7 +32,7 @@ true true - 0.5.0 + 0.5.1 Luminary Luminary Maple Street diff --git a/windows/launcher/webview2/Program.cs b/windows/launcher/webview2/Program.cs index 945a484..5513009 100644 --- a/windows/launcher/webview2/Program.cs +++ b/windows/launcher/webview2/Program.cs @@ -39,7 +39,7 @@ internal static class Program MessageBox.Show( "LuminaryWindow.exe is only the app window.\n\n" + - "Start Luminary.exe (or Luminary.cmd) from the Luminary folder instead.", + "Start Luminary.cmd (or Luminary.vbs) from the Luminary folder instead.", "Luminary", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -63,25 +63,69 @@ internal static class Program // Environment.ProcessPath is the exe itself even in a single-file publish; // AppContext.BaseDirectory is only a fallback. var root = Path.GetDirectoryName(Environment.ProcessPath) ?? AppContext.BaseDirectory; - foreach (var name in new[] { "Luminary.exe", "Luminary.vbs", "Luminary.cmd" }) + + // A Go build has one native launcher; use it when present. + var native = Path.Combine(root, "Luminary.exe"); + if (File.Exists(native) && TryStart(native, root)) return true; + + // Do not go through Luminary.vbs here. Windows Script Host can be + // disabled by policy, which makes the window fail even though the + // bundle is healthy. Run the PowerShell launcher hidden instead; it is + // the same code Luminary.cmd uses and needs no console or .vbs handler. + var script = Path.Combine(root, "Luminary.ps1"); + if (File.Exists(script)) { - var launcher = Path.Combine(root, name); - if (!File.Exists(launcher)) continue; + var powershell = Path.Combine( + Environment.SystemDirectory, "WindowsPowerShell", "v1.0", "powershell.exe"); + if (!File.Exists(powershell)) powershell = "powershell.exe"; try { - Process.Start(new ProcessStartInfo(launcher) + var start = new ProcessStartInfo(powershell) { WorkingDirectory = root, - UseShellExecute = true, - }); + UseShellExecute = false, + CreateNoWindow = true, + WindowStyle = ProcessWindowStyle.Hidden, + }; + start.ArgumentList.Add("-NoProfile"); + start.ArgumentList.Add("-ExecutionPolicy"); + start.ArgumentList.Add("Bypass"); + start.ArgumentList.Add("-WindowStyle"); + start.ArgumentList.Add("Hidden"); + start.ArgumentList.Add("-File"); + start.ArgumentList.Add(script); + Process.Start(start); return true; } catch { - // Try the next entry point before giving up. + // Fall through to the command entry point. } } + + foreach (var name in new[] { "Luminary.cmd", "Luminary.vbs" }) + { + var launcher = Path.Combine(root, name); + if (File.Exists(launcher) && TryStart(launcher, root)) return true; + } return false; } + + private static bool TryStart(string launcher, string workingDirectory) + { + try + { + Process.Start(new ProcessStartInfo(launcher) + { + WorkingDirectory = workingDirectory, + UseShellExecute = true, + }); + return true; + } + catch + { + return false; + } + } } diff --git a/windows/releases/SHA256SUMS.txt b/windows/releases/SHA256SUMS.txt index 20e4502..cfc9563 100644 --- a/windows/releases/SHA256SUMS.txt +++ b/windows/releases/SHA256SUMS.txt @@ -1 +1 @@ -e563cfe3be613ff3cea84030275c43fd363b4de4ef98fecf031382cbfc0d25c3 Luminary-0.5.0-win-x64.zip +644c4e60451466e69d16860a9d1be509acc204168fb30bcd3f4f6b75ba24d922 Luminary-0.5.1-win-x64.zip