Skip to content

Commit

Permalink
Merge remote-tracking branch 'ArneBab/show-the-noderef-in-basic-mode-…
Browse files Browse the repository at this point in the history
…for-add-friend' into next
  • Loading branch information
ArneBab committed Sep 4, 2023
2 parents 3104a3b + cb322b8 commit 71d5150
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 7 additions & 12 deletions src/freenet/clients/http/ConnectionsToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ public void handleMethodGET(URI uri, final HTTPRequest request, ToadletContext c
// our reference
if(shouldDrawNoderefBox(advancedMode)) {
drawAddPeerBox(contentNode, ctx);
drawNoderefBox(contentNode, getNoderef(), true);
drawNoderefBox(contentNode, getNoderef());
}

this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
Expand Down Expand Up @@ -863,13 +863,10 @@ protected void handleAltPost(URI uri, HTTPRequest request, ToadletContext ctx, b
final HTMLNode REFTEXT_LINK;

/**
*
* @param contentNode Node to add noderef box to.
* @param fs Noderef to render as text if requested.
* @param showNoderef If true, render the text of the noderef so that it may be copy-pasted. If false, only
* show a link to download it.
*/
void drawNoderefBox(HTMLNode contentNode, SimpleFieldSet fs, boolean showNoderef) {
void drawNoderefBox(HTMLNode contentNode, SimpleFieldSet fs) {
HTMLNode referenceInfobox = contentNode.addChild("div", "class", "infobox infobox-normal");
HTMLNode headerReferenceInfobox = referenceInfobox.addChild("div", "class", "infobox-header");
// FIXME better way to deal with this sort of thing???
Expand All @@ -888,13 +885,11 @@ void drawNoderefBox(HTMLNode contentNode, SimpleFieldSet fs, boolean showNoderef
myName.addChild("span", "]");
}

if (showNoderef) {
HTMLNode warningSentence = referenceInfoboxContent.addChild("p");
NodeL10n.getBase().addL10nSubstitution(warningSentence, "DarknetConnectionsToadlet.referenceCopyWarning",
new String[] { "bold" },
new HTMLNode[] { HTMLNode.STRONG });
referenceInfoboxContent.addChild("pre", "id", "reference", fs.toOrderedStringWithBase64() + '\n');
}
HTMLNode warningSentence = referenceInfoboxContent.addChild("p");
NodeL10n.getBase().addL10nSubstitution(warningSentence, "DarknetConnectionsToadlet.referenceCopyWarning",
new String[] { "bold" },
new HTMLNode[] { HTMLNode.STRONG });
referenceInfoboxContent.addChild("pre", "id", "reference", fs.toOrderedStringWithBase64() + '\n');

if(!isOpennet()) {
HTMLNode myIps = referenceInfoboxContent.addChild("p");
Expand Down
2 changes: 1 addition & 1 deletion src/freenet/clients/http/DarknetAddRefToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void handleMethodGET(URI uri, final HTTPRequest request, ToadletContext c

ConnectionsToadlet.drawAddPeerBox(contentNode, ctx, false, friendsToadlet.path());

friendsToadlet.drawNoderefBox(contentNode, getNoderef(), pageMaker.advancedMode(request, this.container));
friendsToadlet.drawNoderefBox(contentNode, getNoderef());

this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
}
Expand Down

0 comments on commit 71d5150

Please sign in to comment.