From d0fb5ec4aa4f8e028531f0421232161cd1a2b373 Mon Sep 17 00:00:00 2001 From: Arne Babenhauserheide Date: Sat, 29 Jul 2023 02:42:50 +0200 Subject: [PATCH] add core operations interface skelleton --- src/freenet/clients/http/WelcomeToadlet.java | 20 ++++++++++++++++++- .../staticfiles/core-operations-interface.css | 8 ++++++++ .../templates/core-operations-interface.html | 10 ++++++++++ src/freenet/l10n/freenet.l10n.en.properties | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/freenet/clients/http/staticfiles/core-operations-interface.css create mode 100644 src/freenet/clients/http/templates/core-operations-interface.html diff --git a/src/freenet/clients/http/WelcomeToadlet.java b/src/freenet/clients/http/WelcomeToadlet.java index 944ba16bb67..044ae5d03b4 100644 --- a/src/freenet/clients/http/WelcomeToadlet.java +++ b/src/freenet/clients/http/WelcomeToadlet.java @@ -3,6 +3,7 @@ * http://www.gnu.org/ for further details of the GPL. */ package freenet.clients.http; +import freenet.clients.http.utils.PebbleUtils; import freenet.config.InvalidConfigValueException; import freenet.config.NodeNeedRestartException; import freenet.node.*; @@ -13,6 +14,7 @@ import java.io.File; import java.io.IOException; import java.net.URI; +import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -522,6 +524,9 @@ public void handleMethodGET(URI uri, HTTPRequest request, ToadletContext ctx) th if (ctx.isAllowedFullAccess()) { contentNode.addChild(ctx.getAlertManager().createSummary()); } + + page.addCustomStyleSheet("/static/core-operations-interface.css"); + this.putCoreOperationsInterface(ctx, contentNode); if (node.config.get("fproxy").getBoolean("fetchKeyBoxAboveBookmarks")) { this.putFetchKeyBox(ctx, contentNode); @@ -583,7 +588,20 @@ public void handleMethodGET(URI uri, HTTPRequest request, ToadletContext ctx) th this.writeHTMLReply(ctx, 200, "OK", pageNode.generate()); } - private void putFetchKeyBox(ToadletContext ctx, HTMLNode contentNode) { + private void putCoreOperationsInterface(ToadletContext ctx, HTMLNode contentNode) throws IOException { + HTMLNode coreOperationsBox = ctx.getPageMaker().getInfobox("infobox-normal", l10n("nodeOperationLabel"), contentNode, "node-operation", true); + coreOperationsBox.addAttribute("id", "coreNodeOperation"); + + HashMap model = new HashMap<>(); + model.put("formPassword", node.clientCore.getToadletContainer().getFormPassword()); + PebbleUtils.addChild( + coreOperationsBox, + "core-operations-interface", + model, + "WelcomeToadlet"); + } + + private void putFetchKeyBox(ToadletContext ctx, HTMLNode contentNode) { // Fetch-a-key box HTMLNode fetchKeyContent = ctx.getPageMaker().getInfobox("infobox-normal", l10n("fetchKeyLabel"), contentNode, "fetch-key", true); fetchKeyContent.addAttribute("id", "keyfetchbox"); diff --git a/src/freenet/clients/http/staticfiles/core-operations-interface.css b/src/freenet/clients/http/staticfiles/core-operations-interface.css new file mode 100644 index 00000000000..82ad8dfb17b --- /dev/null +++ b/src/freenet/clients/http/staticfiles/core-operations-interface.css @@ -0,0 +1,8 @@ +.core-operations-interface--container { + display: flex; + flex-direction: row; + width: 100%; +} +.core-operations-interface--column { + flex-grow: 1; +} diff --git a/src/freenet/clients/http/templates/core-operations-interface.html b/src/freenet/clients/http/templates/core-operations-interface.html new file mode 100644 index 00000000000..44466a02eba --- /dev/null +++ b/src/freenet/clients/http/templates/core-operations-interface.html @@ -0,0 +1,10 @@ +
+
+ Messaging +
+
+ Invite +
+ + +
diff --git a/src/freenet/l10n/freenet.l10n.en.properties b/src/freenet/l10n/freenet.l10n.en.properties index 0d5da8d4958..c7a971a7b3d 100644 --- a/src/freenet/l10n/freenet.l10n.en.properties +++ b/src/freenet/l10n/freenet.l10n.en.properties @@ -2259,6 +2259,7 @@ WelcomeToadlet.confirmFIN=Do you want to insert the following Frost message? WelcomeToadlet.disabledAlert=Disabled alert WelcomeToadlet.extVersion=Freenet-ext Build #${build} r${rev} WelcomeToadlet.fetch=Fetch +WelcomeToadlet.nodeOperationLabel=Core node operation WelcomeToadlet.fetchKeyLabel=Visit a freesite or download a file (if you know the key) WelcomeToadlet.finInsertSuccessWithKey=The message has been inserted successfully into ${key}. WelcomeToadlet.finInsertedTitle=Insertion