From ac960a98bf6457419e3c78df58a012d13e39b8dc Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 28 Jul 2022 00:45:34 +0000 Subject: [PATCH] Clean up apps list. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3938 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/core.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/core.js b/core/core.js index f8aada0a..8261aa13 100644 --- a/core/core.js +++ b/core/core.js @@ -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 {