Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/next' into gradle--update-to-8.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBab committed Nov 30, 2024
2 parents ff472a4 + 82f2ede commit f677d92
Show file tree
Hide file tree
Showing 59 changed files with 1,535 additions and 1,207 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v4

- name: Wrapper validation
uses: gradle/wrapper-validation-action@v2
uses: gradle/actions/wrapper-validation@v4

- name: Speedup dpkg
run: sudo sh -c "echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/force-unsafe-io"
Expand Down
12 changes: 10 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
next:

-

- Update Gradle to 8.9 thanks to Christophe!
- replace length = 0 checks with isEmpty() — thanks to Juiceman!
- do not recommend disabling js helpers in fproxy (these are reviewed)
- add more resilient plugin list exception handling
- Remove gc meddling that hasn’t been necessary for many Java releases
- Add webp filter, thanks to Torusrxxx!
- Update Japanese localization, thanks to qupo1!
- Fix build info with gradle daemon, thanks to Bombe!
- Improve IPv6 handling, thanks to Torusrxxx!
- Hide no longer relevant new load management statistics, thanks to Torusrxxx!

1498:

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/freenet/fred.svg?branch=next)](https://travis-ci.org/freenet/fred)
[![Build status](https://img.shields.io/github/check-runs/hyphanet/fred/next?label=build)](https://github.com/hyphanet/fred/actions)
[![Coverity status](https://scan.coverity.com/projects/2316/badge.svg?flat=1)](https://scan.coverity.com/projects/freenet-fred)

# Freenet
Expand All @@ -11,7 +11,7 @@ Fred stands for Freenet REference Daemon.

## Building

We've included the [Gradle Wrapper](https://docs.gradle.org/3.2/userguide/gradle_wrapper.html) as
We've included the [Gradle Wrapper](https://docs.gradle.org/8.11/userguide/gradle_wrapper.html) as
recommended by the Gradle project. If you trust the version we've committed you can build
immediately:

Expand All @@ -23,7 +23,7 @@ immediately:

> gradlew jar

We've [configured it](gradle/wrapper/gradle-wrapper.properties) to [verify the checksum](https://docs.gradle.org/3.2/userguide/gradle_wrapper.html#sec:verification)
We've [configured it](gradle/wrapper/gradle-wrapper.properties) to [verify the checksum](https://docs.gradle.org/8.11/userguide/gradle_wrapper.html#wrapper_checksum_verification)
of the archive it downloads from `https://services.gradle.org`.

### Build with ant
Expand All @@ -38,7 +38,7 @@ The installers are built from specialized repositories:
- The GNU/Linux, macOS and *nix installer is built from [hyphanet/java_installer](https://github.com/hyphanet/java_installer).
- The Windows installer is built from [hyphanet/wininstaller-innosetup](https://github.com/hyphanet/wininstaller-innosetup) and signed with [hyphanet/sign-windows-installer](https://github.com/hyphanet/sign-windows-installer).

Free code signing for the Windows installer is provided by [SignPath.io](https://about.signpath.io/?), the certificate by the [SignPath Foundation](https://signpath.org/).
Free code signing for the Windows installer is provided by [SignPath.io](https://about.signpath.io/), the certificate by the [SignPath Foundation](https://signpath.org/).


## Testing
Expand All @@ -61,7 +61,7 @@ To test your version of Freenet, build it with ,./gradlew jar`,
stop your node, replace `freenet.jar` in your
Freenet directory with `build/libs/freenet.jar`, and start your node again.

To override values set in `build.gradle` put them into [the file](https://docs.gradle.org/3.2/userguide/build_environment.html)
To override values set in `build.gradle` put them into [the file](https://docs.gradle.org/8.11/userguide/build_environment.html)
`gradle.properties` in the format `variable = value`. For instance:

org.gradle.parallel = true
Expand All @@ -79,10 +79,10 @@ See our [contributor guidelines](CONTRIBUTING.md).

### Get in contact

* Ask the [development mailing list](https://freenetproject.org/pages/help.html#mailing-lists)
* Ask the [development mailing list](https://www.hyphanet.org/pages/help.html#mailing-lists)
or join us in [IRC](https://web.libera.chat/?nick=Rabbit|?#freenet) - `#freenet` on
`irc.libera.chat`.
* You can file problems in the [bug tracker](https://bugs.freenetproject.org/my_view_page.php).
* You can file problems in the [bug tracker](https://freenet.mantishub.io/my_view_page.php).

## Add a new dependency

Expand Down
6 changes: 3 additions & 3 deletions dependencies.properties
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ slf4j-api.order=6
update-sh.version=4
update-sh.filename=update.sh
update-sh.type=OPTIONAL_PRELOAD
update-sh.key=CHK@eqS2pZjAww56FPeX1eDynCV232MN48lD7IXUin1aJQ0,w3kSvNctztRGBWInewFaS7Uz5NF98wMaMGCMzRZbbvk,AAMC--8/update.sh
update-sh.size=16275
update-sh.sha256=380d5b4942d85650359fc224189a85c00400fc6b0d1dbc1d4fa945b0ccba9675
update-sh.key=CHK@U1kfQvYezh4LM2J3enh3KJtLM1dk9ieN1iJ-vwcHk1g,0JbL52oAzZ1xJtfS0r8WLlnQ9aZjXkpIgLuyyEsJ1ss,AAMC--8/update.sh
update-sh.size=16847
update-sh.sha256=879c4576be2185fdbe3408940faa90ba20cd1c75f5dc5afb98992443d4186b73
update-sh.os=ALL_UNIX
update-sh.executable=true
update-cmd.version=1
Expand Down
22 changes: 19 additions & 3 deletions src/freenet/client/filter/CSSTokenizerFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public static <T> T[] concat(T[] a, T[] b) {
allelementVerifiers.add("cursor");
allelementVerifiers.add("direction");
allelementVerifiers.add("display");
allelementVerifiers.add("dominant-baseline");
allelementVerifiers.add("elevation");
allelementVerifiers.add("empty-cells");
allelementVerifiers.add("flex");
Expand Down Expand Up @@ -297,11 +298,13 @@ public static <T> T[] concat(T[] a, T[] b) {
allelementVerifiers.add("text-align");
allelementVerifiers.add("text-align-last");
allelementVerifiers.add("text-autospace");
allelementVerifiers.add("text-combine-upright");
allelementVerifiers.add("text-decoration");
allelementVerifiers.add("text-decoration-color");
allelementVerifiers.add("text-decoration-line");
allelementVerifiers.add("text-decoration-skip");
allelementVerifiers.add("text-decoration-style");
allelementVerifiers.add("text-decoration-thickness");
allelementVerifiers.add("text-emphasis");
allelementVerifiers.add("text-emphasis-color");
allelementVerifiers.add("text-emphasis-position");
Expand Down Expand Up @@ -1001,6 +1004,11 @@ else if("display".equalsIgnoreCase(element))
elementVerifiers.put(element,new CSSPropertyVerifier(null, null, Arrays.asList("131a132", "140<0,1>[1,3]", "137", "138", "139"), null, true));
allelementVerifiers.remove(element);
}
else if("dominant-baseline".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("auto", "text-bottom", "alphabetic", "ideographic", "middle", "central", "mathematical", "hanging", "text-top"),ElementInfo.VISUALMEDIA));
allelementVerifiers.remove(element);
}
else if("elevation".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("below","level","above","higher","lower"),ElementInfo.AURALMEDIA,Arrays.asList("an")));
Expand Down Expand Up @@ -1155,7 +1163,7 @@ else if("line-height".equalsIgnoreCase(element))
}
else if("line-break".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("auto","newspaper","normal","strict","keep-all"),ElementInfo.VISUALMEDIA));
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("auto","anywhere","normal","strict","loose"),ElementInfo.VISUALMEDIA));
allelementVerifiers.remove(element);
}
else if("list-style-image".equalsIgnoreCase(element))
Expand Down Expand Up @@ -1498,6 +1506,11 @@ else if("text-autospace".equalsIgnoreCase(element))
allelementVerifiers.remove(element);

}
else if("text-combine-upright".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("none","all"),ElementInfo.VISUALMEDIA,null,null));
allelementVerifiers.remove(element);
}
else if("text-decoration".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("115a73a104a116")));
Expand Down Expand Up @@ -1530,13 +1543,16 @@ else if("text-decoration-style".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("104")));
allelementVerifiers.remove(element);

}
else if("text-decoration-thickness".equalsIgnoreCase(element))
{
elementVerifiers.put(element, new CSSPropertyVerifier(Arrays.asList("from-font", "auto"), ElementInfo.VISUALMEDIA, Arrays.asList("le", "pe")));
allelementVerifiers.remove(element);
}
else if("text-emphasis".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("73a107")));
allelementVerifiers.remove(element);

}
else if("text-emphasis-color".equalsIgnoreCase(element))
{
Expand Down
19 changes: 1 addition & 18 deletions src/freenet/client/filter/HTMLFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,7 @@ void run() throws IOException, DataFilterException {
// If detecting charset, and found it, stop afterwards.
if(onlyDetectingCharset && detectedCharset != null)
return;
int x;

try {
x = r.read();
}
/**
* libgcj up to at least 4.2.2 has a bug: InputStreamReader.refill() throws this exception when BufferedInputReader.refill() returns false for EOF. See:
* line 299 at InputStreamReader.java (in refill()): http://www.koders.com/java/fidD8F7E2EB1E4C22DA90EBE0130306AE30F876AB00.aspx?s=refill#L279
* line 355 at BufferedInputStream.java (in refill()): http://www.koders.com/java/fid1949641524FAC0083432D79793F554CD85F46759.aspx?s=refill#L355
* TODO: remove this when the gcj bug is fixed and the affected gcj versions are outdated.
*/
catch(java.io.CharConversionException cce) {
if(freenet.node.Node.checkForGCJCharConversionBug()) /* only ignore the exception on affected libgcj */
x = -1;
else
throw cce;
}

int x = r.read();
if (x == -1) {
switch (mode) {
case INTEXT :
Expand Down
44 changes: 27 additions & 17 deletions src/freenet/clients/fcp/RequestStatusCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import freenet.client.ClientMetadata;
import freenet.client.FetchException.FetchExceptionMode;
Expand All @@ -28,16 +29,16 @@ public class RequestStatusCache {

private final ArrayList<RequestStatus> downloads;
private final ArrayList<RequestStatus> uploads;
private final HashMap<String, RequestStatus> requestsByIdentifier;
private final MultiValueTable<FreenetURI, RequestStatus> downloadsByURI;
private final Map<String, RequestStatus> requestsByIdentifier;
private final MultiValueTable<FreenetURI, DownloadRequestStatus> downloadsByURI;
private final MultiValueTable<FreenetURI, RequestStatus> uploadsByFinalURI;

RequestStatusCache() {
downloads = new ArrayList<RequestStatus>();
uploads = new ArrayList<RequestStatus>();
requestsByIdentifier = new HashMap<String, RequestStatus>();
downloadsByURI = new MultiValueTable<FreenetURI, RequestStatus>();
uploadsByFinalURI = new MultiValueTable<FreenetURI, RequestStatus>();
downloads = new ArrayList<>();
uploads = new ArrayList<>();
requestsByIdentifier = new HashMap<>();
downloadsByURI = new MultiValueTable<>();
uploadsByFinalURI = new MultiValueTable<>();
}

synchronized void addDownload(DownloadRequestStatus status) {
Expand Down Expand Up @@ -112,7 +113,7 @@ synchronized void removeByIdentifier(String identifier) {
downloads.remove(status);
FreenetURI uri = status.getURI();
assert(uri != null);
downloadsByURI.removeElement(uri, status);
downloadsByURI.removeElement(uri, (DownloadRequestStatus) status);
} else if(status instanceof UploadRequestStatus) {
uploads.remove(status);
FreenetURI uri = ((UploadRequestStatus) status).getFinalURI();
Expand Down Expand Up @@ -192,17 +193,26 @@ public synchronized void updateStarted(String identifier, FreenetURI redirect) {
}

public synchronized CacheFetchResult getShadowBucket(FreenetURI key, boolean noFilter) {
Object[] downloads = downloadsByURI.getArray(key);
if(downloads == null) return null;
for(Object o : downloads) {
DownloadRequestStatus download = (DownloadRequestStatus) o;
for (DownloadRequestStatus download : downloadsByURI.getAllAsList(key)) {
Bucket data = download.getDataShadow();
if(data == null) continue;
if(data.size() == 0) continue;
if(noFilter && download.filterData) continue;
if (data == null) {
continue;
}
if (data.size() == 0) {
continue;
}
if (noFilter && download.filterData) {
continue;
}
// FIXME it probably *is* worth the effort to allow this when it is overridden on the fetcher, since the user changed the type???
if(download.overriddenDataType) continue;
return new CacheFetchResult(new ClientMetadata(download.getMIMEType()), new NoFreeBucket(data), download.filterData);
if (download.overriddenDataType) {
continue;
}
return new CacheFetchResult(
new ClientMetadata(download.getMIMEType()),
new NoFreeBucket(data),
download.filterData
);
}
return null;
}
Expand Down
43 changes: 19 additions & 24 deletions src/freenet/clients/http/BookmarkEditorToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,10 @@ else if("edit".equals(action) || "addItem".equals(action) || "addCat".equals(act
if(req.isPartSet("name"))
name = req.getPartAsStringFailsafe("name", MAX_NAME_LENGTH);

if("edit".equals(action)) {
Bookmark targetBookmark = bookmarkManager.getBookmarkByPath(bookmarkManager.parentPath(bookmarkPath) + name);
if (!isValidName(name) || (targetBookmark != null && targetBookmark != bookmark)) {
addNameError(pageMaker, content);
} else if ("edit".equals(action)) {
bookmarkManager.renameBookmark(bookmarkPath, name);
boolean hasAnActivelink = req.isPartSet("hasAnActivelink");
if(bookmark instanceof BookmarkItem) {
Expand All @@ -394,7 +397,7 @@ else if("edit".equals(action) || "addItem".equals(action) || "addCat".equals(act

} else if("addItem".equals(action) || "addCat".equals(action)) {

Bookmark newBookmark = null;
Bookmark newBookmark;
if("addItem".equals(action)) {
FreenetURI key = new FreenetURI(req.getPartAsStringFailsafe("key", MAX_KEY_LENGTH));
/* TODO:
Expand All @@ -404,29 +407,21 @@ else if("edit".equals(action) || "addItem".equals(action) || "addCat".equals(act
* - values as "on", "true", "yes" should be accepted.
*/
boolean hasAnActivelink = req.isPartSet("hasAnActivelink");
if (!isValidName(name)) {
addNameError(pageMaker, content);
} else
newBookmark = new BookmarkItem(key, name,
req.getPartAsStringFailsafe("descB", MAX_KEY_LENGTH),
req.getPartAsStringFailsafe("explain", MAX_EXPLANATION_LENGTH),
hasAnActivelink, bookmarkManager, ctx.getAlertManager());
} else
if (!isValidName(name)) {
addNameError(pageMaker, content);
} else
newBookmark = new BookmarkCategory(name);

if (newBookmark != null) {

bookmarkManager.addBookmark(bookmarkPath, newBookmark);
bookmarkManager.storeBookmarks();
if(newBookmark instanceof BookmarkItem)
sendBookmarkFeeds(req, (BookmarkItem) newBookmark, req.getPartAsStringFailsafe("publicDescB", MAX_KEY_LENGTH));

pageMaker.getInfobox("infobox-success", NodeL10n.getBase().getString("BookmarkEditorToadlet.addedNewBookmarkTitle"), content, "bookmark-add-new", false).
addChild("p", NodeL10n.getBase().getString("BookmarkEditorToadlet.addedNewBookmark"));
newBookmark = new BookmarkItem(key, name,
req.getPartAsStringFailsafe("descB", MAX_KEY_LENGTH),
req.getPartAsStringFailsafe("explain", MAX_EXPLANATION_LENGTH),
hasAnActivelink, bookmarkManager, ctx.getAlertManager());
} else {
newBookmark = new BookmarkCategory(name);
}

bookmarkManager.addBookmark(bookmarkPath, newBookmark);
bookmarkManager.storeBookmarks();
if(newBookmark instanceof BookmarkItem)
sendBookmarkFeeds(req, (BookmarkItem) newBookmark, req.getPartAsStringFailsafe("publicDescB", MAX_KEY_LENGTH));

pageMaker.getInfobox("infobox-success", NodeL10n.getBase().getString("BookmarkEditorToadlet.addedNewBookmarkTitle"), content, "bookmark-add-new", false).
addChild("p", NodeL10n.getBase().getString("BookmarkEditorToadlet.addedNewBookmark"));
}
}
else if("share".equals(action))
Expand Down
8 changes: 4 additions & 4 deletions src/freenet/clients/http/ConfigToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ public void handleMethodPOST(URI uri, HTTPRequest request,
}
String params = paramsBuilder.toString();
if (directorySelector) {
MultiValueTable<String, String> headers = new MultiValueTable<String, String>(
1);
// params ends in &. Download directory browser starts in default
// download directory.
headers.put("Location", directoryBrowserPath + params + "path="
+ core.getDownloadsDir().getAbsolutePath());
MultiValueTable<String, String> headers = MultiValueTable.from(
"Location",
directoryBrowserPath + params + "path=" + core.getDownloadsDir().getAbsolutePath()
);
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
return;
}
Expand Down
7 changes: 4 additions & 3 deletions src/freenet/clients/http/ConnectionsToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@ public void handleMethodGET(URI uri, final HTTPRequest request, ToadletContext c
if(path.endsWith("myref.fref")) {
SimpleFieldSet fs = getNoderef();
String noderefString = fs.toOrderedStringWithBase64();
MultiValueTable<String, String> extraHeaders = new MultiValueTable<String, String>();
// Force download to disk
extraHeaders.put("Content-Disposition", "attachment; filename=myref.fref");
MultiValueTable<String, String> extraHeaders = MultiValueTable.from(
// Force download to disk
"Content-Disposition", "attachment; filename=myref.fref"
);
writeReply(ctx, 200, "application/x-freenet-reference", "OK", extraHeaders, noderefString);
return;
}
Expand Down
Loading

0 comments on commit f677d92

Please sign in to comment.