Latest data
Process log
+- ';
+
+ /* proces old logs */
+ if ($hasOldLogFiles) {
+
+ $helper = $this->loadHelper('botmon', true);
+
+ $helper->cleanup();
+ } else {
+ echo '
- No files to process. '; + } + + echo '
diff --git a/action.php b/action.php index 319d45d..a3c4c8a 100644 --- a/action.php +++ b/action.php @@ -84,7 +84,7 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin { public function insertAdminHeader(Event $event, $param) { $event->data['link'][] = ['rel' => 'stylesheet', 'href' => DOKU_BASE.'lib/plugins/botmon/admin.css', 'defer' => 'defer']; - $event->data['script'][] = ['href' => DOKU_BASE.'lib/plugins/botmon/admin.js', 'defer' => 'defer', '_data' => '']; + $event->data['script'][] = ['src' => DOKU_BASE.'lib/plugins/botmon/admin.js', 'defer' => 'defer', '_data' => '']; } diff --git a/admin.css b/admin.css index b11cdff..047a8d4 100644 --- a/admin.css +++ b/admin.css @@ -389,7 +389,6 @@ background-size: 20px; } - /* grid layout for the overview: */ .botmon_bots_grid, .botmon_webmetrics_grid, .botmon_traffic_grid { & { @@ -435,7 +434,7 @@ } /* the "today" tab: */ - #botmon__today { + #botmon__latest { /* item header */ header { @@ -747,13 +746,40 @@ } } } + + /* the log tab: */ + #botmon__log { + + #botmon__loglist { + & { + border: #999 solid 1px; + background-color: #F0F0F0; + margin: 0; padding: .5em; + border-radius: .5em 1pt 1pt .5em; + list-style: none inside; + display: block; + min-height: 24rem; + max-height: 32rem; + overflow: hidden auto + } + li { + &:nth-child(even) { + background-color: #DFDFDF; + } + &.info { color: #626262; font-style: italic;} + &.success { color: #217121; } + &.error { color: #bb2929; } + } + } + + } } /* dark mode overrides */ @media (prefers-color-scheme: dark) { body.darkmode.mode_admin #botmon__admin { - #botmon__today { + #botmon__latest { header { background-color: #0c0c0d; @@ -844,7 +870,7 @@ } /* layout overrides for narrow screens: */ @media (max-width: 800px) { - #botmon__admin #botmon__today #botmon__today__visitorlists { + #botmon__admin #botmon__latest #botmon__today__visitorlists { dl.visitor_details { & { display: block; @@ -865,7 +891,7 @@ } @media (max-width: 670px) { - #botmon__admin #botmon__today { + #botmon__admin #botmon__latest { .botmon_bots_grid, .botmon_webmetrics_grid, .botmon_traffic_grid { & { grid-template-columns: 1fr !important; diff --git a/admin.js b/admin.js index 14da250..776f5d6 100644 --- a/admin.js +++ b/admin.js @@ -32,8 +32,7 @@ const BotMon = { //console.info('BotMon.init()'); // find the plugin basedir: - this._baseDir = document.currentScript.src.substring(0, document.currentScript.src.indexOf('/exe/')) - + '/plugins/botmon/'; + this._baseDir = document.currentScript.src.substring(0, document.currentScript.src.lastIndexOf('/')+1); // read the page language from the DOM: this._lang = document.getRootNode().documentElement.lang || this._lang; @@ -186,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}` : '' ) + ')'; @@ -1011,6 +1010,10 @@ BotMon.live = { const me = BotMon.live.data.analytics; const ipRanges = BotMon.live.data.ipRanges; + // Number of IP address segments to look at: + const kIP4Segments = 1; + const kIP6Segments = 2; + let isp = 'null'; // default ISP id let name = 'Unknown'; // default ISP name @@ -1691,7 +1694,7 @@ BotMon.live = { // assign the columns to an object: const data = {}; cols.forEach( (colVal,i) => { - colName = columns[i] || `col${i}`; + const colName = columns[i] || `col${i}`; const colValue = (colName == 'ts' ? new Date(colVal) : colVal.trim()); data[colName] = colValue; }); @@ -1729,10 +1732,12 @@ BotMon.live = { gui: { init: function() { - // init the lists view: - this.lists.init(); + console.log('BotMon.live.gui.init()'); + // init sub-objects: + BotMon.t._callInit(this); }, + /* The Overview / web metrics section of the live tab */ overview: { /** diff --git a/admin.php b/admin.php index 79b249f..54ddf0a 100644 --- a/admin.php +++ b/admin.php @@ -35,6 +35,8 @@ class admin_plugin_botmon extends AdminPlugin { // display GeoIP data? $geoIPconf = $this->getConf('geoiplib'); + $hasOldLogFiles = $this->hasOldLogFiles(); + // spinner animation as SVG image: $svg = ''; @@ -45,15 +47,11 @@ class admin_plugin_botmon extends AdminPlugin {