mirror of
https://github.com/zadam/trilium.git
synced 2025-06-05 01:18:44 +02:00
added support for app_css attribute, which allows custom styling
This commit is contained in:
parent
c831221cc4
commit
b6277049f3
@ -5,13 +5,32 @@ const router = express.Router();
|
||||
const auth = require('../services/auth');
|
||||
const source_id = require('../services/source_id');
|
||||
const sql = require('../services/sql');
|
||||
const Repository = require('../services/repository');
|
||||
const attributes = require('../services/attributes');
|
||||
const wrap = require('express-promise-wrap').wrap;
|
||||
|
||||
router.get('', auth.checkAuth, wrap(async (req, res, next) => {
|
||||
const repository = new Repository(req);
|
||||
|
||||
res.render('index', {
|
||||
sourceId: await source_id.generateSourceId(),
|
||||
maxSyncIdAtLoad: await sql.getValue("SELECT MAX(id) FROM sync")
|
||||
maxSyncIdAtLoad: await sql.getValue("SELECT MAX(id) FROM sync"),
|
||||
appCss: await getAppCss(repository)
|
||||
});
|
||||
}));
|
||||
|
||||
async function getAppCss(repository) {
|
||||
let css = '';
|
||||
const notes = attributes.getNotesWithAttribute(repository, 'app_css');
|
||||
|
||||
for (const note of await notes) {
|
||||
css += `/* ${note.noteId} */
|
||||
${note.content}
|
||||
|
||||
`;
|
||||
}
|
||||
|
||||
return css;
|
||||
}
|
||||
|
||||
module.exports = router;
|
||||
|
@ -13,7 +13,8 @@ const BUILTIN_ATTRIBUTES = [
|
||||
'exclude_from_export',
|
||||
'run',
|
||||
'manual_transaction_handling',
|
||||
'disable_inclusion'
|
||||
'disable_inclusion',
|
||||
'app_css'
|
||||
];
|
||||
|
||||
async function getNoteAttributeMap(noteId) {
|
||||
|
@ -529,5 +529,9 @@
|
||||
// final form which is pretty ugly.
|
||||
$("#container").show();
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
<%= appCss %>
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user