trilium/src/routes/index.js

33 lines
695 B
JavaScript
Raw Normal View History

2017-10-22 09:10:33 +08:00
"use strict";
const source_id = require('../services/source_id');
const sql = require('../services/sql');
2018-03-31 21:07:58 +08:00
const repository = require('../services/repository');
const labels = require('../services/labels');
async function index(req, res) {
res.render('index', {
sourceId: await source_id.generateSourceId(),
maxSyncIdAtLoad: await sql.getValue("SELECT MAX(id) FROM sync"),
2018-03-31 21:07:58 +08:00
appCss: await getAppCss()
});
}
2018-03-31 21:07:58 +08:00
async function getAppCss() {
let css = '';
2018-03-31 21:07:58 +08:00
const notes = labels.getNotesWithLabel('app_css');
for (const note of await notes) {
css += `/* ${note.noteId} */
${note.content}
`;
}
return css;
}
module.exports = {
index
};