Files
R3ap3r 3178b8f4f7 Aurora SpotiRip desktop and web app
- Spotify playlist, library, album and artist browsing with in-app playback
- Song, playlist and album downloads via spotdl with YouTube and Bandcamp fallbacks
- Electron desktop app (castLabs Widevine) with a permanent sidebar layout
- Linux and Windows packaging scripts
2026-09-25 23:20:57 -05:00

33 lines
947 B
TypeScript

import { app } from "electron";
import { existsSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
type DesktopSettings = { downloadFolder: string };
const SETTINGS_FILE = join(app.getPath("userData"), "settings.json");
function defaults(): DesktopSettings {
return { downloadFolder: join(app.getPath("music"), "Aurora SpotiRip") };
}
export function loadSettings(): DesktopSettings {
try {
if (existsSync(SETTINGS_FILE)) {
return { ...defaults(), ...JSON.parse(readFileSync(SETTINGS_FILE, "utf8")) };
}
} catch {
}
return defaults();
}
export function saveSettings(changes: Partial<DesktopSettings>) {
const next = { ...loadSettings(), ...changes };
writeFileSync(SETTINGS_FILE, JSON.stringify(next, null, 2));
applySettings(next);
return next;
}
export function applySettings(settings = loadSettings()) {
process.env.SPOTIRIP_DOWNLOAD_FOLDER = settings.downloadFolder;
}