Make randomized UA strings
This commit is contained in:
parent
bfd42f9fa7
commit
14fa018ec1
2 changed files with 31 additions and 2 deletions
25
libbrowz.js
25
libbrowz.js
|
@ -1,3 +1,23 @@
|
||||||
|
const userAgents = [
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Firefox/128.0",
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0",
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Edg/120.0.0.0",
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Edg/98.0.0.0",
|
||||||
|
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36",
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
||||||
|
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
|
||||||
|
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36",
|
||||||
|
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Firefox/128.0"
|
||||||
|
];
|
||||||
|
|
||||||
|
function getRandomUserAgent() {
|
||||||
|
const randomIndex = Math.floor(Math.random() * userAgents.length);
|
||||||
|
return userAgents[randomIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentUA = "" // We haven't loaded any websites yet. It should be blank.
|
||||||
|
|
||||||
let tabGroup = document.querySelector("tab-group");
|
let tabGroup = document.querySelector("tab-group");
|
||||||
function normalizeUrl(url) {
|
function normalizeUrl(url) {
|
||||||
// Define regex patterns for matching URL schemes and local addresses
|
// Define regex patterns for matching URL schemes and local addresses
|
||||||
|
@ -23,6 +43,7 @@ function normalizeUrl(url) {
|
||||||
let url = undefined
|
let url = undefined
|
||||||
let browserFrame = undefined
|
let browserFrame = undefined
|
||||||
function go() {
|
function go() {
|
||||||
|
currentUA = getRandomUserAgent()
|
||||||
browserFrame = tabGroup.getActiveTab().webview
|
browserFrame = tabGroup.getActiveTab().webview
|
||||||
let browser = tabGroup.getActiveTab()
|
let browser = tabGroup.getActiveTab()
|
||||||
url = normalizeUrl(document.getElementById("txtUrl").value)
|
url = normalizeUrl(document.getElementById("txtUrl").value)
|
||||||
|
@ -38,7 +59,7 @@ function go() {
|
||||||
}
|
}
|
||||||
document.getElementById("txtUrl").value = ""
|
document.getElementById("txtUrl").value = ""
|
||||||
browserFrame.loadURL(url,
|
browserFrame.loadURL(url,
|
||||||
{userAgent: 'Sneedium/Undefined (Windows NT 5.1; Win32) AppleWebKit/537.92 (Blink, like Electron) Blink/109.0.5414.74 Safari/537.92'});
|
{userAgent: currentUA});
|
||||||
browserFrame.addEventListener('dom-ready', () => {
|
browserFrame.addEventListener('dom-ready', () => {
|
||||||
browserFrame.insertCSS(`
|
browserFrame.insertCSS(`
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
@ -77,7 +98,7 @@ function forward() {
|
||||||
function refresh() {
|
function refresh() {
|
||||||
if (typeof url != undefined) {
|
if (typeof url != undefined) {
|
||||||
browserFrame.loadURL(browserFrame.getURL(),
|
browserFrame.loadURL(browserFrame.getURL(),
|
||||||
{userAgent: 'Sneedium/Undefined (Windows NT 5.1; Win32) AppleWebKit/537.92 (Blink, like Electron) Blink/109.0.5414.74 Safari/537.92'});
|
{userAgent: currentUA});
|
||||||
} else {
|
} else {
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
|
|
8
sneedium-maker.sh
Executable file
8
sneedium-maker.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
y=$(date +%Y)
|
||||||
|
read -p "Sneedium # of year $y (1,2,3,4...):" v
|
||||||
|
npm run make
|
||||||
|
mkdir "Sneedium $y.$v"
|
||||||
|
mv sneedium-linux-* "Sneedium $y.$v"
|
||||||
|
mv sneedium-win32-* "Sneedium $y.$v"
|
||||||
|
tar -czvf "Sneedium $y.$v.tar.gz" "Sneedium $y.$v"
|
||||||
|
rm -rf "Sneedium $y.$v"
|
Loading…
Reference in a new issue