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"""
|
||||
|
||||
Reference in New Issue
Block a user