Skip to content

Commit

Permalink
remove stealth, listen to explicit actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ccev committed Apr 27, 2024
1 parent 1600b25 commit 751f4bf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
33 changes: 17 additions & 16 deletions xilriws-proxy/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ let currentProxyCreds = {

ws.onmessage = (event) => {
console.log('Message from server: ', event.data);
const data = JSON.parse(event.data)
const message = JSON.parse(event.data)
const action = message.action
const data = message.data

currentProxyCreds = {
username: data.username,
password: data.password
if (action === 'setProxy') {
currentProxyCreds = {
username: data.username,
password: data.password
}
startProxy(data.host, data.port, data.scheme)
}
startProxy(data.host, data.port, data.scheme)
}

function sendWs(action, detail) {
function sendWs(action, detail = null) {
ws.send(JSON.stringify({action: action, detail: detail}))
}

Expand All @@ -36,7 +40,7 @@ function startProxy(host, port, scheme) {
chrome.proxy.settings.set(
{value: proxyConfig},
() => {
sendWs('finish:proxy', host + ':' + port)
sendWs('finish:setProxy', host + ':' + port)
},
)
}
Expand All @@ -57,15 +61,12 @@ chrome.tabs.onUpdated.addListener((tabId, details) => {
}

chrome.tabs.executeScript(
tabId,
{code: 'localStorage.clear()', runAt: 'document_start'},
(result) => {console.log('Cleared local storage')}
)
// chrome.tabs.executeScript(
// tabId,
// {file: 'stealth.min.js', runAt: 'document_start'},
// (result) => {console.log('stealth.js loaded')}
// )
tabId,
{code: 'localStorage.clear()', runAt: 'document_start'},
(result) => {
console.log('Cleared local storage')
}
)
})

chrome.tabs.onRemoved.addListener(
Expand Down
2 changes: 0 additions & 2 deletions xilriws-proxy/stealth.min.js

This file was deleted.

0 comments on commit 751f4bf

Please sign in to comment.