24 lines
502 B
TypeScript
24 lines
502 B
TypeScript
/**
|
|
* Profile 路由 - 根据 URL 匹配平台
|
|
*/
|
|
import type { SiteProfile } from './types';
|
|
import { profile1688 } from './1688';
|
|
import { profileTaobao } from './taobao';
|
|
|
|
const PROFILES: SiteProfile[] = [
|
|
profile1688,
|
|
profileTaobao
|
|
];
|
|
|
|
export function matchProfile(url: string): SiteProfile | null {
|
|
for (const p of PROFILES) {
|
|
if (p.urlPatterns.some(re => re.test(url))) {
|
|
return p;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export { profile1688, profileTaobao };
|
|
export type { SiteProfile };
|