Skip to content

Commit

Permalink
add core operations interface skelleton
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBab committed Sep 9, 2023
1 parent 5bda2ac commit d0fb5ec
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/freenet/clients/http/WelcomeToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<String, Object> 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");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.core-operations-interface--container {
display: flex;
flex-direction: row;
width: 100%;
}
.core-operations-interface--column {
flex-grow: 1;
}
10 changes: 10 additions & 0 deletions src/freenet/clients/http/templates/core-operations-interface.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="core-operations-interface--container">
<div class="core-operations-interface--column core-operations-interface--friend-messages">
Messaging
</div>
<div class="core-operations-interface--column core-operations-interface--invite">
Invite
</div>
<!--<input name="formPassword" type="hidden" value="{{ formPassword }}">-->
<!--{{ l10n("networkSecurityPageTitle") }}-->
</div>
1 change: 1 addition & 0 deletions src/freenet/l10n/freenet.l10n.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d0fb5ec

Please sign in to comment.