@orangeworks/orangetree 0.4.2 → 0.4.4
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 +12 -0
- package/dist/public/i18n.js +3 -3
- package/dist/server.js +41 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @orangeworks/orangetree
|
|
2
2
|
|
|
3
|
+
## 0.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fc66b51: Fix the automatic restart after pairing crashing on Windows. In 0.4.3 the app relaunched itself to finish connecting, but the restarted process exited instead of coming back — leaving the app down and the cloud "Open" failing. The relaunched app now survives and connects reliably (its output goes to a log file under the data folder).
|
|
8
|
+
|
|
9
|
+
## 0.4.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7a30bbb: Pairing a PC from the app now makes it reachable from the cloud right away. Previously, pairing a freshly launched app left it unreachable — opening it from the cloud dashboard showed a 404 — until the app was manually restarted. The app now relaunches itself automatically to finish connecting.
|
|
14
|
+
|
|
3
15
|
## 0.4.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/public/i18n.js
CHANGED
|
@@ -34,7 +34,7 @@ const ko = {
|
|
|
34
34
|
"pair.provisioning": "PC\uB97C \uC900\uBE44\uD558\uB294 \uC911",
|
|
35
35
|
"pair.paired.title": "\uC5F0\uACB0 \uC644\uB8CC!",
|
|
36
36
|
"pair.paired.url": "\uC811\uC18D \uC8FC\uC18C",
|
|
37
|
-
"pair.paired.restart": "\
|
|
37
|
+
"pair.paired.restart": "\uD074\uB77C\uC6B0\uB4DC \uC5F0\uACB0\uC744 \uC801\uC6A9\uD558\uB824\uACE0 \uC571\uC744 \uB2E4\uC2DC \uC2DC\uC791\uD558\uB294 \uC911\uC785\uB2C8\uB2E4. \uC7A0\uC2DC \uD6C4 \uB300\uC2DC\uBCF4\uB4DC\uC758 \u201C\uC5F0\uACB0 PC\u201D\uC5D0\uC11C \uC5F4\uC5B4 \uC8FC\uC138\uC694.",
|
|
38
38
|
"pair.retry": "\uB2E4\uC2DC \uC2DC\uB3C4",
|
|
39
39
|
"pair.start.fail": "\uC5F0\uACB0\uC744 \uC2DC\uC791\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.",
|
|
40
40
|
"pair.failed.denied": "\uC2B9\uC778\uC774 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
|
|
@@ -338,7 +338,7 @@ const en = {
|
|
|
338
338
|
"pair.provisioning": "Preparing your PC",
|
|
339
339
|
"pair.paired.title": "Connected!",
|
|
340
340
|
"pair.paired.url": "Access URL",
|
|
341
|
-
"pair.paired.restart": "
|
|
341
|
+
"pair.paired.restart": "Restarting the app to apply the cloud connection \u2014 open this PC from the dashboard in a moment.",
|
|
342
342
|
"pair.retry": "Try again",
|
|
343
343
|
"pair.start.fail": "Could not start the connection.",
|
|
344
344
|
"pair.failed.denied": "The request was denied.",
|
|
@@ -638,7 +638,7 @@ const ja = {
|
|
|
638
638
|
"pair.provisioning": "PC\u3092\u6E96\u5099\u4E2D",
|
|
639
639
|
"pair.paired.title": "\u63A5\u7D9A\u5B8C\u4E86\uFF01",
|
|
640
640
|
"pair.paired.url": "\u30A2\u30AF\u30BB\u30B9URL",
|
|
641
|
-
"pair.paired.restart": "\
|
|
641
|
+
"pair.paired.restart": "\u30AF\u30E9\u30A6\u30C9\u63A5\u7D9A\u3092\u9069\u7528\u3059\u308B\u305F\u3081\u306B\u30A2\u30D7\u30EA\u3092\u518D\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059\u3002\u5C11\u3057\u5F85\u3063\u3066\u304B\u3089\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u3067\u3053\u306EPC\u3092\u958B\u3044\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
642
642
|
"pair.retry": "\u518D\u8A66\u884C",
|
|
643
643
|
"pair.start.fail": "\u63A5\u7D9A\u3092\u958B\u59CB\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",
|
|
644
644
|
"pair.failed.denied": "\u627F\u8A8D\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\u3002",
|
package/dist/server.js
CHANGED
|
@@ -8,7 +8,8 @@ var __export = (target, all) => {
|
|
|
8
8
|
import { createServer as createServer2 } from "node:http";
|
|
9
9
|
import { readFile, readdir, writeFile, mkdir as mkdir2 } from "node:fs/promises";
|
|
10
10
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
11
|
-
import {
|
|
11
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
12
|
+
import { existsSync as existsSync9, readFileSync as readFileSync4, openSync } from "node:fs";
|
|
12
13
|
import { homedir as homedir3 } from "node:os";
|
|
13
14
|
import { join as join9, extname, normalize as normalize5, basename as basename3, dirname as dirname6, relative as relative3, isAbsolute as isAbsolute3, sep as sep2 } from "node:path";
|
|
14
15
|
import { fileURLToPath } from "node:url";
|
|
@@ -17548,7 +17549,7 @@ var PairingManager = class {
|
|
|
17548
17549
|
if (this.gen !== gen) return;
|
|
17549
17550
|
const exchanged = await exchangeOnboardingToken(this.cloudBase, onboardingToken);
|
|
17550
17551
|
if (this.gen !== gen) return;
|
|
17551
|
-
await this.onPaired({
|
|
17552
|
+
const needsRestart = await this.onPaired({
|
|
17552
17553
|
credentials: exchanged.credentials,
|
|
17553
17554
|
otreeToken: exchanged.otreeToken,
|
|
17554
17555
|
recordId: pc.recordId,
|
|
@@ -17556,7 +17557,7 @@ var PairingManager = class {
|
|
|
17556
17557
|
});
|
|
17557
17558
|
if (this.gen !== gen) return;
|
|
17558
17559
|
this.sessionToken = null;
|
|
17559
|
-
this.state = { phase: "paired", accessUrl: pc.accessUrl, needsRestart
|
|
17560
|
+
this.state = { phase: "paired", accessUrl: pc.accessUrl, needsRestart };
|
|
17560
17561
|
} catch (err) {
|
|
17561
17562
|
if (this.gen !== gen) return;
|
|
17562
17563
|
this.sessionToken = null;
|
|
@@ -17862,6 +17863,37 @@ async function startNewt(upstreamPort) {
|
|
|
17862
17863
|
newtStarting = false;
|
|
17863
17864
|
}
|
|
17864
17865
|
}
|
|
17866
|
+
var relaunching = false;
|
|
17867
|
+
function relaunch() {
|
|
17868
|
+
if (relaunching) return;
|
|
17869
|
+
relaunching = true;
|
|
17870
|
+
console.log("[pair] config changed \u2014 relaunching to apply cloud remote mode.");
|
|
17871
|
+
let spawned = false;
|
|
17872
|
+
const spawnChild = () => {
|
|
17873
|
+
if (spawned) return;
|
|
17874
|
+
spawned = true;
|
|
17875
|
+
const env = { ...process.env };
|
|
17876
|
+
for (const k of ["OTREE_ROOT", "OTREE_REMOTE_AUTH", "OTREE_CLOUD_API", "OTREE_BIND", "OTREE_OPEN"]) {
|
|
17877
|
+
delete env[k];
|
|
17878
|
+
}
|
|
17879
|
+
env.OTREE_PORT = String(resolvedPort || PORT);
|
|
17880
|
+
let stdio = "ignore";
|
|
17881
|
+
try {
|
|
17882
|
+
const logFd = openSync(join9(appData.root, "relaunch.log"), "a");
|
|
17883
|
+
stdio = ["ignore", logFd, logFd];
|
|
17884
|
+
} catch {
|
|
17885
|
+
}
|
|
17886
|
+
const child = spawn2(process.execPath, process.argv.slice(1), { detached: true, stdio, windowsHide: true, env });
|
|
17887
|
+
child.unref();
|
|
17888
|
+
setTimeout(() => process.exit(0), 100);
|
|
17889
|
+
};
|
|
17890
|
+
void (newtManager?.stop() ?? Promise.resolve()).finally(() => {
|
|
17891
|
+
newtManager = null;
|
|
17892
|
+
server.close(spawnChild);
|
|
17893
|
+
server.closeAllConnections();
|
|
17894
|
+
setTimeout(spawnChild, 2e3).unref();
|
|
17895
|
+
});
|
|
17896
|
+
}
|
|
17865
17897
|
function cloudApiBase() {
|
|
17866
17898
|
const v = process.env.OTREE_CLOUD_API?.trim();
|
|
17867
17899
|
return v && /^https?:\/\//i.test(v) ? v : null;
|
|
@@ -17891,6 +17923,11 @@ async function onPaired(r) {
|
|
|
17891
17923
|
workRoot,
|
|
17892
17924
|
pairing: { onboardingToken: null, consumedAt: Date.now() }
|
|
17893
17925
|
});
|
|
17926
|
+
const needsRestart = !remoteSession || pairingCloudBase() !== remoteCfg.cloudApiBase;
|
|
17927
|
+
if (needsRestart) {
|
|
17928
|
+
setTimeout(() => relaunch(), 2500);
|
|
17929
|
+
return true;
|
|
17930
|
+
}
|
|
17894
17931
|
if (remoteCfg.mode === "remote") {
|
|
17895
17932
|
if (r.otreeToken && !remoteCfg.tokenRequired) {
|
|
17896
17933
|
remoteCfg.token = r.otreeToken;
|
|
@@ -17902,6 +17939,7 @@ async function onPaired(r) {
|
|
|
17902
17939
|
}
|
|
17903
17940
|
void startNewt(resolvedPort);
|
|
17904
17941
|
}
|
|
17942
|
+
return false;
|
|
17905
17943
|
}
|
|
17906
17944
|
var pairingManager = new PairingManager(
|
|
17907
17945
|
pairingCloudBase(),
|
package/package.json
CHANGED