Bug fixes

This commit is contained in:
Finn
2026-01-19 17:49:05 +01:00
parent 348476cf0a
commit 6ea013c1ad
5 changed files with 31 additions and 42 deletions

View File

@@ -42,6 +42,9 @@ public final class dashboard implements WebPage {
return new WebResponsePacket(401, "text/plain", new HashMap<>(), Html.utf8("Invalid session user."));
}
Oac2WebApp app = Oac2WebApp.get();
RegistrarDao dao = app.dao();
String msg = null;
String err = null;
@@ -50,9 +53,6 @@ public final class dashboard implements WebPage {
String action = p.getOr("action", "").trim();
try {
Oac2WebApp app = Oac2WebApp.get();
RegistrarDao dao = app.dao();
if ("create_infoname".equalsIgnoreCase(action)) {
String tln = p.get("tln");
String info = p.get("infoname");
@@ -90,6 +90,7 @@ public final class dashboard implements WebPage {
String value = p.get("value");
int ttl = p.getInt("ttl", 3600);
Integer priority = (p.get("priority") == null) ? null : p.getInt("priority", 0);
Integer port = (p.get("port") == null) ? null : p.getInt("port", 0);
Integer weight = (p.get("weight") == null) ? null : p.getInt("weight", 0);
@@ -110,12 +111,11 @@ public final class dashboard implements WebPage {
}
}
return render(ctx, userId, msg, err);
return render(userId, msg, err, dao);
}
private WebResponsePacket render(WebPageContext ctx, int userId, String msg, String err) throws Exception {
Oac2WebApp app = Oac2WebApp.get();
RegistrarDao.InfoNameRow[] owned = app.dao().listOwnedInfoNames(userId);
private WebResponsePacket render(int userId, String msg, String err, RegistrarDao dao) throws Exception {
RegistrarDao.InfoNameRow[] owned = dao.listOwnedInfoNames(userId);
StringBuilder list = new StringBuilder();
if (owned.length == 0) {
@@ -151,7 +151,7 @@ public final class dashboard implements WebPage {
%s
<div class="row">
<div class="col"><a href="/">Home</a></div>
<div class="col"><a href="/ins/index.html">Home</a></div>
</div>
</div>
""".formatted(
@@ -164,12 +164,6 @@ public final class dashboard implements WebPage {
String html = Html.page("Dashboard", body);
Map<String, String> headers = new HashMap<>();
// keep the same session header visible to client, if needed
if (ctx.request.getHeaders() != null) {
String sess = ctx.request.getHeaders().get("session");
if (sess != null) headers.put("session", sess);
}
return new WebResponsePacket(200, "text/html", headers, Html.utf8(html));
}
}