Clean up apps list.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3938 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-07-28 00:45:34 +00:00
parent f787eb077b
commit ac960a98bf

View File

@ -498,13 +498,17 @@ async function blobHandler(request, response, blobId, uri) {
(credentials.permissions.administration && user == 'core'))) {
var database = new Database(user);
var apps = new Set();
let apps_original = database.get('apps');
try {
apps = new Set(JSON.parse(database.get('apps')));
apps = new Set(JSON.parse(apps_original));
} catch {
}
if (!apps.has(appName)) {
apps.add(appName);
database.set('apps', JSON.stringify([...apps]));
}
apps = JSON.stringify([...apps].sort());
if (apps != apps_original) {
database.set('apps', apps);
}
database.set('path:' + appName, newBlobId);
} else {