set baseURL

This commit is contained in:
adbenitez
2022-05-03 07:21:49 -04:00
parent 144a2df3c9
commit e24a72de61
@@ -62,6 +62,11 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
this.dcContext = DcHelper.getContext(getApplicationContext());
this.dcAppMsg = this.dcContext.getMsg(appMessageId);
// `msg_id` in the subdomain makes sure, different apps using same files do not share the same cache entry
// (WebView may use a global cache shared across objects).
// (a random-id would also work, but would need maintenance and does not add benefits as we regard the file-part interceptRequest() only,
// also a random-id is not that useful for debugging)
this.baseURL = "https://acc" + dcContext.getAccountId() + "-msg" + appMessageId + ".localhost";
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
@@ -75,11 +80,7 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
webSettings.setDomStorageEnabled(true);
webView.addJavascriptInterface(new InternalJSApi(), "InternalJSApi");
// `msg_id` in the subdomain makes sure, different apps using same files do not share the same cache entry
// (WebView may use a global cache shared across objects).
// (a random-id would also work, but would need maintenance and does not add benefits as we regard the file-part interceptRequest() only,
// also a random-id is not that useful for debugging)
webView.loadUrl("https://acc" + dcContext.getAccountId() + "-msg" + appMessageId + ".localhost/index.html");
webView.loadUrl(this.baseURL + "/index.html");
Util.runOnAnyBackgroundThread(() -> {
JSONObject info = this.dcAppMsg.getWebxdcInfo();