ssb: The block list can be crudely managed through the admin app.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 8m54s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 8m54s
This commit is contained in:
@@ -16,6 +16,14 @@ function delete_user(user) {
|
||||
}
|
||||
}
|
||||
|
||||
async function add_block() {
|
||||
await tfrpc.rpc.addBlock(document.getElementById('add_block').value);
|
||||
}
|
||||
|
||||
async function remove_block(id) {
|
||||
await tfrpc.rpc.removeBlock(id);
|
||||
}
|
||||
|
||||
function global_settings_set(key, value) {
|
||||
tfrpc.rpc
|
||||
.global_settings_set(key, value)
|
||||
@@ -94,11 +102,32 @@ ${description.value}</textarea
|
||||
${user}: ${permissions.map((x) => permission_template(x))}
|
||||
</li>
|
||||
`;
|
||||
const block_template = (block) => html`
|
||||
<li class="w3-card w3-margin">
|
||||
<button
|
||||
class="w3-button w3-theme-action"
|
||||
@click=${(e) => remove_block(block.id)}
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
<code>${block.id}</code>
|
||||
${new Date(block.timestamp)}
|
||||
</li>
|
||||
`;
|
||||
const users_template = (users) =>
|
||||
html` <header class="w3-container w3-theme-l2"><h2>Users</h2></header>
|
||||
<ul class="w3-ul">
|
||||
${Object.entries(users).map((u) => user_template(u[0], u[1]))}
|
||||
</ul>`;
|
||||
const blocks_template = (blocks) =>
|
||||
html` <header class="w3-container w3-theme-l2"><h2>Blocks</h2></header>
|
||||
<div class="w3-row w3-margin">
|
||||
<input type="text" class="w3-threequarter w3-input" id="add_block"></input>
|
||||
<button class="w3-quarter w3-button w3-theme-action" @click=${add_block}>Add</button>
|
||||
</div>
|
||||
<ul class="w3-ul">
|
||||
${blocks.map((b) => block_template(b))}
|
||||
</ul>`;
|
||||
const page_template = (data) =>
|
||||
html`<div style="padding: 0; margin: 0; width: 100%; max-width: 100%">
|
||||
<header class="w3-container w3-theme-l2"><h2>Global Settings</h2></header>
|
||||
@@ -109,7 +138,7 @@ ${description.value}</textarea
|
||||
.map((x) => html`${input_template(x, data.settings[x])}`)}
|
||||
</ul>
|
||||
</div>
|
||||
${users_template(data.users)}
|
||||
${users_template(data.users)} ${blocks_template(data.blocks)}
|
||||
</div> `;
|
||||
render(page_template(g_data), document.body);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user