Răsfoiți Sursa

Added IPInfo in settings logs

CauseFX 6 ani în urmă
părinte
comite
7d61afef05
4 a modificat fișierele cu 51 adăugiri și 7 ștergeri
  1. 10 7
      api/pages/settings-settings-logs.php
  2. 38 0
      js/custom.js
  3. 0 0
      js/custom.min.js
  4. 3 0
      js/functions.js

+ 10 - 7
api/pages/settings-settings-logs.php

@@ -82,7 +82,11 @@ if(file_exists('config'.DIRECTORY_SEPARATOR.'config.php')){
                     }
                 },
                 { "data": "username" },
-                { "data": "ip" },
+                { data: \'ip\',
+                    render: function ( data, type, row ) {
+                        return ipInfoSpan(data);
+                    }
+                },
                 { data: \'auth_type\',
                     render: function ( data, type, row ) {
                         if ( type === \'display\' || type === \'filter\' ) {
@@ -99,19 +103,18 @@ if(file_exists('config'.DIRECTORY_SEPARATOR.'config.php')){
                 "columns": [
                 { data: \'utc_date\',
                     render: function ( data, type, row ) {
-                        // If display or filter data is requested, format the date
                         if ( type === \'display\' || type === \'filter\' ) {
                             var m = moment.tz(data, activeInfo.timezone);
                             return moment(m).format(\'LLL\');
                         }
-
-                    // Otherwise the data type requested (`type`) is type detection or
-                    // sorting data, for which we want to use the integer, so just return
-                    // that, unaltered
                     return data;}
                     },
                 { "data": "username" },
-                { "data": "ip" },
+                { data: \'ip\',
+                    render: function ( data, type, row ) {
+                        return ipInfoSpan(data);
+                    }
+                },
                 { "data": "message" },
                 { data: \'type\',
                     render: function ( data, type, row ) {

+ 38 - 0
js/custom.js

@@ -1939,4 +1939,42 @@ $(document).on('click', ".showMoreHealth", function(){
    var id = $(this).attr('data-id');
     $('.showMoreHealthDiv-'+id).toggleClass('d-none');
     $(this).find('.card-body').toggleClass('healthPosition');
+});
+//IP INFO
+$(document).on('click', ".ipInfo", function(){
+    $.getJSON("https://ipinfo.io/"+$(this).text()+"/?token=ddd0c072ad5021", function (response) {
+        var region = (typeof response.region == 'undefined') ? ' N/A' : response.region;
+        var ip = (typeof response.ip == 'undefined') ? ' N/A' : response.ip;
+        var hostname = (typeof response.hostname == 'undefined') ? ' N/A' : response.hostname;
+        var loc = (typeof response.loc == 'undefined') ? ' N/A' : response.loc;
+        var org = (typeof response.org == 'undefined') ? ' N/A' : response.org;
+        var city = (typeof response.city == 'undefined') ? ' N/A' : response.city;
+        var country = (typeof response.country == 'undefined') ? ' N/A' : response.country;
+        var phone = (typeof response.phone == 'undefined') ? ' N/A' : response.phone;
+        var div = '<div class="row">' +
+            '<div class="col-lg-12">' +
+            '<div class="white-box">' +
+            '<h3 class="box-title">'+ip+'</h3>' +
+            '<div class="table-responsive">' +
+            '<table class="table">' +
+            '<tbody>' +
+            '<tr><td class="text-left">Hostname</td><td class="txt-oflo text-right">'+hostname+'</td></tr>' +
+            '<tr><td class="text-left">Location</td><td class="txt-oflo text-right">'+loc+'</td></tr>' +
+            '<tr><td class="text-left">Org</td><td class="txt-oflo text-right">'+org+'</td></tr>' +
+            '<tr><td class="text-left">City</td><td class="txt-oflo text-right">'+city+'</td></tr>' +
+            '<tr><td class="text-left">Country</td><td class="txt-oflo text-right">'+country+'</td></tr>' +
+            '<tr><td class="text-left">Phone</td><td class="txt-oflo text-right">'+phone+'</td></tr>' +
+            '<tr><td class="text-left">Region</td><td class="txt-oflo text-right">'+region+'</td></tr>' +
+            '</tbody>' +
+            '</table>' +
+            '</div>' +
+            '</div>' +
+            '</div>' +
+            '</div>';
+        swal({
+            content: createElementFromHTML(div),
+            buttons: false,
+            className: 'bg-org'
+        });
+    });
 });

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
js/custom.min.js


+ 3 - 0
js/functions.js

@@ -7146,6 +7146,9 @@ function oAuthLoginNeededCheck() {
         local('r', 'loggingIn');
     });
 }
+function ipInfoSpan(ip){
+    return '<span class="ipInfo mouse">'+ip+'</span>';
+}
 function launch(){
 	organizrConnect('api/?v1/launch_organizr').success(function (data) {
         try {

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff