brought over changes from 879035d

The last known good state before I got sidetracked into docker changes
This commit is contained in:
matt wilkie 2025-02-16 21:29:38 -07:00
parent 152f3193d1
commit 7af4e52766
5 changed files with 17 additions and 4 deletions

View File

@ -35,6 +35,7 @@ import RibbonOptions from "./options/appearance/ribbon.js";
import LocalizationOptions from "./options/appearance/i18n.js"; import LocalizationOptions from "./options/appearance/i18n.js";
import CodeBlockOptions from "./options/appearance/code_block.js"; import CodeBlockOptions from "./options/appearance/code_block.js";
import EditorOptions from "./options/text_notes/editor.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 FNote from "../../entities/fnote.js";
import type NoteContextAwareWidget from "../note_context_aware_widget.js"; import type NoteContextAwareWidget from "../note_context_aware_widget.js";
@ -76,7 +77,8 @@ const CONTENT_WIDGETS: Record<string, (typeof NoteContextAwareWidget)[]> = {
RevisionsSnapshotIntervalOptions, RevisionsSnapshotIntervalOptions,
RevisionSnapshotsLimitOptions, RevisionSnapshotsLimitOptions,
NetworkConnectionsOptions, NetworkConnectionsOptions,
HtmlImportTagsOptions HtmlImportTagsOptions,
ShareSettingsOptions // moved to the end of the array
], ],
_optionsAdvanced: [DatabaseIntegrityCheckOptions, DatabaseAnonymizationOptions, AdvancedSyncOptions, VacuumDatabaseOptions], _optionsAdvanced: [DatabaseIntegrityCheckOptions, DatabaseAnonymizationOptions, AdvancedSyncOptions, VacuumDatabaseOptions],
_backendLog: [BackendLogWidget] _backendLog: [BackendLogWidget]

View File

@ -15,7 +15,7 @@ function checkAuth(req: Request, res: Response, next: NextFunction) {
if (!sqlInit.isDbInitialized()) { if (!sqlInit.isDbInitialized()) {
res.redirect("setup"); res.redirect("setup");
} else if (!req.session.loggedIn && !isElectron && !noAuthentication) { } else if (!req.session.loggedIn && !isElectron && !noAuthentication) {
res.redirect("login"); res.redirect("share");
} else { } else {
next(); next();
} }

View File

@ -252,7 +252,11 @@ const defaultOptions: DefaultOption[] = [
"tt" "tt"
]), ]),
isSynced: true isSynced: true
} },
// Share settings
{ name: 'redirectBareDomain', value: 'false', isSynced: true },
{ name: 'showLoginInShareTheme', value: 'false', isSynced: true }
]; ];
/** /**

View File

@ -16,6 +16,7 @@ import type SNote from "./shaca/entities/snote.js";
import type SBranch from "./shaca/entities/sbranch.js"; import type SBranch from "./shaca/entities/sbranch.js";
import type SAttachment from "./shaca/entities/sattachment.js"; import type SAttachment from "./shaca/entities/sattachment.js";
import utils from "../services/utils.js"; import utils from "../services/utils.js";
import optionService from '../services/option_service.js';
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } { function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) { if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
@ -151,7 +152,8 @@ function register(router: Router) {
const { header, content, isEmpty } = contentRenderer.getContent(note); const { header, content, isEmpty } = contentRenderer.getContent(note);
const subRoot = getSharedSubTreeRoot(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; let useDefaultView = true;
// Check if the user has their own template // Check if the user has their own template

View File

@ -88,5 +88,10 @@
</nav> </nav>
<% } %> <% } %>
</div> </div>
<footer>
<% if (showLoginInShareTheme === 'true') { %>
<p><a href="/login" class="login-link">Login</a></p>
<% } %>
</footer>
</body> </body>
</html> </html>