henergyqueai 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/henergyqueai.js +1 -1
- package/package.json +1 -1
- package/src/connexion.js +14 -7
package/bin/henergyqueai.js
CHANGED
|
@@ -36,7 +36,7 @@ import { expandReferences } from "../src/references.js";
|
|
|
36
36
|
import { stopAll } from "../src/background.js";
|
|
37
37
|
import { loadHooks } from "../src/hooks.js";
|
|
38
38
|
|
|
39
|
-
const VERSION = "0.9.
|
|
39
|
+
const VERSION = "0.9.3";
|
|
40
40
|
// Le papillon, une ligne vide, le trait, l'aide et une ligne vide.
|
|
41
41
|
const HEADER_HEIGHT = LOGO_HEIGHT + 4;
|
|
42
42
|
const BODY_ROW = HEADER_HEIGHT + 1;
|
package/package.json
CHANGED
package/src/connexion.js
CHANGED
|
@@ -3,15 +3,22 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
3
3
|
import { hostname } from "node:os";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
|
|
6
|
+
// On Windows the address must not go through cmd: it reads each « & » of the
|
|
7
|
+
// query string as a new command, so the browser got a truncated address and
|
|
8
|
+
// « code=… » launched VS Code.
|
|
9
|
+
export const browserCommand = (url, platform = process.platform) =>
|
|
10
|
+
platform === "win32"
|
|
11
|
+
? ["rundll32.exe", ["url.dll,FileProtocolHandler", url]]
|
|
12
|
+
: platform === "darwin"
|
|
13
|
+
? ["open", [url]]
|
|
14
|
+
: ["xdg-open", [url]];
|
|
15
|
+
|
|
6
16
|
const openBrowser = (url) => {
|
|
7
|
-
const [command, args] =
|
|
8
|
-
process.platform === "win32"
|
|
9
|
-
? ["cmd", ["/c", "start", "", url]]
|
|
10
|
-
: process.platform === "darwin"
|
|
11
|
-
? ["open", [url]]
|
|
12
|
-
: ["xdg-open", [url]];
|
|
17
|
+
const [command, args] = browserCommand(url);
|
|
13
18
|
try {
|
|
14
|
-
spawn(command, args, { detached: true, stdio: "ignore" })
|
|
19
|
+
const child = spawn(command, args, { detached: true, stdio: "ignore", windowsHide: true });
|
|
20
|
+
child.on("error", () => {});
|
|
21
|
+
child.unref();
|
|
15
22
|
return true;
|
|
16
23
|
} catch {
|
|
17
24
|
return false;
|