-
Notifications
You must be signed in to change notification settings - Fork 0
/
sw-rules.cjs
29 lines (28 loc) · 1.12 KB
/
sw-rules.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module.exports.cacheRules = {
simple: {
match: (url, $eject) =>
url.host === "blog.saop.cc" &&
url.pathname.match(
/\.(woff2|woff|ttf|cur|ico|avif|webp|bmp|svg|raw|png|jpg|jpeg|gif|css|js|json|html|ass|vtt|mov|mpv|mp4|mp3|m4a|moc|mtn|xml)$/
),
},
};
module.exports.getRaceUrls = (srcUrl) => {
if (srcUrl.startsWith("https://cdn.bootcdn.net/ajax/libs")) {
const url = new URL(srcUrl);
return [
srcUrl,
`https://lib.baomitu.com` + url.pathname,
`https://cdn.staticfile.net` + url.pathname,
`https://npm.elemecdn.com` + url.pathname,
`https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M` + url.pathname,
`https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M` + url.pathname,
`https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M` + url.pathname,
`https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M` + url.pathname,
`https://registry.npmmirror.com` + url.pathname,
`https://unpkg.com` + url.pathname,
`https://cdn.jsdelivr.net/npm` + url.pathname,
`https://fastly.jsdelivr.net/npm` + url.pathname,
];
}
};