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:
@@ -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
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -62,21 +62,21 @@ class MainActivity : AppCompatActivity() {
|
|||||||
return digest.joinToString("") { "%02x".format(it) }
|
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
|
@android.webkit.JavascriptInterface
|
||||||
fun fetchManifest(channel: String): String {
|
fun fetchManifest(channel: String): String {
|
||||||
val url = "https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota/h5-manifest-$channel.json"
|
val manifestUrl = "https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota/manifest.json"
|
||||||
Log.i(TAG, "Bridge fetching $url")
|
Log.i(TAG, "Bridge fetching $manifestUrl → $channel")
|
||||||
return try {
|
return try {
|
||||||
val conn = URL(url).openConnection() as HttpURLConnection
|
val conn = URL(manifestUrl).openConnection() as HttpURLConnection
|
||||||
conn.connectTimeout = 10_000
|
conn.connectTimeout = 10_000; conn.readTimeout = 10_000
|
||||||
conn.readTimeout = 10_000
|
|
||||||
conn.instanceFollowRedirects = true
|
conn.instanceFollowRedirects = true
|
||||||
val code = conn.responseCode
|
if (conn.responseCode != 200) throw Exception("HTTP ${conn.responseCode}")
|
||||||
if (code != 200) throw Exception("HTTP $code")
|
val raw = conn.inputStream.bufferedReader().readText()
|
||||||
conn.inputStream.bufferedReader().readText()
|
val json = org.json.JSONObject(raw)
|
||||||
|
json.getJSONObject(channel).toString()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, "Bridge fetch failed: ${e.message}")
|
Log.e(TAG, "Bridge fetchManifest($channel) failed: ${e.message}")
|
||||||
"""{"error":"${e.message}"}"""
|
"""{"error":"${e.message}"}"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user