TODO: 测试稳定性.
This commit is contained in:
14
chromeproxy/.vscode/launch.json
vendored
14
chromeproxy/.vscode/launch.json
vendored
@@ -9,6 +9,20 @@
|
||||
"name": "Chrome Extension debugging",
|
||||
"port": 9222,
|
||||
"type": "chrome",
|
||||
"runtimeArgs": [
|
||||
"--user-data-dir=/tmp/chromeproxy-userdata",
|
||||
"--ignore-certificate-errors",
|
||||
"--disable-dev-shm-usage",
|
||||
"--mute-audio",
|
||||
"--safebrowsing-disable-auto-update",
|
||||
"--disable-gpu",
|
||||
"--no-sandbox",
|
||||
"--disable-blink-features=AutomationControlled",
|
||||
"--disable-infobars",
|
||||
"--allow-running-insecure-content",
|
||||
"--disable-features=TranslateUI",
|
||||
"--test-type",
|
||||
],
|
||||
"url": "http:/localhost:7123",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
var task_manager = {
|
||||
}
|
||||
|
||||
|
||||
function GetTask(sender) {
|
||||
fetch(GetTaskUrl).then(function (response) {
|
||||
if (response.ok) {
|
||||
@@ -94,7 +93,7 @@ function Tell(sender, jnjectType) {
|
||||
chrome.webRequest.onBeforeRequest.addListener(function (details) {
|
||||
if (details.url.startsWith("http://eson.config")) {
|
||||
var params = new URLSearchParams(details.url)
|
||||
GetTaskUrl = params.get("taskurl");
|
||||
UpdateHost(params.get("taskurl"))
|
||||
chrome.tabs.remove(details.tabId, function () { });
|
||||
return { cancel: true };
|
||||
}
|
||||
|
||||
@@ -5,6 +5,13 @@ var GetTaskUrl = `${Host}/task/get`;
|
||||
var FinishTaskUrl = `${Host}/task/content`;
|
||||
var ErrorTaskUrl = `${Host}/task/error`;
|
||||
|
||||
function UpdateHost(host) {
|
||||
Host = host
|
||||
GetTaskUrl = `${Host}/task/get`
|
||||
FinishTaskUrl = `${Host}/task/content`
|
||||
ErrorTaskUrl = `${Host}/task/error`
|
||||
}
|
||||
|
||||
const BackgroundMsgType = {
|
||||
NOTWANT: 'notwant',
|
||||
CONTENT: 'content',
|
||||
|
||||
Reference in New Issue
Block a user