mirror of
https://github.com/AIsouler/GKD_subscription.git
synced 2025-12-20 08:44:55 +08:00
perf: check deprecatedKeys
This commit is contained in:
@@ -18,23 +18,22 @@ interface RawDeprecatedKeysSetting {
|
||||
}
|
||||
|
||||
export const checkDeprecatedGroupKeys = (apps: RawApp[]) => {
|
||||
apps.forEach((a) => {
|
||||
appDeprecatedKeys.forEach((d) => {
|
||||
if (a.id === d.id) {
|
||||
a.groups.forEach((g) => {
|
||||
if (d.deprecatedKeys.indexOf(g.key.valueOf()) !== -1) {
|
||||
apps.forEach((app) => {
|
||||
const deprecatedKeys = appDeprecatedKeysMap.get(app.id);
|
||||
if (deprecatedKeys) {
|
||||
app.groups.forEach(({ key, name }) => {
|
||||
if (deprecatedKeys.includes(key)) {
|
||||
console.error({
|
||||
configName: a.name,
|
||||
appId: a.id,
|
||||
groupName: g.name,
|
||||
groupKey: g.key,
|
||||
configName: app.name,
|
||||
appId: app.id,
|
||||
groupName: name,
|
||||
groupKey: key,
|
||||
});
|
||||
throw new Error('invalid deprecated group key');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const appDeprecatedKeys: RawDeprecatedKeysSetting[] = [
|
||||
@@ -555,3 +554,11 @@ const appDeprecatedKeys: RawDeprecatedKeysSetting[] = [
|
||||
deprecatedKeys: [2],
|
||||
},
|
||||
];
|
||||
|
||||
const map: Map<string, number[]> = new Map();
|
||||
|
||||
appDeprecatedKeys.forEach(({ id, deprecatedKeys }) => {
|
||||
map.set(id, deprecatedKeys);
|
||||
});
|
||||
|
||||
const appDeprecatedKeysMap = map;
|
||||
|
||||
Reference in New Issue
Block a user