Skip to content

Build your personal knowledge base with Trilium Notes

feat(setup): display network addresses on browser as well

Elian Dorandb6f034cb589
diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsx
index 0473c8eba8..02e6a3d299 100644
--- a/apps/client/src/setup.tsx
+++ b/apps/client/src/setup.tsx
@@ -369,14 +369,14 @@ function SyncFromDesktop({ setState }: { setState: (state: State) => void }) {
<CardSection>1. {t("setup.sync-from-desktop-step1")}</CardSection>
<CardSection>2. {t("setup.sync-from-desktop-step2")}</CardSection>
<CardSection>3. {t("setup.sync-from-desktop-step3")}</CardSection>
- <CardSection>4. {t("setup.sync-from-desktop-step4", { protocol: location.protocol, port: location.port })}</CardSection>
+ <CardSection>4. {t("setup.sync-from-desktop-step4")}</CardSection>
<CardSection>5. {t("setup.sync-from-desktop-step5")}</CardSection>
</Card>
{networkAddresses.length > 0 && (
<Card heading={t("setup.your-ip-addresses")} className="ip-addresses">
{networkAddresses.map((addr) => (
- <CardSection key={addr}>{`${location.protocol}//${addr}:${location.port}`}</CardSection>
+ <CardSection key={addr}>{addr}</CardSection>
))}
</Card>
)}
@@ -471,7 +471,7 @@ function SetupPage({ title, description, className, illustration, children, foot
function getNetworkAddresses(): string[] {
if (!isElectron()) {
- return [];
+ return [`${location.protocol}//${location.host}`];
}
// eslint-disable-next-line @typescript-eslint/no-require-imports
@@ -491,7 +491,7 @@ function getNetworkAddresses(): string[] {
// Sort by likelihood of being the local network address.
addresses.sort((a, b) => networkScore(a) - networkScore(b));
- return addresses;
+ return addresses.map((addr) => `${location.protocol}//${addr}:${location.port}`);
}
function networkScore(addr: string): number {
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 2c8528d486..6afd867eae 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2264,8 +2264,8 @@
"sync-from-desktop-step1": "Open your desktop instance of Trilium Notes.",
"sync-from-desktop-step2": "From the Trilium Menu, click Options.",
"sync-from-desktop-step3": "Click on Sync category in the note tree.",
- "sync-from-desktop-step4": "Change server instance address to point to this device: \"{{protocol}}//<hostname>:{{- port}}\" and click Save.",
- "sync-from-desktop-step5": "Click \"Test sync\" button to verify connection is successful.",
+ "sync-from-desktop-step4": "Change server instance address to point to one of the addresses on the right and click Save.",
+ "sync-from-desktop-step5": "Click the \"Test sync\" button to verify connection is successful.",
"sync-from-desktop-warning": "Make sure both devices are on the same network.",
"sync-from-desktop-waiting": "Waiting for connection...",
"advanced-options": "Advanced options",