diff --git a/action.php b/action.php index 46bdcf3..be451e2 100644 --- a/action.php +++ b/action.php @@ -309,6 +309,7 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin { } private function insertCaptchaLoader() { + echo '' . NL; } diff --git a/admin.js b/admin.js index 0661f9e..a684ebc 100644 --- a/admin.js +++ b/admin.js @@ -42,7 +42,7 @@ const BotMon = { // get yesterday's date: let d = new Date(); - d.setDate(d.getDate() - 1); + if (BMSettings.showday == 'yesterday') d.setDate(d.getDate() - 1); this._datestr = d.toISOString().slice(0, 10); // init the sub-objects: @@ -185,7 +185,7 @@ const BotMon = { /* everything specific to the "Latest" tab is self-contained in the "live" object: */ BotMon.live = { init: function() { - console.info('BotMon.live.init()'); + //console.info('BotMon.live.init()'); // set the title: const tDiff = 'UTC ' + (BotMon._timeDiff != '' ? ` (offset: ${BotMon._timeDiff}` : '' ) + ')'; @@ -1056,13 +1056,13 @@ BotMon.live = { const prefix = v.ip.split(':').slice(0, kIP6Segments).join(':'); rawIP = ipSeg.slice(0, kIP6Segments).join(':'); ipGroup = 'ip6-' + rawIP.replaceAll(':', '-'); - ipName = prefix + '::' + '/' + (16 * kIP6Segments); + ipName = prefix + '::'; // + '/' + (16 * kIP6Segments); } else { ipSeg = ipAddr.split('.'); const prefix = v.ip.split('.').slice(0, kIP4Segments).join('.'); rawIP = ipSeg.slice(0, kIP4Segments).join('.') ; ipGroup = 'ip4-' + rawIP.replaceAll('.', '-'); - ipName = prefix + '.x.x.x'.substring(0, 1+(4-kIP4Segments)*2) + '/' + (8 * kIP4Segments); + ipName = prefix + '.x.x.x'.substring(0, 1+(4-kIP4Segments)*2); // + '/' + (8 * kIP4Segments); } } diff --git a/admin.php b/admin.php index a9ca24b..2f30ef3 100644 --- a/admin.php +++ b/admin.php @@ -104,7 +104,13 @@ class admin_plugin_botmon extends AdminPlugin { echo '
  • No files to process.
  • '; } - echo ''; + echo '' . NL; + echo ''; + echo ''; } diff --git a/captcha.js b/captcha.js index cb79a4e..fdbcbc8 100644 --- a/captcha.js +++ b/captcha.js @@ -13,6 +13,13 @@ const $BMCaptcha = { }, install: function() { + + // localisation helper function: + let _loc = function(id, alt) { + if ($BMLocales && $BMLocales[id]) return $BMLocales[id]; + return alt; + } + // find the parent element: let bm_parent = document.getElementsByTagName('body')[0]; @@ -22,11 +29,14 @@ const $BMCaptcha = { dlg.setAttribute('open', 'open'); dlg.classList.add('checking'); dlg.id = 'botmon_captcha_box'; - dlg.innerHTML = '

    Captcha box

    Making sure you are a human:

    '; + dlg.innerHTML = '

    ' + _loc('dlgTitle', 'Title') + '

    ' + _loc('dlgSubtitle', 'Subtitle') + '

    '; // Checkbox: const lbl = document.createElement('label'); - lbl.innerHTML = 'Click to confirm.Checking …Loading …An error occured.'; + lbl.innerHTML = '' + _loc('dlgConfirm', "Confirm.") + '' + + '' + _loc('dlgChecking', "Checking") + '' + + '' + _loc('dlgLoading', "Loading") + '' + + '' + _loc('dlgError', "Error") + ''; const cb = document.createElement('input'); cb.setAttribute('type', 'checkbox'); cb.setAttribute('disabled', 'disabled'); diff --git a/conf/default.php b/conf/default.php index 53540b4..45cf90c 100644 --- a/conf/default.php +++ b/conf/default.php @@ -5,6 +5,7 @@ * @author Sascha Leib */ +$conf['showday'] = 'yesterday'; $conf['geoiplib'] = 'disabled'; $conf['useCaptcha'] = 'disabled'; $conf['captchaSeed'] = 'c53bc5f94929451987efa6c768d8856b'; diff --git a/conf/metadata.php b/conf/metadata.php index 32c61a1..32dd6d0 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -5,6 +5,9 @@ * @author Sascha Leib */ +$meta['showday'] = array('multichoice', + '_choices' => array ('yesterday', 'today')); + $meta['geoiplib'] = array('multichoice', '_choices' => array ('disabled', 'phpgeoip')); diff --git a/config/default-whitelist.txt b/config/default-whitelist.txt index 397720d..093087f 100644 --- a/config/default-whitelist.txt +++ b/config/default-whitelist.txt @@ -342,5 +342,5 @@ 2a02:0598:0096:8a00:0000:0000:1200:0120 2a02:0598:0096:8a00:0000:0000:1200:013f 123 # localhosts -127.0.0.1 127.255.255.255 8 -::1 ::1 128 \ No newline at end of file +#127.0.0.1 127.255.255.255 8 +#::1 ::1 128 \ No newline at end of file diff --git a/lang/de/lang.php b/lang/de/lang.php new file mode 100644 index 0000000..0b240a6 --- /dev/null +++ b/lang/de/lang.php @@ -0,0 +1,14 @@ + + */ + +// Captcha dialog locale strings: +$lang['bm_dlgTitle'] = 'Benutzerüberprüfung'; +$lang['bm_dlgSubtitle'] = 'Bitte bestätige, dass du kein Bot bist:'; +$lang['bm_dlgConfirm'] = 'Klicke, um zu bestätigen.'; +$lang['bm_dlgChecking'] = 'Wird überprüft …'; +$lang['bm_dlgLoading'] = 'Seite wird geladen …'; +$lang['bm_dlgError'] = 'Es ist ein Fehler aufgetreten.'; diff --git a/lang/en/lang.php b/lang/en/lang.php new file mode 100644 index 0000000..b5b9334 --- /dev/null +++ b/lang/en/lang.php @@ -0,0 +1,14 @@ + + */ + +// Captcha dialog locale strings: +$lang['bm_dlgTitle'] = 'User Check'; +$lang['bm_dlgSubtitle'] = 'Please confirm you are not a bot:'; +$lang['bm_dlgConfirm'] = 'Click to confirm.'; +$lang['bm_dlgChecking'] = 'Checking …'; +$lang['bm_dlgLoading'] = 'Loading page …'; +$lang['bm_dlgError'] = 'An error occured.'; diff --git a/lang/en/settings.php b/lang/en/settings.php index 022458c..d42003b 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -5,9 +5,13 @@ * @author Sascha Leib */ +$lang['showday'] = 'Which data to show in the “Latest” tab:'; + $lang['showday_o_yesterday'] = 'Last full day (yesterday)'; + $lang['showday_o_today'] = 'Ongoing logs (today)'; + $lang['geoiplib'] = 'Add GeoIP Information
    (requires PHP module to be installed)'; $lang['geoiplib_o_disabled'] = 'Disabled'; $lang['geoiplib_o_phpgeoip'] = 'Use GeoIP Module'; $lang['useCaptcha'] = 'Enable Captcha
    (Experimental, read the manual first!)'; -$lang['captchaSeed'] = 'Captcha Seed
    (Enter a 16 to 32 digits random number)'; +$lang['captchaSeed'] = 'Captcha Seed
    (Best use a random number, e.g. here )';