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]>
66 lines
1.7 KiB
JavaScript
Executable File
66 lines
1.7 KiB
JavaScript
Executable File
const fs = require('fs');
|
|
const path = require('path');
|
|
const { app } = require('electron');
|
|
|
|
const themesFilePath = path.join(app.getPath('userData'), 'themes.json');
|
|
const lastThemeFilePath = path.join(app.getPath('userData'), 'last-theme.json');
|
|
|
|
const loadedThemes = [];
|
|
|
|
/**
|
|
* Load saved themes into loadedThemes array, mutating it so the reference stays intact.
|
|
*/
|
|
function loadSavedThemes() {
|
|
try {
|
|
if (fs.existsSync(themesFilePath)) {
|
|
const data = fs.readFileSync(themesFilePath, 'utf8');
|
|
const parsed = JSON.parse(data);
|
|
loadedThemes.splice(0, loadedThemes.length, ...parsed); // Replace contents in-place
|
|
} else {
|
|
loadedThemes.splice(0, loadedThemes.length); // Clear array if no file
|
|
}
|
|
} catch (err) {
|
|
console.error('Error loading saved themes:', err);
|
|
loadedThemes.splice(0, loadedThemes.length);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Save current loadedThemes array to disk.
|
|
*/
|
|
function saveThemes() {
|
|
try {
|
|
fs.writeFileSync(themesFilePath, JSON.stringify(loadedThemes, null, 2), 'utf8');
|
|
} catch (err) {
|
|
console.error('Error saving themes:', err);
|
|
}
|
|
}
|
|
|
|
function saveLastTheme(themePath) {
|
|
try {
|
|
fs.writeFileSync(lastThemeFilePath, JSON.stringify({ path: themePath }), 'utf8');
|
|
} catch (err) {
|
|
console.error('Error saving last theme:', err);
|
|
}
|
|
}
|
|
|
|
function loadLastTheme() {
|
|
try {
|
|
if (fs.existsSync(lastThemeFilePath)) {
|
|
const data = fs.readFileSync(lastThemeFilePath, 'utf8');
|
|
const json = JSON.parse(data);
|
|
return json.path || null;
|
|
}
|
|
} catch (err) {
|
|
console.error('Error loading last theme:', err);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
module.exports = {
|
|
loadedThemes,
|
|
loadSavedThemes,
|
|
saveThemes,
|
|
saveLastTheme,
|
|
loadLastTheme,
|
|
}; |