文章转自Leonn 的博客的《多说修改支持HTTPS(改进)》

背景

多说其实早已经提供了 https 的支持,怎奈于之前新浪头像不支持,所以需要做反代来委屈实现。
但是现在他其实已经支持了!

修改内容

大半夜跑到禾令奇的博客看的他的embed.js样式抄过来的 =。=
他的样式文件下载,算了不提供,看到里面有自建的 CDN,万一别人不知道该也没设置防盗链,流量就没了。。
在自己的多说的embed.js文件中,找到avatarUrl: function(e)改为下面这个即可!
注意:默认头像地址请自行修改!

avatarUrl: function(e) {
    if (document.location.protocol == "https:") {
        if (e.avatar_url) {
             e.avatar_url = e.avatar_url.replace(/^http\:\/\//, "https://");
             e.avatar_url = e.avatar_url.replace(/himg\.bdimg\.com/, "ofasiydp7.qnssl.com");//镜像源是baidu的https域名
             e.avatar_url = e.avatar_url.replace(/ds\.cdncache\.org/, "ofa8iijro.qnssl.com");//镜像源是cdncache的https域名
             e.avatar_url = e.avatar_url.replace(/img\d+\.douban\.com/, "img2.doubanio.com");//豆瓣无需镜像
             e.avatar_url = e.avatar_url.replace(/app\.qlogo\.cn/, "app.qlogo.cn");//镜像源是qlogo的https域名
             e.avatar_url = e.avatar_url.replace(/tp\d+\.sinaimg\.cn/, "tva2.sinaimg.cn");//镜像源是sina的https域名
        } else {
        rt.data.default_avatar_url = "//cdn.helingqi.com/images/img.png";//评论区默认头像的地址,请自行修改
        }
    }
  return e.avatar_url || rt.data.default_avatar_url
},
版权属于:泽泽社长
本文链接:https://blog.zezeshe.com/archives/say-more-change-https-improved.html
本站未注明转载的文章均为原创,并采用 CC BY-NC-SA 4.0 授权协议,转载请注明来源,谢谢!