feat: 处理MCBBS网站异常重试

This commit is contained in:
502647092 2021-09-03 08:09:39 +00:00
parent effbbc5f77
commit 10ce31c2e0

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name 圈云盒子顶帖器
// @namespace https://circlecloud.ltd/
// @version 0.1.6
// @version 0.1.7
// @description 自动顶贴
// @author MiaoWoo
// @match https://www.mcbbs.net/forum-server-1.html**
@ -55,7 +55,8 @@
async function main() {
await sleep(3000)
//feat: auto refresh when mcbbs return 504
if (document.getElementsByTagName('h1')[0].innerText.startsWith(504)) {
let errorh1 = document.getElementsByTagName('h1')[0]
if (errorh1 && errorh1.innerText.startsWith(50)) {
return refresh()
}
let taskId = setTimeout(refresh, 60000)
@ -72,6 +73,7 @@
await post('updateServers', servers)
console.log('数据上报完成!')
}
document.getElementById('scbar_txt').value = "数据上报完成!"
store.lastPostServer = JSON.stringify({
first: servers[0].tid,
five: servers[5].tid,