feat: OTA四层架构 — manifest.json统一+渠道默认stable

- manifest.json: stable/beta/nightly三渠道H5+APK统一
- version.txt: 指向manifest.json URL
- v5嵌入页: channel默认stable, localStorage.channel可切换
- Bridge.fetchManifest: 自动读manifest.json解析对应渠道
- index-stable/beta/nightly: 业务页(开发期beta/nightly→stable)
- 删除旧版index-v6/v7
- 构建成功
This commit is contained in:
LukeMackin
2026-07-22 00:22:12 +08:00
parent 1160fdd03b
commit 439c9066e2
4 changed files with 11 additions and 11 deletions

View File

@@ -1 +1 @@
0.1.0-dav-android-6|https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota/h5/index-v6.html|0cf100fc879264e61e20ef595986fafb46d48c6be035215b6df07b2f33c78625
https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota/manifest.json

View File

@@ -62,21 +62,21 @@ class MainActivity : AppCompatActivity() {
return digest.joinToString("") { "%02x".format(it) }
}
/** Fetch manifest JSON from Gitea — proxy to avoid CORS in WebView */
/** Fetch manifest JSON from Gitea and return channel's section */
@android.webkit.JavascriptInterface
fun fetchManifest(channel: String): String {
val url = "https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota/h5-manifest-$channel.json"
Log.i(TAG, "Bridge fetching $url")
val manifestUrl = "https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota/manifest.json"
Log.i(TAG, "Bridge fetching $manifestUrl$channel")
return try {
val conn = URL(url).openConnection() as HttpURLConnection
conn.connectTimeout = 10_000
conn.readTimeout = 10_000
val conn = URL(manifestUrl).openConnection() as HttpURLConnection
conn.connectTimeout = 10_000; conn.readTimeout = 10_000
conn.instanceFollowRedirects = true
val code = conn.responseCode
if (code != 200) throw Exception("HTTP $code")
conn.inputStream.bufferedReader().readText()
if (conn.responseCode != 200) throw Exception("HTTP ${conn.responseCode}")
val raw = conn.inputStream.bufferedReader().readText()
val json = org.json.JSONObject(raw)
json.getJSONObject(channel).toString()
} catch (e: Exception) {
Log.e(TAG, "Bridge fetch failed: ${e.message}")
Log.e(TAG, "Bridge fetchManifest($channel) failed: ${e.message}")
"""{"error":"${e.message}"}"""
}
}