@kenkaiiii/gg-boss 4.3.151 → 4.3.153
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.
|
@@ -92224,7 +92224,7 @@ function createTaskTools(deps) {
|
|
|
92224
92224
|
|
|
92225
92225
|
// src/audio.ts
|
|
92226
92226
|
init_esm_shims();
|
|
92227
|
-
import { spawn as spawn6 } from "child_process";
|
|
92227
|
+
import { spawn as spawn6, execFileSync as execFileSync3 } from "child_process";
|
|
92228
92228
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
92229
92229
|
import path28 from "path";
|
|
92230
92230
|
import fs29 from "fs";
|
|
@@ -92328,6 +92328,79 @@ function trySpawn(cmd, args) {
|
|
|
92328
92328
|
}
|
|
92329
92329
|
});
|
|
92330
92330
|
}
|
|
92331
|
+
function isWsl() {
|
|
92332
|
+
if (process.platform !== "linux") return false;
|
|
92333
|
+
return !!process.env.WSL_DISTRO_NAME || fs29.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop");
|
|
92334
|
+
}
|
|
92335
|
+
async function tryPlayOnWindowsHost(file2) {
|
|
92336
|
+
try {
|
|
92337
|
+
const here = path28.dirname(fileURLToPath2(import.meta.url));
|
|
92338
|
+
const devAssets = path28.resolve(here, "..", "assets");
|
|
92339
|
+
const resolved = path28.resolve(file2);
|
|
92340
|
+
const inDist = resolved === here || resolved.startsWith(here + path28.sep);
|
|
92341
|
+
const inAssets = resolved === devAssets || resolved.startsWith(devAssets + path28.sep);
|
|
92342
|
+
if (!inDist && !inAssets) {
|
|
92343
|
+
return false;
|
|
92344
|
+
}
|
|
92345
|
+
const winPath = execFileSync3("wslpath", ["-w", resolved], {
|
|
92346
|
+
encoding: "utf8",
|
|
92347
|
+
timeout: 2e3
|
|
92348
|
+
}).trim();
|
|
92349
|
+
const script = [
|
|
92350
|
+
"Add-Type -AssemblyName presentationCore;",
|
|
92351
|
+
"$p = New-Object System.Windows.Media.MediaPlayer;",
|
|
92352
|
+
"$p.Open([uri]$env:GGBOSS_AUDIO_PATH);",
|
|
92353
|
+
"$p.Play();",
|
|
92354
|
+
// Same reason as the win32 branch: MediaPlayer is async, so we have
|
|
92355
|
+
// to keep powershell.exe alive long enough to actually emit audio.
|
|
92356
|
+
"Start-Sleep -Seconds 5;"
|
|
92357
|
+
].join(" ");
|
|
92358
|
+
return new Promise((resolve3) => {
|
|
92359
|
+
let resolved2 = false;
|
|
92360
|
+
try {
|
|
92361
|
+
const child = spawn6(
|
|
92362
|
+
"powershell.exe",
|
|
92363
|
+
["-NoProfile", "-WindowStyle", "Hidden", "-Command", script],
|
|
92364
|
+
{
|
|
92365
|
+
detached: true,
|
|
92366
|
+
stdio: "ignore",
|
|
92367
|
+
env: {
|
|
92368
|
+
...process.env,
|
|
92369
|
+
GGBOSS_AUDIO_PATH: winPath,
|
|
92370
|
+
// WSLENV propagates listed vars across the WSL→Windows boundary.
|
|
92371
|
+
// Append rather than replace so we don't clobber existing rules.
|
|
92372
|
+
WSLENV: (process.env.WSLENV ? process.env.WSLENV + ":" : "") + "GGBOSS_AUDIO_PATH"
|
|
92373
|
+
}
|
|
92374
|
+
}
|
|
92375
|
+
);
|
|
92376
|
+
child.once("error", () => {
|
|
92377
|
+
if (!resolved2) {
|
|
92378
|
+
resolved2 = true;
|
|
92379
|
+
resolve3(false);
|
|
92380
|
+
}
|
|
92381
|
+
});
|
|
92382
|
+
child.once("spawn", () => {
|
|
92383
|
+
if (!resolved2) {
|
|
92384
|
+
resolved2 = true;
|
|
92385
|
+
child.unref();
|
|
92386
|
+
resolve3(true);
|
|
92387
|
+
}
|
|
92388
|
+
});
|
|
92389
|
+
setTimeout(() => {
|
|
92390
|
+
if (!resolved2) {
|
|
92391
|
+
resolved2 = true;
|
|
92392
|
+
child.unref();
|
|
92393
|
+
resolve3(true);
|
|
92394
|
+
}
|
|
92395
|
+
}, 50);
|
|
92396
|
+
} catch {
|
|
92397
|
+
resolve3(false);
|
|
92398
|
+
}
|
|
92399
|
+
});
|
|
92400
|
+
} catch {
|
|
92401
|
+
return false;
|
|
92402
|
+
}
|
|
92403
|
+
}
|
|
92331
92404
|
async function playFile(file2) {
|
|
92332
92405
|
if (!fs29.existsSync(file2)) return;
|
|
92333
92406
|
const platform2 = process.platform;
|
|
@@ -92350,6 +92423,7 @@ async function playFile(file2) {
|
|
|
92350
92423
|
await trySpawn("powershell.exe", ["-NoProfile", "-WindowStyle", "Hidden", "-Command", script]);
|
|
92351
92424
|
return;
|
|
92352
92425
|
}
|
|
92426
|
+
if (isWsl() && await tryPlayOnWindowsHost(file2)) return;
|
|
92353
92427
|
const linuxCandidates = [
|
|
92354
92428
|
{ cmd: "mpv", args: ["--really-quiet", "--no-video", file2] },
|
|
92355
92429
|
{ cmd: "ffplay", args: ["-nodisp", "-autoexit", "-loglevel", "quiet", file2] },
|
|
@@ -93219,4 +93293,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
93219
93293
|
* LICENSE file in the root directory of this source tree.
|
|
93220
93294
|
*)
|
|
93221
93295
|
*/
|
|
93222
|
-
//# sourceMappingURL=chunk-
|
|
93296
|
+
//# sourceMappingURL=chunk-2SKO3MTH.js.map
|