Skip to content

Build your personal knowledge base with Trilium Notes

fix(desktop): repair typecheck and review nits for LAN access

Elian Dorandbaf47e6a764
diff --git a/apps/client/src/widgets/type_widgets/options/security.tsx b/apps/client/src/widgets/type_widgets/options/security.tsx
index ae123fd3f3..84f2a34f86 100644
--- a/apps/client/src/widgets/type_widgets/options/security.tsx
+++ b/apps/client/src/widgets/type_widgets/options/security.tsx
@@ -164,7 +164,7 @@ function LanAccessSettings({ liveValue, pendingValue, setPendingValue }: ToggleS
const hasPendingChange = pendingValue !== null && pendingValue !== liveValue;
async function handleToggle(enabled: boolean) {
- const confirmed = await window.electronApi!.security.setLanAccessEnabled(enabled);
+ const confirmed = await window.electronApi?.security.setLanAccessEnabled(enabled);
if (confirmed) {
setPendingValue(enabled === liveValue ? null : enabled);
}
diff --git a/apps/server/src/routes/api/system_info.spec.ts b/apps/server/src/routes/api/system_info.spec.ts
index ac51925072..814652a5f3 100644
--- a/apps/server/src/routes/api/system_info.spec.ts
+++ b/apps/server/src/routes/api/system_info.spec.ts
@@ -74,6 +74,7 @@ describe("System info API", () => {
{ address: "203.0.113.5", internal: false, family: "IPv4" },
{ address: "192.168.1.20", internal: false, family: "IPv4" },
{ address: "10.0.0.4", internal: false, family: "IPv4" },
+ { address: "172.16.0.9", internal: false, family: "IPv4" },
{ address: "fe80::1", internal: false, family: "IPv6", scopeid: 4 },
{ address: "fd00::1", internal: false, family: "IPv6", scopeid: 0 }
]
@@ -82,6 +83,7 @@ describe("System info API", () => {
expect(collectNetworkAddresses(interfaces)).toEqual([
"192.168.1.20", // 192.168.* ranks first
"10.0.0.4", // then 10.*
+ "172.16.0.9", // then 172.16–31.* private range
"203.0.113.5", // then other IPv4
"fd00::1" // IPv6 last; fe80::1 dropped (scopeid !== 0)
]);
diff --git a/packages/trilium-core/src/services/scripting_guard.spec.ts b/packages/trilium-core/src/services/scripting_guard.spec.ts
index 5f1900cd16..98dc5d1d85 100644
--- a/packages/trilium-core/src/services/scripting_guard.spec.ts
+++ b/packages/trilium-core/src/services/scripting_guard.spec.ts
@@ -17,6 +17,7 @@ function withSecurity(security: Partial<CoreConfig["Security"]>) {
Security: {
backendScriptingEnabled: false,
sqlConsoleEnabled: false,
+ allowLanAccess: false,
...security
}
});