fix: 1.1.1.3 online installer 5.8M + mods toggle + ZGC vs G1GC conflict
- server/main.py BUILDS_DIR absolute + /launcher/download/online,offine-setup - site index/js online->/download/online 5.8M - LaunchCommandBuilder skip G1GC when systemBasedJvm (ZGC conflict -> Bootstrap crash) - JFXLauncher toggle robust rename + FileAlreadyExists fix
This commit is contained in:
+38
-1
@@ -43,7 +43,7 @@ logger = structlog.get_logger(__name__)
|
||||
# Cache for manifests - expires after 5 minutes
|
||||
manifest_cache = TTLCache(maxsize=100, ttl=300)
|
||||
|
||||
BUILDS_DIR = Path("builds")
|
||||
BUILDS_DIR = Path(__file__).parent / "builds"
|
||||
VERSIONS_DIR = BUILDS_DIR / "versions"
|
||||
WHITELIST_DIR = Path(__file__).parent / "whitelist"
|
||||
|
||||
@@ -1813,6 +1813,43 @@ async def download_jre(request: Request):
|
||||
return await send_file_async(pp, request, content_type="application/zip", cache=True)
|
||||
raise HTTPException(404, "JRE zip not found on server")
|
||||
|
||||
def _find_latest_setup(pattern: str) -> Path | None:
|
||||
"""Find latest Go setup exe by pattern (Online/Offline)"""
|
||||
cands = list(BUILDS_DIR.glob(pattern))
|
||||
if not cands:
|
||||
return None
|
||||
# sort by version key from filename
|
||||
def ver_key(p: Path):
|
||||
# ZernMC-Online-Setup-1.1.1.2.exe -> 1.1.1.2
|
||||
name = p.stem
|
||||
ver = name.split("-")[-1]
|
||||
try:
|
||||
return tuple(int(x) for x in ver.split("."))
|
||||
except:
|
||||
return (0,)
|
||||
cands.sort(key=ver_key, reverse=True)
|
||||
return cands[0]
|
||||
|
||||
@app.get("/launcher/download/online")
|
||||
async def download_online_setup(request: Request):
|
||||
"""Download online Go installer (5.8M, STANDALONE EXE without bundled JRE)"""
|
||||
p = _find_latest_setup("ZernMC-Online-Setup-*.exe")
|
||||
if p and p.exists():
|
||||
return await send_file_async(p, request, content_type="application/vnd.microsoft.portable-executable", cache=True)
|
||||
raise HTTPException(404, "Online installer not found")
|
||||
|
||||
@app.get("/launcher/download/offline-setup")
|
||||
async def download_offline_setup(request: Request):
|
||||
"""Download offline Go installer (STANDALONE EXE with embedded build, ~100M)"""
|
||||
p = _find_latest_setup("ZernMC-Offline-Setup-*.exe")
|
||||
if p and p.exists():
|
||||
return await send_file_async(p, request, content_type="application/vnd.microsoft.portable-executable", cache=True)
|
||||
# fallback: try legacy offline zip embed name without -Setup
|
||||
p2 = _find_latest_setup("ZernMC-Offline-*.exe")
|
||||
if p2 and p2.exists():
|
||||
return await send_file_async(p2, request, content_type="application/vnd.microsoft.portable-executable", cache=True)
|
||||
raise HTTPException(404, "Offline installer not found")
|
||||
|
||||
@app.get("/launcher/download/zip/{filename}")
|
||||
async def download_launcher_zip(filename: str, request: Request = None):
|
||||
"""Download specific launcher ZIP archive"""
|
||||
|
||||
@@ -383,11 +383,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:12px">
|
||||
<a class="btn btn-primary btn-block" id="download-online-btn" href="/launcher/download/jre" download>
|
||||
<a class="btn btn-primary btn-block" id="download-online-btn" href="/launcher/download/online" download>
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M4 21h16"/></svg>
|
||||
<span>Online Setup (5.8М)</span>
|
||||
</a>
|
||||
<a class="btn btn-ghost btn-block" id="download-offline-btn" href="/launcher/download/latest">
|
||||
<a class="btn btn-ghost btn-block" id="download-offline-btn" href="/launcher/download/offline-setup">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
||||
<span>Offline ZIP (98М)</span>
|
||||
</a>
|
||||
|
||||
@@ -345,16 +345,12 @@
|
||||
// online setup is Go exe (~5.8M) — try to discover via /launcher/version or static name
|
||||
try {
|
||||
const v = version && version !== '—' ? version : '1.1.1.2';
|
||||
dlOnline.href = API + '/launcher/download/jre'; // JRE endpoint validated, exe name is ZernMC-Online-Setup-<ver>.exe
|
||||
dlOnline.href = API + '/launcher/download/online';
|
||||
dlOnline.setAttribute('data-version', v);
|
||||
// probe if online exe exists
|
||||
fetch(API + '/launcher/file/' + v + '/ZernMC-Online-Setup-' + v + '.exe', {method:'HEAD'}).then(r=>{
|
||||
if (r.ok) dlOnline.href = API + '/launcher/file/' + v + '/ZernMC-Online-Setup-' + v + '.exe';
|
||||
}).catch(()=>{});
|
||||
} catch(e){}
|
||||
}
|
||||
if (dlOffline) dlOffline.href = API + '/launcher/download/offline-setup';
|
||||
if (dlOffline && data.new_format && data.new_format.download_url) {
|
||||
dlOffline.href = API + data.new_format.download_url;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[site] failed to load launcher info', e);
|
||||
|
||||
Reference in New Issue
Block a user