mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server-esm: Avoid passing async to express
This commit is contained in:
parent
fe385bf2e4
commit
3852753a89
@ -7,15 +7,11 @@ import assetPath from "../services/asset_path.js";
|
|||||||
import appPath from "../services/app_path.js";
|
import appPath from "../services/app_path.js";
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
|
|
||||||
async function setupPage(req: Request, res: Response) {
|
function setupPage(req: Request, res: Response) {
|
||||||
if (sqlInit.isDbInitialized()) {
|
if (sqlInit.isDbInitialized()) {
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
const windowService = (await import("../services/window")).default;
|
handleElectronRedirect();
|
||||||
const { app } = await import("electron");
|
} else {
|
||||||
windowService.createMainWindow(app);
|
|
||||||
windowService.closeSetupWindow();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
res.redirect('.');
|
res.redirect('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +34,13 @@ async function setupPage(req: Request, res: Response) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleElectronRedirect() {
|
||||||
|
const windowService = (await import("../services/window")).default;
|
||||||
|
const { app } = await import("electron");
|
||||||
|
windowService.createMainWindow(app);
|
||||||
|
windowService.closeSetupWindow();
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setupPage
|
setupPage
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user