From bdc9eb6598950ab926166d232c81f74c105e947e Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 3 Jan 2021 20:31:00 +0000 Subject: [PATCH] Make ~cory/index/ fail with a better error if not logged in, and require the administrator while I'm at it. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3629 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/cory/index.json | 2 +- apps/cory/index/app.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/cory/index.json b/apps/cory/index.json index 3908d086..24c9c94f 100644 --- a/apps/cory/index.json +++ b/apps/cory/index.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&ovJdMIXT/ocLxZ1rO1N03SpZr3w3RFKCFXl+isnXcx4=.sha256","index.html":"&TFtniuUIVO7XeWCgwmqPAmuBzpGX6slxJQcPMEr+860=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&6uFJG2C0kZar1Aj+7p2/KzYEBXgmK/uJSt7aIJqenN4=.sha256","index.html":"&TFtniuUIVO7XeWCgwmqPAmuBzpGX6slxJQcPMEr+860=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256"}} \ No newline at end of file diff --git a/apps/cory/index/app.js b/apps/cory/index/app.js index 342dd734..532d0645 100644 --- a/apps/cory/index/app.js +++ b/apps/cory/index/app.js @@ -368,7 +368,14 @@ core.register('message', async function(m) { }); async function main() { - await app.setDocument(utf8Decode(await getFile("index.html"))); + if (core.user && + core.user.credentials && + core.user.credentials.permissions && + core.user.credentials.permissions.administration) { + await app.setDocument(utf8Decode(await getFile("index.html"))); + } else { + await app.setDocument('
Only the administrator can use this app at this time. Login at the top right.
'); + } } main(); \ No newline at end of file