fix nearby firefox discovery
Former-commit-id: 098cc0b4a8
Former-commit-id: cd5aeaf1599099e78be7d4693f4284d7dac1e1e1
This commit is contained in:
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
TORSOCKS=$(which torsocks)
|
TORSOCKS=$(which torsocks)
|
||||||
if [ -f "${TORSOCKS}" ]; then
|
if [ -f "${TORSOCKS}" ]; then
|
||||||
. "${TORSOCKS}" on
|
#. "${TORSOCKS}" on
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
version="$(curl -s https://aus1.torproject.org/torbrowser/update_3/release/downloads.json | jq -r ".version")"
|
version="$(curl -s https://aus1.torproject.org/torbrowser/update_3/release/downloads.json | jq -r ".version")"
|
||||||
|
@ -261,121 +261,104 @@ public class I2PFirefox extends I2PCommonBrowser {
|
|||||||
if (plugin != null && !plugin.isEmpty()) {
|
if (plugin != null && !plugin.isEmpty()) {
|
||||||
File userDir = new File(plugin);
|
File userDir = new File(plugin);
|
||||||
if (userDir.exists()) {
|
if (userDir.exists()) {
|
||||||
File[] userDirs = userDir.listFiles();
|
if (isWindows()) {
|
||||||
for (File userDir1 : userDirs) {
|
File searchResult = searchFile(userDir, "firefox-esr.exe");
|
||||||
File[] userFiles = userDir1.listFiles();
|
if (searchResult != null)
|
||||||
if (userFiles != null) {
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
for (File userFile : userFiles) {
|
searchResult = searchFile(userDir, "firefox-esr.exe");
|
||||||
// logger.info("CHECKING NEARBY" + userFile.getAbsolutePath());
|
if (searchResult != null)
|
||||||
if (userFile.isDirectory()) {
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
File[] userFiles2 = userFile.listFiles();
|
searchResult = searchFile(userDir, "firefox.exe");
|
||||||
for (File userFile2 : userFiles2) {
|
if (searchResult != null)
|
||||||
if (userFile2.isDirectory())
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
continue;
|
searchResult = searchFile(userDir, "firefox-bin.exe");
|
||||||
if (!isWindows()) {
|
if (searchResult != null)
|
||||||
if (userFile2.getName().equals("firefox") ||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
userFile2.getName().equals("firefox-bin") ||
|
searchResult = searchFile(userDir, "waterfox.exe");
|
||||||
userFile2.getName().equals("firefox-esr") ||
|
if (searchResult != null)
|
||||||
userFile2.getName().equals("waterfox") ||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
userFile2.getName().equals("waterfox-bin") ||
|
searchResult = searchFile(userDir, "waterfox-bin.exe");
|
||||||
userFile2.getName().equals("librewolf")) {
|
if (searchResult != null)
|
||||||
return new String[] {userFile2.getAbsolutePath()};
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
}
|
searchResult = searchFile(userDir, "librewolf.exe");
|
||||||
} else {
|
if (searchResult != null)
|
||||||
if (userFile2.getName().equals("firefox.exe") ||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
userFile2.getName().equals("firefox-bin.exe") ||
|
} else {
|
||||||
userFile2.getName().equals("firefox-esr.exe") ||
|
File searchResult = searchFile(userDir, "firefox-esr");
|
||||||
userFile2.getName().equals("waterfox.exe") ||
|
if (searchResult != null)
|
||||||
userFile2.getName().equals("waterfox-bin.exe") ||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
userFile2.getName().equals("librewolf.exe")) {
|
searchResult = searchFile(userDir, "firefox-esr");
|
||||||
return new String[] {userFile2.getAbsolutePath()};
|
if (searchResult != null)
|
||||||
}
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
}
|
searchResult = searchFile(userDir, "firefox");
|
||||||
}
|
if (searchResult != null)
|
||||||
if (!isWindows()) {
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
if (userFile.getName().equals("firefox") ||
|
searchResult = searchFile(userDir, "firefox-bin");
|
||||||
userFile.getName().equals("firefox-bin") ||
|
if (searchResult != null)
|
||||||
userFile.getName().equals("firefox-esr") ||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
userFile.getName().equals("waterfox") ||
|
searchResult = searchFile(userDir, "waterfox");
|
||||||
userFile.getName().equals("waterfox-bin") ||
|
if (searchResult != null)
|
||||||
userFile.getName().equals("librewolf")) {
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
return new String[] {userFile.getAbsolutePath()};
|
searchResult = searchFile(userDir, "waterfox-bin");
|
||||||
}
|
if (searchResult != null)
|
||||||
} else {
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
if (userFile.getName().equals("firefox.exe") ||
|
searchResult = searchFile(userDir, "librewolf");
|
||||||
userFile.getName().equals("firefox-bin.exe") ||
|
if (searchResult != null)
|
||||||
userFile.getName().equals("firefox-esr.exe") ||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
userFile.getName().equals("waterfox.exe") ||
|
|
||||||
userFile.getName().equals("waterfox-bin.exe") ||
|
|
||||||
userFile.getName().equals("librewolf.exe")) {
|
|
||||||
return new String[] {userFile.getAbsolutePath()};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// now, do the same thing, but with user.dir instead of plugin
|
|
||||||
// list the directories in the user.dir directory
|
|
||||||
userDir = new File(System.getProperty("user.dir"));
|
|
||||||
if (userDir.exists()) {
|
|
||||||
File[] userDirs = userDir.listFiles();
|
|
||||||
// list the files in the user.dir directory
|
|
||||||
for (File userDir1 : userDirs) {
|
|
||||||
File[] userFiles = userDir1.listFiles();
|
|
||||||
if (userFiles != null) {
|
|
||||||
for (File userFile : userFiles) {
|
|
||||||
if (userFile.isDirectory()) {
|
|
||||||
File[] userFiles2 = userFile.listFiles();
|
|
||||||
for (File userFile2 : userFiles2) {
|
|
||||||
if (userFile2.isDirectory())
|
|
||||||
continue;
|
|
||||||
if (isWindows()) {
|
|
||||||
if (userFile2.getName().equals("firefox") ||
|
|
||||||
userFile2.getName().equals("firefox-bin") ||
|
|
||||||
userFile2.getName().equals("firefox-esr") ||
|
|
||||||
userFile2.getName().equals("waterfox") ||
|
|
||||||
userFile2.getName().equals("waterfox-bin") ||
|
|
||||||
userFile2.getName().equals("librewolf")) {
|
|
||||||
return new String[] {userFile2.getAbsolutePath()};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (userFile.getName().equals("firefox.exe") ||
|
|
||||||
userFile.getName().equals("firefox-bin.exe") ||
|
|
||||||
userFile.getName().equals("firefox-esr.exe") ||
|
|
||||||
userFile.getName().equals("waterfox.exe") ||
|
|
||||||
userFile.getName().equals("waterfox-bin.exe") ||
|
|
||||||
userFile.getName().equals("librewolf.exe")) {
|
|
||||||
return new String[] {userFile.getAbsolutePath()};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isWindows()) {
|
|
||||||
if (userFile.getName().equals("firefox") ||
|
|
||||||
userFile.getName().equals("firefox-bin") ||
|
|
||||||
userFile.getName().equals("firefox-esr") ||
|
|
||||||
userFile.getName().equals("waterfox") ||
|
|
||||||
userFile.getName().equals("waterfox-bin") ||
|
|
||||||
userFile.getName().equals("librewolf")) {
|
|
||||||
return new String[] {userFile.getAbsolutePath()};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (userFile.getName().equals("firefox.exe") ||
|
|
||||||
userFile.getName().equals("firefox-bin.exe") ||
|
|
||||||
userFile.getName().equals("firefox-esr.exe") ||
|
|
||||||
userFile.getName().equals("waterfox.exe") ||
|
|
||||||
userFile.getName().equals("waterfox-bin.exe") ||
|
|
||||||
userFile.getName().equals("librewolf.exe")) {
|
|
||||||
return new String[] {userFile.getAbsolutePath()};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// now, do the same thing, but with user.dir instead of plugin
|
||||||
|
// list the directories in the user.dir directory
|
||||||
|
File userDir = new File(System.getProperty("user.dir"));
|
||||||
|
if (userDir.exists()) {
|
||||||
|
if (isWindows()) {
|
||||||
|
File searchResult = searchFile(userDir, "firefox-esr.exe");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "firefox-esr.exe");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "firefox.exe");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "firefox-bin.exe");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "waterfox.exe");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "waterfox-bin.exe");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "librewolf.exe");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
} else {
|
||||||
|
File searchResult = searchFile(userDir, "firefox-esr");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "firefox-esr");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "firefox");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "firefox-bin");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "waterfox");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "waterfox-bin");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
searchResult = searchFile(userDir, "librewolf");
|
||||||
|
if (searchResult != null)
|
||||||
|
return new String[] {searchResult.getAbsolutePath()};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new String[] {};
|
return new String[] {};
|
||||||
}
|
}
|
||||||
private static String[] FIREFOX_FINDER() {
|
private static String[] FIREFOX_FINDER() {
|
||||||
|
Reference in New Issue
Block a user