mirror of
https://github.com/zadam/trilium.git
synced 2026-04-05 03:29:06 +02:00
feat(setup): display network addresses on browser as well
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user