Auto-Updater: Separate Update-URL (updates.daddelolymp.de) fuer Pangolin-Bypass

- UPDATE_URL getrennt von HUB_URL (kein Pangolin-Auth fuer Squirrel)
- GOG Exchange laeuft jetzt ueber Renderer-Fetch (hat Pangolin-Session-Cookie)
- Konfigurierbar via GAMING_HUB_UPDATE_URL env var

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-08 14:48:34 +01:00
parent cad4f40c53
commit e4c3586ef3

View file

@ -12,6 +12,8 @@ try {
} }
const HUB_URL = process.env.GAMING_HUB_URL || 'https://hub.daddelolymp.de'; const HUB_URL = process.env.GAMING_HUB_URL || 'https://hub.daddelolymp.de';
// Separate URL for auto-updates (no Pangolin auth, publicly accessible)
const UPDATE_URL = process.env.GAMING_HUB_UPDATE_URL || 'https://updates.daddelolymp.de';
const APP_VERSION = app.getVersion(); const APP_VERSION = app.getVersion();
// Sync IPC: preload reads app version from package.json // Sync IPC: preload reads app version from package.json
@ -22,9 +24,9 @@ ipcMain.on('get-app-version', (event) => {
function setupAutoUpdater() { function setupAutoUpdater() {
if (process.platform !== 'win32') return; if (process.platform !== 'win32') return;
// Squirrel.Windows appends /RELEASES to the feed URL, // Squirrel.Windows appends /RELEASES to the feed URL.
// so point to /downloads where RELEASES + nupkg files live // Uses separate subdomain without Pangolin auth (Squirrel has no browser session).
const updateURL = `${HUB_URL}/downloads`; const updateURL = `${UPDATE_URL}/downloads`;
try { try {
autoUpdater.setFeedURL({ url: updateURL }); autoUpdater.setFeedURL({ url: updateURL });
} catch (e) { } catch (e) {
@ -235,21 +237,24 @@ document.getElementById('cancelBtn').addEventListener('click', () => {
const state = parsed.searchParams.get('state') || ''; const state = parsed.searchParams.get('state') || '';
if (code) { if (code) {
// Exchange the code via our server // Exchange code via renderer fetch (has Pangolin session cookie)
const resp = await fetch(`${HUB_URL}/api/game-library/gog/exchange`, { const jsCode = `
fetch('/api/game-library/gog/exchange', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code, linkTo: state }), body: JSON.stringify({ code: ${JSON.stringify(code)}, linkTo: ${JSON.stringify(state)} }),
}); }).then(r => r.json()).then(result => {
const result = await resp.json(); window.dispatchEvent(new Event('gog-connected'));
return result;
})
`;
const result = await mainWindow.webContents.executeJavaScript(jsCode);
if (resp.ok && result.ok) { if (result && result.ok) {
childWindow.loadURL(`data:text/html,${encodeURIComponent(`<!DOCTYPE html><html><head><style>body{background:#1a1a2e;color:#fff;font-family:sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0}div{text-align:center}h2{color:#a855f7}</style></head><body><div><h2>GOG verbunden!</h2><p>${result.profileName}: ${result.gameCount} Spiele geladen.</p></div></body></html>`)}`); childWindow.loadURL(`data:text/html,${encodeURIComponent(`<!DOCTYPE html><html><head><style>body{background:#1a1a2e;color:#fff;font-family:sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0}div{text-align:center}h2{color:#a855f7}</style></head><body><div><h2>GOG verbunden!</h2><p>${result.profileName}: ${result.gameCount} Spiele geladen.</p></div></body></html>`)}`);
// Notify renderer to refresh profiles
mainWindow.webContents.executeJavaScript('window.dispatchEvent(new Event("gog-connected"))');
setTimeout(() => { try { childWindow.close(); } catch {} }, 2500); setTimeout(() => { try { childWindow.close(); } catch {} }, 2500);
} else { } else {
childWindow.loadURL(`data:text/html,${encodeURIComponent(`<!DOCTYPE html><html><head><style>body{background:#1a1a2e;color:#fff;font-family:sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0}div{text-align:center}h2{color:#e74c3c}</style></head><body><div><h2>Fehler</h2><p>${result.error || 'Unbekannter Fehler'}</p></div></body></html>`)}`); childWindow.loadURL(`data:text/html,${encodeURIComponent(`<!DOCTYPE html><html><head><style>body{background:#1a1a2e;color:#fff;font-family:sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0}div{text-align:center}h2{color:#e74c3c}</style></head><body><div><h2>Fehler</h2><p>${(result && result.error) || 'Unbekannter Fehler'}</p></div></body></html>`)}`);
} }
} }
} catch (err) { } catch (err) {