@walldock/agent 0.2.2 → 0.2.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/dist/main.js +12 -6
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -73,9 +73,11 @@ function log(msg) {
|
|
|
73
73
|
// ─── Main ─────────────────────────────────────────────────────────────────────
|
|
74
74
|
async function main() {
|
|
75
75
|
const args = process.argv.slice(2);
|
|
76
|
-
// --unlink: remove stored credentials and startup entry
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
// --unlink / --relink: remove stored credentials and startup entry
|
|
77
|
+
// --relink also falls through to the pairing flow below
|
|
78
|
+
if (args.includes('--unlink') || args.includes('--relink')) {
|
|
79
|
+
const isRelink = args.includes('--relink');
|
|
80
|
+
// Kill any running background instance first
|
|
79
81
|
const bgPid = await (0, pid_1.runningPid)();
|
|
80
82
|
if (bgPid) {
|
|
81
83
|
try {
|
|
@@ -92,8 +94,11 @@ async function main() {
|
|
|
92
94
|
await storage.deleteDeviceToken();
|
|
93
95
|
await storage.clearDeviceIdentity();
|
|
94
96
|
await (0, startup_1.unregisterStartup)().catch(() => undefined);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
if (!isRelink) {
|
|
98
|
+
console.log('Device unlinked and startup entry removed.');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
console.log('Device unlinked. Starting pairing…\n');
|
|
97
102
|
}
|
|
98
103
|
// --status: print current link status
|
|
99
104
|
if (args.includes('--status')) {
|
|
@@ -204,7 +209,8 @@ async function main() {
|
|
|
204
209
|
await storage.setDeviceIdentity({ deviceId: existing.deviceId, deviceName: existing.deviceName });
|
|
205
210
|
log(`Linked as "${existing.deviceName}". Starting sync…`);
|
|
206
211
|
if (await maybeStartTray()) {
|
|
207
|
-
console.log(
|
|
212
|
+
console.log(`Walldock Agent is running in the system tray (linked as "${existing.deviceName}").`);
|
|
213
|
+
console.log('To re-link this device: walldock-agent --unlink');
|
|
208
214
|
process.exit(0);
|
|
209
215
|
}
|
|
210
216
|
sync.start({ token: existing.token, deviceId: existing.deviceId });
|