diff --git a/scripts/download-electron.js b/scripts/download-electron.js index c015bd3..68d9936 100644 --- a/scripts/download-electron.js +++ b/scripts/download-electron.js @@ -6,7 +6,7 @@ * The patched Electron fixes input starvation ("aim freeze") when --disable-frame-rate-limit * is active on modern Chromium. Without this, uncapped FPS causes 50-300ms input delays. * - * The zip is hosted as a release asset on the same Gitea repo. The script checks the + * The zip is hosted as a GitHub release asset. The script checks the * local version file to skip re-downloading if already present. * * Usage: @@ -22,12 +22,11 @@ const { execSync } = require('child_process'); // ── Configuration ────────────────────────────────────────────────────────── const ELECTRON_VERSION = '42.0.0-nightly.20260227'; -const ASSET_NAME = 'electron-v42.0.0-nightly-patched-win32-x64.zip'; -const GITEA_BASE = 'https://gitea.crjlab.net'; -const REPO = 'bigjakk/Krunker-Civilian-Client'; -// The release tag that holds the patched Electron zip. -// Upload the zip as an asset to this release on Gitea. -const RELEASE_TAG = 'electron-patched'; +const ASSET_NAME = 'electron-v42.0.0-nightly-release-patched-win32-x64.zip'; +const GITHUB_BASE = 'https://github.com'; +const REPO = 'bigjakk/Electron-Websocket-Fix'; +const RELEASE_TAG = 'v1.0.0'; +const DIRECT_DOWNLOAD_URL = `${GITHUB_BASE}/${REPO}/releases/download/${RELEASE_TAG}/${ASSET_NAME}`; // On Windows, overwrite the npm-installed Electron with our patched build. // On Linux/macOS (CI cross-compilation), extract to a separate dist-win/ directory @@ -96,29 +95,8 @@ function downloadToFile(url, dest) { }); } -async function getAssetUrl() { - const apiUrl = `${GITEA_BASE}/api/v1/repos/${REPO}/releases/tags/${RELEASE_TAG}`; - const res = await get(apiUrl); - const body = await new Promise((resolve, reject) => { - let data = ''; - res.on('data', (chunk) => { data += chunk; }); - res.on('end', () => resolve(data)); - res.on('error', reject); - }); - - const release = JSON.parse(body); - const asset = release.assets.find((a) => a.name === ASSET_NAME); - if (!asset) { - const names = release.assets.map((a) => a.name).join(', '); - throw new Error( - `Asset "${ASSET_NAME}" not found in release "${RELEASE_TAG}".\n` + - ` Available assets: ${names || '(none)'}\n` + - ` Upload the patched Electron zip to: ${GITEA_BASE}/${REPO}/releases/tag/${RELEASE_TAG}` - ); - } - - // Gitea API returns browser_download_url for direct download - return asset.browser_download_url; +function getAssetUrl() { + return DIRECT_DOWNLOAD_URL; } function extractZip(zipPath, destDir) { @@ -151,9 +129,8 @@ async function main() { console.log(` Installed: ${installed}, need: ${ELECTRON_VERSION}`); } - // Resolve download URL from Gitea release - console.log(` Fetching release info for "${RELEASE_TAG}"...`); - const url = await getAssetUrl(); + // Direct download from GitHub release + const url = getAssetUrl(); console.log(` Asset URL: ${url}`); // Download @@ -196,13 +173,9 @@ main().then(() => { }).catch((err) => { console.error('[KCC] Electron download failed:', err.message); console.error(''); - console.error(' If this is your first time building, you need the patched Electron zip'); - console.error(` uploaded as a release asset on ${GITEA_BASE}/${REPO}`); + console.error(' Download the patched Electron manually from:'); + console.error(` ${DIRECT_DOWNLOAD_URL}`); console.error(''); - console.error(' 1. Go to: ' + GITEA_BASE + '/' + REPO + '/releases/new'); - console.error(` 2. Create a release with tag: ${RELEASE_TAG}`); - console.error(` 3. Upload: ${ASSET_NAME}`); - console.error(''); - console.error(' See electron-build/BUILD.md for how to build Electron from source.'); + console.error(` See ${GITHUB_BASE}/${REPO} for details.`); process.exit(1); });