cleanup: 删除旧manifest+index-v*.html(已用manifest.json+index-{channel}.html)
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width">
|
||||
<style>
|
||||
body{font-family:monospace;background:#0c0a1d;color:#e8e0f0;padding:16px;margin:0}
|
||||
header{background:linear-gradient(135deg,#7c3aed,#2563eb);margin:-16px -16px 12px -16px;padding:20px 16px;text-align:center}
|
||||
h1{font-size:20px;color:#fff;margin:0}
|
||||
.sub{color:#c4b5fd;font-size:12px;margin-top:4px}
|
||||
.card{background:#1a1530;border-radius:12px;padding:16px;margin:8px 0;border:1px solid #2d2650}
|
||||
.card-title{color:#a78bfa;font-size:14px;font-weight:bold;margin-bottom:8px}
|
||||
.chip-row{display:flex;gap:8px;margin:8px 0}
|
||||
.chip{flex:1;text-align:center;padding:10px 0;border-radius:8px;font-size:13px;cursor:pointer;border:1px solid #4c3a80;background:#1e1740;color:#aaa}
|
||||
.chip-on{background:#7c3aed;color:#fff;border-color:#a78bfa}
|
||||
.btn{display:block;width:100%;padding:14px;margin:8px 0;border:none;border-radius:10px;font-size:16px;cursor:pointer;font-weight:bold}
|
||||
.btn-check{background:#7c3aed;color:#fff}
|
||||
.btn-download{background:#059669;color:#fff}
|
||||
.log{background:#0f0b20;padding:12px;border-radius:8px;margin-top:12px;font-size:11px;color:#888;white-space:pre-wrap;max-height:200px;overflow-y:auto}
|
||||
.badge{display:inline-block;background:#7c3aed;color:#fff;padding:3px 10px;border-radius:6px;font-size:11px}
|
||||
</style></head><body>
|
||||
<header>
|
||||
<h1>Yuzu GCA <span class="badge">v6</span></h1>
|
||||
<div class="sub">热更新 v6 — 渠道选择器</div>
|
||||
</header>
|
||||
<div class="card">
|
||||
<div class="card-title">更新渠道</div>
|
||||
<div class="chip-row">
|
||||
<div class="chip chip-on" onclick="selectCh(this,'stable')">Stable</div>
|
||||
<div class="chip chip-off" onclick="selectCh(this,'beta')">Beta</div>
|
||||
<div class="chip chip-off" onclick="selectCh(this,'nightly')">Nightly</div>
|
||||
</div>
|
||||
</div>
|
||||
<span id="ver" style="display:none">0.1.0-dav-android-6</span>
|
||||
<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 channel='stable';
|
||||
var dlUrl='',dlVer='',dlSha='';
|
||||
var BASE='https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota';
|
||||
|
||||
function selectCh(el,ch){
|
||||
document.querySelectorAll('.chip').forEach(function(c){c.className='chip chip-off'});
|
||||
el.className='chip chip-on';
|
||||
channel=ch;
|
||||
log('channel: '+ch)
|
||||
}
|
||||
function log(m){document.getElementById('log').innerText+=m+'\n'}
|
||||
function checkUpdate(){
|
||||
log('manifest via Bridge ...');
|
||||
var resp=Android.fetchManifest(channel);
|
||||
try{
|
||||
var j=JSON.parse(resp);
|
||||
if(j.error){log('ERR: '+j.error);return}
|
||||
log('latest: '+j.latest+' min: '+j.min_version);
|
||||
if(j.min_version){
|
||||
var v=j.min_version.replace(/[^0-9]/g,''),my=document.getElementById('ver').textContent.replace(/[^0-9]/g,'');
|
||||
if(parseInt(my)<parseInt(v)){log('ERR: too old, need APK update');return}
|
||||
}
|
||||
dlUrl=j.url;dlSha=j.sha256||'';
|
||||
if(!dlSha||dlSha.startsWith('TBD')){log('ERR: channel no build');return}
|
||||
if(!dlUrl||dlUrl.indexOf(BASE)!==0){log('ERR: invalid url');return}
|
||||
var myVer=document.getElementById('ver').textContent;
|
||||
if(j.latest!==myVer&&j.latest!=='v'+myVer&&'v'+j.latest!==myVer){dlVer=j.latest;
|
||||
log('*** NEW VERSION ***');document.getElementById('btnApply').disabled=false}
|
||||
else log('up to date')
|
||||
}catch(e){log('ERR: '+e.message)}
|
||||
}
|
||||
function applyUpdate(){
|
||||
var t=Android.fetchText(('h5/index-'+dlVer).replace('0.1.0-dav-android-','v')+'.html');
|
||||
if(typeof t!=='string'||t.startsWith('ERROR:')){log('ERR: '+t);return}
|
||||
if(!dlSha||dlSha.startsWith('TBD')){log('ERR: SHA256 required');return}
|
||||
var h=Android.sha256(t);
|
||||
if(h!==dlSha){log('SHA256 MISMATCH!');return}
|
||||
Android.saveCache(t);log('OK! restart app to apply')
|
||||
}
|
||||
</script></body></html>
|
||||
@@ -1,59 +0,0 @@
|
||||
<!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:#22c55e}
|
||||
.chip{display:inline-block;padding:8px 16px;margin:4px;border-radius:6px;font-size:13px;cursor:pointer;border:1px solid #334155}
|
||||
.chip-on{background:#15803d;color:#fff;border-color:#22c55e}
|
||||
.chip-off{background:#1e293b;color:#94a3b8}
|
||||
.btn{display:block;width:100%;padding:14px;margin:8px 0;border:none;border-radius:8px;font-size:16px;cursor:pointer}
|
||||
.btn-check{background:#15803d;color:#fff}
|
||||
.btn-download{background:#1e40af;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:#22c55e;color:#000;padding:2px 8px;border-radius:4px;font-size:11px;margin-left:8px}
|
||||
</style></head><body>
|
||||
<h1>Yuzu GCA <span class="badge">v7</span></h1>
|
||||
<div class="info">version <span id="ver">0.1.0-dav-android-7</span></div>
|
||||
|
||||
<div style="margin:12px 0">
|
||||
<span id="ch-stable" class="chip chip-on" onclick="selectCh('stable')">Stable</span>
|
||||
<span id="ch-beta" class="chip chip-off" onclick="selectCh('beta')">Beta</span>
|
||||
<span id="ch-nightly" class="chip chip-off" onclick="selectCh('nightly')">Nightly</span>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-check" onclick="checkUpdate()">检查更新 (v7)</button>
|
||||
<button class="btn btn-download" onclick="applyUpdate()" id="btnApply" disabled>下载更新</button>
|
||||
<div class="log" id="log"></div>
|
||||
<script>
|
||||
var dlUrl='',dlVer='',channel='stable';
|
||||
var BASE='https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota';
|
||||
|
||||
function selectCh(ch){
|
||||
channel=ch;
|
||||
document.querySelectorAll('.chip').forEach(c=>c.className='chip chip-off');
|
||||
document.getElementById('ch-'+ch).className='chip chip-on';
|
||||
log('channel → '+ch)
|
||||
}
|
||||
function log(m){document.getElementById('log').innerText+=m+'\n'}
|
||||
function checkUpdate(){
|
||||
var url=BASE+'/version.txt?t='+Date.now();
|
||||
if(channel!=='stable') url=BASE+'/version-'+channel+'.txt?t='+Date.now();
|
||||
fetch(url,{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-v7.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>
|
||||
Reference in New Issue
Block a user