31 lines
827 B
JavaScript
Executable File
31 lines
827 B
JavaScript
Executable File
'use strict'
|
|
|
|
// CrossSound — Stream Deck bridge.
|
|
//
|
|
// Thin wrapper around the shared CrossSound API package, served on port 52124 for
|
|
// the Stream Deck plugin. Identical endpoint surface to the Xbox Game Bar bridge
|
|
// (they share ./crosssound-api) — just a different port.
|
|
|
|
const { createApi } = require('./crosssound-api')
|
|
|
|
const PORT = 52124
|
|
let api = null
|
|
|
|
/**
|
|
* @param {(action: string, data: object) => void} sender forwarded to the renderer
|
|
* @param {object} [client] SoundCloud API client (enables /search and library routes)
|
|
*/
|
|
function start(sender, client) {
|
|
if (api) return
|
|
api = createApi({ sendAction: sender, client })
|
|
api.start(PORT)
|
|
}
|
|
|
|
function update(state) { if (api) api.update(state) }
|
|
|
|
function stop() {
|
|
if (api) { api.stop(); api = null }
|
|
}
|
|
|
|
module.exports = { start, update, stop, PORT }
|