feat: frame.html 加入 APK 版本检测

- checkUpdate 读取 j.apk.versionCode
- 如果>5(当前版本),显示Download APK链接
- apkLink div在下载按钮下方
- BUILD SUCCESSFUL
This commit is contained in:
LukeMackin
2026-07-22 16:46:17 +08:00
parent c6f7567eb9
commit c41a3ad9d9
2 changed files with 2 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ h1{font-size:18px;color:#38bdf8}
<div class="info">version <span id="ver">v0.1.0-dav-android-5</span></div>
<button class="btn btn-check" onclick="checkUpdate()">检查更新</button>
<button class="btn btn-download" onclick="applyUpdate()" id="btnApply" disabled>下载更新</button>
<div id="apkLink" style="display:none;margin-top:8px;font-size:12px;color:#38bdf8"></div>
<div class="log" id="log"></div>
<script>
var dlUrl='',dlVer='',dlSha='';
@@ -26,6 +27,7 @@ function checkUpdate(){
var j=JSON.parse(Android.fetchManifest(channel));
if(j.error){log('ERR: '+j.error);return}
var h5=j.h5;log('latest: '+h5.latest+' min: '+h5.min_version);
var apk=j.apk;if(apk&&apk.versionCode>5){log('APK UPDATE: v'+apk.version+' (code '+apk.versionCode+')');document.getElementById('apkLink').innerHTML='<a href=\"'+apk.url+'\">Download APK v'+apk.version+'</a>';document.getElementById('apkLink').style.display='block'}
var v=(h5.min_version||'').replace(/[^0-9]/g,''),my=(document.getElementById('ver').innerText||'').replace(/[^0-9]/g,'');
if(parseInt(my||'0')<parseInt(v||'0')){log('ERR: APK too old (need v'+h5.min_version+')');return}
dlUrl=h5.url;dlSha=h5.sha256||'';

BIN
s2.png Normal file

Binary file not shown.