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]>
69 lines
2.5 KiB
JavaScript
Executable File
69 lines
2.5 KiB
JavaScript
Executable File
const { nativeImage, globalShortcut } = require('electron');
|
|
const path = require('path');
|
|
|
|
function updateTaskbarButtons(mainWindow, state = {}) {
|
|
if (process.platform !== 'win32') return;
|
|
|
|
const playIcon = nativeImage.createFromPath(path.join(__dirname, '..', 'icons', state.isPlaying ? 'pause.png' : 'play.png'));
|
|
const nextIcon = nativeImage.createFromPath(path.join(__dirname, '..', 'icons', 'next.png'));
|
|
const prevIcon = nativeImage.createFromPath(path.join(__dirname, '..', 'icons', 'prev.png'));
|
|
const likeIcon = nativeImage.createFromPath(path.join(__dirname, '..', 'icons', state.isLiked ? 'unlike.png' : 'like.png'));
|
|
|
|
mainWindow.setThumbarButtons([
|
|
{
|
|
tooltip: 'Previous',
|
|
icon: prevIcon,
|
|
click: () => mainWindow.webContents.send('crosssound-media-action', { action: 'previous' })
|
|
},
|
|
{
|
|
tooltip: state.isPlaying ? 'Pause' : 'Play',
|
|
icon: playIcon,
|
|
click: () => mainWindow.webContents.send('crosssound-media-action', { action: 'playpause' })
|
|
},
|
|
{
|
|
tooltip: 'Next',
|
|
icon: nextIcon,
|
|
click: () => mainWindow.webContents.send('crosssound-media-action', { action: 'next' })
|
|
},
|
|
{
|
|
tooltip: state.isLiked ? 'Unlike' : 'Like',
|
|
icon: likeIcon,
|
|
click: () => mainWindow.webContents.send('crosssound-media-action', { action: 'like' })
|
|
}
|
|
]);
|
|
}
|
|
|
|
function tryRegister(key, handler) {
|
|
if (!key) return;
|
|
try {
|
|
globalShortcut.register(key, handler);
|
|
} catch (e) {
|
|
console.error(`Failed to register hotkey "${key}":`, e);
|
|
}
|
|
}
|
|
|
|
function registerMediaKeys(mainWindow, hotkeys = {}, torCallbacks = {}) {
|
|
const send = (action) => () => mainWindow?.webContents.send('crosssound-media-action', { action });
|
|
tryRegister(hotkeys.playpause || 'MediaPlayPause', send('playpause'));
|
|
tryRegister(hotkeys.next || 'MediaNextTrack', send('next'));
|
|
tryRegister(hotkeys.previous || 'MediaPreviousTrack', send('previous'));
|
|
tryRegister(hotkeys.like || 'F23', send('like'));
|
|
if (hotkeys.newcircuit) tryRegister(hotkeys.newcircuit, torCallbacks.newCircuit || (() => {}));
|
|
if (hotkeys.toggletor) tryRegister(hotkeys.toggletor, torCallbacks.toggleTor || (() => {}));
|
|
}
|
|
|
|
function reregisterMediaKeys(mainWindow, hotkeys, torCallbacks) {
|
|
globalShortcut.unregisterAll();
|
|
registerMediaKeys(mainWindow, hotkeys, torCallbacks);
|
|
}
|
|
|
|
function unregisterMediaKeys() {
|
|
globalShortcut.unregisterAll();
|
|
}
|
|
|
|
module.exports = {
|
|
updateTaskbarButtons,
|
|
registerMediaKeys,
|
|
reregisterMediaKeys,
|
|
unregisterMediaKeys,
|
|
}; |