|
|
|
|
@ -20,6 +20,8 @@ import javax.crypto.spec.SecretKeySpec; |
|
|
|
|
|
|
|
|
|
public class Decoder { |
|
|
|
|
|
|
|
|
|
private static final Pattern JS_URI = Pattern.compile("\"(\\.|\\.\\.)/(.?|.+?)\\.js\\?(.?|.+?)\""); |
|
|
|
|
|
|
|
|
|
public static String getJson(String url) throws Exception { |
|
|
|
|
String key = url.contains(";") ? url.split(";")[2] : ""; |
|
|
|
|
url = url.contains(";") ? url.split(";")[0] : url; |
|
|
|
|
@ -34,8 +36,19 @@ public class Decoder { |
|
|
|
|
|
|
|
|
|
private static String fix(String url, String data) { |
|
|
|
|
if (url.startsWith("file") || url.startsWith("assets")) url = UrlUtil.convert(url); |
|
|
|
|
Matcher matcher = JS_URI.matcher(data); |
|
|
|
|
while (matcher.find()) { |
|
|
|
|
String ext = matcher.group(0); |
|
|
|
|
String t = ext.replace("\"./", "\"" + UrlUtil.resolve(url, "./")); |
|
|
|
|
t = t.replace("\"../", "\"" + UrlUtil.resolve(url, "../")); |
|
|
|
|
t = t.replace("./", "__JS1__"); |
|
|
|
|
t = t.replace("../", "__JS2__"); |
|
|
|
|
data = data.replace(ext, t); |
|
|
|
|
} |
|
|
|
|
if (data.contains("../")) data = data.replace("../", UrlUtil.resolve(url, "../")); |
|
|
|
|
if (data.contains("./")) data = data.replace("./", UrlUtil.resolve(url, "./")); |
|
|
|
|
if (data.contains("__JS1__")) data = data.replace("__JS1__", "./"); |
|
|
|
|
if (data.contains("__JS2__")) data = data.replace("__JS2__", "../"); |
|
|
|
|
return data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|