Skip to content

Build your personal knowledge base with Trilium Notes

brought over changes from 879035d

matt wilkie7af4e5276607
diff --git a/src/public/app/widgets/type_widgets/content_widget.ts b/src/public/app/widgets/type_widgets/content_widget.ts
index 1f19e2b81b..d2ea5a9710 100644
--- a/src/public/app/widgets/type_widgets/content_widget.ts
+++ b/src/public/app/widgets/type_widgets/content_widget.ts
@@ -35,6 +35,7 @@ import RibbonOptions from "./options/appearance/ribbon.js";
import LocalizationOptions from "./options/appearance/i18n.js";
import CodeBlockOptions from "./options/appearance/code_block.js";
import EditorOptions from "./options/text_notes/editor.js";
+import ShareSettingsOptions from "./options/other/share_settings.js"; // added import statement
import type FNote from "../../entities/fnote.js";
import type NoteContextAwareWidget from "../note_context_aware_widget.js";
@@ -76,7 +77,8 @@ const CONTENT_WIDGETS: Record<string, (typeof NoteContextAwareWidget)[]> = {
RevisionsSnapshotIntervalOptions,
RevisionSnapshotsLimitOptions,
NetworkConnectionsOptions,
- HtmlImportTagsOptions
+ HtmlImportTagsOptions,
+ ShareSettingsOptions // moved to the end of the array
],
_optionsAdvanced: [DatabaseIntegrityCheckOptions, DatabaseAnonymizationOptions, AdvancedSyncOptions, VacuumDatabaseOptions],
_backendLog: [BackendLogWidget]
diff --git a/src/services/auth.ts b/src/services/auth.ts
index 3e8957100b..d89fad6335 100644
--- a/src/services/auth.ts
+++ b/src/services/auth.ts
@@ -15,7 +15,7 @@ function checkAuth(req: Request, res: Response, next: NextFunction) {
if (!sqlInit.isDbInitialized()) {
res.redirect("setup");
} else if (!req.session.loggedIn && !isElectron && !noAuthentication) {
- res.redirect("login");
+ res.redirect("share");
} else {
next();
}
diff --git a/src/services/options_init.ts b/src/services/options_init.ts
index bb962835d5..0c738a7593 100644
--- a/src/services/options_init.ts
+++ b/src/services/options_init.ts
@@ -252,7 +252,11 @@ const defaultOptions: DefaultOption[] = [
"tt"
]),
isSynced: true
- }
+ },
+
+ // Share settings
+ { name: 'redirectBareDomain', value: 'false', isSynced: true },
+ { name: 'showLoginInShareTheme', value: 'false', isSynced: true }
];
/**
diff --git a/src/share/routes.ts b/src/share/routes.ts
index c77a41fc03..a1ea2ecf21 100644
--- a/src/share/routes.ts
+++ b/src/share/routes.ts
@@ -16,6 +16,7 @@ import type SNote from "./shaca/entities/snote.js";
import type SBranch from "./shaca/entities/sbranch.js";
import type SAttachment from "./shaca/entities/sattachment.js";
import utils from "../services/utils.js";
+import optionService from '../services/option_service.js';
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
@@ -151,7 +152,8 @@ function register(router: Router) {
const { header, content, isEmpty } = contentRenderer.getContent(note);
const subRoot = getSharedSubTreeRoot(note);
- const opts = { note, header, content, isEmpty, subRoot, assetPath, appPath };
+ const showLoginInShareTheme = optionService.getOption('showLoginInShareTheme');
+ const opts = { note, header, content, isEmpty, subRoot, assetPath, appPath, showLoginInShareTheme };
let useDefaultView = true;
// Check if the user has their own template
diff --git a/src/views/share/page.ejs b/src/views/share/page.ejs
index 0ff04174d2..35d01cd2c9 100644
--- a/src/views/share/page.ejs
+++ b/src/views/share/page.ejs
@@ -88,5 +88,10 @@
</nav>
<% } %>
</div>
+<footer>
+ <% if (showLoginInShareTheme === 'true') { %>
+ <p><a href="/login" class="login-link">Login</a></p>
+ <% } %>
+</footer>
</body>
</html>