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]>
97 lines
4.2 KiB
JavaScript
Executable File
97 lines
4.2 KiB
JavaScript
Executable File
// Squirrel.Windows auto-updater — matches what `@electron-forge/maker-squirrel`
|
|
// produces (RELEASES + *.nupkg + Setup.exe). Uses Electron's BUILT-IN autoUpdater
|
|
// (Squirrel-backed), NOT electron-updater: the built-in one fetches
|
|
// `{feedURL}/RELEASES` from a plain static host, exactly the files the maker
|
|
// outputs. (electron-updater instead wants a `latest.yml` that the squirrel maker
|
|
// never creates — that mismatch is why there was no yaml next to RELEASES.)
|
|
const { autoUpdater, app, BrowserWindow } = require('electron');
|
|
|
|
// Push updater status to the renderer (shown as a toast) so update checks give
|
|
// on-screen feedback — including "up to date" and errors, which are otherwise
|
|
// silent (only a ready-to-install update pops the native dialog).
|
|
function sendStatus(data) {
|
|
try {
|
|
const w = BrowserWindow.getAllWindows()[0];
|
|
if (w && !w.isDestroyed()) w.webContents.send('updater-status', data);
|
|
} catch (_) { /* window gone */ }
|
|
}
|
|
|
|
// Separate channels so debug/test builds and release builds update independently.
|
|
// Release builds pull Latest; debug builds (packaged via `npm run win:debug`,
|
|
// which drops dist/ui/debug-build.flag) pull Debugging. Each folder just needs
|
|
// its own RELEASES + *.nupkg (+ Setup.exe for first install).
|
|
const PROD_URL = 'https://rl16cdn.fi/CrossSound/Latest';
|
|
const DEBUG_URL = 'https://rl16cdn.fi/CrossSound/Debugging';
|
|
|
|
autoUpdater.on('checking-for-update', () => {
|
|
console.log('[updater] Checking for updates...');
|
|
sendStatus({ state: 'checking' });
|
|
});
|
|
autoUpdater.on('update-not-available', () => {
|
|
console.log('[updater] Up to date.');
|
|
sendStatus({ state: 'uptodate' });
|
|
});
|
|
autoUpdater.on('update-available', () => {
|
|
console.log('[updater] Update available — downloading...');
|
|
sendStatus({ state: 'available' });
|
|
});
|
|
autoUpdater.on('error', (err) => {
|
|
const message = (err && err.message) || String(err) || 'unknown';
|
|
console.error('[updater] Error:', message);
|
|
sendStatus({ state: 'error', message });
|
|
});
|
|
|
|
// Squirrel signature: (event, releaseNotes, releaseName, releaseDate, updateURL).
|
|
// AUTO-RELAUNCH: once the new version is downloaded, notify the renderer (toast
|
|
// with a short countdown) and then apply + restart automatically — quitAndInstall
|
|
// on Squirrel.Windows swaps to the new version and relaunches the app.
|
|
let _installing = false;
|
|
autoUpdater.on('update-downloaded', (_event, _notes, releaseName) => {
|
|
if (_installing) return;
|
|
_installing = true;
|
|
const version = releaseName || '';
|
|
const seconds = 5;
|
|
console.log(`[updater] downloaded ${version} — auto-restarting in ${seconds}s`);
|
|
sendStatus({ state: 'downloaded', version, seconds });
|
|
setTimeout(() => {
|
|
console.log('[updater] quitAndInstall() — applying update and relaunching');
|
|
try {
|
|
// The window has a close→hide-to-tray handler gated on app.isQuitting; set
|
|
// it so quitAndInstall actually closes+quits (and Squirrel relaunches),
|
|
// instead of the window hiding to the tray and the app staying alive.
|
|
app.isQuitting = true;
|
|
autoUpdater.quitAndInstall();
|
|
} catch (e) {
|
|
console.error('[updater] quitAndInstall failed:', (e && e.message) || e);
|
|
_installing = false;
|
|
}
|
|
}, seconds * 1000);
|
|
});
|
|
|
|
let _feedConfigured = false;
|
|
|
|
// isDebugBuild: true for a packaged debug build (see dist/ui/debug-build.flag).
|
|
// Picks the channel so debug and release builds update from separate folders.
|
|
function checkForUpdates(isDebugBuild = false) {
|
|
if (!app.isPackaged) {
|
|
console.log('[updater] Skipping update check in dev mode.');
|
|
return;
|
|
}
|
|
try {
|
|
if (!_feedConfigured) {
|
|
const url = isDebugBuild ? DEBUG_URL : PROD_URL;
|
|
// Squirrel.Windows: the URL is the folder that holds RELEASES.
|
|
autoUpdater.setFeedURL({ url });
|
|
console.log(`[updater] feed = ${url} (${isDebugBuild ? 'debug' : 'release'} channel)`);
|
|
_feedConfigured = true;
|
|
}
|
|
autoUpdater.checkForUpdates();
|
|
} catch (e) {
|
|
// Squirrel autoUpdater throws if the app wasn't installed via Setup.exe
|
|
// (e.g. running the unpacked out/…-win32-x64 build) — harmless, just log it.
|
|
console.error('[updater] checkForUpdates failed:', (e && e.message) || e);
|
|
}
|
|
}
|
|
|
|
module.exports = { checkForUpdates };
|