Skip to content

Build your personal knowledge base with Trilium Notes

feat(options/security): add instructions for server

Elian Doran6baa090b3fd2
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index b13e8e15f0..0e4ea08bc7 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1577,7 +1577,10 @@
"sql_console_title": "SQL console",
"sql_console_section_description": "The SQL console allows running raw SQL queries against the database. This can be used to read sensitive data (e.g. sync secrets, API keys) and alter or delete any data. A malicious frontend script could also access the SQL console API programmatically.",
"sql_console_label": "SQL console",
- "sql_console_description": "Allow execution of queries in the SQL console."
+ "sql_console_description": "Allow execution of queries in the SQL console.",
+ "how_to_enable": "How to enable",
+ "server_config_hint": "Add the following to your config.ini file:",
+ "server_env_hint": "Or set the following environment variable:"
},
"password": {
"heading": "Password",
diff --git a/apps/client/src/widgets/type_widgets/options/security.tsx b/apps/client/src/widgets/type_widgets/options/security.tsx
index 064b2b2c99..499135037b 100644
--- a/apps/client/src/widgets/type_widgets/options/security.tsx
+++ b/apps/client/src/widgets/type_widgets/options/security.tsx
@@ -1,4 +1,6 @@
import { t } from "../../../services/i18n";
+import { isElectron } from "../../../services/utils";
+import Collapsible from "../../react/Collapsible";
import { OptionsRowWithToggle } from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
@@ -11,6 +13,21 @@ export default function SecuritySettings() {
);
}
+function ServerConfigHint({ configKey, envVar }: { configKey: string; envVar: string }) {
+ if (isElectron()) {
+ return null;
+ }
+
+ return (
+ <Collapsible title={t("security.how_to_enable")}>
+ <p>{t("security.server_config_hint")}</p>
+ <pre><code>{`[Scripting]\n${configKey}=true`}</code></pre>
+ <p>{t("security.server_env_hint")}</p>
+ <pre><code>{envVar}=true</code></pre>
+ </Collapsible>
+ );
+}
+
function BackendScriptingSettings() {
// Read-only for now — the actual toggle mechanism (IPC + native
// dialog on desktop, config.ini on server) will be implemented separately.
@@ -30,6 +47,10 @@ function BackendScriptingSettings() {
onChange={() => {}}
disabled={true}
/>
+ <ServerConfigHint
+ configKey="backendScriptingEnabled"
+ envVar="TRILIUM_SCRIPTING_BACKEND_ENABLED"
+ />
</OptionsSection>
);
}
@@ -51,6 +72,10 @@ function SqlConsoleSettings() {
onChange={() => {}}
disabled={true}
/>
+ <ServerConfigHint
+ configKey="sqlConsoleEnabled"
+ envVar="TRILIUM_SCRIPTING_SQLCONSOLEENABLED"
+ />
</OptionsSection>
);
}