A single-commit snapshot of better-remote (7a8c4cb plus the uncommitted remote.js work), with every DRM-bearing piece replaced by a stub that keeps the same interface: - src/ui/drm.js: no DRM pipelines; needsDrm/isDrmUrl false, bestEncryptedTranscoding null, playDrmAudio rejects. The engine switcher and drmVjs* helpers stay as no-ops. - src/electron/drm.ts: initCdm/setupLicenseCors no-ops; the drm:license and api:stream:drm-info IPC handlers reject with "DRM is not available". - src/api/soundcloud.ts: resolveEncryptedStream keeps its signature, rejects. - src/electron/main.ts: license host dropped from the header rewrite. - src/ui/pb-lease.js: the expiry self-check uses a placeholder URL instead of a captured DRM manifest URL (same policy values, still passes). - scripts/vmp-sign.js, forge.config.js vmpSign: Widevine signing skipped, so no castLabs EVS account is needed to run or package. - README: says DRM is stubbed here. Go+ tracks SoundCloud only serves encrypted are unplayable and skipped; previews and everything else play as before. No history: the private branches' DRM code is not reachable from this commit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
43 lines
1.0 KiB
JavaScript
Executable File
43 lines
1.0 KiB
JavaScript
Executable File
'use strict'
|
|
|
|
// Server-Sent-Events hub for GET /events. Pushes the now-playing state to every
|
|
// connected client whenever it changes — used by the Game Bar widget for live
|
|
// updates without polling.
|
|
|
|
function createSSEHub() {
|
|
const clients = new Set()
|
|
|
|
return {
|
|
add(res, initial) {
|
|
res.writeHead(200, {
|
|
'Content-Type': 'text/event-stream',
|
|
'Cache-Control': 'no-cache',
|
|
Connection: 'keep-alive',
|
|
'Access-Control-Allow-Origin': '*',
|
|
})
|
|
if (typeof res.flushHeaders === 'function') res.flushHeaders()
|
|
if (initial) {
|
|
try { res.write(`data: ${JSON.stringify(initial)}\n\n`) } catch { /* client gone */ }
|
|
}
|
|
clients.add(res)
|
|
res.on('close', () => clients.delete(res))
|
|
},
|
|
|
|
broadcast(data) {
|
|
const payload = `data: ${JSON.stringify(data)}\n\n`
|
|
for (const res of clients) {
|
|
try { res.write(payload) } catch { clients.delete(res) }
|
|
}
|
|
},
|
|
|
|
closeAll() {
|
|
for (const res of clients) {
|
|
try { res.end() } catch { /* already closed */ }
|
|
}
|
|
clients.clear()
|
|
},
|
|
}
|
|
}
|
|
|
|
module.exports = { createSSEHub }
|