Watch Together Plugin + Electron Desktop App mit Ad-Blocker

Neuer Tab: Watch Together - gemeinsam Videos schauen (w2g.tv-Style)
- Raum-System mit optionalem Passwort und Host-Kontrolle
- Video-Queue mit Hinzufuegen/Entfernen/Umordnen
- YouTube (IFrame API) + direkte Video-URLs (.mp4, .webm)
- Synchronisierte Wiedergabe via WebSocket (/ws/watch-together)
- Server-autoritative Playback-State mit Drift-Korrektur (2.5s Sync-Pulse)
- Host-Transfer bei Disconnect, Room-Cleanup nach 30s

Electron Desktop App (electron/):
- Wrapper fuer Gaming Hub mit integriertem Ad-Blocker
- uBlock-Style Request-Filtering via session.webRequest
- 100+ Ad-Domains + YouTube-spezifische Filter
- Download-Button im Web-Header (nur sichtbar wenn nicht in Electron)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-07 02:40:59 +01:00
parent 4943bbf4a1
commit 73f247ada3
16 changed files with 7386 additions and 4833 deletions

68
electron/main.js Normal file
View file

@ -0,0 +1,68 @@
const { app, BrowserWindow, session, shell } = require('electron');
const path = require('path');
const { setupAdBlocker } = require('./ad-blocker');
// Handle Squirrel events (Windows installer)
try {
if (require('electron-squirrel-startup')) app.quit();
} catch {
// electron-squirrel-startup not installed, skip
}
const HUB_URL = process.env.GAMING_HUB_URL || 'https://hub.daddelolymp.de';
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 1400,
height: 900,
minWidth: 900,
minHeight: 600,
title: 'Gaming Hub',
icon: path.join(__dirname, 'assets', 'icon.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
},
backgroundColor: '#1a1b1e',
autoHideMenuBar: true,
});
// Setup ad blocker BEFORE loading URL
setupAdBlocker(session.defaultSession);
// Custom User-Agent to identify Electron app
const currentUA = mainWindow.webContents.getUserAgent();
mainWindow.webContents.setUserAgent(currentUA + ' GamingHubDesktop/1.0.0');
mainWindow.loadURL(HUB_URL);
// Open external links in default browser
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (!url.startsWith(HUB_URL)) {
shell.openExternal(url);
return { action: 'deny' };
}
return { action: 'allow' };
});
// Handle navigation to external URLs
mainWindow.webContents.on('will-navigate', (event, url) => {
if (!url.startsWith(HUB_URL)) {
event.preventDefault();
shell.openExternal(url);
}
});
}
app.whenReady().then(createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});