fix(update): 统一忽略更新配置到用户目录

This commit is contained in:
2026-04-15 11:44:18 +08:00
parent 51664619f5
commit 36f5d3831e
18 changed files with 486 additions and 104 deletions

View File

@@ -1,9 +1,16 @@
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { homedir } from "node:os";
import { dirname } from "node:path";
import { join } from "node:path";
import type { UpdateCenterItem } from "./types";
export const LEGACY_IGNORE_CONFIG_PATH = "/etc/spark-store/ignored_apps.conf";
export const IGNORE_CONFIG_PATH = join(
homedir(),
".config",
"spark-store",
"ignored_apps.conf",
);
const LEGACY_IGNORE_SEPARATOR = "|";
@@ -77,3 +84,15 @@ export const applyIgnoredEntries = (
createIgnoreKey(item.pkgname, item.nextVersion),
),
}));
export const sortIgnoredItems = (
items: UpdateCenterItem[],
): UpdateCenterItem[] => {
return [...items].sort((left, right) => {
if (left.ignored === right.ignored) {
return 0;
}
return left.ignored === true ? 1 : -1;
});
};