两点:
1. gitalk配置中的proxy选项默认使用了cloudflare workers域名,建议自己使用 https://github.com/Zibri/cloudflare-cors-anywhere 搭建一个,并绑定自己的域名。
2. gitalk的css与JS建议都用JS引入,并合理书写JS的onload事件。
https://gist.github.com/lgh06/0449674b484cbabaac7d17735c8d9d42 https://jihulab.com/-/snippets/1263
redir
为download
,便可获取临时地址,但是会跳转到onedrive.live.com,因此需要国外服务器/cloudflare workers等作中转。附cf workers关键代码:
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
async function handleRequest(request) {
const { origin } = new URL(request.url);
var url1 = String(request.url).replace(origin + '/', 'https://1drv.ms/')
let url2 = await fetch(url1, {redirect: "manual"}).then(function(response){
let innerUrl2 = response.headers.get('location');
return innerUrl2.replace('/redir?', '/download?');
});
let url3 = await fetch(url2, {redirect: "manual"}).then(function(response){
let innerUrl3 = response.headers.get('location').replace('?download','?');
return innerUrl3;
});
return new Response(``, {
status: 301,
headers: {
Location: url3,
"Cache-Control":"max-age=60"
},
});
}
https://1drv.ms/v/s!AqpFcPtySpJNqAbVx3KvIpyx0bfk?e=geLwcy
https://github.com/Mapaler/GetOneDriveDirectLink
https://github.com/aploium/OneDrive-Direct-Link
https://github.com/spencerwooo/onedrive-cf-index
https://github.com/reruin/sharelist https://github.com/txperl/JustList
writefreely可以自定义CSS, 可是遗憾的是不能自定义JS。
通过查看writefreely的官方论坛,发现有一个hack方法。
在自定义的CSS内部,增加如下代码:
</style>
<script>
console.log('test')
</script>
<style type="text/css">
也可以用script src 引用远程的js文件。
这可玩性就非常高了。
简单分析原理:
自定义的CSS都会被放到head标签内的内部。
通过开头的 </style>
以及结尾的<style type="text/css">
对浏览器进行欺骗,便可以插入JS了。
nice。