feat: add audit logging for admin trash restore/purge and notification clear actions

- Record audit events in `admin_trash_restore` and `admin_trash_purge` endpoints with target metadata
- Log `notification.read.all` event when user clears devRant notification feed
- Include `devrant` as a valid origin in audit categories
- Add `admin_section` and `pagination_query` fields to audit and backup schemas for UI consistency
This commit is contained in:
2026-06-16 05:08:58 +00:00
parent 1934dd5727
commit 99ed5c4f15
24 changed files with 466 additions and 186 deletions
+2 -1
View File
@@ -2,7 +2,8 @@
import { ApiTester } from "./ApiTester.js";
import { CodeCopy } from "./CodeCopy.js";
import { DevRantTester, DevRantLogin } from "./DevRantTester.js";
import { DevRantTester } from "./DevRantTester.js";
import { DevRantLogin } from "./DevRantLogin.js";
export class ApiDocs {
constructor() {
-47
View File
@@ -18,53 +18,6 @@ function el(tag, props = {}, children = []) {
return node;
}
export class DevRantLogin {
constructor(mount) {
this.mount = mount;
this.render();
devrantSession.onChange(() => this.render());
}
render() {
this.mount.innerHTML = "";
const bar = el("div", { class: "api-tester devrant-login" });
if (devrantSession.isLoggedIn()) {
bar.appendChild(
el("span", {
class: "try-note",
text: `Authenticated as ${devrantSession.username || "user " + devrantSession.auth.user_id} (token #${devrantSession.auth.token_id}).`,
}),
);
const out = el("button", { type: "button", class: "btn try-send", text: "Log out" });
out.addEventListener("click", () => devrantSession.logout());
bar.appendChild(out);
this.mount.appendChild(bar);
return;
}
const user = el("input", { class: "param-input", type: "text", placeholder: "username or email" });
const pass = el("input", { class: "param-input", type: "password", placeholder: "password" });
const docs = window.DEVPLACE_DOCS || {};
if (docs.username) user.value = docs.username;
const send = el("button", { type: "button", class: "btn btn-primary try-send", text: "Log in" });
const note = el("span", { class: "try-note", text: "Log in once to enable the authenticated widgets on every devRant page." });
send.addEventListener("click", async () => {
send.disabled = true;
note.textContent = "Logging in...";
try {
await devrantSession.login(user.value.trim(), pass.value);
} catch (error) {
note.textContent = error.message || "Login failed";
send.disabled = false;
}
});
bar.appendChild(el("div", { class: "auth-field" }, [el("label", { text: "Username" }), user]));
bar.appendChild(el("div", { class: "auth-field" }, [el("label", { text: "Password" }), pass]));
bar.appendChild(send);
bar.appendChild(note);
this.mount.appendChild(bar);
}
}
export class DevRantTester {
constructor(mount) {
this.mount = mount;