mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
make sure shaca is loaded before any request
This commit is contained in:
parent
f9c01851ef
commit
b3763eed61
@ -62,16 +62,18 @@ function register(router) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get('/share/:shareId', (req, res, next) => {
|
router.get('/share/:shareId', (req, res, next) => {
|
||||||
const {shareId} = req.params;
|
|
||||||
|
|
||||||
shacaLoader.ensureLoad();
|
shacaLoader.ensureLoad();
|
||||||
|
|
||||||
|
const {shareId} = req.params;
|
||||||
|
|
||||||
const note = shaca.aliasToNote[shareId] || shaca.notes[shareId];
|
const note = shaca.aliasToNote[shareId] || shaca.notes[shareId];
|
||||||
|
|
||||||
renderNote(note, res);
|
renderNote(note, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/share/api/notes/:noteId', (req, res, next) => {
|
router.get('/share/api/notes/:noteId', (req, res, next) => {
|
||||||
|
shacaLoader.ensureLoad();
|
||||||
|
|
||||||
const {noteId} = req.params;
|
const {noteId} = req.params;
|
||||||
const note = shaca.getNote(noteId);
|
const note = shaca.getNote(noteId);
|
||||||
|
|
||||||
@ -85,6 +87,8 @@ function register(router) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get('/share/api/notes/:noteId/download', (req, res, next) => {
|
router.get('/share/api/notes/:noteId/download', (req, res, next) => {
|
||||||
|
shacaLoader.ensureLoad();
|
||||||
|
|
||||||
const {noteId} = req.params;
|
const {noteId} = req.params;
|
||||||
const note = shaca.getNote(noteId);
|
const note = shaca.getNote(noteId);
|
||||||
|
|
||||||
@ -107,6 +111,8 @@ function register(router) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get('/share/api/images/:noteId/:filename', (req, res, next) => {
|
router.get('/share/api/images/:noteId/:filename', (req, res, next) => {
|
||||||
|
shacaLoader.ensureLoad();
|
||||||
|
|
||||||
const image = shaca.getNote(req.params.noteId);
|
const image = shaca.getNote(req.params.noteId);
|
||||||
|
|
||||||
if (!image) {
|
if (!image) {
|
||||||
@ -118,13 +124,15 @@ function register(router) {
|
|||||||
|
|
||||||
addNoIndexHeader(image, res);
|
addNoIndexHeader(image, res);
|
||||||
|
|
||||||
res.set('Content-Type', image.mime);
|
res.setHeader('Content-Type', image.mime);
|
||||||
|
|
||||||
res.send(image.getContent());
|
res.send(image.getContent());
|
||||||
});
|
});
|
||||||
|
|
||||||
// used for PDF viewing
|
// used for PDF viewing
|
||||||
router.get('/share/api/notes/:noteId/view', (req, res, next) => {
|
router.get('/share/api/notes/:noteId/view', (req, res, next) => {
|
||||||
|
shacaLoader.ensureLoad();
|
||||||
|
|
||||||
const {noteId} = req.params;
|
const {noteId} = req.params;
|
||||||
const note = shaca.getNote(noteId);
|
const note = shaca.getNote(noteId);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user