泛采专业版插件

1.检测后台服务是否异常,2.项目报警提示功能

目前為 2021-08-18 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
Fang Tiansheng
評價
0 0 0
版本
2.3.3
建立日期
2021-02-25
更新日期
2021-08-18
尺寸
5.0 KB
授權條款
未知
腳本執行於

// ==UserScript==
// @name 泛采专业版插件
// @namespace https://raw.githubusercontent.com/fangtiansheng/xinhua/master/script/baelish.js
// @include *://spider.vpc.shangjian.tech/*
// @include *://baelish.zncjtest.xhszjs.cn/*
// @include *://baelish-zncj.xhszjs.com/*
// @include *://8.131.101.146:30726/*
// @require https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js
// @icon https://www.valuesimplex.com/images/favicon.ico
// @icon64 https://www.valuesimplex.com/images/favicon.ico
// @grant GM_xmlhttpRequest
// @version 2.4.0
// @description 1.检测后台服务是否异常,2.项目报警提示功能,3.自动删除报警提示.
// @author 房天生
// @match *://spider.vpc.shangjian.tech/*
// @match *://baelish.zncjtest.xhszjs.cn/*
// @match *://baelish-zncj.xhszjs.com/*
// @match *://8.131.101.146:30726/*
// @grant GM_info
// ==/UserScript==

(function () {
"use strict";
// 定时ping泛采系统查看服务是否在线
const scriptInfo = GM_info.script;
const version = scriptInfo.version;
var interval = 1000 * 20;

var ping = function () {
let xhr = new XMLHttpRequest();
xhr.open("GET", "crawl/crawl/get-user-list");
xhr.onreadystatechange = function () {
let head = document.getElementsByClassName("head")[0];
if (xhr.readyState === 4) {
if (xhr.status === 200) {
head.style.backgroundColor = "";
window.document.title = "爬虫管理系统";
} else {
head.style.backgroundColor = "gray";
window.document.title = "🔥后台服务异常🔥";
}
}
};
xhr.send();
};

window.setInterval(ping, interval);
console.log(
`%c 泛采系统专业版插件 %c v${version} %c`,
"background:#0049b0 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
"background:#f56c6c ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff",
"background:transparent"
);

//定时扫描项目报警数量
if (window.location.hostname === "spider.vpc.shangjian.tech") {
setInterval(async () => {
const project = await fetch(
"https://spider.vpc.shangjian.tech/spider/project",
{
headers: {
accept: "application/json, text/plain, */*",
"accept-language":
"zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"cache-control": "no-cache",
pragma: "no-cache",
"sec-ch-ua":
'" Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"',
"sec-ch-ua-mobile": "?0",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
},
referrerPolicy: "no-referrer",
body: null,
method: "GET",
mode: "cors",
credentials: "include",
}
)
.then((response) => response.json())
.then(function (response) {
let data = response.data;
let count = 0;
let names = [];
for (let i = 0; i < data.length; i++) {
if (data[i].warning_count > 0 && data[i].id !== 97) {
names.push(data[i].name);
}
}
return names;
})
.then(function (names) {
//console.log("[+]项目中 "+names.length+"个报警。");
if (names.length > 0) {
window.document.title = "🔥报警: " + names.join(", ");
}
});
let list = JSON.parse(localStorage.getItem("report_ids"));
if (list.length > 0) {
console.log("共", list.length, "条警告。");
let url =
"spider/monitor?type=delete_report_history&report_id=" +
list.toString();
fetch(url, {
headers: {
accept: "application/json, text/plain, */*",
"accept-language":
"zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"cache-control": "no-cache",
pragma: "no-cache",
"sec-ch-ua":
'"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
"sec-ch-ua-mobile": "?0",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
},
referrerPolicy: "no-referrer",
body: null,
method: "DELETE",
mode: "cors",
credentials: "include",
});
} else {
console.log("目前没有告警。");
}
}, interval);
}
if (window.location.hostname.endsWith("xhszjs.cn")) {
setInterval(async () => {
const project = await fetch(window.location.origin, {
headers: {
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"cache-control": "no-cache",
pragma: "no-cache",
"upgrade-insecure-requests": "1",
},
referrer: "http://baelish.zncjtest.xhszjs.cn/",
referrerPolicy: "strict-origin-when-cross-origin",
body: null,
method: "GET",
mode: "cors",
credentials: "include",
});
}, interval);
}
})();