feat: move default download directories to desktop

This commit is contained in:
Sucukdeluxe
2026-08-09 14:43:42 +02:00
parent 1750c6f0a9
commit 403051e3cf
6 changed files with 114 additions and 38 deletions
+55 -16
View File
@@ -17,6 +17,45 @@ afterEach(() => {
});
describe("settings storage", () => {
it("defaults download directories to the desktop project folder", () => {
const baseDir = path.join(os.homedir(), "Desktop", "Multi-Debrid-Downloader");
const defaults = defaultSettings();
expect(defaults.outputDir).toBe(baseDir);
expect(defaults.extractDir).toBe(path.join(baseDir, "_entpackt"));
expect(defaults.mkvLibraryDir).toBe(path.join(baseDir, "_mkv"));
});
it("migrates an untouched legacy directory configuration", () => {
const legacyBaseDir = path.join(os.homedir(), "Downloads", "RealDebrid");
const normalized = normalizeSettings({
...defaultSettings(),
outputDir: legacyBaseDir,
extractDir: path.join(legacyBaseDir, "_entpackt"),
mkvLibraryDir: path.join(legacyBaseDir, "_mkv")
});
const defaults = defaultSettings();
expect(normalized.outputDir).toBe(defaults.outputDir);
expect(normalized.extractDir).toBe(defaults.extractDir);
expect(normalized.mkvLibraryDir).toBe(defaults.mkvLibraryDir);
});
it("keeps custom directory choices during legacy migration", () => {
const legacyBaseDir = path.join(os.homedir(), "Downloads", "RealDebrid");
const customOutputDir = path.join(os.homedir(), "Videos", "Custom-Downloads");
const normalized = normalizeSettings({
...defaultSettings(),
outputDir: customOutputDir,
extractDir: path.join(legacyBaseDir, "_entpackt"),
mkvLibraryDir: path.join(legacyBaseDir, "_mkv")
});
expect(normalized.outputDir).toBe(customOutputDir);
expect(normalized.extractDir).toBe(path.join(legacyBaseDir, "_entpackt"));
expect(normalized.mkvLibraryDir).toBe(path.join(legacyBaseDir, "_mkv"));
});
it("does not persist provider credentials when rememberToken is disabled", () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rd-store-"));
tempDirs.push(dir);
@@ -71,7 +110,7 @@ describe("settings storage", () => {
expect(loaded.allDebridToken).toBe("all-token");
});
it("normalizes invalid enum and numeric values", () => {
it("normalizes invalid enum and numeric values", () => {
const normalized = normalizeSettings({
...defaultSettings(),
providerPrimary: "invalid-provider" as unknown as AppSettings["providerPrimary"],
@@ -105,21 +144,21 @@ describe("settings storage", () => {
expect(normalized.outputDir).toBe(defaultSettings().outputDir);
expect(normalized.extractDir).toBe(defaultSettings().extractDir);
expect(normalized.mkvLibraryDir).toBe(defaultSettings().mkvLibraryDir);
expect(normalized.updateRepo).toBe(defaultSettings().updateRepo);
});
it("migrates the previous private update repository to the public release repository", () => {
for (const updateRepo of [
"legacy-owner/real-debrid-downloader",
"legacy-owner/multi-debrid-downloader",
"legacy-owner/real-debrid-downloader.git"
]) {
const normalized = normalizeSettings({ ...defaultSettings(), updateRepo });
expect(normalized.updateRepo).toBe(defaultSettings().updateRepo);
}
});
it("normalizes malformed persisted config on load", () => {
expect(normalized.updateRepo).toBe(defaultSettings().updateRepo);
});
it("migrates the previous private update repository to the public release repository", () => {
for (const updateRepo of [
"legacy-owner/real-debrid-downloader",
"legacy-owner/multi-debrid-downloader",
"legacy-owner/real-debrid-downloader.git"
]) {
const normalized = normalizeSettings({ ...defaultSettings(), updateRepo });
expect(normalized.updateRepo).toBe(defaultSettings().updateRepo);
}
});
it("normalizes malformed persisted config on load", () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rd-store-"));
tempDirs.push(dir);
const paths = createStoragePaths(dir);