chromeworker/chromeproxy/base.js

40 lines
932 B
JavaScript

var Host = "http://localhost:7123"
var GetTaskUrl = `${Host}/task/get`;
var FinishTaskUrl = `${Host}/task/content`;
var ErrorTaskUrl = `${Host}/task/error`;
var WorkerNumber = 10;
var PassContentCondition = undefined;
// 默认条件所有内容都获取
var DefaultContentCondition = function () {
return true;
// return href.startsWith("https://playerduo.com") && content.startsWith('<head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">')
}
function UpdateHost(host) {
Host = host
GetTaskUrl = `${Host}/task/get`
FinishTaskUrl = `${Host}/task/content`
ErrorTaskUrl = `${Host}/task/error`
}
const BackgroundMsgType = {
NOTWANT: 'notwant',
CONTENT: 'content',
GETTASK: 'gettask',
TIMEOUT: 'timeout',
ERROR: 'error',
OK: 'ok',
};
const InjectMsgType = {
FETCH: 'fetch',
WAIT: 'wait',
ERROR: 'error',
NOTASK: 'notask',
OK: 'ok',
};