Get rid of unuseful unpacker classes
This commit is contained in:
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user