mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-28 18:42:28 +08:00
results of npx prettier
This commit is contained in:
parent
ed8b8e50a4
commit
2ec2d784ec
@ -85,7 +85,6 @@ const CONTENT_WIDGETS: Record<string, (typeof NoteContextAwareWidget)[]> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default class ContentWidgetTypeWidget extends TypeWidget {
|
export default class ContentWidgetTypeWidget extends TypeWidget {
|
||||||
|
|
||||||
private $content!: JQuery<HTMLElement>;
|
private $content!: JQuery<HTMLElement>;
|
||||||
|
|
||||||
static getType() {
|
static getType() {
|
||||||
|
@ -5,22 +5,22 @@ import type { OptionMap, OptionNames } from "../../../../../../services/options_
|
|||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4>${t('Share Settings')}</h4>
|
<h4>${t("Share Settings")}</h4>
|
||||||
|
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
<input class="form-check-input" type="checkbox" name="redirectBareDomain" value="true">
|
<input class="form-check-input" type="checkbox" name="redirectBareDomain" value="true">
|
||||||
${t('Redirect bare domain to Share page')}
|
${t("Redirect bare domain to Share page")}
|
||||||
</label>
|
</label>
|
||||||
<p class="form-text">${t('When enabled, accessing the root URL will redirect to the Share page instead of Login')}</p>
|
<p class="form-text">${t("When enabled, accessing the root URL will redirect to the Share page instead of Login")}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
<input class="form-check-input" type="checkbox" name="showLoginInShareTheme" value="true">
|
<input class="form-check-input" type="checkbox" name="showLoginInShareTheme" value="true">
|
||||||
${t('Show Login link in Share theme')}
|
${t("Show Login link in Share theme")}
|
||||||
</label>
|
</label>
|
||||||
<p class="form-text">${t('Add a login link to the Share page footer')}</p>
|
<p class="form-text">${t("Add a login link to the Share page footer")}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
@ -30,22 +30,20 @@ export default class ShareSettingsOptions extends OptionsWidget {
|
|||||||
this.contentSized();
|
this.contentSized();
|
||||||
|
|
||||||
// Add change handlers for both checkboxes
|
// 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) {
|
async optionsLoaded(options: OptionMap) {
|
||||||
this.$widget.find('input[name="redirectBareDomain"]').prop('checked',
|
this.$widget.find('input[name="redirectBareDomain"]').prop("checked", options.redirectBareDomain === "true");
|
||||||
options.redirectBareDomain === 'true');
|
|
||||||
|
this.$widget.find('input[name="showLoginInShareTheme"]').prop("checked", options.showLoginInShareTheme === "true");
|
||||||
this.$widget.find('input[name="showLoginInShareTheme"]').prop('checked',
|
|
||||||
options.showLoginInShareTheme === 'true');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
const redirectBareDomain = this.$widget.find('input[name="redirectBareDomain"]').prop('checked');
|
const redirectBareDomain = this.$widget.find('input[name="redirectBareDomain"]').prop("checked");
|
||||||
await this.updateOption<'redirectBareDomain'>('redirectBareDomain', redirectBareDomain.toString());
|
await this.updateOption<"redirectBareDomain">("redirectBareDomain", redirectBareDomain.toString());
|
||||||
|
|
||||||
const showLoginInShareTheme = this.$widget.find('input[name="showLoginInShareTheme"]').prop('checked');
|
const showLoginInShareTheme = this.$widget.find('input[name="showLoginInShareTheme"]').prop("checked");
|
||||||
await this.updateOption<'showLoginInShareTheme'>('showLoginInShareTheme', showLoginInShareTheme.toString());
|
await this.updateOption<"showLoginInShareTheme">("showLoginInShareTheme", showLoginInShareTheme.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,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) {
|
||||||
const redirectToShare = options.getOption('redirectBareDomain') === 'true';
|
const redirectToShare = options.getOption("redirectBareDomain") === "true";
|
||||||
res.redirect(redirectToShare ? "share" : "login");
|
res.redirect(redirectToShare ? "share" : "login");
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
@ -255,8 +255,8 @@ const defaultOptions: DefaultOption[] = [
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Share settings
|
// Share settings
|
||||||
{ name: 'redirectBareDomain', value: 'false', isSynced: true },
|
{ name: "redirectBareDomain", value: "false", isSynced: true },
|
||||||
{ name: 'showLoginInShareTheme', value: 'false', isSynced: true }
|
{ name: "showLoginInShareTheme", value: "false", isSynced: true }
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +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 options from '../services/options.js';
|
import options from "../services/options.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) {
|
||||||
@ -152,7 +152,7 @@ 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 showLoginInShareTheme = options.getOption('showLoginInShareTheme');
|
const showLoginInShareTheme = options.getOption("showLoginInShareTheme");
|
||||||
const opts = { note, header, content, isEmpty, subRoot, assetPath, appPath, showLoginInShareTheme };
|
const opts = { note, header, content, isEmpty, subRoot, assetPath, appPath, showLoginInShareTheme };
|
||||||
let useDefaultView = true;
|
let useDefaultView = true;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user