add: small littleweb browser changes

This commit is contained in:
trisua 2025-07-08 17:38:24 -04:00
parent e7febc7c7e
commit 388ccbf58c
9 changed files with 194 additions and 21 deletions

View file

@ -1069,7 +1069,13 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
// permissions ui
self.define(
"generate_permissions_ui",
(_, permissions, field_id = "role") => {
(
_,
permissions,
field_id = "role",
add_name = "add_permission_to_role",
remove_name = "remove_permission_from_role",
) => {
function all_matching_permissions(role) {
const matching = [];
const not_matching = [];
@ -1099,7 +1105,7 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
function get_permissions_html(role, id) {
const [matching, not_matching] = all_matching_permissions(role);
globalThis.remove_permission_from_role = (permission) => {
globalThis[remove_name] = (permission) => {
matching.splice(matching.indexOf(permission), 1);
not_matching.push(permission);
@ -1107,7 +1113,7 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
get_permissions_html(rebuild_role(matching), id);
};
globalThis.add_permission_to_role = (permission) => {
globalThis[add_name] = (permission) => {
not_matching.splice(not_matching.indexOf(permission), 1);
matching.push(permission);
@ -1120,14 +1126,14 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
for (const match of matching) {
permissions_html += `<div class="card w-full secondary flex justify-between gap-2">
<span>${match} <code>${permissions[match]}</code></span>
<button class="red lowered" onclick="remove_permission_from_role('${match}')">Remove</button>
<button class="red lowered" onclick="${remove_name}('${match}')">Remove</button>
</div>`;
}
for (const match of not_matching) {
permissions_html += `<div class="card w-full secondary flex justify-between gap-2">
<span>${match} <code>${permissions[match]}</code></span>
<button class="green lowered" onclick="add_permission_to_role('${match}')">Add</button>
<button class="green lowered" onclick="${add_name}('${match}')">Add</button>
</div>`;
}

View file

@ -54,7 +54,7 @@ function fix_atto_links() {
`atto://${path.replace("atto://", "").split("/")[0]}${x}`;
} else {
y[property] =
`/api/v1/net/atto://${path.replace("atto://", "").split("/")[0]}${x}`;
`/api/v1/net/${path.replace("atto://", "").split("/")[0]}${x}`;
}
}
}