fix(updater): migrate legacy release repositories
Redirect settings that still reference the former private repositories to the public GitHub release source so existing installations can discover v2.0.1 and later updates.
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "real-debrid-downloader",
|
"name": "real-debrid-downloader",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "real-debrid-downloader",
|
"name": "real-debrid-downloader",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"adm-zip": "0.6.0",
|
"adm-zip": "0.6.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "real-debrid-downloader",
|
"name": "real-debrid-downloader",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"description": "Desktop downloader",
|
"description": "Desktop downloader",
|
||||||
"main": "build/main/main/main.js",
|
"main": "build/main/main/main.js",
|
||||||
"author": "Sucukdeluxe",
|
"author": "Sucukdeluxe",
|
||||||
|
|||||||
+5
-3
@@ -328,13 +328,15 @@ function normalizeProviderOrder(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEPRECATED_UPDATE_REPOS = new Set([
|
const DEPRECATED_UPDATE_REPO_NAMES = new Set([
|
||||||
"sucukdeluxe/real-debrid-downloader"
|
"real-debrid-downloader",
|
||||||
|
"multi-debrid-downloader"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function migrateUpdateRepo(raw: string, fallback: string): string {
|
function migrateUpdateRepo(raw: string, fallback: string): string {
|
||||||
const trimmed = raw.trim();
|
const trimmed = raw.trim();
|
||||||
if (!trimmed || DEPRECATED_UPDATE_REPOS.has(trimmed.toLowerCase())) {
|
const repoName = trimmed.split("/").filter(Boolean).pop()?.replace(/\.git$/i, "").toLowerCase() || "";
|
||||||
|
if (!trimmed || (DEPRECATED_UPDATE_REPO_NAMES.has(repoName) && trimmed.toLowerCase() !== fallback.toLowerCase())) {
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
return trimmed;
|
return trimmed;
|
||||||
|
|||||||
@@ -108,6 +108,17 @@ describe("settings storage", () => {
|
|||||||
expect(normalized.updateRepo).toBe(defaultSettings().updateRepo);
|
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", () => {
|
it("normalizes malformed persisted config on load", () => {
|
||||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rd-store-"));
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rd-store-"));
|
||||||
tempDirs.push(dir);
|
tempDirs.push(dir);
|
||||||
|
|||||||
Reference in New Issue
Block a user