From b19d8baab43300f8fecfc9d289493a79e3347cbd Mon Sep 17 00:00:00 2001 From: WiredSpast <74211155+WiredSpast@users.noreply.github.com> Date: Fri, 16 Jun 2023 07:56:08 +0200 Subject: [PATCH] Remove faulty changes --- .../unity_tools/UnityWebModifyer.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java index 3b1abe4..742d84a 100644 --- a/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java +++ b/G-Earth/src/main/java/gearth/services/unity_tools/UnityWebModifyer.java @@ -114,13 +114,11 @@ public class UnityWebModifyer { contents = insertFrameworkCode(contents, 0, "js_code/unity_code.js"); - // String exportSearch = "Module.asmLibraryArg,buffer);Module[\\\"asm\\\"]=asm;"; - String exportSearch = "Module[\"asm\"][\"Fj\"]).apply(null,arguments)};"; + String exportSearch = "Module.asmLibraryArg,buffer);Module[\\\"asm\\\"]=asm;"; int exportIndex = contents.indexOf(exportSearch) + exportSearch.length(); contents = insertFrameworkCode(contents, exportIndex, "js_code/unity_exports.js"); - // String importSearch = "if(!env[\"tableBase\"]){env[\"tableBase\"]=0}"; - String importSearch = "\"LANG\":lang,\"_\":getExecutableName()};"; + String importSearch = "if(!env[\"tableBase\"]){env[\"tableBase\"]=0}"; int importIndex = contents.indexOf(importSearch) + importSearch.length(); contents = insertFrameworkCode(contents, importIndex, "js_code/unity_imports.js"); @@ -143,18 +141,16 @@ public class UnityWebModifyer { byte[] encoded = Files.readAllBytes(Paths.get(loaderFile.getAbsolutePath())); String contents = new String(encoded, StandardCharsets.UTF_8); - // contents = contents.replace("o.result.responseHeaders[e]==s.getResponseHeader(e)", "false"); - contents = contents.replace("r.headers.get(e)==t.headers.get(e)", "false"); - // contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)", - // "const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" + - // " if (e === \"ETag\") {\n" + - // " a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" + - // " }\n" + - // " else {\n" + - // " a.responseHeaders[e] = o.getResponseHeader(e)\n" + - // " }"); - contents = contents.replace("!r.headers.get(\"ETag\")", "!r.headers.set(\"Etag\", `W/\"${[...Array(6)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}-${[...Array(13)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')}\"`)"); - + contents = contents.replace("o.result.responseHeaders[e]==s.getResponseHeader(e)", "false"); + contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)", + "const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" + + " if (e === \"ETag\") {\n" + + " a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" + + " }\n" + + " else {\n" + + " a.responseHeaders[e] = o.getResponseHeader(e)\n" + + " }"); + BufferedWriter writer = new BufferedWriter(new FileWriter(loaderFile)); writer.write(contents); writer.close();