Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
docs(standalone): name the right identifier, say what the port is rather than what it is not
Elian Doran19c491cc6119
diff --git a/apps/client/src/widgets/type_widgets/options/security.tsx b/apps/client/src/widgets/type_widgets/options/security.tsxindex 68575e94cd..995ebfe795 100644--- a/apps/client/src/widgets/type_widgets/options/security.tsx+++ b/apps/client/src/widgets/type_widgets/options/security.tsx@@ -62,13 +62,9 @@ export default function SecuritySettings() {}/**- * Whether this build can change the settings from here.- *- * Both platforms that can keep them outside the database can: the desktop in its data directory,- * standalone in an OPFS file its database worker holds the lock on. A server reads them from- * `config.ini`, and a standalone tab that does not own the database has no worker to write through- * — the tab that does is where the toggle works. Elsewhere the toggle shows the state and- * `ServerConfigHint` says where to change it.+ * Whether this build can change the settings from here: the desktop, which writes its data+ * directory, and the standalone tab that owns the worker holding the OPFS file's lock. Everywhere+ * else the toggle shows the state and `WhereToEnableHint` says where to change it.*/function canToggle(): boolean {return isElectron() || (isStandalone && !!window.standaloneApi?.security);diff --git a/apps/standalone/src/local-bridge.ts b/apps/standalone/src/local-bridge.tsindex a874690717..af813f9dae 100644--- a/apps/standalone/src/local-bridge.ts+++ b/apps/standalone/src/local-bridge.ts@@ -105,9 +105,9 @@ const securityChanges = new Map<string, (written: boolean) => void>();const SECURITY_CHANGE_TIMEOUT_MS = 30_000;/**- * The one channel a security setting can be written over, entangled with the worker at startup.- * Not `self.onmessage`, which backend scripts can call: they run through `eval()` in the worker's- * realm, which reaches its globals but not another module's bindings.+ * The private channel a security setting is written over, entangled with the worker at startup.+ * Module scope is what makes it trustworthy: backend scripts run through `eval()` in the worker's+ * realm, which reaches its globals, `self.onmessage` among them, but no module's bindings.*/let securityPort: MessagePort | null = null;diff --git a/apps/standalone/src/local-server-worker.ts b/apps/standalone/src/local-server-worker.tsindex cc661e56ac..d5daacce65 100644--- a/apps/standalone/src/local-server-worker.ts+++ b/apps/standalone/src/local-server-worker.ts@@ -107,9 +107,9 @@ let messagingProvider: InstanceType<typeof WorkerMessagingProvider> | null = nullet securityStore: import('./lightweight/security_settings').SecuritySettingsStore | null = null;/**- * The page's end of the security channel, taken from the INIT message. Not `self.onmessage`, which- * backend scripts can call: they run through `eval()` in this worker's realm, which reaches its- * globals but not another module's bindings.+ * The page's end of that channel, taken from the INIT message. Module scope is what makes it+ * trustworthy: backend scripts run through `eval()` in this worker's realm, which reaches its+ * globals, `self.onmessage` among them, but no module's bindings.*/let securityPort: MessagePort | null = null;