mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-30 21:40:15 +02:00
Adding support to MEGA browser extension (#262)
Now you can copy an URL from Firefox and Chrome MEGA extension and the program will transform it to a ordinary MEGA URL
This commit is contained in:
parent
0f5a351979
commit
a654ada7da
@ -786,6 +786,9 @@ public class MiscTools {
|
|||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
|
|
||||||
|
if (data.startsWith("moz-extension") || data.startsWith("chrome-extension"))
|
||||||
|
data = extensionURL2NormalLink(data);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ArrayList<String> links = new ArrayList<>();
|
ArrayList<String> links = new ArrayList<>();
|
||||||
@ -1402,6 +1405,15 @@ public class MiscTools {
|
|||||||
return replace1.replaceAll("https://mega\\.nz/file/([^#]+)#(.+)", "https://mega.nz/#!$1!$2");
|
return replace1.replaceAll("https://mega\\.nz/file/([^#]+)#(.+)", "https://mega.nz/#!$1!$2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This method changes the MEGA extension URL to a ordinary MEGA URL,
|
||||||
|
so copying the extension URL from Firefox or Chrome also works as a normal URL */
|
||||||
|
public static String extensionURL2NormalLink(String data) {
|
||||||
|
|
||||||
|
String toReplace = data.substring(0, data.indexOf('#') + 1);
|
||||||
|
|
||||||
|
return data.replace(toReplace, "https://mega.nz");
|
||||||
|
}
|
||||||
|
|
||||||
private MiscTools() {
|
private MiscTools() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user