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[]) => {
|
export const checkDeprecatedGroupKeys = (apps: RawApp[]) => {
|
||||||
apps.forEach((a) => {
|
apps.forEach((app) => {
|
||||||
appDeprecatedKeys.forEach((d) => {
|
const deprecatedKeys = appDeprecatedKeysMap.get(app.id);
|
||||||
if (a.id === d.id) {
|
if (deprecatedKeys) {
|
||||||
a.groups.forEach((g) => {
|
app.groups.forEach(({ key, name }) => {
|
||||||
if (d.deprecatedKeys.indexOf(g.key.valueOf()) !== -1) {
|
if (deprecatedKeys.includes(key)) {
|
||||||
console.error({
|
console.error({
|
||||||
configName: a.name,
|
configName: app.name,
|
||||||
appId: a.id,
|
appId: app.id,
|
||||||
groupName: g.name,
|
groupName: name,
|
||||||
groupKey: g.key,
|
groupKey: key,
|
||||||
});
|
});
|
||||||
throw new Error('invalid deprecated group key');
|
throw new Error('invalid deprecated group key');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const appDeprecatedKeys: RawDeprecatedKeysSetting[] = [
|
const appDeprecatedKeys: RawDeprecatedKeysSetting[] = [
|
||||||
@@ -555,3 +554,11 @@ const appDeprecatedKeys: RawDeprecatedKeysSetting[] = [
|
|||||||
deprecatedKeys: [2],
|
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