pinggy 0.6.10 → 0.7.0
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/ARCHITECTURE.md +36 -21
- package/CLAUDE.md +8 -5
- package/README.md +32 -4
- package/dist/{chunk-AYU3GM4D.js → chunk-2IPBK3RG.js} +173 -133
- package/dist/{chunk-3IPMFCEF.js → chunk-QUVQ7ODD.js} +1 -0
- package/dist/{chunk-G3NF35JY.js → chunk-ZSED6OIR.js} +3050 -266
- package/dist/{configStore-6LCHFPQX.js → configStore-VDPOPFLJ.js} +1 -1
- package/dist/{daemonChild-4ZZ3YQDL.js → daemonChild-5HZFQLQR.js} +3 -3
- package/dist/index.cjs +3417 -459
- package/dist/index.js +4 -4
- package/dist/{main-3D7R75PR.js → main-M4BTDE2A.js} +3 -3
- package/dist/{updateChild-ZOC3VGJL.js → updateChild-CEVYCBED.js} +1 -1
- package/package.json +2 -1
- package/scripts/install/install.ps1 +12 -10
- package/scripts/install/install.sh +21 -14
|
@@ -758,7 +758,7 @@ async function downloadAndVerify(request, dependencies = defaultDownloadDependen
|
|
|
758
758
|
|
|
759
759
|
// src/update/windowsSwap.ts
|
|
760
760
|
import fs8 from "fs";
|
|
761
|
-
import
|
|
761
|
+
import path7 from "path";
|
|
762
762
|
|
|
763
763
|
// src/daemon/lifecycle/daemonManager.ts
|
|
764
764
|
import os4 from "os";
|
|
@@ -768,11 +768,13 @@ import { spawn } from "child_process";
|
|
|
768
768
|
// src/daemon/lifecycle/serviceInstaller.ts
|
|
769
769
|
import os3 from "os";
|
|
770
770
|
import fs6 from "fs";
|
|
771
|
-
import
|
|
771
|
+
import path6 from "path";
|
|
772
772
|
import { execSync, execFileSync as execFileSync2 } from "child_process";
|
|
773
|
+
|
|
774
|
+
// src/daemon/lifecycle/servicePaths.ts
|
|
775
|
+
import path5 from "path";
|
|
773
776
|
var SERVICE_LABEL = "io.pinggy.agent";
|
|
774
777
|
var SYSTEMD_SERVICE_NAME = "pinggy";
|
|
775
|
-
var SERVICE_ANY_LOCATION_ENV = "PINGGY_SERVICE_ANY_LOCATION";
|
|
776
778
|
function installerBinaryPath(platform, home, env) {
|
|
777
779
|
if (platform === "win32") {
|
|
778
780
|
const localAppData = env.LOCALAPPDATA || path5.win32.join(home, "AppData", "Local");
|
|
@@ -780,6 +782,31 @@ function installerBinaryPath(platform, home, env) {
|
|
|
780
782
|
}
|
|
781
783
|
return path5.posix.join(home, ".pinggy", "bin", "pinggy");
|
|
782
784
|
}
|
|
785
|
+
function systemdServicePath(home) {
|
|
786
|
+
return path5.posix.join(home, ".config", "systemd", "user", `${SYSTEMD_SERVICE_NAME}.service`);
|
|
787
|
+
}
|
|
788
|
+
function launchdPlistPath(home) {
|
|
789
|
+
return path5.posix.join(home, "Library", "LaunchAgents", `${SERVICE_LABEL}.plist`);
|
|
790
|
+
}
|
|
791
|
+
function autostartFilePath(platform, home) {
|
|
792
|
+
if (platform === "linux") return systemdServicePath(home);
|
|
793
|
+
if (platform === "darwin") return launchdPlistPath(home);
|
|
794
|
+
return null;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// src/daemon/lifecycle/serviceInstaller.ts
|
|
798
|
+
var AUTOSTART_ON_COMMAND = "pinggy autostart on";
|
|
799
|
+
var AUTOSTART_OFF_COMMAND = "pinggy autostart off";
|
|
800
|
+
var SERVICE_ANY_LOCATION_ENV = "PINGGY_SERVICE_ANY_LOCATION";
|
|
801
|
+
function machineServiceInstallContext() {
|
|
802
|
+
return {
|
|
803
|
+
platform: os3.platform(),
|
|
804
|
+
isPkg: "pkg" in process,
|
|
805
|
+
execPath: process.execPath,
|
|
806
|
+
home: os3.homedir(),
|
|
807
|
+
env: process.env
|
|
808
|
+
};
|
|
809
|
+
}
|
|
783
810
|
function realPath(p) {
|
|
784
811
|
try {
|
|
785
812
|
return fs6.realpathSync(p);
|
|
@@ -809,25 +836,25 @@ function isInstallerBinary(ctx) {
|
|
|
809
836
|
}
|
|
810
837
|
function installerFix(platform) {
|
|
811
838
|
return [
|
|
812
|
-
"
|
|
839
|
+
"Autostart works only for pinggy installed with the Pinggy installer.",
|
|
813
840
|
"Install it, then run this command again:",
|
|
814
841
|
` ${installCommandFor(platform)}`,
|
|
815
|
-
|
|
842
|
+
` ${AUTOSTART_ON_COMMAND}`
|
|
816
843
|
].join("\n");
|
|
817
844
|
}
|
|
818
845
|
function npmInstallerFix(platform) {
|
|
819
846
|
return [
|
|
820
|
-
"The npm version of pinggy cannot
|
|
847
|
+
"The npm version of pinggy cannot turn on autostart.",
|
|
821
848
|
"Remove it, install pinggy with the Pinggy installer, then run this command again:",
|
|
822
849
|
` ${NPM_UNINSTALL_COMMAND}`,
|
|
823
850
|
` ${installCommandFor(platform)}`,
|
|
824
|
-
|
|
851
|
+
` ${AUTOSTART_ON_COMMAND}`
|
|
825
852
|
].join("\n");
|
|
826
853
|
}
|
|
827
854
|
function installedCopyFix(installedPath) {
|
|
828
855
|
return [
|
|
829
856
|
"This pinggy is not the installed one. Run this command with the installed copy:",
|
|
830
|
-
` ${installedPath}
|
|
857
|
+
` ${installedPath} autostart on`
|
|
831
858
|
].join("\n");
|
|
832
859
|
}
|
|
833
860
|
function serviceInstallRefusal(ctx, fileExists = fs6.existsSync) {
|
|
@@ -837,23 +864,50 @@ function serviceInstallRefusal(ctx, fileExists = fs6.existsSync) {
|
|
|
837
864
|
if (fileExists(installedPath)) return installedCopyFix(installedPath);
|
|
838
865
|
return installerFix(ctx.platform);
|
|
839
866
|
}
|
|
840
|
-
function printInstalled() {
|
|
841
|
-
printer_default.success("pinggy now starts automatically when this computer starts.");
|
|
842
|
-
}
|
|
843
|
-
function printUninstalled() {
|
|
844
|
-
printer_default.success("pinggy no longer starts automatically when this computer starts.");
|
|
845
|
-
}
|
|
846
|
-
function printNotInstalled() {
|
|
847
|
-
printer_default.print("pinggy is not set to start automatically.");
|
|
848
|
-
}
|
|
849
867
|
var QUIET = { stdio: ["ignore", "ignore", "pipe"] };
|
|
850
868
|
function toolError(err) {
|
|
851
869
|
const stderr = err.stderr?.toString().trim();
|
|
852
870
|
return stderr ? stderr.replace(/^ERROR:\s*/i, "") : errorMessage(err);
|
|
853
871
|
}
|
|
872
|
+
var NO_BOOT_ENTRY = { present: false, program: null };
|
|
873
|
+
function unescapeXml(value) {
|
|
874
|
+
return value.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/&/g, "&");
|
|
875
|
+
}
|
|
876
|
+
function bootEntryProgram(platform, text) {
|
|
877
|
+
let match = null;
|
|
878
|
+
if (platform === "linux") {
|
|
879
|
+
match = /^ExecStart=(.+) --_daemon-child\s*$/m.exec(text);
|
|
880
|
+
} else if (platform === "darwin") {
|
|
881
|
+
match = /<key>ProgramArguments<\/key>\s*<array>\s*<string>([^<]+)<\/string>/.exec(text);
|
|
882
|
+
} else if (platform === "win32") {
|
|
883
|
+
match = /<Command>([^<]+)<\/Command>/.exec(text);
|
|
884
|
+
}
|
|
885
|
+
return match ? unescapeXml(match[1].trim()) : null;
|
|
886
|
+
}
|
|
887
|
+
function sameProgram(platform, left, right) {
|
|
888
|
+
return platform === "win32" ? left.toLowerCase() === right.toLowerCase() : left === right;
|
|
889
|
+
}
|
|
890
|
+
function readBootEntry(platform = os3.platform()) {
|
|
891
|
+
if (platform === "win32") {
|
|
892
|
+
return readWindowsTask();
|
|
893
|
+
}
|
|
894
|
+
const entryPath = platform === "linux" ? getSystemdServicePath() : platform === "darwin" ? getLaunchdPlistPath() : null;
|
|
895
|
+
if (!entryPath || !fs6.existsSync(entryPath)) {
|
|
896
|
+
return NO_BOOT_ENTRY;
|
|
897
|
+
}
|
|
898
|
+
let text = "";
|
|
899
|
+
try {
|
|
900
|
+
text = fs6.readFileSync(entryPath, "utf-8");
|
|
901
|
+
} catch (err) {
|
|
902
|
+
logger.debug("Could not read the boot entry", { entryPath, error: errorMessage(err) });
|
|
903
|
+
}
|
|
904
|
+
return { present: true, program: bootEntryProgram(platform, text) };
|
|
905
|
+
}
|
|
906
|
+
function startsBeforeSignIn(platform = os3.platform()) {
|
|
907
|
+
return platform === "linux" && lingerEnabled(os3.userInfo().username);
|
|
908
|
+
}
|
|
854
909
|
function getSystemdServicePath() {
|
|
855
|
-
|
|
856
|
-
return path5.join(dir, `${SYSTEMD_SERVICE_NAME}.service`);
|
|
910
|
+
return systemdServicePath(os3.homedir());
|
|
857
911
|
}
|
|
858
912
|
function generateSystemdUnit(program) {
|
|
859
913
|
const execStart = `${program} --_daemon-child`;
|
|
@@ -874,14 +928,13 @@ WantedBy=default.target
|
|
|
874
928
|
}
|
|
875
929
|
function installSystemd(program) {
|
|
876
930
|
const servicePath = getSystemdServicePath();
|
|
877
|
-
const dir =
|
|
931
|
+
const dir = path6.dirname(servicePath);
|
|
878
932
|
fs6.mkdirSync(dir, { recursive: true });
|
|
879
933
|
fs6.writeFileSync(servicePath, generateSystemdUnit(program), "utf-8");
|
|
880
934
|
execSync("systemctl --user daemon-reload", QUIET);
|
|
881
935
|
execSync(`systemctl --user enable ${SYSTEMD_SERVICE_NAME}`, QUIET);
|
|
882
936
|
execSync(`systemctl --user start ${SYSTEMD_SERVICE_NAME}`, QUIET);
|
|
883
937
|
logger.info("systemd user service installed", { servicePath });
|
|
884
|
-
printInstalled();
|
|
885
938
|
enableLinger(os3.userInfo().username);
|
|
886
939
|
}
|
|
887
940
|
function lingerEnabled(username) {
|
|
@@ -902,27 +955,25 @@ function enableLinger(username) {
|
|
|
902
955
|
logger.info("systemd lingering enabled", { username });
|
|
903
956
|
} catch (err) {
|
|
904
957
|
logger.warn("loginctl enable-linger failed", { error: errorMessage(err) });
|
|
905
|
-
printer_default.print(`pinggy starts when ${username} signs in. To start it before anyone signs in, run: loginctl enable-linger ${username}`);
|
|
906
958
|
}
|
|
907
959
|
}
|
|
908
|
-
function
|
|
960
|
+
function removeSystemd() {
|
|
909
961
|
const servicePath = getSystemdServicePath();
|
|
910
962
|
try {
|
|
911
|
-
execSync(`systemctl --user
|
|
912
|
-
|
|
913
|
-
|
|
963
|
+
execSync(`systemctl --user disable ${SYSTEMD_SERVICE_NAME}`, QUIET);
|
|
964
|
+
} catch (err) {
|
|
965
|
+
logger.debug("systemctl disable failed", { error: toolError(err) });
|
|
914
966
|
}
|
|
915
|
-
|
|
916
|
-
|
|
967
|
+
fs6.rmSync(servicePath, { force: true });
|
|
968
|
+
try {
|
|
917
969
|
execSync("systemctl --user daemon-reload", QUIET);
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
} else {
|
|
921
|
-
printNotInstalled();
|
|
970
|
+
} catch (err) {
|
|
971
|
+
logger.debug("systemctl daemon-reload failed", { error: toolError(err) });
|
|
922
972
|
}
|
|
973
|
+
logger.info("systemd user service removed", { servicePath });
|
|
923
974
|
}
|
|
924
975
|
function getLaunchdPlistPath() {
|
|
925
|
-
return
|
|
976
|
+
return launchdPlistPath(os3.homedir());
|
|
926
977
|
}
|
|
927
978
|
function generateLaunchdPlist(program) {
|
|
928
979
|
const allArgs = [program, "--_daemon-child"];
|
|
@@ -946,48 +997,45 @@ ${programArgs}
|
|
|
946
997
|
</plist>
|
|
947
998
|
`;
|
|
948
999
|
}
|
|
1000
|
+
function launchdUid() {
|
|
1001
|
+
return process.getuid?.() ?? 501;
|
|
1002
|
+
}
|
|
1003
|
+
function launchdJobLoaded(uid) {
|
|
1004
|
+
try {
|
|
1005
|
+
execFileSync2("launchctl", ["print", `gui/${uid}/${SERVICE_LABEL}`], QUIET);
|
|
1006
|
+
return true;
|
|
1007
|
+
} catch {
|
|
1008
|
+
return false;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
949
1011
|
function installLaunchd(program) {
|
|
950
1012
|
const plistPath = getLaunchdPlistPath();
|
|
951
|
-
const dir =
|
|
1013
|
+
const dir = path6.dirname(plistPath);
|
|
952
1014
|
fs6.mkdirSync(dir, { recursive: true });
|
|
953
1015
|
fs6.writeFileSync(plistPath, generateLaunchdPlist(program), "utf-8");
|
|
954
|
-
const uid =
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1016
|
+
const uid = launchdUid();
|
|
1017
|
+
if (launchdJobLoaded(uid)) {
|
|
1018
|
+
try {
|
|
1019
|
+
execFileSync2("launchctl", ["kickstart", `gui/${uid}/${SERVICE_LABEL}`], QUIET);
|
|
1020
|
+
} catch (err) {
|
|
1021
|
+
logger.debug("launchctl kickstart failed", { error: toolError(err) });
|
|
1022
|
+
}
|
|
1023
|
+
} else {
|
|
1024
|
+
loadLaunchdPlist(uid, plistPath);
|
|
958
1025
|
}
|
|
959
|
-
loadLaunchdPlist(uid, plistPath);
|
|
960
1026
|
logger.info("launchd agent installed", { plistPath });
|
|
961
|
-
printInstalled();
|
|
962
1027
|
}
|
|
963
1028
|
function loadLaunchdPlist(uid, plistPath) {
|
|
964
1029
|
try {
|
|
965
|
-
|
|
1030
|
+
execFileSync2("launchctl", ["bootstrap", `gui/${uid}`, plistPath], QUIET);
|
|
966
1031
|
} catch {
|
|
967
|
-
|
|
968
|
-
execSync(`launchctl load -w ${plistPath}`);
|
|
969
|
-
} catch {
|
|
970
|
-
}
|
|
1032
|
+
execFileSync2("launchctl", ["load", "-w", plistPath], QUIET);
|
|
971
1033
|
}
|
|
972
1034
|
}
|
|
973
|
-
function
|
|
1035
|
+
function removeLaunchd() {
|
|
974
1036
|
const plistPath = getLaunchdPlistPath();
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
execSync(`launchctl bootout gui/${uid}/${SERVICE_LABEL} 2>/dev/null || true`);
|
|
978
|
-
} catch {
|
|
979
|
-
try {
|
|
980
|
-
execSync(`launchctl unload ${plistPath} 2>/dev/null || true`);
|
|
981
|
-
} catch {
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
if (fs6.existsSync(plistPath)) {
|
|
985
|
-
fs6.unlinkSync(plistPath);
|
|
986
|
-
logger.info("launchd agent removed", { plistPath });
|
|
987
|
-
printUninstalled();
|
|
988
|
-
} else {
|
|
989
|
-
printNotInstalled();
|
|
990
|
-
}
|
|
1037
|
+
fs6.rmSync(plistPath, { force: true });
|
|
1038
|
+
logger.info("launchd agent removed", { plistPath });
|
|
991
1039
|
}
|
|
992
1040
|
var WINDOWS_TASK_NAME = "PinggyDaemon";
|
|
993
1041
|
function escapeXml(value) {
|
|
@@ -1036,7 +1084,7 @@ function generateTaskXml(program, userId) {
|
|
|
1036
1084
|
}
|
|
1037
1085
|
function createWindowsTask(program) {
|
|
1038
1086
|
const xml = generateTaskXml(program, getWindowsUserId());
|
|
1039
|
-
const tmpPath =
|
|
1087
|
+
const tmpPath = path6.join(os3.tmpdir(), `${WINDOWS_TASK_NAME}.xml`);
|
|
1040
1088
|
fs6.writeFileSync(tmpPath, "\uFEFF" + xml, "utf16le");
|
|
1041
1089
|
try {
|
|
1042
1090
|
execFileSync2("schtasks", ["/Create", "/TN", WINDOWS_TASK_NAME, "/XML", tmpPath, "/F"], QUIET);
|
|
@@ -1055,6 +1103,18 @@ function windowsTaskExists() {
|
|
|
1055
1103
|
return false;
|
|
1056
1104
|
}
|
|
1057
1105
|
}
|
|
1106
|
+
function readWindowsTask() {
|
|
1107
|
+
try {
|
|
1108
|
+
const xml = execFileSync2("schtasks", ["/Query", "/TN", WINDOWS_TASK_NAME, "/XML"], {
|
|
1109
|
+
encoding: "utf-8",
|
|
1110
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
1111
|
+
windowsHide: true
|
|
1112
|
+
});
|
|
1113
|
+
return { present: true, program: bootEntryProgram("win32", xml) };
|
|
1114
|
+
} catch {
|
|
1115
|
+
return NO_BOOT_ENTRY;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1058
1118
|
function isElevated() {
|
|
1059
1119
|
try {
|
|
1060
1120
|
return /S-1-16-(12288|16384)\b/.test(execFileSync2("whoami", ["/groups"], { encoding: "utf-8" }));
|
|
@@ -1073,29 +1133,17 @@ function installWindows(program) {
|
|
|
1073
1133
|
createWindowsTask(program);
|
|
1074
1134
|
execFileSync2("schtasks", ["/Run", "/TN", WINDOWS_TASK_NAME], QUIET);
|
|
1075
1135
|
} catch (err) {
|
|
1076
|
-
|
|
1077
|
-
process.exit(1);
|
|
1136
|
+
throw new Error(windowsTaskError("turn on autostart", "change it", err));
|
|
1078
1137
|
}
|
|
1079
1138
|
logger.info("Scheduled task installed", { task: WINDOWS_TASK_NAME });
|
|
1080
|
-
printInstalled();
|
|
1081
1139
|
}
|
|
1082
|
-
|
|
1083
|
-
if (!windowsTaskExists()) {
|
|
1084
|
-
printNotInstalled();
|
|
1085
|
-
return;
|
|
1086
|
-
}
|
|
1140
|
+
function removeWindows() {
|
|
1087
1141
|
try {
|
|
1088
1142
|
execFileSync2("schtasks", ["/Delete", "/TN", WINDOWS_TASK_NAME, "/F"], QUIET);
|
|
1089
1143
|
} catch (err) {
|
|
1090
|
-
|
|
1091
|
-
process.exit(1);
|
|
1144
|
+
throw new Error(windowsTaskError("turn off autostart", "turn it off", err));
|
|
1092
1145
|
}
|
|
1093
1146
|
logger.info("Scheduled task removed", { task: WINDOWS_TASK_NAME });
|
|
1094
|
-
if (isDaemonRunning()) {
|
|
1095
|
-
const result = await stopDaemon();
|
|
1096
|
-
if (!result.ok) console.log(`Could not stop the daemon: ${result.error}`);
|
|
1097
|
-
}
|
|
1098
|
-
printUninstalled();
|
|
1099
1147
|
}
|
|
1100
1148
|
function readServiceEntryText() {
|
|
1101
1149
|
const platform = os3.platform();
|
|
@@ -1126,51 +1174,34 @@ function serviceRestartInstruction(info, platform = os3.platform(), query = runS
|
|
|
1126
1174
|
}
|
|
1127
1175
|
return null;
|
|
1128
1176
|
}
|
|
1129
|
-
function
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
}
|
|
1143
|
-
const program = serviceProgramPath(context);
|
|
1144
|
-
switch (platform) {
|
|
1145
|
-
case "linux":
|
|
1146
|
-
installSystemd(program);
|
|
1147
|
-
break;
|
|
1148
|
-
case "darwin":
|
|
1149
|
-
installLaunchd(program);
|
|
1150
|
-
break;
|
|
1151
|
-
case "win32":
|
|
1152
|
-
installWindows(program);
|
|
1153
|
-
break;
|
|
1154
|
-
default:
|
|
1155
|
-
console.error(`Unsupported platform: ${platform}`);
|
|
1156
|
-
process.exit(1);
|
|
1177
|
+
function installBootEntry(program, platform = os3.platform()) {
|
|
1178
|
+
if (platform === "win32") {
|
|
1179
|
+
installWindows(program);
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
if (platform !== "linux" && platform !== "darwin") {
|
|
1183
|
+
throw new Error(`Autostart is not supported on ${platform}.`);
|
|
1184
|
+
}
|
|
1185
|
+
try {
|
|
1186
|
+
if (platform === "linux") installSystemd(program);
|
|
1187
|
+
else installLaunchd(program);
|
|
1188
|
+
} catch (err) {
|
|
1189
|
+
throw new Error(`Could not turn on autostart: ${toolError(err)}`);
|
|
1157
1190
|
}
|
|
1158
1191
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
console.error(`Unsupported platform: ${platform}`);
|
|
1173
|
-
process.exit(1);
|
|
1192
|
+
function removeBootEntry(platform = os3.platform()) {
|
|
1193
|
+
if (platform === "win32") {
|
|
1194
|
+
removeWindows();
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
if (platform !== "linux" && platform !== "darwin") {
|
|
1198
|
+
throw new Error(`Autostart is not supported on ${platform}.`);
|
|
1199
|
+
}
|
|
1200
|
+
try {
|
|
1201
|
+
if (platform === "linux") removeSystemd();
|
|
1202
|
+
else removeLaunchd();
|
|
1203
|
+
} catch (err) {
|
|
1204
|
+
throw new Error(`Could not turn off autostart: ${toolError(err)}`);
|
|
1174
1205
|
}
|
|
1175
1206
|
}
|
|
1176
1207
|
|
|
@@ -1309,7 +1340,7 @@ async function ensureDaemonRunning() {
|
|
|
1309
1340
|
return info;
|
|
1310
1341
|
}
|
|
1311
1342
|
if (process.versions.electron) {
|
|
1312
|
-
const { runDaemonChild } = await import("./daemonChild-
|
|
1343
|
+
const { runDaemonChild } = await import("./daemonChild-5HZFQLQR.js");
|
|
1313
1344
|
const handle = await runDaemonChild({
|
|
1314
1345
|
installSignalHandlers: false,
|
|
1315
1346
|
exitOnFailure: false,
|
|
@@ -1423,7 +1454,7 @@ async function waitForExit(pid, timeoutMs) {
|
|
|
1423
1454
|
}
|
|
1424
1455
|
|
|
1425
1456
|
// src/update/windowsSwap.ts
|
|
1426
|
-
var WINDOWS_PATH =
|
|
1457
|
+
var WINDOWS_PATH = path7.win32;
|
|
1427
1458
|
var BACKUP_MARKER = ".prev";
|
|
1428
1459
|
var NEW_FILE_SUFFIX = ".new.exe";
|
|
1429
1460
|
var OLD_FILE_SUFFIX = ".old";
|
|
@@ -1654,7 +1685,7 @@ function releaseUpdateLock() {
|
|
|
1654
1685
|
|
|
1655
1686
|
// src/update/unixLinkSwap.ts
|
|
1656
1687
|
import fs10 from "fs";
|
|
1657
|
-
import
|
|
1688
|
+
import path8 from "path";
|
|
1658
1689
|
var BINARY_NAME = "pinggy";
|
|
1659
1690
|
var DOWNLOAD_PREFIX = "pinggy.download.";
|
|
1660
1691
|
var CONVERT_PREFIX = "pinggy.convert.";
|
|
@@ -1676,17 +1707,17 @@ var realUnixSwapEnvironment = {
|
|
|
1676
1707
|
isAlive: isProcessAlive
|
|
1677
1708
|
};
|
|
1678
1709
|
function unixDownloadPath(layout) {
|
|
1679
|
-
return
|
|
1710
|
+
return path8.posix.join(layout.versionsDirectory, `${DOWNLOAD_PREFIX}${process.pid}`);
|
|
1680
1711
|
}
|
|
1681
1712
|
function versionDirectory(layout, version) {
|
|
1682
|
-
return
|
|
1713
|
+
return path8.posix.join(layout.versionsDirectory, version);
|
|
1683
1714
|
}
|
|
1684
1715
|
function versionBinaryPath(layout, version) {
|
|
1685
|
-
return
|
|
1716
|
+
return path8.posix.join(versionDirectory(layout, version), BINARY_NAME);
|
|
1686
1717
|
}
|
|
1687
1718
|
function readLinkVersion(layout) {
|
|
1688
1719
|
try {
|
|
1689
|
-
const version =
|
|
1720
|
+
const version = path8.posix.basename(path8.posix.dirname(fs10.readlinkSync(layout.link)));
|
|
1690
1721
|
return parseVersion(version) ? version : null;
|
|
1691
1722
|
} catch {
|
|
1692
1723
|
return null;
|
|
@@ -1701,14 +1732,14 @@ function highestVersionBelow(layout, ceiling) {
|
|
|
1701
1732
|
}
|
|
1702
1733
|
function moveLink(layout, version, environment) {
|
|
1703
1734
|
fs10.mkdirSync(layout.binDirectory, { recursive: true });
|
|
1704
|
-
const temporaryLink =
|
|
1735
|
+
const temporaryLink = path8.posix.join(layout.binDirectory, `${LINK_TEMP_PREFIX}${process.pid}`);
|
|
1705
1736
|
fs10.rmSync(temporaryLink, { force: true });
|
|
1706
1737
|
fs10.symlinkSync(versionBinaryPath(layout, version), temporaryLink);
|
|
1707
1738
|
fs10.renameSync(temporaryLink, layout.link);
|
|
1708
1739
|
environment.fsyncDirectory(layout.binDirectory);
|
|
1709
1740
|
}
|
|
1710
1741
|
function convertPlainFile(layout, execPath, runningVersion, environment) {
|
|
1711
|
-
const temporaryPath =
|
|
1742
|
+
const temporaryPath = path8.posix.join(layout.versionsDirectory, `${CONVERT_PREFIX}${process.pid}`);
|
|
1712
1743
|
fs10.copyFileSync(execPath, temporaryPath);
|
|
1713
1744
|
fs10.chmodSync(temporaryPath, EXECUTABLE_MODE3);
|
|
1714
1745
|
environment.fsyncFile(temporaryPath);
|
|
@@ -1723,7 +1754,7 @@ function removeDeadProcessTemp(directory, prefix, environment) {
|
|
|
1723
1754
|
for (const name of fs10.readdirSync(directory)) {
|
|
1724
1755
|
const pidText = name.startsWith(prefix) ? name.slice(prefix.length) : "";
|
|
1725
1756
|
if (/^\d+$/.test(pidText) && !environment.isAlive(Number(pidText))) {
|
|
1726
|
-
fs10.rmSync(
|
|
1757
|
+
fs10.rmSync(path8.posix.join(directory, name), { force: true });
|
|
1727
1758
|
}
|
|
1728
1759
|
}
|
|
1729
1760
|
}
|
|
@@ -1885,8 +1916,17 @@ export {
|
|
|
1885
1916
|
installCommandFor,
|
|
1886
1917
|
createInstallProbe,
|
|
1887
1918
|
installerBinaryPath,
|
|
1888
|
-
|
|
1889
|
-
|
|
1919
|
+
autostartFilePath,
|
|
1920
|
+
AUTOSTART_ON_COMMAND,
|
|
1921
|
+
AUTOSTART_OFF_COMMAND,
|
|
1922
|
+
machineServiceInstallContext,
|
|
1923
|
+
serviceProgramPath,
|
|
1924
|
+
serviceInstallRefusal,
|
|
1925
|
+
sameProgram,
|
|
1926
|
+
readBootEntry,
|
|
1927
|
+
startsBeforeSignIn,
|
|
1928
|
+
installBootEntry,
|
|
1929
|
+
removeBootEntry,
|
|
1890
1930
|
currentBootId,
|
|
1891
1931
|
startedInEarlierBoot,
|
|
1892
1932
|
resolveLatestTag,
|
|
@@ -37,6 +37,7 @@ var Subcommand = {
|
|
|
37
37
|
Restart: "restart",
|
|
38
38
|
Device: "device",
|
|
39
39
|
Update: "update",
|
|
40
|
+
Autostart: "autostart",
|
|
40
41
|
// The old spelling, refused with a hint. As a subcommand it never reaches tunnel mode, where `--token` is the
|
|
41
42
|
// tunnel token and a device token would go to the tunnel server.
|
|
42
43
|
Devices: "devices"
|