Files
RedLintu16andClaude Opus 5.5 b67b29b40b CrossSound desktop with the DRM stubbed out
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]>
2026-10-14 10:06:08 -07:00

59 lines
1.8 KiB
JavaScript
Executable File

'use strict'
const { createServer } = require('./server')
const { createSSEHub } = require('./lib/sse')
/**
* Create a CrossSound API instance. Each bridge (Stream Deck, Xbox Game Bar)
* creates its own instance on its own port; they all share this implementation.
*
* @param {object} opts
* @param {(action: string, data?: object) => void} opts.sendAction
* Forwards a playback command to the renderer. main.ts wires this to
* `win.webContents.send('crosssound-media-action', { action, ...data })`.
* @param {object} [opts.client] SoundCloud API client (enables library/search routes).
* @returns {{ start: (port: number, host?: string) => void, update: (state: object) => void, stop: () => void, setClient: (c: object) => void }}
*/
function createApi({ sendAction, client } = {}) {
let currentState = {}
const sse = createSSEHub()
const ctx = {
sendAction: (action, data = {}) => { if (sendAction) sendAction(action, data) },
client: client || null,
state: () => currentState,
sse,
}
let server = null
return {
start(port, host = '127.0.0.1') {
if (server) return
server = createServer(ctx)
server.on('error', (err) => {
if (err.code === 'EADDRINUSE') console.warn(`[crosssound-api] port ${port} in use — not started`)
else console.error(`[crosssound-api] server error: ${err.message}`)
server = null
})
server.listen(port, host, () => console.log(`[crosssound-api] listening on http://${host}:${port}`))
},
/** Cache the latest now-playing state and push it to SSE subscribers. */
update(state) {
currentState = state || {}
sse.broadcast(currentState)
},
stop() {
sse.closeAll()
if (server) { server.close(); server = null }
},
/** Attach/replace the SoundCloud client after construction, if needed. */
setClient(c) { ctx.client = c || null },
}
}
module.exports = { createApi }