- ota/version.txt → 0.1.0-dav-android-8 - ota/h5/index-v8.html → 紫色标题+v8徽章,含自更新按钮 - embedded index.html → 下载目标改为 v8
43 lines
2.1 KiB
HTML
43 lines
2.1 KiB
HTML
<!DOCTYPE html>
|
|
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width">
|
|
<style>
|
|
body{font-family:monospace;background:#0f172a;color:#e2e8f0;padding:16px;margin:0}
|
|
h1{font-size:18px;color:#a78bfa}
|
|
.btn{display:block;width:100%;padding:14px;margin:8px 0;border:none;border-radius:8px;font-size:16px;cursor:pointer}
|
|
.btn-check{background:#7c3aed;color:#fff}
|
|
.btn-download{background:#15803d;color:#fff}
|
|
.log{background:#1e293b;padding:12px;border-radius:8px;margin-top:12px;max-height:300px;overflow-y:auto;font-size:12px;white-space:pre-wrap}
|
|
.info{color:#94a3b8;font-size:12px}
|
|
.badge{display:inline-block;background:#a78bfa;color:#000;padding:2px 8px;border-radius:4px;font-size:11px;margin-left:8px}
|
|
</style></head><body>
|
|
<h1>Yuzu GCA <span class="badge">v8</span></h1>
|
|
<div class="info">version <span id="ver">0.1.0-dav-android-8</span></div>
|
|
<button class="btn btn-check" onclick="checkUpdate()">检查更新</button>
|
|
<button class="btn btn-download" onclick="applyUpdate()" id="btnApply" disabled>下载更新</button>
|
|
<div class="log" id="log"></div>
|
|
<script>
|
|
var dlUrl='',dlVer='';
|
|
var BASE='https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota';
|
|
|
|
function log(m){document.getElementById('log').innerText+=m+'\n'}
|
|
function checkUpdate(){
|
|
log('checking...');
|
|
fetch(BASE+'/version.txt?t='+Date.now(),{cache:'no-store'})
|
|
.then(r=>{if(!r.ok)throw Error('HTTP '+r.status);return r.text()})
|
|
.then(t=>{t=t.trim();log('remote: '+t);
|
|
var local=document.getElementById('ver').innerText;
|
|
if(t!==local && t!=='v'+local && 'v'+t!==local){dlVer=t;dlUrl=BASE+'/h5/index-v8.html';
|
|
log('*** NEW VERSION ***');document.getElementById('btnApply').disabled=false}
|
|
else log('up to date')})
|
|
.catch(e=>log('ERR: '+e.message))
|
|
}
|
|
function applyUpdate(){
|
|
log('downloading...');
|
|
fetch(dlUrl+'?t='+Date.now(),{cache:'no-store'})
|
|
.then(r=>{if(!r.ok)throw Error('HTTP '+r.status);return r.text()})
|
|
.then(t=>{localStorage.setItem('gca_html',t);localStorage.setItem('gca_ver',dlVer);
|
|
log('OK reloading...');setTimeout(function(){location.reload()},300)})
|
|
.catch(e=>log('ERR: '+e.message))
|
|
}
|
|
</script></body></html>
|