Sum up ModWatchTool columns over shards

adjust userscript bot detection
This commit is contained in:
HF 2022-10-31 21:11:28 +01:00
parent 6431cf3945
commit f51b350d55
5 changed files with 35 additions and 26 deletions

View File

@ -18,7 +18,6 @@ import pixelTransferController from './ui/PixelTransferController';
import store from './store/store';
import renderApp from './components/App';
import { initRenderer, getRenderer } from './ui/renderer';
import { requestBanMe } from './store/actions/fetch';
import socketClient from './socket/SocketClient';
persistStore(store, {}, () => {
@ -87,28 +86,6 @@ persistStore(store, {}, () => {
}
}, 300000);
// detect bot scripts
setTimeout(() => {
let elList = document.querySelectorAll('body > div > span');
for (let i = 0; i < elList.length; i += 1) {
if (elList[i].innerText.includes('Void')) {
requestBanMe(1);
return;
}
}
elList = document.querySelectorAll('option');
for (let i = 0; i < elList.length; i += 1) {
const el = elList[i];
if (el.value === 'random') {
const parentEl = el.parentElement.parentElement;
if (parentEl && parentEl.innerText.startsWith('Strategy')) {
requestBanMe(1);
return;
}
}
}
}, 40000);
document.removeEventListener('DOMContentLoaded', onLoad);
};
document.addEventListener('DOMContentLoaded', onLoad, false);

View File

@ -355,7 +355,7 @@ export async function getPixelsFromArea(
let printIIDs = false;
let printUsers = false;
const columns = ['#'];
const columns = ['rid'];
const types = ['number'];
if (!filterIP && ip2Id.size > 0) {
printIIDs = true;

View File

@ -541,8 +541,36 @@ export function combineTables(a, b) {
bTable.rows = bTable.rows.concat(newRows);
}
if (bTable.columns[0] === 'rid') {
// make sure that row-ids are unique
bTable.rows.forEach((row, i) => { row[0] = i; });
}
const amountCol = bTable.columns.indexOf('#');
if (~amountCol) {
// sum amounts of duplicates if possible
let sumCol = bTable.columns.indexOf('canvas');
if (sumCol === -1) sumCol = bTable.columns.indexOf('IID');
if (~sumCol) {
const timeCol = bTable.columns.indexOf('time');
for (let i = 0; i < bTable.rows.length; i += 1) {
const aCol = bTable.rows[i];
const val = aCol[sumCol];
if (val && val !== 'N/A') {
for (let u = i + 1; u < bTable.rows.length; u += 1) {
const bCol = bTable.rows[u];
if (bCol[sumCol] === val) {
const amount = aCol[amountCol] + bCol[amountCol];
if (~timeCol && aCol[timeCol] < bCol[timeCol]) {
bTable.rows[i] = bCol;
}
bTable.rows.splice(u, 1);
bTable.rows[i][amountCol] = amount;
u -= 1;
}
}
}
}
}
}
return bTable;
}

View File

@ -17,7 +17,7 @@ async function banme(req, res) {
let expires = 0;
if (code === 1) {
reason = 'Userscript Bot';
expires = Date.now() + 1000 * 3600 * 24 * 30;
expires = Date.now() + 1000 * 3600 * 24 * 14;
/*
* ignore it for now to collect data manually
*
@ -32,6 +32,9 @@ async function banme(req, res) {
reason = 'Captcha Solving Script';
expires = Date.now() + 1000 * 3600 * 24 * 3;
*/
} else if (code === 3) {
reason = 'Updated Userscript Bot';
expires = Date.now() + 1000 * 3600 * 24 * 30;
} else {
res.json({
status: 'nope',

View File

@ -65,10 +65,11 @@ function generateMainPage(req) {
/>
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
<script>window.ssv=JSON.parse('${JSON.stringify(ssvR)}')</script>
<script>(function(){const o=XMLHttpRequest.prototype.open;const f=fetch;const c=(u)=>{try{if(u instanceof URL)u=u.host+u.pathname;if(u instanceof Request)u=u.url;u=decodeURIComponent(u.toLowerCase());}catch{u=null};if(!u||u.includes("glitch.me")||u.includes("touchedbydarkness"))window.location="https://www.youtube.com/watch?v=PjrAwC4TIPA";};XMLHttpRequest.prototype.open=(...args)=>{c(args[1]);return o.apply(this,args)};window.fetch=(...args)=>{c(args[0]);return f.apply(this,args)};window.ssv=JSON.parse('${JSON.stringify(ssvR)}');})();</script>
<link rel="stylesheet" type="text/css" id="globcss" href="${styleassets.default}" />
</head>
<body>
<script>(function(){const s=String.prototype.split;const a=new MutationObserver(e=>e.forEach(e=>e.addedNodes.forEach(e=>{"SCRIPT"===e.tagName&&e.innerText&&(e.innerText.length/s.apply(e.innerText,['_0_x']).length)<20&&(window.location="https://www.youtube.com/watch?v=PjrAwC4TIPA")})));a.observe(document.body,{childList:!0});a.observe(document.body.parentElement,{childList:!0});})();</script>
<div id="app">
</div>
${scripts.map((script) => `<script src="${script}"></script>`).join('')}