relay-companion 0.1.611 → 0.1.613
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.
|
@@ -63,8 +63,44 @@ function preferredMacElectronExecutable(electronPath, { existsSync = fs.existsSy
|
|
|
63
63
|
return electronPath;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
// Background Task Management also keys a legacy agent on the PATH at
|
|
67
|
+
// ProgramArguments[0]: a new path is a new item, and macOS posts "Relay can run
|
|
68
|
+
// in the background" again. The pill's path named its release folder, so every
|
|
69
|
+
// update re-posted the notice. Measured in a macOS 26 VM (2026-10-08): a new
|
|
70
|
+
// path posts it; the same path re-pointed at a differently signed binary, or
|
|
71
|
+
// with different later arguments, does not. The pill therefore launches
|
|
72
|
+
// through one link, ~/.relay/runtime/Relay.app, that each install re-points at
|
|
73
|
+
// its own Electron bundle. Any failure falls back to the release path (the old
|
|
74
|
+
// behaviour), and a real directory at the link path is never replaced.
|
|
75
|
+
const STABLE_PILL_BUNDLE = Object.freeze([".relay", "runtime", "Relay.app"]);
|
|
76
|
+
|
|
77
|
+
function stablePillExecutable(electronExecutable, { homeDir, fsImpl = fs, pid = process.pid } = {}) {
|
|
78
|
+
const value = String(electronExecutable || "");
|
|
79
|
+
if (!homeDir || !value) return electronExecutable;
|
|
80
|
+
const bundle = path.resolve(value, "..", "..", "..");
|
|
81
|
+
if (path.extname(bundle) !== ".app" || path.basename(path.dirname(value)) !== "MacOS") return electronExecutable;
|
|
82
|
+
const link = path.join(homeDir, ...STABLE_PILL_BUNDLE);
|
|
83
|
+
try {
|
|
84
|
+
const existing = fsImpl.lstatSync(link, { throwIfNoEntry: false });
|
|
85
|
+
if (existing && !existing.isSymbolicLink()) return electronExecutable;
|
|
86
|
+
if (!existing || fsImpl.readlinkSync(link) !== bundle) {
|
|
87
|
+
fsImpl.mkdirSync(path.dirname(link), { recursive: true });
|
|
88
|
+
const temporary = `${link}.${pid}.tmp`;
|
|
89
|
+
try { fsImpl.unlinkSync(temporary); } catch {}
|
|
90
|
+
fsImpl.symlinkSync(bundle, temporary, "dir");
|
|
91
|
+
fsImpl.renameSync(temporary, link);
|
|
92
|
+
}
|
|
93
|
+
const stable = path.join(link, "Contents", "MacOS", path.basename(value));
|
|
94
|
+
return fsImpl.statSync(stable).isFile() ? stable : electronExecutable;
|
|
95
|
+
} catch {
|
|
96
|
+
return electronExecutable;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
66
100
|
module.exports = {
|
|
67
101
|
LEGACY_MAC_EXECUTABLE_NAME,
|
|
102
|
+
STABLE_PILL_BUNDLE,
|
|
103
|
+
stablePillExecutable,
|
|
68
104
|
RELAY_MAC_ASSOCIATED_BUNDLE_IDENTIFIERS,
|
|
69
105
|
RELAY_MAC_EXECUTABLE_NAME,
|
|
70
106
|
associatedBundleIdentifiersPlist,
|
package/package.json
CHANGED