Loading admin/static/app.js +15 −1 Changes for admin/static/app.js: 15 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -69,11 +69,25 @@ const ProxyPlusAdmin = (() => { body.innerHTML = ""; for (const r of routes) { const tr = document.createElement("tr"); tr.innerHTML = `<td>${r.id}</td><td>${r.path_prefix}</td><td>${r.upstream}</td><td>${r.upstream_pool}</td><td>${r.required_permission}</td>`; tr.innerHTML = `<td>${r.id}</td><td>${r.path_prefix}</td><td>${r.upstream}</td><td>${r.upstream_pool}</td><td>${r.required_permission}</td><td></td>`; const delBtn = document.createElement("button"); delBtn.textContent = "Löschen"; delBtn.onclick = () => deleteRoute(r.id); tr.lastElementChild.appendChild(delBtn); body.appendChild(tr); } } async function deleteRoute(id) { if (!confirm("Route '" + id + "' wirklich löschen?")) return; try { await api("DELETE", "/api/v1/http/routes", { id }); await refreshRoutes(); } catch (e) { document.getElementById("route-error").textContent = e.message; } } async function refreshRelays() { const relays = await api("GET", "/api/v1/smtp/relays"); const body = document.querySelector("#smtp-relays tbody"); Loading admin/static/index.html +1 −1 Changes for admin/static/index.html: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ <table id="status-table"></table> <h2>HTTP-Routen</h2> <table id="http-routes"><thead><tr><th>ID</th><th>Pfad</th><th>Upstream</th><th>Pool</th><th>Berechtigung</th></tr></thead><tbody></tbody></table> <table id="http-routes"><thead><tr><th>ID</th><th>Pfad</th><th>Upstream</th><th>Pool</th><th>Berechtigung</th><th>Aktionen</th></tr></thead><tbody></tbody></table> <button onclick="ProxyPlusAdmin.showNewRouteForm()">Neue Route</button> <div id="new-route-form" hidden> <input id="route-id" placeholder="ID"> Loading src/api/JsonApiServer.cpp +12 −0 Changes for src/api/JsonApiServer.cpp: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -233,6 +233,18 @@ void JsonApiController::registerRoutes() { return json_object_to_json_string(resp); }}); _routes.push_back( {"DELETE", "/api/v1/http/routes", "http.routes.write", [this](RouteContext &ctx) -> std::string { JsonGuard body(json_tokener_parse(ctx.body.c_str())); if (!body.obj) return jsonError("invalid JSON body"); std::string id = getStringField(body, "id"); if (id.empty()) return jsonError("id is required"); _configStore.deleteHttpRoute(id); JsonGuard resp(json_object_new_object()); json_object_object_add(resp, "status", json_object_new_string("deleted")); return json_object_to_json_string(resp); }}); _routes.push_back( {"GET", "/api/v1/smtp/relays", "smtp.domains.read", [this](RouteContext &) -> std::string { JsonGuard arr(json_object_new_array()); Loading Loading
admin/static/app.js +15 −1 Changes for admin/static/app.js: 15 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -69,11 +69,25 @@ const ProxyPlusAdmin = (() => { body.innerHTML = ""; for (const r of routes) { const tr = document.createElement("tr"); tr.innerHTML = `<td>${r.id}</td><td>${r.path_prefix}</td><td>${r.upstream}</td><td>${r.upstream_pool}</td><td>${r.required_permission}</td>`; tr.innerHTML = `<td>${r.id}</td><td>${r.path_prefix}</td><td>${r.upstream}</td><td>${r.upstream_pool}</td><td>${r.required_permission}</td><td></td>`; const delBtn = document.createElement("button"); delBtn.textContent = "Löschen"; delBtn.onclick = () => deleteRoute(r.id); tr.lastElementChild.appendChild(delBtn); body.appendChild(tr); } } async function deleteRoute(id) { if (!confirm("Route '" + id + "' wirklich löschen?")) return; try { await api("DELETE", "/api/v1/http/routes", { id }); await refreshRoutes(); } catch (e) { document.getElementById("route-error").textContent = e.message; } } async function refreshRelays() { const relays = await api("GET", "/api/v1/smtp/relays"); const body = document.querySelector("#smtp-relays tbody"); Loading
admin/static/index.html +1 −1 Changes for admin/static/index.html: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ <table id="status-table"></table> <h2>HTTP-Routen</h2> <table id="http-routes"><thead><tr><th>ID</th><th>Pfad</th><th>Upstream</th><th>Pool</th><th>Berechtigung</th></tr></thead><tbody></tbody></table> <table id="http-routes"><thead><tr><th>ID</th><th>Pfad</th><th>Upstream</th><th>Pool</th><th>Berechtigung</th><th>Aktionen</th></tr></thead><tbody></tbody></table> <button onclick="ProxyPlusAdmin.showNewRouteForm()">Neue Route</button> <div id="new-route-form" hidden> <input id="route-id" placeholder="ID"> Loading
src/api/JsonApiServer.cpp +12 −0 Changes for src/api/JsonApiServer.cpp: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -233,6 +233,18 @@ void JsonApiController::registerRoutes() { return json_object_to_json_string(resp); }}); _routes.push_back( {"DELETE", "/api/v1/http/routes", "http.routes.write", [this](RouteContext &ctx) -> std::string { JsonGuard body(json_tokener_parse(ctx.body.c_str())); if (!body.obj) return jsonError("invalid JSON body"); std::string id = getStringField(body, "id"); if (id.empty()) return jsonError("id is required"); _configStore.deleteHttpRoute(id); JsonGuard resp(json_object_new_object()); json_object_object_add(resp, "status", json_object_new_string("deleted")); return json_object_to_json_string(resp); }}); _routes.push_back( {"GET", "/api/v1/smtp/relays", "smtp.domains.read", [this](RouteContext &) -> std::string { JsonGuard arr(json_object_new_array()); Loading