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`