chore(prettier): fix all files

This commit is contained in:
Elian Doran
2025-01-09 18:07:02 +02:00
parent 19ee861699
commit 4cbb529fd4
571 changed files with 23226 additions and 23940 deletions

View File

@@ -11,18 +11,16 @@ import protectedSessionService from "../services/protected_session.js";
import packageJson from "../../package.json" with { type: "json" };
import assetPath from "../services/asset_path.js";
import appPath from "../services/app_path.js";
import { Request, Response } from 'express';
import { Request, Response } from "express";
import BNote from "../becca/entities/bnote.js";
function index(req: Request, res: Response) {
const options = optionService.getOptionMap();
const view = (!utils.isElectron() && req.cookies['trilium-device'] === 'mobile')
? 'mobile'
: 'desktop';
const view = !utils.isElectron() && req.cookies["trilium-device"] === "mobile" ? "mobile" : "desktop";
const csrfToken = req.csrfToken();
log.info(`Generated CSRF token ${csrfToken} with secret ${res.getHeader('set-cookie')}`);
log.info(`Generated CSRF token ${csrfToken} with secret ${res.getHeader("set-cookie")}`);
// We force the page to not be cached since on mobile the CSRF token can be
// broken when closing the browser and coming back in to the page.
@@ -30,7 +28,7 @@ function index(req: Request, res: Response) {
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
const theme = options.theme;
const themeNote = attributeService.getNoteWithLabel('appTheme', theme);
const themeNote = attributeService.getNoteWithLabel("appTheme", theme);
const isElectron = utils.isElectron();
res.render(view, {
@@ -42,8 +40,8 @@ function index(req: Request, res: Response) {
layoutOrientation: options.layoutOrientation,
platform: process.platform,
isElectron,
hasNativeTitleBar: (isElectron && options.nativeTitleBarVisible === "true"),
hasBackgroundEffects: (isElectron && options.backgroundEffects === "true"),
hasNativeTitleBar: isElectron && options.nativeTitleBarVisible === "true",
hasBackgroundEffects: isElectron && options.backgroundEffects === "true",
mainFontSize: parseInt(options.mainFontSize),
treeFontSize: parseInt(options.treeFontSize),
detailFontSize: parseInt(options.detailFontSize),
@@ -52,7 +50,7 @@ function index(req: Request, res: Response) {
instanceName: config.General ? config.General.instanceName : null,
appCssNoteIds: getAppCssNoteIds(),
isDev: env.isDev(),
isMainWindow: (view === "mobile") ? true : !req.query.extraWindow,
isMainWindow: view === "mobile" ? true : !req.query.extraWindow,
isProtectedSessionAvailable: protectedSessionService.isProtectedSessionAvailable(),
maxContentWidth: Math.max(640, parseInt(options.maxContentWidth)),
triliumVersion: packageJson.version,
@@ -62,12 +60,12 @@ function index(req: Request, res: Response) {
}
function getThemeCssUrl(theme: string, themeNote: BNote | null) {
if (theme === 'auto') {
if (theme === "auto") {
return `${assetPath}/stylesheets/theme.css`;
} else if (theme === 'light') {
} else if (theme === "light") {
// light theme is always loaded as baseline
return false;
} else if (theme === 'dark') {
} else if (theme === "dark") {
return `${assetPath}/stylesheets/theme-dark.css`;
} else if (theme === "next") {
return `${assetPath}/stylesheets/theme-next.css`;
@@ -84,7 +82,7 @@ function getThemeCssUrl(theme: string, themeNote: BNote | null) {
}
function getAppCssNoteIds() {
return attributeService.getNotesWithLabel('appCss').map(note => note.noteId);
return attributeService.getNotesWithLabel("appCss").map((note) => note.noteId);
}
export default {