fix: point Electron download at GitHub release
Build and Release / build-and-release (push) Failing after 4m12s

Download patched Electron from GitHub (bigjakk/Electron-Websocket-Fix)
instead of Gitea. Use direct download URL, no API call needed.
This commit is contained in:
2026-04-03 15:43:13 -07:00
parent 40bdd1bf69
commit cf05ce38e1
+13 -40
View File
@@ -6,7 +6,7 @@
* The patched Electron fixes input starvation ("aim freeze") when --disable-frame-rate-limit * 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. * 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. * local version file to skip re-downloading if already present.
* *
* Usage: * Usage:
@@ -22,12 +22,11 @@ const { execSync } = require('child_process');
// ── Configuration ────────────────────────────────────────────────────────── // ── Configuration ──────────────────────────────────────────────────────────
const ELECTRON_VERSION = '42.0.0-nightly.20260227'; const ELECTRON_VERSION = '42.0.0-nightly.20260227';
const ASSET_NAME = 'electron-v42.0.0-nightly-patched-win32-x64.zip'; const ASSET_NAME = 'electron-v42.0.0-nightly-release-patched-win32-x64.zip';
const GITEA_BASE = 'https://gitea.crjlab.net'; const GITHUB_BASE = 'https://github.com';
const REPO = 'bigjakk/Krunker-Civilian-Client'; const REPO = 'bigjakk/Electron-Websocket-Fix';
// The release tag that holds the patched Electron zip. const RELEASE_TAG = 'v1.0.0';
// Upload the zip as an asset to this release on Gitea. const DIRECT_DOWNLOAD_URL = `${GITHUB_BASE}/${REPO}/releases/download/${RELEASE_TAG}/${ASSET_NAME}`;
const RELEASE_TAG = 'electron-patched';
// On Windows, overwrite the npm-installed Electron with our patched build. // On Windows, overwrite the npm-installed Electron with our patched build.
// On Linux/macOS (CI cross-compilation), extract to a separate dist-win/ directory // On Linux/macOS (CI cross-compilation), extract to a separate dist-win/ directory
@@ -96,29 +95,8 @@ function downloadToFile(url, dest) {
}); });
} }
async function getAssetUrl() { function getAssetUrl() {
const apiUrl = `${GITEA_BASE}/api/v1/repos/${REPO}/releases/tags/${RELEASE_TAG}`; return DIRECT_DOWNLOAD_URL;
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 extractZip(zipPath, destDir) { function extractZip(zipPath, destDir) {
@@ -151,9 +129,8 @@ async function main() {
console.log(` Installed: ${installed}, need: ${ELECTRON_VERSION}`); console.log(` Installed: ${installed}, need: ${ELECTRON_VERSION}`);
} }
// Resolve download URL from Gitea release // Direct download from GitHub release
console.log(` Fetching release info for "${RELEASE_TAG}"...`); const url = getAssetUrl();
const url = await getAssetUrl();
console.log(` Asset URL: ${url}`); console.log(` Asset URL: ${url}`);
// Download // Download
@@ -196,13 +173,9 @@ main().then(() => {
}).catch((err) => { }).catch((err) => {
console.error('[KCC] Electron download failed:', err.message); console.error('[KCC] Electron download failed:', err.message);
console.error(''); console.error('');
console.error(' If this is your first time building, you need the patched Electron zip'); console.error(' Download the patched Electron manually from:');
console.error(` uploaded as a release asset on ${GITEA_BASE}/${REPO}`); console.error(` ${DIRECT_DOWNLOAD_URL}`);
console.error(''); console.error('');
console.error(' 1. Go to: ' + GITEA_BASE + '/' + REPO + '/releases/new'); console.error(` See ${GITHUB_BASE}/${REPO} for details.`);
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.');
process.exit(1); process.exit(1);
}); });