mirror of
https://github.com/zadam/trilium.git
synced 2024-11-12 18:54:49 +08:00
27 lines
650 B
JavaScript
27 lines
650 B
JavaScript
"use strict";
|
|
|
|
const sqlInit = require('../services/sql_init');
|
|
const setupService = require('../services/setup');
|
|
|
|
async function setupPage(req, res) {
|
|
if (await sqlInit.isDbInitialized()) {
|
|
res.redirect('/');
|
|
}
|
|
|
|
// we got here because DB is not completely initialized so if schema exists
|
|
// it means we're in sync in progress state.
|
|
const syncInProgress = await sqlInit.schemaExists();
|
|
|
|
if (syncInProgress) {
|
|
// trigger sync if it's not already running
|
|
setupService.triggerSync();
|
|
}
|
|
|
|
res.render('setup', {
|
|
syncInProgress: syncInProgress
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
setupPage
|
|
};
|