Expose shared_database(), which provides access to data that is specific to the app owner and app and can be written for any visitor.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3860 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-03-16 00:23:14 +00:00
parent 352f33f5a1
commit 5e0c20e432
2 changed files with 14 additions and 6 deletions

View File

@ -221,6 +221,12 @@ async function getProcessBlob(blobId, key, options) {
return Object.fromEntries(Object.keys(db).map(x => [x, db[x].bind(db)]));
};
}
if (options.packageOwner && options.packageName) {
imports.shared_database = function(key) {
var db = new Database(':shared:' + options.packageOwner + ':' + options.packageName + ':' + key);
return Object.fromEntries(Object.keys(db).map(x => [x, db[x].bind(db)]));
}
}
process.task.setImports(imports);
process.task.activate();
let source = await getBlobOrContent(blobId);