Compare commits

...

14 Commits

18 changed files with 308 additions and 205 deletions

View File

@ -107,7 +107,7 @@ jobs:
- run: echo enabled=1 >> /etc/yum.repos.d/adoptium.repo
- run: echo gpgcheck=1 >> /etc/yum.repos.d/adoptium.repo
- run: echo gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public >> /etc/yum.repos.d/adoptium.repo
- run: dnf clean all && rm -r /var/cache/dnf && dnf upgrade -y && dnf update -y
- run: dnf clean all && rm -rf /var/cache/dnf && dnf upgrade -y && dnf update -y
- run: dnf install -y temurin-21-jdk
- name: Generate override.properties
run: |

82
.github/workflows/nightly.yml vendored Normal file
View File

@ -0,0 +1,82 @@
name: Nightly
#on: [push]
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
CHANGES.md
sparse-checkout-cone-mode: false
- name: sleep 15 minutes
run: |
echo "sleeping 15 minutes to wait for artifacts"
sleep 1m
echo "sleeping 14 minutes to wait for artifacts"
sleep 1m
echo "sleeping 13 minutes to wait for artifacts"
sleep 1m
echo "sleeping 12 minutes to wait for artifacts"
sleep 1m
echo "sleeping 11 minutes to wait for artifacts"
sleep 1m
echo "sleeping 10 minutes to wait for artifacts"
sleep 1m
echo "sleeping 9 minutes to wait for artifacts"
sleep 1m
echo "sleeping 8 minutes to wait for artifacts"
sleep 1m
echo "sleeping 7 minutes to wait for artifacts"
sleep 1m
echo "sleeping 6 minutes to wait for artifacts"
sleep 1m
echo "sleeping 5 minutes to wait for artifacts"
sleep 1m
echo "sleeping 4 minutes to wait for artifacts"
sleep 1m
echo "sleeping 3 minutes to wait for artifacts"
sleep 1m
echo "sleeping 2 minutes to wait for artifacts"
sleep 1m
echo "sleeping 1 minutes to wait for artifacts"
sleep 1m
- name: Download artifacts
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
skip_unpack: true
workflow: ant.yml
if_no_artifact_found: fail
# remove .zip file extension
- run: for f in *.zip; do unzip "$f"; rm "$f"; done
- run: echo "" | tee -a CHANGES.md
- run: echo "## Checksums" | tee -a CHANGES.md
- run: echo "" | tee -a CHANGES.md
- run: echo '```' | tee -a CHANGES.md
- run: sha256sum * | tee -a CHANGES.md
- run: echo '```' | tee -a CHANGES.md
- run: echo "" | tee -a CHANGES.md
- run: echo '```' | tee -a CHANGES.md
- run: file * | tee -a CHANGES.md
- run: echo '```' | tee -a CHANGES.md
- run: echo "" | tee -a CHANGES.md
- name: Upload artifacts
uses: ncipollo/release-action@v1
with:
commit: $GITHUB_SHA
name: nightly
prerelease: true
makeLatest: true
allowUpdates: true
artifacts: "*"
bodyFile: "CHANGES.md"

View File

@ -1,3 +1,14 @@
2025 Tue, January 7
-------------------
- Disable downloading Chrome extensions, begin phasing out Chrome support
Sat, October 19
---------------
- Ignore most changes when running in Tor Browser, only set the proxy
- 2.7.0 release
Mon, July 8
-----------

View File

@ -7,7 +7,7 @@ RUN echo enabled=1 >> /etc/yum.repos.d/adoptium.repo
RUN echo gpgcheck=1 >> /etc/yum.repos.d/adoptium.repo
RUN echo gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public >> /etc/yum.repos.d/adoptium.repo
RUN cat /etc/yum.repos.d/adoptium.repo
RUN dnf clean all && rm -r /var/cache/dnf && dnf upgrade -y && dnf update -y
RUN dnf clean all && rm -rf /var/cache/dnf && dnf upgrade -y && dnf update -y
RUN dnf -y install rpm-build temurin-19-jdk
ADD . /src/i2p.plugins.firefox
WORKDIR /src/i2p.plugins.firefox

View File

@ -6,41 +6,26 @@ Extension Versions
```md
i2p-in-private-browsing
2.6.0
https://addons.mozilla.org/firefox/downloads/file/4339795/i2p_in_private_browsing-2.6.0.xpi
2.7.0
https://addons.mozilla.org/firefox/downloads/file/4364373/i2p_in_private_browsing-2.7.0.xpi
noscript
11.4.34
https://addons.mozilla.org/firefox/downloads/file/4333280/noscript-11.4.34.xpi
12.1.1
https://addons.mozilla.org/firefox/downloads/file/4411102/noscript-12.1.1.xpi
localcdn-fork-of-decentraleyes
2.6.72
https://addons.mozilla.org/firefox/downloads/file/4336546/localcdn_fork_of_decentraleyes-2.6.72.xpi
2.6.76
https://addons.mozilla.org/firefox/downloads/file/4401439/localcdn_fork_of_decentraleyes-2.6.76.xpi
onion-in-container-browsing
0.82
https://addons.mozilla.org/firefox/downloads/file/3904685/onion_in_container_browsing-0.82.xpi
javascript-restrictor
0.19
https://addons.mozilla.org/firefox/downloads/file/4339678/javascript_restrictor-0.19.xpi
0.19.1
https://addons.mozilla.org/firefox/downloads/file/4352350/javascript_restrictor-0.19.1.xpi
ublock-origin
1.59.0
https://addons.mozilla.org/firefox/downloads/file/4328681/ublock_origin-1.59.0.xpi
1.61.2
https://addons.mozilla.org/firefox/downloads/file/4391011/ublock_origin-1.61.2.xpi
```
## Chromium
```md
__MSG_extensionName__
1.29
https://clients2.google.com/service/update2/crx
NoScript
11.4.33
https://clients2.google.com/service/update2/crx
LocalCDN
2.6.72
https://clients2.google.com/service/update2/crx
uBlock Origin
1.59.0
https://clients2.google.com/service/update2/crx
__MSG_extensionName__
0.19
https://clients2.google.com/service/update2/crx
```

View File

@ -885,7 +885,7 @@ Linux(because the top command will be run and the script will exit).\n\nBoth det
<redirector output="VERSION.md" error="VERSION.md" alwayslog="true" append="true"></redirector>
<arg value="```md"/>
</exec>
<exec executable="manifest-json-version" failonerror="true">
<!--<exec executable="manifest-json-version" failonerror="true">
<redirector output="VERSION.md" error="VERSION.md" alwayslog="true" append="true"></redirector>
<arg value="-mf"/>
<arg value="src/i2p.chromium.base.profile/extensions/i2pchrome.js/manifest.json"/>
@ -909,7 +909,7 @@ Linux(because the top command will be run and the script will exit).\n\nBoth det
<redirector output="VERSION.md" error="VERSION.md" alwayslog="true" append="true"></redirector>
<arg value="-mf"/>
<arg value="src/i2p.chromium.usability.profile/extensions/jshelter.js/manifest.json"/>
</exec>
</exec>-->
<exec executable="echo" failonerror="true">
<redirector output="VERSION.md" error="VERSION.md" alwayslog="true" append="true"></redirector>
<arg value="```"/>
@ -918,20 +918,20 @@ Linux(because the top command will be run and the script will exit).\n\nBoth det
<target name="i2pChromiumBaseProfile">
<mkdir dir="src/i2p.chromium.base.profile/extensions/" />
<exec executable="crx3" failonerror="true">
<!--<exec executable="crx3" failonerror="true">
<arg value="download"/>
<arg value="ikdjcmomgldfciocnpekfndklkfgglpe" />
<arg value="-u=true"/>
<arg value="-o" />
<arg value="src/i2p.chromium.base.profile/extensions/i2pchrome.js.crx" />
</exec>
<exec executable="crx3" failonerror="true">
</exec>-->
<!--<exec executable="crx3" failonerror="true">
<arg value="download"/>
<arg value="doojmbjmlfjjnbmnoijecmcbfeoakpjm" />
<arg value="-u=true"/>
<arg value="-o" />
<arg value="src/i2p.chromium.base.profile/extensions/noscript.js.crx" />
</exec>
</exec>-->
<exec executable="echo" failonerror="true" append="false" output="src/i2p.chromium.base.profile/version.md">
<arg value="Profile Version" />
</exec>
@ -951,7 +951,7 @@ Linux(because the top command will be run and the script will exit).\n\nBoth det
<target name="i2pChromiumUsabilityProfile">
<mkdir dir="src/i2p.chromium.usability.profile/extensions/" />
<exec executable="crx3" failonerror="true">
<!--<exec executable="crx3" failonerror="true">
<arg value="download"/>
<arg value="ikdjcmomgldfciocnpekfndklkfgglpe" />
<arg value="-u=true"/>
@ -978,7 +978,7 @@ Linux(because the top command will be run and the script will exit).\n\nBoth det
<arg value="-u=true"/>
<arg value="-o" />
<arg value="src/i2p.chromium.usability.profile/extensions/localcdn.js.crx" />
</exec>
</exec>-->
<exec executable="echo" failonerror="true" append="false" output="src/i2p.chromium.usability.profile/version.md">
<arg value="Profile Version" />
</exec>

Binary file not shown.

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Tue Aug 20 23:41:03 EDT 2024
build.number=746
#Tue Jan 07 18:04:41 EST 2025
build.number=805

View File

@ -26,7 +26,7 @@ import java.util.stream.Stream;
* @author idk
* @since 0.0.1
*/
public class I2PChromium extends I2PChromiumProfileUnpacker {
public class I2PChromium extends I2PChromiumProfileBuilder {
private final String[] CHROMIUM_SEARCH_PATHS = CHROMIUM_FINDER();
private Process p = null;
private String chromePath;

View File

@ -30,8 +30,7 @@ public class I2PChromiumProfileBuilder extends I2PChromiumProfileChecker {
return profileDir.getAbsolutePath();
} else {
// create the directory
I2PChromiumProfileUnpacker unpacker = new I2PChromiumProfileUnpacker();
if (!unpacker.unpackProfile(profileDir.getAbsolutePath(), mode)) {
if (!this.unpackProfile(profileDir.getAbsolutePath(), "chromium", mode)) {
return null;
}
return profileDir.getAbsolutePath();
@ -54,8 +53,7 @@ public class I2PChromiumProfileBuilder extends I2PChromiumProfileChecker {
if (pdf.exists() && pdf.isDirectory()) {
return pd;
} else {
I2PChromiumProfileUnpacker unpacker = new I2PChromiumProfileUnpacker();
if (!unpacker.unpackProfile(pdf.getAbsolutePath(), mode)) {
if (!this.unpackProfile(pdf.getAbsolutePath(), "chromium", mode)) {
return null;
}
}

View File

@ -1,42 +0,0 @@
package net.i2p.i2pfirefox;
/**
* I2PChromiumProfileUnpacker.java
* Copyright (C) 2022 idk <hankhill19580@gmail.com>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the MIT License. See LICENSE.md for details.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* I2PChromiumProfileUnpacker is a class that unpacks the Chromium profile zip
* file into the Chromium base profile directory. This is not used by the
* Chromium browser instance, it's unpacked to the disk to be copied to the
* active profile directory.
*
* @author idk
* @since 0.0.1
*/
public class I2PChromiumProfileUnpacker extends I2PChromiumProfileBuilder {
public static void main(String[] args) {
I2PChromiumProfileUnpacker pu = new I2PChromiumProfileUnpacker();
String profileDirectory = pu.profileDirectory("base");
if (profileDirectory == null) {
pu.logger.info("No profile directory found");
return;
}
}
/**
* unpack the profile directory
*
* @return true if the profile directory was successfully unpacked
* @since 0.0.1
*/
public boolean unpackProfile(String profileDirectory, String mode) {
logger.info("Unpacking base profile to " + profileDirectory);
return unpackProfile(profileDirectory, "chromium", mode);
}
}

View File

@ -434,7 +434,7 @@ public class I2PCommonBrowser {
* copied to
* @throws IOException if an I/O error occurs during the file copy process
*/
private void copyFile(File sourceFile, File destinationFile)
public void copyFile(File sourceFile, File destinationFile)
throws IOException {
try (InputStream in = new FileInputStream(sourceFile);
OutputStream out = new FileOutputStream(destinationFile)) {

View File

@ -1,9 +1,11 @@
package net.i2p.i2pfirefox;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
@ -27,7 +29,7 @@ import java.util.stream.Stream;
* @author idk
* @since 0.0.1
*/
public class I2PFirefox extends I2PFirefoxProfileUnpacker {
public class I2PFirefox extends I2PFirefoxProfileBuilder {
private final String[] FIREFOX_SEARCH_PATHS = FIREFOX_FINDER();
private Process process = null;
private String firefoxPath;
@ -124,6 +126,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
}
return exePath;
}
public String[] firefoxPathsOSX() {
String firefoxPathsProp = getProperties().getProperty("firefox.paths.osx");
if (firefoxPathsProp != null)
@ -134,6 +137,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
"/Applications/Waterfox.app/Contents/MacOS",
"/Applications/Librewolf.app/Contents/MacOS"};
}
private String[] FIND_FIREFOX_SEARCH_PATHS_OSX() {
String[] path = firefoxPathsOSX();
String[] exes = firefoxBinsUnix();
@ -147,6 +151,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
}
return exePath;
}
public String[] firefoxPathsWindows() {
String firefoxPathsProp =
getProperties().getProperty("firefox.paths.windows");
@ -181,6 +186,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
new File(programFiles, "Librewolf/").toString(),
};
}
private String[] firefoxBinsWindows() {
String firefoxPathsProp =
getProperties().getProperty("firefox.bins.windows");
@ -192,6 +198,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
"waterfox.exe", "waterfox-bin.exe", "librewolf.exe",
};
}
private String[] FIND_FIREFOX_SEARCH_PATHS_WINDOWS() {
String[] path = firefoxPathsWindows();
String[] exes = firefoxBinsWindows();
@ -226,6 +233,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
}
return exePath;
}
private String[] FIND_FIREFOX_SEARCH_PATHS() {
switch (getOperatingSystem()) {
case "Windows":
@ -337,6 +345,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
return new String[] {};
}
private String[] FIREFOX_FINDER() {
String[] nearby = NEARBY_FIREFOX_SEARCH_PATHS();
String[] all = FIND_FIREFOX_SEARCH_PATHS();
@ -366,8 +375,9 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
if (firefoxFile.exists()) {
logger.info("Found valid firefox at " + firefox);
validFirefoxes.add(firefox);
} else {
logger.info("firefox at " + firefox + "does not exist");
}
logger.info("firefox at " + firefox + "does not exist");
}
return validFirefoxes.toArray(new String[validFirefoxes.size()]);
}
@ -376,7 +386,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
* Return the best available Firefox from the list of Firefoxes we have.
*
* @return the path to the best available Firefox, or null if none are
* found.
* found.
* @since 0.0.1
*/
public String topFirefox() {
@ -411,7 +421,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
*
* @param override the path to a valid Firefox binary to use.
* @return the path to the best available Firefox, or null if none are
* found.
* found.
* @since 0.0.1
*/
public String topFirefox(String overrideFirefox) {
@ -429,7 +439,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
* the default profile.
*
* @return a ProcessBuilder for the top Firefox binary and
* the default profile.
* the default profile.
* @since 0.0.1
*/
public ProcessBuilder defaultProcessBuilder() {
@ -442,7 +452,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
*
* @param args the args to pass to the Firefox binary
* @return a ProcessBuilder for the top Firefox binary and
* the default profile.
* the default profile.
*/
public ProcessBuilder defaultProcessBuilder(String[] args) {
return processBuilder(args, false);
@ -455,7 +465,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
*
* @param args the arguments to pass to the Firefox binary.
* @return a ProcessBuilder for the top Firefox binary and
* the default profile.
* the default profile.
* @since 0.0.1
*/
public ProcessBuilder privateProcessBuilder() {
@ -469,7 +479,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
*
* @param args the arguments to pass to the Firefox binary
* @return a ProcessBuilder for the top Firefox binary and
* the default profile.
* the default profile.
*/
public ProcessBuilder privateProcessBuilder(String[] args) {
ArrayList<String> argList = new ArrayList<String>();
@ -491,7 +501,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
*
* @param args the arguments to pass to the Firefox binary.
* @return a ProcessBuilder for the top Firefox binary and
* the default profile.
* the default profile.
* @since 0.0.1
*/
public ProcessBuilder appProcessBuilder() {
@ -505,7 +515,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
*
* @param args the arguments to pass to the Firefox binary
* @return a ProcessBuilder for the top Firefox binary and
* the default profile.
* the default profile.
*/
public ProcessBuilder appProcessBuilder(String[] args) {
ArrayList<String> argList = new ArrayList<String>();
@ -526,7 +536,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
*
* @param args the arguments to pass to the Firefox binary
* @return a ProcessBuilder for the top Firefox binary and
* the default profile.
* the default profile.
*/
public ProcessBuilder headlessProcessBuilder(String[] args) {
ArrayList<String> argList = new ArrayList<String>();
@ -548,14 +558,14 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
*
* @param args the extended arguments to pass to the Firefox binary.
* @return a ProcessBuilder for the top Firefox binary and
* default profile, with a specific set of extended arguments.
* default profile, with a specific set of extended arguments.
* @since 0.0.1
*/
/*
public ProcessBuilder processBuilder(String[] args ) {
return processBuilder(args, false);
}
*/
* public ProcessBuilder processBuilder(String[] args ) {
* return processBuilder(args, false);
* }
*/
public ProcessBuilder processBuilder(String[] args, boolean app) {
String firefox = topFirefox();
if (!firefox.isEmpty()) {
@ -683,7 +693,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
pb.environment().put("TOR_SKIP_CONTROLPORTTEST", "1");
pb.environment().put("TOR_NONTOR_PROXY", "1");
return pb;
//}
// }
// return null;
}
@ -693,12 +703,14 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
}
return "base";
}
public Process launchAndDetatch(boolean privateWindow, String[] url) {
int privateWindowInt = 0;
if (privateWindow)
privateWindowInt = 1;
return launchAndDetatch(privateWindowInt, url);
}
public Process launchAndDetatch(int privateWindow, String[] url) {
validateUserDirectory();
boolean app = false;
@ -706,12 +718,13 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
app = true;
if (waitForProxy()) {
String profileDirectory = this.profileDirectory(app, baseMode());
if (this.validateProfileDirectory(profileDirectory)) {
if (this.validateProfileDirectory(profileDirectory) && !isTorBrowser()) {
logger.info("Valid profile directory: " + profileDirectory);
} else {
logger.info("Invalid profile directory: " + profileDirectory +
" rebuilding...");
if (!this.copyBaseProfiletoProfile(usabilityMode(), app)) {
if (!this.copyBaseProfiletoProfile(usabilityMode(), app,
isTorBrowser())) {
logger.info("Failed to rebuild profile directory: " +
profileDirectory);
return null;
@ -720,7 +733,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
}
}
if (validateProfileFirstRun(profileDirectory)) {
if (isWindows()) {
if (isWindows() && !isTorBrowser()) {
ProcessBuilder hpb = headlessProcessBuilder(url);
try {
Process hp = hpb.start();
@ -786,8 +799,8 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
* Waits for an HTTP proxy on the port 4444 to be ready.
* Launches Firefox with the profile directory.
*
* @param bool if true, the profile will be ephemeral(i.e. a
* --private-window profile).
* @param bool if true, the profile will be ephemeral(i.e. a
* --private-window profile).
* @param String[] a list of URL's to pass to the browser window
* @since 0.0.17
*/
@ -797,6 +810,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
priv = 1;
launch(priv, url);
}
public void launch(int privateWindow, String[] url) {
if (waitForProxy()) {
process = launchAndDetatch(privateWindow, url);
@ -820,7 +834,7 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
* Launches Firefox with the profile directory.
*
* @param bool if true, the profile will be ephemeral(i.e. a
* --private-window profile).
* --private-window profile).
* @since 0.0.1
*/
public void launch(boolean privateWindow) { launch(privateWindow, null); }
@ -902,12 +916,40 @@ public class I2PFirefox extends I2PFirefoxProfileUnpacker {
visitURL.toArray(new String[visitURL.size()]));
}
/*private void sleep(int millis) {
public boolean isTorBrowser() {
String[] args = {"--version"};
ProcessBuilder tpb = defaultProcessBuilder(args);
try {
Thread.sleep(millis);
} catch (InterruptedException bad) {
bad.printStackTrace();
throw new RuntimeException(bad);
Process tp = tpb.start();
BufferedReader reader =
new BufferedReader(new InputStreamReader(tp.getInputStream()));
StringBuilder builder = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append(System.getProperty("line.separator"));
}
String result = builder.toString().toLowerCase();
if (result.contains("tor ")) {
logger.info("running in Tor Browser, modifying only required config");
return true;
} else {
logger.info("running in regular Firefox, using extended config");
return false;
}
} catch (Exception e) {
return false;
}
}*/
}
/*
* private void sleep(int millis) {s
* try {
* Thread.sleep(millis);
* } catch (InterruptedException bad) {
* bad.printStackTrace();
* throw new RuntimeException(bad);
* }
* }
*/
}

View File

@ -1,6 +1,7 @@
package net.i2p.i2pfirefox;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
@ -25,6 +26,44 @@ import java.nio.file.StandardCopyOption;
*/
public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
private boolean strict;
private String TBB_BASE =
"user_pref(\"extensions.torbutton.use_nontor_proxy\", true);\n"
+ "user_pref(\"extensions.torlauncher.start_tor\", false);\n"
+ "user_pref(\"extensions.torlauncher.prompt_at_startup\", false);\n"
+
"user_pref(\"network.proxy.no_proxies_on\", \"127.0.0.1:7657,localhost:7657,127.0.0.1:7662,localhost:7662,127.0.0.1:7669,localhost:7669\");\n"
+ "user_pref(\"network.proxy.type\", 1);\n"
+ "user_pref(\"network.proxy.http\", \"127.0.0.1\");\n"
+ "user_pref(\"network.proxy.http_port\", 4444);\n"
+ "user_pref(\"network.proxy.ssl\", \"127.0.0.1\");\n"
+ "user_pref(\"network.proxy.ssl_port\", 4444);\n"
+ "user_pref(\"network.proxy.ftp\", \"127.0.0.1\");"
+ "user_pref(\"network.proxy.ftp_port\", 4444);\n"
+ "user_pref(\"network.proxy.socks\", \"127.0.0.1\");\n"
+ "user_pref(\"network.proxy.socks_port\", 4444);\n"
+ "user_pref(\"network.proxy.share_proxy_settings\", true);\n"
+ "user_pref(\"browser.startup.homepage\", \"about:blank\");\n"
+ "user_pref(\"keyword.enabled\", false);\n"
+ "user_pref(\"extensions.allowPrivateBrowsingByDefault\", true);\n"
+ "user_pref(\"extensions.PrivateBrowsing.notification\", false);\n"
+ "user_pref(\"extensions.pocket.enabled\", false);\n"
+
"user_pref(\"browser.newtabpage.activity-stream.showSponsoredTopSites\", false);\n"
+
"user_pref(\"browser.newtabpage.activity-stream.showSponsored\", false);\n"
+
"user_pref(\"services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsored\", false);\n"
+
"user_pref(\"browser.newtabpage.activity-stream.feeds.section.highlights\", false);\n"
+
"user_pref(\"browser.newtabpage.activity-stream.feeds.section.topstories\", false);\n"
+
"user_pref(\"browser.newtabpage.activity-stream.default.sites\", \"http://planet.i2p/,http://legwork.i2p/,http://i2pwiki.i2p/,http://i2pforums.i2p/,http://zzz.i2p/\");\n"
+
"user_pref(\"browser.newtabpage.activity-stream.feeds.topsites\", true);\n"
+ "user_pref(\"browser.fixup.domainsuffixwhitelist.i2p\", true);\n";
private String userChromeCSS() {
String ret =
"@namespace url(\"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\")\n";
@ -99,19 +138,24 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
* @return the profile directory, or null if it could not be created
*/
// public String profileDirectory() {
// return profileDirectory("I2P_FIREFOX_PROFILE", "firefox", false);
// return profileDirectory("I2P_FIREFOX_PROFILE", "firefox", false);
// }
private String baseProfileDir(String file, String base) {
private String baseProfileDir(String file, String base,
boolean isTorBrowser) {
File profileDir = new File(file, "i2p.firefox." + base + ".profile");
// make sure the directory exists
if (profileDir.exists()) {
return profileDir.getAbsolutePath();
} else {
// create the directory
I2PFirefoxProfileUnpacker unpacker = new I2PFirefoxProfileUnpacker();
if (!unpacker.unpackProfile(profileDir.getAbsolutePath(), base)) {
return null;
if (!isTorBrowser) {
if (!this.unpackProfile(profileDir.getAbsolutePath(), "firefox",
base)) {
return null;
}
} else {
makeTBBDirectory(profileDir, profileDir);
}
return profileDir.getAbsolutePath();
}
@ -122,21 +166,20 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
*
* @return the base profile directory, or null if it could not be created
*/
public String baseProfileDirectory(String base) {
public String baseProfileDirectory(String base, boolean isTorBrowser) {
String pd = System.getenv("I2P_FIREFOX_BASE_PROFILE");
if (pd != null && !pd.isEmpty()) {
File pdf = new File(pd);
if (pdf.exists() && pdf.isDirectory()) {
return pd;
} else {
I2PFirefoxProfileUnpacker unpacker = new I2PFirefoxProfileUnpacker();
if (!unpacker.unpackProfile(pdf.getAbsolutePath(), base)) {
if (!this.unpackProfile(pdf.getAbsolutePath(), "firefox", base)) {
return null;
}
}
}
String rtd = runtimeDirectory();
return baseProfileDir(rtd, base);
return baseProfileDir(rtd, base, isTorBrowser);
}
/**
@ -177,11 +220,10 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
*
* @since 0.0.1
*/
public boolean copyBaseProfiletoProfile(String base, boolean app) {
String baseProfile = baseProfileDirectory(base);
public boolean copyBaseProfiletoProfile(String base, boolean app,
boolean isTorBrowser) {
String baseProfile = baseProfileDirectory(base, isTorBrowser);
String profile = profileDirectory(app, base);
logger.info("Copying base profile to profile directory: " + baseProfile +
" -> " + profile);
if (baseProfile.isEmpty() || profile.isEmpty()) {
return false;
}
@ -190,24 +232,31 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
if (!profileDir.exists()) {
try {
logger.info("Copying base profile to profile directory");
copyDirectory(baseProfileDir, profileDir, "firefox", base);
if (!isTorBrowser) {
logger.info("Copying base profile to profile directory: " +
baseProfile + " -> " + profile);
copyDirectory(baseProfileDir, profileDir, "firefox", base);
} else {
logger.info("Creating base directory for use with Tor Browser");
makeTBBDirectory(baseProfileDir, profileDir);
}
logger.info("Copied base profile to profile directory");
return true;
} catch (Exception e) {
logger.info("Error copying base profile to profile" + e);
return false;
}
logger.info("Copied base profile to profile directory");
}
// if user.js does not exist yet, make an empty one.
// if (!touch(profileDir.toString(), "user.js")) {
// return false;
//}
// }
// if extensions does not exist yet, make an empty one.
// if (!mkExtensionsDir(profileDir.toString())){
// return false;
//}
// }
return copyStrictOptions(base, app);
return copyStrictOptions(base, app, isTorBrowser);
}
protected boolean writeAppChrome(String profile) {
@ -223,6 +272,7 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
}
return true;
}
protected boolean deleteAppChrome(String profile) {
File dir = new File(profile, "chrome");
if (!dir.exists())
@ -232,15 +282,17 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
f.delete();
return true;
}
/**
* Copy the strict options from the base profile to the profile
*
* @return true if successful, false otherwise
* @since 0.0.1
*/
public boolean copyStrictOptions(String base, boolean app) {
public boolean copyStrictOptions(String base, boolean app,
boolean isTorBrowser) {
logger.info("Checking strict options");
String baseProfile = baseProfileDirectory(base);
String baseProfile = baseProfileDirectory(base, isTorBrowser);
String profile = profileDirectory(app, base);
if (baseProfile.isEmpty() || profile.isEmpty()) {
logger.info("Empty paths");
@ -249,8 +301,8 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
File baseProfileDir = new File(baseProfile);
File profileDir = new File(profile);
setupUserChrome(profileDir, app);
if (!baseProfileDir.exists() || !profileDir.exists()) {
logger.info("Empty directories");
if (!baseProfileDir.exists()) {
logger.info("Empty base directories: " + baseProfileDir);
return false;
}
File baseOverrides = new File(baseProfile, "strict-overrides.js");
@ -317,6 +369,20 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
}
}
protected void makeTBBDirectory(File sourceDir, File destDir) {
logger.info("creating TBB directory");
if (!destDir.exists())
destDir.mkdir();
File workUserJs = new File(destDir, "user.js");
// Write the value of TBB_BASE to the file workUserJs
try (FileWriter writer = new FileWriter(workUserJs)) {
logger.info("writing TBB user.js");
writer.write(TBB_BASE);
} catch (IOException e) {
logger.info("Error writing to file: " + e.getMessage());
}
}
/**
* Construct a new Profile Builder
*
@ -326,6 +392,7 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
/**
* Construct a new Profile Builder
*
* @param strict if true, the strict overrides will be copied to the profile
*
* @since 0.0.1

View File

@ -1,41 +0,0 @@
package net.i2p.i2pfirefox;
/**
* I2PFirefoxProfileUnpacker.java
* Copyright (C) 2022 idk <hankhill19580@gmail.com>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the MIT License. See LICENSE.md for details.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* I2PFirefoxProfileUnpacker is a class that unpacks the I2P Firefox profile
* from a zip file embedded in the `jar` file. The zip is unpacked to a base
* directory where it is left untouched, and the base profile is copied to the
* active profile directory.
*
* @author idk
* @since 0.0.1
*/
public class I2PFirefoxProfileUnpacker extends I2PFirefoxProfileBuilder {
public static void main(String[] args) {
I2PFirefoxProfileUnpacker up = new I2PFirefoxProfileUnpacker();
String profileDirectory = up.profileDirectory(false, "base");
if (profileDirectory == null) {
up.logger.info("No profile directory found");
return;
}
}
/**
* unpack the profile directory
*
* @return true if the profile directory was successfully unpacked
* @since 0.0.1
*/
public boolean unpackProfile(String profileDirectory, String base) {
return unpackProfile(profileDirectory, "firefox", base);
}
}

View File

@ -116,7 +116,7 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
_log.info("I2P Browser tray manager not supported");
try {
I2PBrowser i2pBrowser = new I2PBrowser(profileDir.getAbsolutePath());
String[] args = {"http://proxy.i2p"};
String[] args = {"http://127.0.0.1:7657"};
i2pBrowser.launchFirefox(0, args);
} catch (Exception e) {
_log.error("Error starting I2P Browser", e);
@ -124,7 +124,7 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
} else {
try {
_log.info(
"Starting I2P Browser tray manager by testing http://proxy.i2p");
"Starting I2P Browser tray manager by testing http://127.0.0.1:7657");
MenuService dtg = startTrayApp();
try {
Thread.sleep(5000);
@ -144,7 +144,7 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
_log.info("I2P Browser tray manager not found");
}
I2PBrowser i2pBrowser = new I2PBrowser(profileDir.getAbsolutePath());
String[] args = {"http://proxy.i2p"};
String[] args = {"http://127.0.0.1:7657"};
i2pBrowser.launchFirefox(0, args);
} catch (Exception e) {
_log.error("Error starting I2P Browser tray manager", e);
@ -190,8 +190,8 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
// Ubuntu GNOME does not work, SystemTray.isSupported() returns false
String xdg = System.getenv("XDG_CURRENT_DESKTOP");
boolean dflt = SystemVersion.isWindows() || SystemVersion.isMac() ||
"XFCE".equals(xdg) ||
"KDE".equals(xdg) || "LXDE".equals(xdg);
"XFCE".equals(xdg) || "KDE".equals(xdg) ||
"LXDE".equals(xdg);
return _context.getProperty(PROP_DTG_ENABLED, dflt);
}
@ -211,7 +211,7 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
_log.info("I2P Browser starting up");
try {
I2PBrowser i2pBrowser = new I2PBrowser(profileDir.getAbsolutePath());
String[] args = {"http://proxy.i2p"};
String[] args = {"http://127.0.0.1:7657"};
i2pBrowser.launchFirefox(0, args);
} catch (Exception e) {
_log.error("Error starting I2P Browser", e);
@ -235,7 +235,7 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
try {
I2PBrowser i2pBrowser = new I2PBrowser(profileDir.getAbsolutePath());
i2pBrowser.usability = true;
String[] args = {"http://proxy.i2p"};
String[] args = {"http://127.0.0.1:7657"};
i2pBrowser.launchFirefox(0, args);
} catch (Exception e) {
_log.error("Error starting I2P Browser", e);

View File

@ -19,11 +19,6 @@ user_pref("extensions.torlauncher.start_tor", false);
//user_pref("extensions.torlauncher.default_bridge_type", "");
user_pref("extensions.torlauncher.prompt_at_startup", false);
// Resist-fingerprinting and first-party isolation enable
user_pref("privacy.resistFingerprinting", true);
user_pref("privacy.firstparty.isolate", true);
// Use i2p http proxy for all connections and set homepage to safe local form.
// DON'T allow access to the admin panel from the profile we browse i2p with.
@ -39,7 +34,6 @@ user_pref("network.proxy.socks", "127.0.0.1");
user_pref("network.proxy.socks_port", 4444);
user_pref("network.proxy.share_proxy_settings", true);
user_pref("browser.startup.homepage", "about:blank");
user_pref("dom.security.https_only_mode", false);
user_pref("keyword.enabled", false);
user_pref("extensions.allowPrivateBrowsingByDefault", true);
user_pref("extensions.PrivateBrowsing.notification", false);
@ -51,17 +45,4 @@ user_pref("browser.newtabpage.activity-stream.feeds.section.highlights", false);
user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
user_pref("browser.newtabpage.activity-stream.default.sites", "http://planet.i2p/,http://legwork.i2p/,http://i2pwiki.i2p/,http://i2pforums.i2p/,http://zzz.i2p/");
user_pref("browser.newtabpage.activity-stream.feeds.topsites", true);
user_pref("ui.use_standins_for_native_colors", true);
user_pref("webgl.disable-extensions", true);
user_pref("webgl.min_capability_mode", true);
user_pref("webgl.disable-fail-if-major-performance-caveat", true);
user_pref("webgl.enable-webgl2", false);
user_pref("media.navigator.enabled", false);
user_pref("dom.w3c_touch_events.enabled", false);
user_pref("browser.privatebrowsing.autostart", false);
user_pref("browser.display.use_system_colors", false);
user_pref("dom.image-lazy-loading.enabled", false);
user_pref("extensions.autoDisableScopes", 0);
user_pref("extensions.enabledScopes", 1);
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", false);
user_pref("browser.fixup.domainsuffixwhitelist.i2p", true);

View File

@ -228,4 +228,24 @@ user_pref("dom.w3c_touch_events.enabled", false);
user_pref("browser.privatebrowsing.autostart", false);
user_pref("browser.display.use_system_colors", false);
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", false);
user_pref("browser.fixup.domainsuffixwhitelist.i2p", true);
user_pref("browser.fixup.domainsuffixwhitelist.i2p", true);
user_pref("ui.use_standins_for_native_colors", true);
user_pref("webgl.disable-extensions", true);
user_pref("webgl.min_capability_mode", true);
user_pref("webgl.disable-fail-if-major-performance-caveat", true);
user_pref("webgl.enable-webgl2", false);
user_pref("media.navigator.enabled", false);
user_pref("dom.w3c_touch_events.enabled", false);
user_pref("browser.privatebrowsing.autostart", false);
user_pref("browser.display.use_system_colors", false);
user_pref("dom.image-lazy-loading.enabled", false);
user_pref("extensions.autoDisableScopes", 0);
user_pref("extensions.enabledScopes", 1);
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", false);
user_pref("dom.security.https_only_mode", false);
// Resist-fingerprinting and first-party isolation enable
user_pref("privacy.resistFingerprinting", true);
user_pref("privacy.firstparty.isolate", true);