@hienlh/ppm 0.7.34 → 0.7.35
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/cli/commands/cloud.ts +20 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -89,7 +89,26 @@ export function registerCloudCommands(program: Command): void {
|
|
|
89
89
|
console.log(` ✓ Machine linked`);
|
|
90
90
|
console.log(` Name: ${device.name}`);
|
|
91
91
|
console.log(` ID: ${device.device_id}`);
|
|
92
|
-
|
|
92
|
+
|
|
93
|
+
// Auto-detect running tunnel and start heartbeat immediately
|
|
94
|
+
try {
|
|
95
|
+
const { resolve } = await import("node:path");
|
|
96
|
+
const { homedir } = await import("node:os");
|
|
97
|
+
const { existsSync, readFileSync } = await import("node:fs");
|
|
98
|
+
const statusFile = resolve(homedir(), ".ppm", "status.json");
|
|
99
|
+
if (existsSync(statusFile)) {
|
|
100
|
+
const status = JSON.parse(readFileSync(statusFile, "utf-8"));
|
|
101
|
+
if (status.shareUrl) {
|
|
102
|
+
const { sendHeartbeat } = await import("../../services/cloud.service.ts");
|
|
103
|
+
const ok = await sendHeartbeat(status.shareUrl);
|
|
104
|
+
if (ok) {
|
|
105
|
+
console.log(`\n ➜ Cloud: synced tunnel URL (${status.shareUrl})`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch { /* non-blocking */ }
|
|
110
|
+
|
|
111
|
+
console.log();
|
|
93
112
|
} catch (err: unknown) {
|
|
94
113
|
const msg = err instanceof Error ? err.message : String(err);
|
|
95
114
|
console.error(` ✗ Link failed: ${msg}\n`);
|