From 46d3e8f5677957ca2df93855679a464999e2825d Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 17 Aug 2022 00:29:57 +0000 Subject: [PATCH] Exposing setting the index page in the admin app and added a crude emoji picker, finally. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3966 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/cory/admin.json | 2 +- apps/cory/admin/app.js | 11 +- apps/cory/admin/script.js | 26 +- apps/cory/ssb.json | 2 +- apps/cory/ssb/emojis.js | 70 + apps/cory/ssb/emojis.json | 15115 ++++++++++++++++++++++++++++++++++ apps/cory/ssb/tf-message.js | 35 +- core/core.js | 11 +- 8 files changed, 15247 insertions(+), 25 deletions(-) create mode 100644 apps/cory/ssb/emojis.js create mode 100644 apps/cory/ssb/emojis.json diff --git a/apps/cory/admin.json b/apps/cory/admin.json index 162a8091..48a72d52 100644 --- a/apps/cory/admin.json +++ b/apps/cory/admin.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&ONpfDPCOakAWKWw0vPwQGPqMPbFNxZR/DOhIEQtK7Ac=.sha256","index.html":"&D3JwdPXy/QsLXkmwNDrBFXdzxfqO1/JGxfqEArnS5v4=.sha256","lit.min.js":"&3FfrVflmGr0n4lvN0GriN1Qz1lEw31SbZxRSJrcXR28=.sha256","script.js":"&hgxmXRvzwz27iH2BATFq20aLX4rtvL/AI/5QJV487XM=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&srACRivbm0ZbvlMOAQ/9mhdcu++LLh6ckcRoRLvewjU=.sha256","index.html":"&D3JwdPXy/QsLXkmwNDrBFXdzxfqO1/JGxfqEArnS5v4=.sha256","lit.min.js":"&3FfrVflmGr0n4lvN0GriN1Qz1lEw31SbZxRSJrcXR28=.sha256","script.js":"&yTGrKjg1U/F9wt/60ySlg4N+qewVoaRUqqWQWkHi1Q0=.sha256"}} \ No newline at end of file diff --git a/apps/cory/admin/app.js b/apps/cory/admin/app.js index 3a709b5a..63ee9e8d 100644 --- a/apps/cory/admin/app.js +++ b/apps/cory/admin/app.js @@ -4,9 +4,16 @@ tfrpc.register(function delete_user(user) { return core.deleteUser(user); }); +tfrpc.register(function global_settings_set(key, value) { + return core.globalSettingsSet(key, value); +}); + async function main() { - let data = {users: {}, granted: await core.allPermissionsGranted()}; - print(JSON.stringify(data)); + let data = { + users: {}, + granted: await core.allPermissionsGranted(), + index: await core.globalSettingsGet('index'), + }; for (let user of await core.users()) { data.users[user] = await core.permissionsForUser(user); } diff --git a/apps/cory/admin/script.js b/apps/cory/admin/script.js index 50ff5a52..3cbe23b8 100644 --- a/apps/cory/admin/script.js +++ b/apps/cory/admin/script.js @@ -11,9 +11,22 @@ function delete_user(user) { } } +function global_settings_set(key, value) { + tfrpc.rpc.global_settings_set(key, value).then(function() { + alert(`Set "${key}" to "${value}".`); + }).catch(function(error) { + alert(`Failed to set "${key}": ${JSON.stringify(error, null, 2)}.`); + }); +} + window.addEventListener('load', function() { const permission_template = (permission) => html` ${permission}`; + const input_template = (key, value) => html` + + + + `; const user_template = (user, permissions) => html`
  • `; const users_template = (users) => - html`