feat: add route helper to handler context

This commit is contained in:
HRG @ SCExC 2025-02-11 17:32:47 +09:00
parent 9613188a1c
commit 28a441d98a
2 changed files with 6 additions and 1 deletions

View file

@ -88,6 +88,8 @@ function bootstrapContext(db, structureId, routeId, initContext) {
// todo wrap template in data-bliss-edit-template thing since ws can't take us to the editor on a component basis?? maybe...
// for now just designing with component approach
const eta = model.getTemplater(structureId);
const structure = model.getStructure(db, structureId)
const __urlPrefix = structure.route_prefix;
const libs = { eta, db: getDb, push: webPush, files: { saveFile: (...args) => saveFile(structureId, ...args) } };
@ -120,7 +122,10 @@ function bootstrapContext(db, structureId, routeId, initContext) {
vapidPublicKey: vapidPublicKey,
fetch: fetch,
clearTimeout: clearTimeout,
setTimeout: setTimeout
setTimeout: setTimeout,
route: function (url) {
return __urlPrefix ? path.join(__urlPrefix, url) : url;
},
});
for (let appDb of dbs) {
let dbInstance = model.getDbInstance(appDb.id);

BIN
out.mp3 Normal file

Binary file not shown.