herdr-remote 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/tui.mjs +35 -21
- package/herdr-plugin.toml +1 -1
- package/package.json +1 -1
package/dist/tui.mjs
CHANGED
|
@@ -3132,16 +3132,21 @@ function RelayScreen({ ctx }) {
|
|
|
3132
3132
|
{ id: "regenerate", kind: "action", label: t("relay.regenerate") }
|
|
3133
3133
|
];
|
|
3134
3134
|
const addresses = useMemo2(() => listReachableAddresses({ includeLoopback: false }), []);
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3135
|
+
const applyFields = (updates) => {
|
|
3136
|
+
let next = draft;
|
|
3137
|
+
for (const [id, value] of updates) {
|
|
3138
|
+
const result = (0, import_settings_model.setField)(next, id, value);
|
|
3139
|
+
if (result.errorKey) {
|
|
3140
|
+
ctx.notify(t(result.errorKey), "error");
|
|
3141
|
+
return false;
|
|
3142
|
+
}
|
|
3143
|
+
next = result.draft;
|
|
3140
3144
|
}
|
|
3141
|
-
ctx.updateDraft(
|
|
3145
|
+
ctx.updateDraft(next);
|
|
3142
3146
|
ctx.notify("", "info");
|
|
3143
3147
|
return true;
|
|
3144
3148
|
};
|
|
3149
|
+
const applyField = (id, value) => applyFields([[id, value]]);
|
|
3145
3150
|
const save = () => {
|
|
3146
3151
|
try {
|
|
3147
3152
|
const result = (0, import_settings_model.saveDraft)(draft);
|
|
@@ -3212,7 +3217,7 @@ function RelayScreen({ ctx }) {
|
|
|
3212
3217
|
current: draft.relay.mode === "remote" && draft.relay.remoteUrl === import_config.OFFICIAL_RELAY_URL ? "official" : draft.relay.mode,
|
|
3213
3218
|
onPick: (choice) => {
|
|
3214
3219
|
if (choice === "official") {
|
|
3215
|
-
|
|
3220
|
+
applyFields([["mode", "remote"], ["remoteUrl", import_config.OFFICIAL_RELAY_URL]]);
|
|
3216
3221
|
ctx.setEditing(null);
|
|
3217
3222
|
return;
|
|
3218
3223
|
}
|
|
@@ -3712,7 +3717,7 @@ function About({ ctx }) {
|
|
|
3712
3717
|
children: updateLabel
|
|
3713
3718
|
}
|
|
3714
3719
|
) }),
|
|
3715
|
-
/* @__PURE__ */ jsx10(Row, { label: t("about.version"), children: /* @__PURE__ */ jsx10(Text9, { color: theme.muted, children: "0.2.
|
|
3720
|
+
/* @__PURE__ */ jsx10(Row, { label: t("about.version"), children: /* @__PURE__ */ jsx10(Text9, { color: theme.muted, children: "0.2.3" }) }),
|
|
3716
3721
|
/* @__PURE__ */ jsx10(Row, { label: t("about.configPath"), children: /* @__PURE__ */ jsx10(Text9, { color: theme.muted, children: (0, import_config.configPath)() }) }),
|
|
3717
3722
|
/* @__PURE__ */ jsx10(Row, { label: t("about.statePath"), children: /* @__PURE__ */ jsx10(Text9, { color: theme.muted, children: (0, import_config.stateDir)() }) }),
|
|
3718
3723
|
/* @__PURE__ */ jsx10(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text9, { color: theme.muted, children: t("about.docs") }) }),
|
|
@@ -3724,10 +3729,10 @@ function About({ ctx }) {
|
|
|
3724
3729
|
import { useMemo as useMemo3, useState as useState9 } from "react";
|
|
3725
3730
|
import { Box as Box10, Text as Text10, useInput as useInput8 } from "ink";
|
|
3726
3731
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3727
|
-
function stepsFor(mode) {
|
|
3732
|
+
function stepsFor(mode, remoteUrl) {
|
|
3728
3733
|
const steps = ["language", "access"];
|
|
3729
3734
|
if (mode === "lan") steps.push("address");
|
|
3730
|
-
if (mode === "remote") steps.push("relayUrl", "password");
|
|
3735
|
+
if (mode === "remote" && remoteUrl !== import_config.OFFICIAL_RELAY_URL) steps.push("relayUrl", "password");
|
|
3731
3736
|
steps.push("finish");
|
|
3732
3737
|
return steps;
|
|
3733
3738
|
}
|
|
@@ -3742,18 +3747,26 @@ function Wizard({ ctx, onDone }) {
|
|
|
3742
3747
|
() => listReachableAddresses({ includeLoopback: false }),
|
|
3743
3748
|
[]
|
|
3744
3749
|
);
|
|
3745
|
-
const steps = useMemo3(
|
|
3750
|
+
const steps = useMemo3(
|
|
3751
|
+
() => stepsFor(draft.relay.mode, draft.relay.remoteUrl),
|
|
3752
|
+
[draft.relay.mode, draft.relay.remoteUrl]
|
|
3753
|
+
);
|
|
3746
3754
|
const stepIndex = Math.max(0, steps.indexOf(step));
|
|
3747
|
-
const
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3755
|
+
const applyAll = (updates) => {
|
|
3756
|
+
let next = draft;
|
|
3757
|
+
for (const [id, value] of updates) {
|
|
3758
|
+
const result = (0, import_settings_model.setField)(next, id, value);
|
|
3759
|
+
if (result.errorKey) {
|
|
3760
|
+
ctx.notify(t(result.errorKey), "error");
|
|
3761
|
+
return false;
|
|
3762
|
+
}
|
|
3763
|
+
next = result.draft;
|
|
3752
3764
|
}
|
|
3753
|
-
ctx.updateDraft(
|
|
3765
|
+
ctx.updateDraft(next);
|
|
3754
3766
|
ctx.notify("", "info");
|
|
3755
3767
|
return true;
|
|
3756
3768
|
};
|
|
3769
|
+
const apply = (id, value) => applyAll([[id, value]]);
|
|
3757
3770
|
const advance = (from, order = steps) => {
|
|
3758
3771
|
const index = order.indexOf(from);
|
|
3759
3772
|
setStep(order[Math.min(order.length - 1, index + 1)]);
|
|
@@ -3838,13 +3851,14 @@ function Wizard({ ctx, onDone }) {
|
|
|
3838
3851
|
current: draft.relay.mode === "remote" && draft.relay.remoteUrl === import_config.OFFICIAL_RELAY_URL ? "official" : draft.relay.mode,
|
|
3839
3852
|
onPick: (choice) => {
|
|
3840
3853
|
if (choice === "official") {
|
|
3841
|
-
if (!
|
|
3842
|
-
if (!apply("remoteUrl", import_config.OFFICIAL_RELAY_URL)) return;
|
|
3854
|
+
if (!applyAll([["mode", "remote"], ["remoteUrl", import_config.OFFICIAL_RELAY_URL]])) return;
|
|
3843
3855
|
(0, import_service.setRelayPassword)("");
|
|
3844
|
-
advance("access",
|
|
3856
|
+
advance("access", stepsFor("remote", import_config.OFFICIAL_RELAY_URL));
|
|
3845
3857
|
return;
|
|
3846
3858
|
}
|
|
3847
|
-
if (apply("mode", choice))
|
|
3859
|
+
if (apply("mode", choice)) {
|
|
3860
|
+
advance("access", stepsFor(choice, draft.relay.remoteUrl));
|
|
3861
|
+
}
|
|
3848
3862
|
},
|
|
3849
3863
|
onCancel: back
|
|
3850
3864
|
}
|
package/herdr-plugin.toml
CHANGED
package/package.json
CHANGED