update: 快照链接校验

This commit is contained in:
aisouler
2024-02-22 11:46:09 +08:00
parent 916a1f2674
commit cd72765bf6

View File

@@ -130,7 +130,7 @@ export async function* walk(dirPath: string) {
export const validSnapshotUrl = (s: string) => {
const u = new URL(s);
return u.pathname.startsWith('/import/');
return u.pathname.startsWith('/import/') || u.pathname.startsWith('/i/');
};
export const checkConfig = (newConfig: RawSubscription) => {
@@ -284,7 +284,7 @@ export const checkConfig = (newConfig: RawSubscription) => {
groupKey: g.key,
});
throw new Error(
`invalid snapshotUrls: ${u}\nit should like https://i.gkd.li/import/12506571`,
`invalid snapshotUrls: ${u}\nit should like https://i.gkd.li/import/12506571 or https://i.gkd.li/i/14362119`,
);
}
});
@@ -299,7 +299,7 @@ export const checkConfig = (newConfig: RawSubscription) => {
ruleKey: r.key,
});
throw new Error(
`invalid snapshotUrls: ${u}\nit should like https://i.gkd.li/import/12506571`,
`invalid snapshotUrls: ${u}\nit should like https://i.gkd.li/import/12506571 or https://i.gkd.li/i/14362119`,
);
}
});