mirror of
https://github.com/movie-web/movie-web.git
synced 2025-01-20 08:11:14 +01:00
15 lines
363 B
TypeScript
15 lines
363 B
TypeScript
|
import { conf } from "@/setup/config";
|
||
|
|
||
|
export function processCdnLink(url: string): string {
|
||
|
const parsedUrl = new URL(url);
|
||
|
const replacements = conf().CDN_REPLACEMENTS;
|
||
|
for (const [before, after] of replacements) {
|
||
|
if (parsedUrl.hostname.endsWith(before)) {
|
||
|
parsedUrl.host = after;
|
||
|
return parsedUrl.toString();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return url;
|
||
|
}
|