diff --git a/admin.css b/admin.css index 899d43a..8f3cad1 100644 --- a/admin.css +++ b/admin.css @@ -119,12 +119,14 @@ /* Captcha statuses */ &.captcha::before { background-image: url('img/captcha.png') } &.cap_Y::before { background-position-y: -20px } - &.cap_YN::before { background-position-y: -40px } + &.cap_YN::before, &.cap_YYN::before { background-position-y: -40px } &.cap_W::before { background-position-y: -60px } &.cap_H::before { background-position-y: -80px } &.cap_X::before { background-position-y: -100px } - &.cap_YH::before { background-position-y: -120px } + &.cap_YH::before, &.cap_YYH::before { background-position-y: -120px } &.cap_YNH::before { background-position-y: -140px } + &.cap_YY::before { background-position-y: -160px } + &.cap_N::before { background-position-y: -180px } /* Country flags */ /* Note: flag images and CSS adapted from: https://github.com/lafeber/world-flags-sprite/ */ diff --git a/admin.js b/admin.js index 204af86..896711b 100644 --- a/admin.js +++ b/admin.js @@ -416,7 +416,7 @@ BotMon.live = { _client: BotMon.live.data.clients.match(nv.agent) ?? null, // client info _platform: BotMon.live.data.platforms.match(nv.agent), // platform info _captcha: {'X': 0, 'Y': 0, 'N': 0, 'W':0, 'H': 0, - _str: function() { return (this.X > 0 ? 'X' : '') + (this.Y > 0 ? 'Y' : '') + (this.N > 0 ? 'N' : '') + (this.W > 0 ? 'W' : '') + (this.H > 0 ? 'H' : ''); } + _str: function() { return (this.X > 0 ? 'X' : '') + (this.Y > 0 ? (this.Y > 1 ? 'YY' : 'Y') : '') + (this.N > 0 ? 'N' : '') + (this.W > 0 ? 'W' : '') + (this.H > 0 ? 'H' : ''); } } // captcha counter }}; model._visitors.push(visitor); @@ -574,11 +574,13 @@ BotMon.live = { _makeCaptchaTitle: function(cObj) { const cStr = cObj._str(); switch (cStr) { - case 'Y': - case 'NY': return "Blocked."; + case 'Y': return "Blocked."; + case 'YY': return "Blocked multiple times."; case 'YN': return "Solved"; + case 'YYN': return "Solved after multiple attempts"; case 'W': return "Whitelisted"; case 'H': return "HEAD request, no captcha"; + case 'YH': case 'YYH': return "Block & HEAD mixed"; default: return "Undefined: " + cStr; } } @@ -2083,7 +2085,7 @@ BotMon.live = { botList.forEach( (botInfo) => { const bli = makeElement('dd'); bli.appendChild(makeElement('span', {'class': 'has_icon bot bot_' + botInfo.id }, botInfo.name)); - bli.appendChild(makeElement('span', {'class': 'count' }, botInfo.count)); + bli.appendChild(makeElement('span', {'class': 'count' }, botInfo.count || kNoData)); botElement.append(bli) }); } @@ -2098,7 +2100,7 @@ BotMon.live = { ispList.forEach( (netInfo) => { const li = makeElement('dd'); li.appendChild(makeElement('span', {'class': 'has_icon ipaddr ip' + netInfo.typ }, netInfo.name)); - li.appendChild(makeElement('span', {'class': 'count' }, netInfo.count)); + li.appendChild(makeElement('span', {'class': 'count' }, netInfo.count || kNoData)); botIps.append(li) }); } @@ -2111,7 +2113,7 @@ BotMon.live = { countryList.forEach( (cInfo) => { const cLi = makeElement('dd'); cLi.appendChild(makeElement('span', {'class': 'has_icon country ctry_' + cInfo.id.toLowerCase() }, cInfo.name)); - cLi.appendChild(makeElement('span', {'class': 'count' }, cInfo.count)); + cLi.appendChild(makeElement('span', {'class': 'count' }, cInfo.count || kNoData)); botCountries.appendChild(cLi); }); } @@ -2210,7 +2212,7 @@ BotMon.live = { usrCtryList.forEach( (cInfo) => { const cLi = makeElement('dd'); cLi.appendChild(makeElement('span', {'class': 'has_icon country ctry_' + cInfo.id.toLowerCase() }, cInfo.name)); - cLi.appendChild(makeElement('span', {'class': 'count' }, cInfo.count)); + cLi.appendChild(makeElement('span', {'class': 'count' }, cInfo.count || kNoData)); usrCountries.appendChild(cLi); }); } @@ -2234,7 +2236,7 @@ BotMon.live = { pgDd.appendChild(makeElement('span', { 'class': 'count', 'title': pgInfo.count + " page views" - }, pgInfo.count)); + }, pgInfo.count || kNoData)); wmpages.appendChild(pgDd); }); } diff --git a/captcha.js b/captcha.js index c818c97..4a72efe 100644 --- a/captcha.js +++ b/captcha.js @@ -176,11 +176,10 @@ const $BMCaptcha = { (new Date()).toISOString().substring(0, 10) ]; if (performance.now() - $BMCaptcha._st <= 1500) dat.push(performance.now() - $BMCaptcha._st); - const hash = $BMCaptcha.digest.hash(dat.join(';')); // set the cookie: - document.cookie = "DWConfirm=" + encodeURIComponent(hash) + '; path=/; session;' - + (document.location.protocol === 'https:' ? ' secure;' : ''); + document.cookie = "DWConfirm=" + encodeURIComponent($BMCaptcha.digest.hash(dat.join(';'))) + '; path=/; session;'; + // + (document.location.protocol === 'https:' ? ' secure;' : ''); } catch (err) { console.error(err); diff --git a/img/captcha.png b/img/captcha.png index aec43eb..fd841fc 100644 Binary files a/img/captcha.png and b/img/captcha.png differ