From 2ec2d784ec8f6f6f4fda00d9aef32b7b264885d8 Mon Sep 17 00:00:00 2001 From: Matt Wilkie Date: Mon, 17 Feb 2025 13:19:55 -0700 Subject: [PATCH] results of `npx prettier` --- .../widgets/type_widgets/content_widget.ts | 1 - .../options/other/share_settings.ts | 28 +++++++++---------- src/services/auth.ts | 2 +- src/services/options_init.ts | 4 +-- src/share/routes.ts | 4 +-- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/public/app/widgets/type_widgets/content_widget.ts b/src/public/app/widgets/type_widgets/content_widget.ts index e7a0533ff..5bd577fd2 100644 --- a/src/public/app/widgets/type_widgets/content_widget.ts +++ b/src/public/app/widgets/type_widgets/content_widget.ts @@ -85,7 +85,6 @@ const CONTENT_WIDGETS: Record = { }; export default class ContentWidgetTypeWidget extends TypeWidget { - private $content!: JQuery; static getType() { diff --git a/src/public/app/widgets/type_widgets/options/other/share_settings.ts b/src/public/app/widgets/type_widgets/options/other/share_settings.ts index d7743c63c..9c7cd1b2d 100644 --- a/src/public/app/widgets/type_widgets/options/other/share_settings.ts +++ b/src/public/app/widgets/type_widgets/options/other/share_settings.ts @@ -5,22 +5,22 @@ import type { OptionMap, OptionNames } from "../../../../../../services/options_ const TPL = `
-

${t('Share Settings')}

+

${t("Share Settings")}

-

${t('When enabled, accessing the root URL will redirect to the Share page instead of Login')}

+

${t("When enabled, accessing the root URL will redirect to the Share page instead of Login")}

-

${t('Add a login link to the Share page footer')}

+

${t("Add a login link to the Share page footer")}

`; @@ -30,22 +30,20 @@ export default class ShareSettingsOptions extends OptionsWidget { this.contentSized(); // Add change handlers for both checkboxes - this.$widget.find('input[type="checkbox"]').on('change', () => this.save()); + this.$widget.find('input[type="checkbox"]').on("change", () => this.save()); } async optionsLoaded(options: OptionMap) { - this.$widget.find('input[name="redirectBareDomain"]').prop('checked', - options.redirectBareDomain === 'true'); - - this.$widget.find('input[name="showLoginInShareTheme"]').prop('checked', - options.showLoginInShareTheme === 'true'); + this.$widget.find('input[name="redirectBareDomain"]').prop("checked", options.redirectBareDomain === "true"); + + this.$widget.find('input[name="showLoginInShareTheme"]').prop("checked", options.showLoginInShareTheme === "true"); } async save() { - const redirectBareDomain = this.$widget.find('input[name="redirectBareDomain"]').prop('checked'); - await this.updateOption<'redirectBareDomain'>('redirectBareDomain', redirectBareDomain.toString()); + const redirectBareDomain = this.$widget.find('input[name="redirectBareDomain"]').prop("checked"); + await this.updateOption<"redirectBareDomain">("redirectBareDomain", redirectBareDomain.toString()); - const showLoginInShareTheme = this.$widget.find('input[name="showLoginInShareTheme"]').prop('checked'); - await this.updateOption<'showLoginInShareTheme'>('showLoginInShareTheme', showLoginInShareTheme.toString()); + const showLoginInShareTheme = this.$widget.find('input[name="showLoginInShareTheme"]').prop("checked"); + await this.updateOption<"showLoginInShareTheme">("showLoginInShareTheme", showLoginInShareTheme.toString()); } } diff --git a/src/services/auth.ts b/src/services/auth.ts index 5ba56e426..68c497b91 100644 --- a/src/services/auth.ts +++ b/src/services/auth.ts @@ -16,7 +16,7 @@ function checkAuth(req: Request, res: Response, next: NextFunction) { if (!sqlInit.isDbInitialized()) { res.redirect("setup"); } else if (!req.session.loggedIn && !isElectron && !noAuthentication) { - const redirectToShare = options.getOption('redirectBareDomain') === 'true'; + const redirectToShare = options.getOption("redirectBareDomain") === "true"; res.redirect(redirectToShare ? "share" : "login"); } else { next(); diff --git a/src/services/options_init.ts b/src/services/options_init.ts index 0c738a759..da81abc90 100644 --- a/src/services/options_init.ts +++ b/src/services/options_init.ts @@ -255,8 +255,8 @@ const defaultOptions: DefaultOption[] = [ }, // Share settings - { name: 'redirectBareDomain', value: 'false', isSynced: true }, - { name: 'showLoginInShareTheme', value: 'false', isSynced: true } + { 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 ae2b5d414..3b6258872 100644 --- a/src/share/routes.ts +++ b/src/share/routes.ts @@ -16,7 +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 options from '../services/options.js'; +import options from "../services/options.js"; function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } { if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) { @@ -152,7 +152,7 @@ function register(router: Router) { const { header, content, isEmpty } = contentRenderer.getContent(note); const subRoot = getSharedSubTreeRoot(note); - const showLoginInShareTheme = options.getOption('showLoginInShareTheme'); + const showLoginInShareTheme = options.getOption("showLoginInShareTheme"); const opts = { note, header, content, isEmpty, subRoot, assetPath, appPath, showLoginInShareTheme }; let useDefaultView = true;