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]>
35 lines
1.1 KiB
JavaScript
Executable File
35 lines
1.1 KiB
JavaScript
Executable File
'use strict'
|
|
|
|
// Small HTTP helpers shared by every route module.
|
|
|
|
function setCors(res) {
|
|
res.setHeader('Access-Control-Allow-Origin', '*')
|
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
|
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type')
|
|
}
|
|
|
|
function sendJson(res, code, obj) {
|
|
res.writeHead(code, { 'Content-Type': 'application/json' })
|
|
res.end(JSON.stringify(obj))
|
|
}
|
|
|
|
/** Resolves to the parsed JSON body (or {} on empty/invalid). Caps at 100 KB. */
|
|
function readBody(req) {
|
|
return new Promise((resolve) => {
|
|
let body = ''
|
|
req.on('data', (c) => {
|
|
body += c
|
|
if (body.length > 1e5) req.destroy()
|
|
})
|
|
req.on('end', () => {
|
|
try { resolve(JSON.parse(body || '{}')) } catch { resolve({}) }
|
|
})
|
|
})
|
|
}
|
|
|
|
const ok = (res, extra = {}) => sendJson(res, 200, { ok: true, ...extra })
|
|
const bad = (res, msg = 'bad request') => sendJson(res, 400, { error: msg })
|
|
const unavailable = (res, msg = 'SoundCloud client not ready — sign in first') => sendJson(res, 503, { error: msg })
|
|
|
|
module.exports = { setCors, sendJson, readBody, ok, bad, unavailable }
|