fix(route/weibo/utils): enforce tvax sinaimg CDN (#11533)
Signed-off-by: Rongrong <i@rong.moe> Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
@@ -425,12 +425,13 @@ const weiboUtils = {
|
||||
sinaimgTvax: (() => {
|
||||
// https://datatracker.ietf.org/doc/html/rfc1808#section-2.4.3
|
||||
const regex = /(?<=\/\/)wx(?=[1-4]\.sinaimg\.cn\/)/gi;
|
||||
const prefixes = ['tva', 'tvax'];
|
||||
let cnt = 0;
|
||||
const replace = (html) => {
|
||||
cnt = (cnt + 1) % 2;
|
||||
return html.replace(regex, prefixes[cnt]);
|
||||
};
|
||||
// const prefixes = ['tva', 'tvax'];
|
||||
// let cnt = 0;
|
||||
// const replace = (html) => {
|
||||
// cnt = (cnt + 1) % 2;
|
||||
// return html.replace(regex, prefixes[cnt]);
|
||||
// };
|
||||
const replace = (html) => html.replace(regex, 'tvax'); // enforce `tvax` as `tva` has a strict WAF
|
||||
const replaceKV = (obj, keys) => {
|
||||
keys.forEach((key) => {
|
||||
if (obj[key]) {
|
||||
|
||||
Reference in New Issue
Block a user