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]>
109 lines
3.8 KiB
JavaScript
Executable File
109 lines
3.8 KiB
JavaScript
Executable File
const fs = require('fs');
|
|
const path = require('path');
|
|
const { app } = require('electron');
|
|
|
|
const settingsPath = path.join(app.getPath('userData'), 'settings.json');
|
|
|
|
const defaults = {
|
|
notificationsEnabled: true,
|
|
macNotificationsAsked: false,
|
|
notificationTypes: {
|
|
nowPlaying: true,
|
|
paused: true,
|
|
liked: true,
|
|
unliked: true,
|
|
verificationRequired: true,
|
|
torStarted: true,
|
|
torStopped: true,
|
|
torCrashed: true,
|
|
},
|
|
torEnabled: false,
|
|
hotkeys: {
|
|
playpause: 'MediaPlayPause',
|
|
next: 'MediaNextTrack',
|
|
previous: 'MediaPreviousTrack',
|
|
like: 'F23',
|
|
},
|
|
discordRpc: {
|
|
enabled: false,
|
|
},
|
|
lastfm: {
|
|
enabled: false,
|
|
apiKey: '',
|
|
apiSecret: '',
|
|
sessionKey: '',
|
|
username: '',
|
|
},
|
|
tuneshine: {
|
|
enabled: false,
|
|
devices: [], // [{ url, name, enabled }]
|
|
},
|
|
streamDeck: {
|
|
autoInstall: true, // copy the plugin into Elgato's folder on launch
|
|
},
|
|
// Radio / autoplay "vibe" tuning — how tightly stations stay on the seed's vibe.
|
|
// Weights read by the renderer's vibeScore/filterByVibe; edited in Settings → Radio.
|
|
radioVibe: {
|
|
genreExact: 3, // points when the candidate's genre == the seed's
|
|
genrePartial: 2, // points when one genre string contains the other
|
|
tag: 1, // points per shared tag
|
|
title: 1, // points per shared meaningful title word
|
|
artist: 1, // bonus when same artist AND already on-vibe
|
|
keepThreshold: 1, // minimum score for a track to be kept
|
|
minTracks: 16, // floor before the dominant-genre fallback tops up
|
|
},
|
|
};
|
|
|
|
let current = JSON.parse(JSON.stringify(defaults));
|
|
|
|
function loadSettings() {
|
|
try {
|
|
if (fs.existsSync(settingsPath)) {
|
|
const data = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
current = {
|
|
...defaults,
|
|
...data,
|
|
hotkeys: { ...defaults.hotkeys, ...(data.hotkeys || {}) },
|
|
discordRpc: { ...defaults.discordRpc, ...(data.discordRpc || {}) },
|
|
lastfm: { ...defaults.lastfm, ...(data.lastfm || {}) },
|
|
tuneshine: { ...defaults.tuneshine, ...(data.tuneshine || {}) },
|
|
radioVibe: { ...defaults.radioVibe, ...(data.radioVibe || {}) },
|
|
notificationTypes: { ...defaults.notificationTypes, ...(data.notificationTypes || {}) },
|
|
};
|
|
console.log('[settings] Loaded from disk:', settingsPath);
|
|
console.log('[settings] Active settings:', JSON.stringify(current, null, 2));
|
|
} else {
|
|
console.log('[settings] No settings file found, using defaults.');
|
|
}
|
|
} catch (err) {
|
|
console.error('[settings] Error loading settings:', err);
|
|
}
|
|
return current;
|
|
}
|
|
|
|
function saveSettings(updates) {
|
|
console.log('[settings] Saving updates:', JSON.stringify(updates));
|
|
current = {
|
|
...current,
|
|
...updates,
|
|
hotkeys: { ...current.hotkeys, ...(updates.hotkeys || {}) },
|
|
discordRpc: { ...current.discordRpc, ...(updates.discordRpc || {}) },
|
|
lastfm: { ...current.lastfm, ...(updates.lastfm || {}) },
|
|
tuneshine: { ...current.tuneshine, ...(updates.tuneshine || {}) },
|
|
radioVibe: { ...current.radioVibe, ...(updates.radioVibe || {}) },
|
|
notificationTypes: { ...current.notificationTypes, ...(updates.notificationTypes || {}) },
|
|
};
|
|
try {
|
|
fs.writeFileSync(settingsPath, JSON.stringify(current, null, 2), 'utf8');
|
|
console.log('[settings] Saved to disk successfully.');
|
|
} catch (err) {
|
|
console.error('[settings] Error saving settings:', err);
|
|
}
|
|
return current;
|
|
}
|
|
|
|
function getSettings() {
|
|
return current;
|
|
}
|
|
|
|
module.exports = { loadSettings, saveSettings, getSettings }; |