diff --git a/src/java/net/i2p/i2pfirefox/I2PChromium.java b/src/java/net/i2p/i2pfirefox/I2PChromium.java index ea73f20..7847987 100644 --- a/src/java/net/i2p/i2pfirefox/I2PChromium.java +++ b/src/java/net/i2p/i2pfirefox/I2PChromium.java @@ -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; diff --git a/src/java/net/i2p/i2pfirefox/I2PChromiumProfileBuilder.java b/src/java/net/i2p/i2pfirefox/I2PChromiumProfileBuilder.java index 6d56621..df0c8b4 100644 --- a/src/java/net/i2p/i2pfirefox/I2PChromiumProfileBuilder.java +++ b/src/java/net/i2p/i2pfirefox/I2PChromiumProfileBuilder.java @@ -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; } } diff --git a/src/java/net/i2p/i2pfirefox/I2PChromiumProfileUnpacker.java b/src/java/net/i2p/i2pfirefox/I2PChromiumProfileUnpacker.java deleted file mode 100644 index d4c6330..0000000 --- a/src/java/net/i2p/i2pfirefox/I2PChromiumProfileUnpacker.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.i2p.i2pfirefox; - -/** - * I2PChromiumProfileUnpacker.java - * Copyright (C) 2022 idk - * 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); - } -} diff --git a/src/java/net/i2p/i2pfirefox/I2PFirefox.java b/src/java/net/i2p/i2pfirefox/I2PFirefox.java index d2aebf0..56aded8 100644 --- a/src/java/net/i2p/i2pfirefox/I2PFirefox.java +++ b/src/java/net/i2p/i2pfirefox/I2PFirefox.java @@ -27,7 +27,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; diff --git a/src/java/net/i2p/i2pfirefox/I2PFirefoxProfileBuilder.java b/src/java/net/i2p/i2pfirefox/I2PFirefoxProfileBuilder.java index d426f6e..3dc6cb4 100644 --- a/src/java/net/i2p/i2pfirefox/I2PFirefoxProfileBuilder.java +++ b/src/java/net/i2p/i2pfirefox/I2PFirefoxProfileBuilder.java @@ -109,8 +109,7 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker { return profileDir.getAbsolutePath(); } else { // create the directory - I2PFirefoxProfileUnpacker unpacker = new I2PFirefoxProfileUnpacker(); - if (!unpacker.unpackProfile(profileDir.getAbsolutePath(), base)) { + if (!this.unpackProfile(profileDir.getAbsolutePath(), "firefox", base)) { return null; } return profileDir.getAbsolutePath(); @@ -129,8 +128,7 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker { 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; } } diff --git a/src/java/net/i2p/i2pfirefox/I2PFirefoxProfileUnpacker.java b/src/java/net/i2p/i2pfirefox/I2PFirefoxProfileUnpacker.java deleted file mode 100644 index e488f78..0000000 --- a/src/java/net/i2p/i2pfirefox/I2PFirefoxProfileUnpacker.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.i2p.i2pfirefox; - -/** - * I2PFirefoxProfileUnpacker.java - * Copyright (C) 2022 idk - * 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); - } -}