first commit

This commit is contained in:
kai.t 2024-04-23 10:02:30 +07:00
commit cf0e79f375
10 changed files with 12524 additions and 0 deletions

1
about.html Normal file
View File

@ -0,0 +1 @@
<h1>About</h1>

BIN
images/icon-off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

69
manifest.json Normal file
View File

@ -0,0 +1,69 @@
{
"manifest_version": 2,
"name": "Proxy For Seo Tool",
"description": "__MSG_extensionDescription__",
"version": "1.0.0",
"author": "Kai APAC",
"icons": {
"16": "images/icon.png",
"32": "images/icon.png",
"48": "images/icon.png",
"64": "images/icon.png",
"128": "images/icon.png"
},
"background": {
"scripts": ["scripts/socket.io.js", "scripts/background.js"]
},
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["scripts/content.js"]
}
],
"options_ui": {
"page": "options.html",
"open_in_tab": true,
"browser_style": true
},
"browser_action": {
"default_icon": "images/icon.png",
"default_title": "Proxy For Seo Tool",
"default_popup": "popup.html",
"browser_style": true
},
"permissions": [
"browsingData",
"proxy",
"storage",
"tabs",
"webRequest",
"webRequestBlocking",
"downloads",
"notifications",
"<all_urls>"
],
"commands": {
"modePatterns": {
"description": "__MSG_modePatterns__"
},
"modeDisabled": {
"description": "__MSG_modeDisabled__"
},
"forAll": {
"description": "__MSG_forAll__"
}
},
"browser_specific_settings": {
"gecko": {
"id": "admin@apactech.io",
"strict_min_version": "1.0"
}
}
}

80
options.html Normal file
View File

@ -0,0 +1,80 @@
<link rel="stylesheet" href="styles/bootstrap.css" />
<h1>Options</h1>
<div class="container" style="width: 500px">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Type</th>
<th scope="col">Column heading</th>
<th scope="col">Column heading</th>
<th scope="col">Column heading</th>
</tr>
</thead>
<tbody>
<tr class="table-active">
<th scope="row">Active</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr>
<th scope="row">Default</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-primary">
<th scope="row">Primary</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-secondary">
<th scope="row">Secondary</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-success">
<th scope="row">Success</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-danger">
<th scope="row">Danger</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-warning">
<th scope="row">Warning</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-info">
<th scope="row">Info</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-light">
<th scope="row">Light</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-dark">
<th scope="row">Dark</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
</tbody>
</table>
</div>
<script src="scripts/utils.js"></script>
<script src="scripts/options.js"></script>

78
popup.html Normal file
View File

@ -0,0 +1,78 @@
<link rel="stylesheet" href="styles/bootstrap.css" />
<div class="container" style="width: 500px">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Type</th>
<th scope="col">Column heading</th>
<th scope="col">Column heading</th>
<th scope="col">Column heading</th>
</tr>
</thead>
<tbody>
<tr class="table-active">
<th scope="row">Active</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr>
<th scope="row">Default</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-primary">
<th scope="row">Primary</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-secondary">
<th scope="row">Secondary</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-success">
<th scope="row">Success</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-danger">
<th scope="row">Danger</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-warning">
<th scope="row">Warning</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-info">
<th scope="row">Info</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-light">
<th scope="row">Light</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
<tr class="table-dark">
<th scope="row">Dark</th>
<td>Column content</td>
<td>Column content</td>
<td>Column content</td>
</tr>
</tbody>
</table>
</div>
<script>
console.log(chrome)
</script>

81
scripts/background.js Normal file
View File

@ -0,0 +1,81 @@
"use strict";
let sendAuth;
const credential = {
username: "",
password: "",
};
document.addEventListener("DOMContentLoaded", function () {
const socket = io("https://seotool.nswteam.net");
socket.on("connect", function () {
browser.browserAction.setBadgeText({text: "IO"});
browser.browserAction.setBadgeTextColor({color: "#fff"});
browser.browserAction.setBadgeBackgroundColor({color: "green"});
console.log("socket.io connected");
});
socket.on("disconnect", function () {
browser.browserAction.setBadgeText({text: "IO"});
browser.browserAction.setBadgeTextColor({color: "#fff"});
browser.browserAction.setBadgeBackgroundColor({color: "red"});
console.log("socket.io disconnected");
});
socket.emit("join", {join: "set_proxy"});
socket.on("message", function (message) {
console.log({message});
chrome.runtime.sendMessage({
to: "content",
data: {
socket_message: message,
},
});
/**
* {
* browser_name: ...
* type: socks | socks4, http, https,
* host: '127.0.0.1',
* port: 80,
* username?: ''
* password?: ''
* proxyDNS: ['socks', 'socks4'].includes(message.type)
* }
*/
const proxyDNS = ["socks", "socks4"].includes(message.type);
const proxy = {
type: message.type,
host: message.host,
port: message.port,
proxyDNS: proxyDNS,
};
// delete sendAuth old
if (typeof sendAuth === "function") {
browser.webRequest.onAuthRequired.removeListener(sendAuth);
}
if (message.username) {
proxy.username = credential.username = message.username;
proxy.password = credential.password = message.password;
sendAuth = async () => {
return {
authCredentials: credential,
};
};
browser.webRequest.onAuthRequired.addListener(
sendAuth,
{urls: ["<all_urls>"]},
["blocking"]
);
}
// final handle
browser.proxy.onRequest.addListener(
(requestInfo) => {
return proxy;
},
{urls: ["<all_urls>"]}
);
});
}); // end ready

8
scripts/content.js Normal file
View File

@ -0,0 +1,8 @@
document.addEventListener("DOMContentLoaded", function() {
console.log('---ready---')
chrome.runtime.onMessage.addListener(async (payload, sender) => {
console.log({
payload, sender
})
});
});

7
scripts/socket.io.js Normal file

File diff suppressed because one or more lines are too long

12200
styles/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff