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.
This commit is contained in:
@@ -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`,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<!-- WebView2Loader.dll is native; single-file must extract it at startup. -->
|
||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
||||
<Version>0.5.0</Version>
|
||||
<Version>0.5.1</Version>
|
||||
<AssemblyTitle>Luminary</AssemblyTitle>
|
||||
<Product>Luminary</Product>
|
||||
<Company>Maple Street</Company>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user