fix(android): load WebView pages over http to avoid mixed content
Pages are hosted on appassets.androidplatform.net and the in-page requests target the hub over http://192.168.1.111:8765. Because the pages were loaded over https, Chromium blocked those http requests under the mixed content policy before they ever hit the network, which surfaced as immediate ERR_ABORTED failures. Switch the page scheme to http so the page is served from an insecure context. Mixed content rules are directional: an http page may load https subresources, so both the http hub (8765) and the https hub (8766) remain reachable. WebViewAssetLoader only accepts the http scheme when explicitly enabled, so also call setHttpAllowed(true). Without it PathMatcher.match() returns null for http URIs, the request escapes interception and is treated as a real network request to appassets.androidplatform.net, leaving a blank page with no error log. Also raise the default versionCode/versionName to 34 / 0.3.4 so a build without -PpwVersionCode no longer regresses to 1 / 0.1.0 and triggers a spurious downgrade.
This commit is contained in:
1 parent
c037b43f4a
commit
14e27a4f16
5 files changed
+8
-6
No files matched your search
@@ -7,6 +7,7 @@ __pycache__/
|
||||
*.py[cod]
|
||||
.venv/
|
||||
*.db
|
||||
*.db-journal
|
||||
*.sqlite3
|
||||
.env
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ plugins {
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
val pwVersionCode = (project.findProperty("pwVersionCode") as String?)?.toIntOrNull() ?: 1
|
||||
val pwVersionName = (project.findProperty("pwVersionName") as String?) ?: "0.1.0"
|
||||
val pwVersionCode = (project.findProperty("pwVersionCode") as String?)?.toIntOrNull() ?: 34
|
||||
val pwVersionName = (project.findProperty("pwVersionName") as String?) ?: "0.3.4"
|
||||
|
||||
android {
|
||||
namespace = "com.pulsewall.app"
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var BASE_HREF = "https://appassets.androidplatform.net/assets/pulsewall/";
|
||||
var BASE_HREF = "http://appassets.androidplatform.net/assets/pulsewall/";
|
||||
var feedItems = [];
|
||||
var currentSnapshotId = "builtin_home";
|
||||
var currentTaskId = "";
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div id="pw-sandbox-host"></div>
|
||||
<script>
|
||||
(function () {
|
||||
var BASE_HREF = "https://appassets.androidplatform.net/assets/pulsewall/";
|
||||
var BASE_HREF = "http://appassets.androidplatform.net/assets/pulsewall/";
|
||||
var activeErrors = [];
|
||||
var activeFrame = null;
|
||||
var activeTimer = null;
|
||||
|
||||
@@ -122,6 +122,7 @@ class MainActivity : AppCompatActivity(), HubMessageListener {
|
||||
}
|
||||
|
||||
val assetLoader = WebViewAssetLoader.Builder()
|
||||
.setHttpAllowed(true)
|
||||
.addPathHandler("/assets/", WebViewAssetLoader.AssetsPathHandler(this))
|
||||
.build()
|
||||
|
||||
@@ -184,7 +185,7 @@ class MainActivity : AppCompatActivity(), HubMessageListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
loadUrl("https://appassets.androidplatform.net/assets/pulsewall/host.html")
|
||||
loadUrl("http://appassets.androidplatform.net/assets/pulsewall/host.html")
|
||||
}
|
||||
root.addView(
|
||||
mainWebView,
|
||||
@@ -589,7 +590,7 @@ class MainActivity : AppCompatActivity(), HubMessageListener {
|
||||
sandboxLoadWaiter = loadDeferred
|
||||
sandboxWebView.visibility = View.INVISIBLE
|
||||
sandboxWebView.onResume()
|
||||
sandboxWebView.loadUrl("https://appassets.androidplatform.net/assets/pulsewall/sandbox.html")
|
||||
sandboxWebView.loadUrl("http://appassets.androidplatform.net/assets/pulsewall/sandbox.html")
|
||||
}
|
||||
val loaded = withTimeoutOrNull(2500L) { loadDeferred.await() } ?: false
|
||||
if (!loaded) {
|
||||
|
||||
Reference in new issue
Block a user