@opencrater/sdk 0.8.54 → 0.8.56
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.
Potentially problematic release.
This version of @opencrater/sdk might be problematic. Click here for more details.
- package/dist/hook.js +8 -6
- package/dist/paint.js +8 -7
- package/package.json +1 -1
package/dist/hook.js
CHANGED
|
@@ -783,12 +783,14 @@ function windowsCardShowing(displayMs) {
|
|
|
783
783
|
try {
|
|
784
784
|
const lockPath = path3__namespace.join(os2__namespace.homedir(), ".config", "opencrater", "painter.lock");
|
|
785
785
|
const lock = JSON.parse(fs3__namespace.readFileSync(lockPath, "utf8"));
|
|
786
|
-
if (typeof lock.
|
|
787
|
-
if (Date.now() - lock.startedAt > displayMs +
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
786
|
+
if (typeof lock.startedAt !== "number") return false;
|
|
787
|
+
if (Date.now() - lock.startedAt > displayMs + 1500) return false;
|
|
788
|
+
if (typeof lock.pid === "number") {
|
|
789
|
+
try {
|
|
790
|
+
process.kill(lock.pid, 0);
|
|
791
|
+
} catch (err) {
|
|
792
|
+
if (err.code === "ESRCH") return false;
|
|
793
|
+
}
|
|
792
794
|
}
|
|
793
795
|
return true;
|
|
794
796
|
} catch {
|
package/dist/paint.js
CHANGED
|
@@ -430,7 +430,7 @@ function spawnWindowsConsoleSink() {
|
|
|
430
430
|
function wmiSpawnDetached(cmdLine) {
|
|
431
431
|
try {
|
|
432
432
|
const esc = cmdLine.replace(/'/g, "''");
|
|
433
|
-
const ps = `$ErrorActionPreference='Stop';try{$su=
|
|
433
|
+
const ps = `$ErrorActionPreference='Stop';try{$su=([wmiclass]'Win32_ProcessStartup').CreateInstance();$su.CreateFlags=[uint32]134217728;$r=([wmiclass]'Win32_Process').Create('${esc}',$null,$su);if($r.ReturnValue -eq 0){[Console]::Out.Write('OCPID '+$r.ProcessId)}else{[Console]::Out.Write('OCERR rv='+$r.ReturnValue)}}catch{[Console]::Out.Write('OCERR '+$_.Exception.Message)}`;
|
|
434
434
|
const b64 = Buffer.from(ps, "utf16le").toString("base64");
|
|
435
435
|
const res = child_process.spawnSync(
|
|
436
436
|
powershellPath(),
|
|
@@ -1124,6 +1124,7 @@ function main() {
|
|
|
1124
1124
|
let dismissServer = null;
|
|
1125
1125
|
let dismissServerUrl = null;
|
|
1126
1126
|
const cleanup = (wipe) => {
|
|
1127
|
+
pdebug("cleanup wipe=" + wipe + " elapsed=" + (Date.now() - painterStartedAt) + "ms");
|
|
1127
1128
|
if (interval) clearInterval(interval);
|
|
1128
1129
|
if (dismissPoll) clearInterval(dismissPoll);
|
|
1129
1130
|
if (activityWatch) clearInterval(activityWatch);
|
|
@@ -1473,7 +1474,7 @@ function main() {
|
|
|
1473
1474
|
paint();
|
|
1474
1475
|
interval = setInterval(paint, animated ? ANIM_MS : REPAINT_MS);
|
|
1475
1476
|
startActivityWatch();
|
|
1476
|
-
setTimeout(() => cleanup(), duration2);
|
|
1477
|
+
setTimeout(() => cleanup(true), duration2);
|
|
1477
1478
|
return;
|
|
1478
1479
|
}
|
|
1479
1480
|
const ownerPid = real?.pid ?? 0;
|
|
@@ -1628,11 +1629,11 @@ function main() {
|
|
|
1628
1629
|
if (payload.audioUrl && format !== "audio") void upgradeAudio(payload.audioUrl);
|
|
1629
1630
|
const duration = payload.durationMs ?? (format === "video" ? 18e3 : format === "audio" ? 16e3 : DEFAULT_DURATION_MS);
|
|
1630
1631
|
deadlineAt = Date.now() + duration;
|
|
1631
|
-
setTimeout(() => cleanup(), duration);
|
|
1632
|
-
process.on("SIGTERM", () => cleanup());
|
|
1633
|
-
process.on("SIGINT", () => cleanup());
|
|
1634
|
-
process.on("SIGHUP", () => cleanup());
|
|
1635
|
-
setTimeout(() => cleanup(), duration + 5e3).unref?.();
|
|
1632
|
+
setTimeout(() => cleanup(true), duration);
|
|
1633
|
+
process.on("SIGTERM", () => cleanup(true));
|
|
1634
|
+
process.on("SIGINT", () => cleanup(true));
|
|
1635
|
+
process.on("SIGHUP", () => cleanup(true));
|
|
1636
|
+
setTimeout(() => cleanup(true), duration + 5e3).unref?.();
|
|
1636
1637
|
}
|
|
1637
1638
|
if (typeof __require !== "undefined" && typeof module !== "undefined" && __require.main === module) {
|
|
1638
1639
|
main();
|