mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server-ts: Convert routes/index
This commit is contained in:
parent
a18b054dbb
commit
10c21d3403
19
package-lock.json
generated
19
package-lock.json
generated
@ -91,6 +91,7 @@
|
|||||||
"@types/archiver": "^6.0.2",
|
"@types/archiver": "^6.0.2",
|
||||||
"@types/better-sqlite3": "^7.6.9",
|
"@types/better-sqlite3": "^7.6.9",
|
||||||
"@types/cls-hooked": "^4.3.8",
|
"@types/cls-hooked": "^4.3.8",
|
||||||
|
"@types/csurf": "^1.11.5",
|
||||||
"@types/escape-html": "^1.0.4",
|
"@types/escape-html": "^1.0.4",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/express-session": "^1.18.0",
|
"@types/express-session": "^1.18.0",
|
||||||
@ -1234,6 +1235,15 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/csurf": {
|
||||||
|
"version": "1.11.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/csurf/-/csurf-1.11.5.tgz",
|
||||||
|
"integrity": "sha512-5rw87+5YGixyL2W8wblSUl5DSZi5YOlXE6Awwn2ofLvqKr/1LruKffrQipeJKUX44VaxKj8m5es3vfhltJTOoA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/express-serve-static-core": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/d3-scale": {
|
"node_modules/@types/d3-scale": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz",
|
||||||
@ -14221,6 +14231,15 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/csurf": {
|
||||||
|
"version": "1.11.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/csurf/-/csurf-1.11.5.tgz",
|
||||||
|
"integrity": "sha512-5rw87+5YGixyL2W8wblSUl5DSZi5YOlXE6Awwn2ofLvqKr/1LruKffrQipeJKUX44VaxKj8m5es3vfhltJTOoA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/express-serve-static-core": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/d3-scale": {
|
"@types/d3-scale": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz",
|
||||||
|
@ -112,6 +112,7 @@
|
|||||||
"@types/archiver": "^6.0.2",
|
"@types/archiver": "^6.0.2",
|
||||||
"@types/better-sqlite3": "^7.6.9",
|
"@types/better-sqlite3": "^7.6.9",
|
||||||
"@types/cls-hooked": "^4.3.8",
|
"@types/cls-hooked": "^4.3.8",
|
||||||
|
"@types/csurf": "^1.11.5",
|
||||||
"@types/escape-html": "^1.0.4",
|
"@types/escape-html": "^1.0.4",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/express-session": "^1.18.0",
|
"@types/express-session": "^1.18.0",
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require('../services/sql');
|
import sql = require('../services/sql');
|
||||||
const attributeService = require('../services/attributes');
|
import attributeService = require('../services/attributes');
|
||||||
const config = require('../services/config');
|
import config = require('../services/config');
|
||||||
const optionService = require('../services/options');
|
import optionService = require('../services/options');
|
||||||
const log = require('../services/log');
|
import log = require('../services/log');
|
||||||
const env = require('../services/env');
|
import env = require('../services/env');
|
||||||
const utils = require('../services/utils');
|
import utils = require('../services/utils');
|
||||||
const protectedSessionService = require('../services/protected_session');
|
import protectedSessionService = require('../services/protected_session');
|
||||||
const packageJson = require('../../package.json');
|
import packageJson = require('../../package.json');
|
||||||
const assetPath = require('../services/asset_path');
|
import assetPath = require('../services/asset_path');
|
||||||
const appPath = require('../services/app_path');
|
import appPath = require('../services/app_path');
|
||||||
|
import { Request, Response } from 'express';
|
||||||
|
|
||||||
function index(req, res) {
|
function index(req: Request, res: Response) {
|
||||||
const options = optionService.getOptionMap();
|
const options = optionService.getOptionMap();
|
||||||
|
|
||||||
const view = (!utils.isElectron() && req.cookies['trilium-device'] === 'mobile')
|
const view = (!utils.isElectron() && req.cookies['trilium-device'] === 'mobile')
|
||||||
@ -43,7 +44,7 @@ function index(req, res) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getThemeCssUrl(theme) {
|
function getThemeCssUrl(theme: string) {
|
||||||
if (theme === 'light') {
|
if (theme === 'light') {
|
||||||
return false; // light theme is always loaded as baseline
|
return false; // light theme is always loaded as baseline
|
||||||
} else if (theme === 'dark') {
|
} else if (theme === 'dark') {
|
||||||
@ -63,6 +64,6 @@ function getAppCssNoteIds() {
|
|||||||
return attributeService.getNotesWithLabel('appCss').map(note => note.noteId);
|
return attributeService.getNotesWithLabel('appCss').map(note => note.noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export = {
|
||||||
index
|
index
|
||||||
};
|
};
|
@ -19,7 +19,7 @@ const ValidationError = require('../errors/validation_error');
|
|||||||
// page routes
|
// page routes
|
||||||
const setupRoute = require('./setup');
|
const setupRoute = require('./setup');
|
||||||
const loginRoute = require('./login');
|
const loginRoute = require('./login');
|
||||||
const indexRoute = require('./index.js');
|
const indexRoute = require('./index');
|
||||||
|
|
||||||
// API routes
|
// API routes
|
||||||
const treeApiRoute = require('./api/tree');
|
const treeApiRoute = require('./api/tree');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user