Files
tildefriends/apps/admin/app.js
Cory McWilliams bc3fd57d7a
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 8m54s
ssb: The block list can be crudely managed through the admin app.
2025-11-29 11:33:16 -05:00

39 lines
921 B
JavaScript

import * as tfrpc from '/tfrpc.js';
tfrpc.register(function delete_user(user) {
return core.deleteUser(user);
});
tfrpc.register(function global_settings_set(key, value) {
return core.globalSettingsSet(key, value);
});
tfrpc.register(function addBlock(id) {
return ssb.addBlock(id);
});
tfrpc.register(function removeBlock(id) {
return ssb.removeBlock(id);
});
async function main() {
try {
let data = {
users: {},
granted: await core.allPermissionsGranted(),
settings: await core.globalSettingsDescriptions(),
blocks: await ssb.getBlocks(),
};
for (let user of await core.users()) {
data.users[user] = await core.permissionsForUser(user);
}
await app.setDocument(
utf8Decode(getFile('index.html')).replace('$data', JSON.stringify(data))
);
} catch {
await app.setDocument(
'<span style="color: #f00">Only an administrator can modify these settings.</span>'
);
}
}
main();