mirror of
https://github.com/AIsouler/GKD_subscription.git
synced 2025-12-20 00:35:17 +08:00
chore: deprecatedKeys
This commit is contained in:
10
src/file.ts
10
src/file.ts
@@ -88,8 +88,18 @@ export const validSnapshotUrl = (s: string) => {
|
|||||||
export const checkConfig = (newConfig: SubscriptionConfig) => {
|
export const checkConfig = (newConfig: SubscriptionConfig) => {
|
||||||
// check duplicated group key
|
// check duplicated group key
|
||||||
newConfig.apps?.forEach((app) => {
|
newConfig.apps?.forEach((app) => {
|
||||||
|
const deprecatedKeys = app.deprecatedKeys || [];
|
||||||
const keys = new Set<number>();
|
const keys = new Set<number>();
|
||||||
app.groups?.forEach((g) => {
|
app.groups?.forEach((g) => {
|
||||||
|
if (deprecatedKeys.includes(g.key)) {
|
||||||
|
console.error({
|
||||||
|
configName: newConfig.name,
|
||||||
|
appId: app.id,
|
||||||
|
groupName: g.name,
|
||||||
|
groupKey: g.key,
|
||||||
|
});
|
||||||
|
throw new Error('invalid deprecated group key');
|
||||||
|
}
|
||||||
if (keys.has(g.key)) {
|
if (keys.has(g.key)) {
|
||||||
console.error({
|
console.error({
|
||||||
configName: newConfig.name,
|
configName: newConfig.name,
|
||||||
|
|||||||
@@ -103,6 +103,11 @@ export type AppConfig = {
|
|||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
groups?: GroupConfig[];
|
groups?: GroupConfig[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 某些规则组被移除不使用时, 为了避免 key 在后续被复用, 需要将已经删除的规则组的 key 填入此数组做校验使用
|
||||||
|
*/
|
||||||
|
deprecatedKeys?: number[];
|
||||||
} & CommonProps;
|
} & CommonProps;
|
||||||
|
|
||||||
export type AppConfigMudule = {
|
export type AppConfigMudule = {
|
||||||
|
|||||||
Reference in New Issue
Block a user