2022-08-03 20:57:56 -04:00
|
|
|
import * as tfrpc from '/tfrpc.js';
|
|
|
|
|
|
|
|
tfrpc.register(function delete_user(user) {
|
|
|
|
return core.deleteUser(user);
|
|
|
|
});
|
|
|
|
|
2022-08-16 20:29:57 -04:00
|
|
|
tfrpc.register(function global_settings_set(key, value) {
|
|
|
|
return core.globalSettingsSet(key, value);
|
|
|
|
});
|
|
|
|
|
2022-08-03 20:57:56 -04:00
|
|
|
async function main() {
|
2023-08-04 21:22:27 -04:00
|
|
|
try {
|
|
|
|
let data = {
|
|
|
|
users: {},
|
|
|
|
granted: await core.allPermissionsGranted(),
|
|
|
|
settings: await core.globalSettingsDescriptions(),
|
|
|
|
};
|
|
|
|
for (let user of await core.users()) {
|
|
|
|
data.users[user] = await core.permissionsForUser(user);
|
|
|
|
}
|
2024-02-23 04:35:39 -05:00
|
|
|
await app.setDocument(utf8Decode(getFile('index.html')).replace('$data', JSON.stringify(data)));
|
2023-08-04 21:22:27 -04:00
|
|
|
} catch {
|
2024-02-23 04:35:39 -05:00
|
|
|
await app.setDocument('<span style="color: #f00">Only an administrator can modify these settings.</span>');
|
2022-08-13 15:39:29 -04:00
|
|
|
}
|
2022-08-03 20:57:56 -04:00
|
|
|
}
|
2024-02-23 04:35:39 -05:00
|
|
|
main();
|