function update_status(status) { console.log(status); document.getElementById("status").innerText = status; } async function downloadFile(url) { const response = await fetch(url); const contentLength = response.headers.get('Content-Length'); const total = parseInt(contentLength, 10); let loaded = 0; const reader = response.body.getReader(); const chunks = []; while (true) { const { done, value } = await reader.read(); if (done) break; chunks.push(value); loaded += value.length; // 计算并显示下载进度 const progress = (loaded / total) * 100; update_status(`下载中... ${progress.toFixed(2)}%`); } // 将所有块合并为一个 Blob return new Blob(chunks); } async function patch(android, newDomain, patches) { if (newDomain.endsWith("/")) newDomain = newDomain.slice(0, -1); console.log("downloading"); update_status("下载中..."); let file = await downloadFile("https://file.zhushenwudi.top/pd/1/SIF_CLIENT/lovelive-community." + (android ? "apk" : "ipa")); console.log("downloaded"); console.log("loaded"); update_status("解压客户端..."); const zip = new JSZip(); await zip.loadAsync(file); update_status("获取当前配置..."); let basePath = android ? "" : "Payload/LoveLive.app/"; let server_file; if (android) { let server_info = await zip.file("assets/AppAssets.zip").async("arraybuffer"); const zip2 = new JSZip(); await zip2.loadAsync(server_info); server_file = await zip2.file("config/server_info.json").async("arraybuffer"); } else { server_file = await zip.file("Payload/LoveLive.app/ProjectResources/config/server_info.json").async("arraybuffer"); } let postPatches = []; for (let i=0; iuber-apk-signer, 使用如下命令 `java -jar uber-apk-signer-.jar -a lovelive.apk` 进行签名."; document.body.appendChild(p); } } function init_honoka(android, newDomain, patches) { window.Module = { noInitialRun: true, onRuntimeInitialized: async function() { try { await patch(android, newDomain, patches); } catch(e) { console.warn(e); document.getElementById("status").innerText = "失败。您的文件/选项无效吗?"; } }, arguments: [], preRun: [], postRun: [], print: (msg) => { console.log(msg); }, printErr: (msg) => { console.log(msg); }, totalDependencies: 0, monitorRunDependencies: () => {}, locateFile: function(fileName) { console.log("locateFile", fileName); return fileName; } }; const script = document.createElement("script") script.src = "libhonoka.js"; document.body.appendChild(script); };