Fiddled with saving and loading so that admin users can push and pull to parent apps.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3806 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-01-30 14:51:09 +00:00
parent ec5d7c1a01
commit 0278aceb62
4 changed files with 163 additions and 117 deletions

View File

@ -64,6 +64,7 @@ function socket(request, response, client) {
var packageName;
var blobId;
var match;
var parentApp;
if (match = /^\/([&%][^\.]{44}(?:\.\w+)?)(\/?.*)/.exec(message.path)) {
blobId = match[1];
} else if (match = /^\/\~([^\/]+)\/([^\/]+)\/$/.exec(message.path)) {
@ -74,8 +75,20 @@ function socket(request, response, client) {
response.send(JSON.stringify({action: "error", error: message.path + ' not found'}), 0x1);
return;
}
if (user != 'core') {
var coreId = await new Database('core').get('path:' + path);
parentApp = {
path: '/~core/' + path + '/',
id: coreId,
};
}
}
response.send(JSON.stringify({action: "session", credentials: credentials}), 0x1);
response.send(JSON.stringify({
action: "session",
credentials: credentials,
parentApp: parentApp,
id: blobId,
}), 0x1);
options.api = message.api || [];
options.credentials = credentials;