1
0
Fork 0

fix css not being loaded

This commit is contained in:
Vendicated 2023-01-04 01:14:19 +01:00
parent ac4e05e9f2
commit f7b95b0ba2
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
4 changed files with 17 additions and 7 deletions

View file

@ -0,0 +1,5 @@
package dev.vendicated.vencord;
public class Constants {
public static final String JS_BUNDLE_URL = "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js";
}

View file

@ -11,8 +11,6 @@ import java.net.URL;
import java.util.Locale;
public class HttpClient {
public static final String VENCORD_BUNDLE_URL = "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js";
public static final class HttpException extends IOException {
private final HttpURLConnection conn;
private String message;
@ -53,7 +51,7 @@ public class HttpClient {
VencordMobileRuntime = readAsText(is);
}
var conn = fetch(VENCORD_BUNDLE_URL);
var conn = fetch(Constants.JS_BUNDLE_URL);
try (var is = conn.getInputStream()) {
VencordRuntime = readAsText(is);
}

View file

@ -114,12 +114,11 @@ public class MainActivity extends Activity {
public void handleUrl(Uri url) {
if (url != null) {
if (!url.getAuthority().contains("discord")) return;
if (!url.getAuthority().equals("discord.com")) return;
if (!wvInitialized) {
wv.loadUrl(url.toString());
} else {
wv.evaluateJavascript("Vencord.Webpack.Common.NavigationRouter.transitionTo(\"" + url.getPath() + "\")", (result) -> {
});
wv.evaluateJavascript("Vencord.Webpack.Common.NavigationRouter.transitionTo(\"" + url.getPath() + "\")", null);
}
}
}
@ -130,5 +129,4 @@ public class MainActivity extends Activity {
Uri data = intent.getData();
if (data != null) handleUrl(data);
}
}

View file

@ -34,4 +34,13 @@
return false;
}
};
document.addEventListener("DOMContentLoaded", () => document.documentElement.appendChild(
Object.assign(document.createElement("link"), {
rel: "stylesheet",
type: "text/css",
href: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.css"
}),
{ once: true }
));
})();