Skip to content

Commit

Permalink
Updated to v1.5.0
Browse files Browse the repository at this point in the history
* Added new field "Version" that shows the miner version
* Added new field "Active Window" that shows the currently active foreground windows title
* Added new field "Run Time" that shows how long the current session of the miner has been running for
* Added "First Connection" field that shows the date and time when the miner first connected
* Added new miner statuses "Starting" and "Error"
* Added text next to the "Offline" status that shows how long the miner has been offline
* Added error text when an XMR miner cannot connect to its pool
* Added German and French datatable translation files
* Fixed miner table ordering
  • Loading branch information
UnamSanctam committed May 1, 2022
1 parent aec6502 commit 7654eb5
Show file tree
Hide file tree
Showing 10 changed files with 515 additions and 18 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
### v1.4.2 (01/01/2022)
### 1.5.0 (01/05/2022)
* Added new field "Version" that shows the miner version
* Added new field "Active Window" that shows the currently active foreground windows title
* Added new field "Run Time" that shows how long the current session of the miner has been running for
* Added "First Connection" field that shows the date and time when the miner first connected
* Added new miner statuses "Starting" and "Error"
* Added text next to the "Offline" status that shows how long the miner has been offline
* Added error text when an XMR miner cannot connect to its pool
* Added German and French datatable translation files
* Fixed miner table ordering
### v1.4.2 (01/04/2022)
* Added French translation (Kolhax)
* Added German translation (leisefuxX)
### v1.4.1 (11/01/2022)
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="https://github.com/UnamSanctam/UnamWebPanel/blob/master/UnamWebPanel.png?raw=true">

# UnamWebPanel v1.4.2
# UnamWebPanel v1.5.0

A web panel currently used to optionally monitor and manage the [SilentCryptoMiner](https://github.com/UnamSanctam/SilentCryptoMiner). Might support any other projects I release in the future as well.

Expand All @@ -10,7 +10,7 @@ The panel is quite easy to set up, the only real requirement is a web server wi

Here are some simple steps to get started:
1. Download the panel files and open the UnamWebPane\config.php file with a text editor.
2. Change the `$config['password']` to whatever password you wish to use, this is the password used to access the web panel.
2. Change the `$config['password'] = 'UnamSanctam';` (change `UnamSanctam` to your own password) to whatever password you wish to use, this is the password used to access the web panel.
3. Upload the contents of the UnamWebPanel folder to your webhosts "public_html" folder or the respective folder for your specific webhost.
4. Your web panel should now be up and running, you can browse to the URL or IP of your website and you should see the login screen if everything went correctly.

Expand All @@ -28,6 +28,16 @@ You can find the wiki [here](https://github.com/UnamSanctam/SilentCryptoMiner/wi

## Changelog

### 1.5.0 (01/05/2022)
* Added new field "Version" that shows the miner version
* Added new field "Active Window" that shows the currently active foreground windows title
* Added new field "Run Time" that shows how long the current session of the miner has been running for
* Added "First Connection" field that shows the date and time when the miner first connected
* Added new miner statuses "Starting" and "Error"
* Added text next to the "Offline" status that shows how long the miner has been offline
* Added error text when an XMR miner cannot connect to its pool
* Added German and French datatable translation files
* Fixed miner table ordering
### v1.4.2 (01/04/2022)
* Added French translation (Kolhax)
* Added German translation (leisefuxX)
Expand Down
6 changes: 5 additions & 1 deletion UnamWebPanel/api/endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ function getData($key){
'ms_worker'=>getData('worker'),
'ms_cpu'=>getData('cpu'),
'ms_gpu'=>getData('gpu'),
'ms_activewindow'=>getData('activewindow'),
'ms_runtime'=>getData('runtime'),
'ms_version'=>getData('version'),
'ms_remoteURL'=>getData('remoteconfig'),
'ms_lastConnection'=>$currentDate
];
Expand All @@ -40,7 +43,8 @@ function getData($key){
$base->unam_dbUpdate(getConn(), 'miners', $fields, ['ms_uqhash' => $uqhash, 'ms_type'=>$type]);
} else {
$base->unam_dbInsert(getConn(), 'miners', array_merge(['ms_uqhash'=>$uqhash, 'ms_type'=>$type, 'ms_config'=>($type == 'xmrig' ? 1 : 2)], $fields));
$miner = $base->unam_dbSelect(getConn(), 'miners', 'ms_minerID, ms_config', ['ms_uqhash' => $uqhash, 'ms_type'=>$type]);
}

$config = $base->unam_dbSelect(getConn(), 'configs', 'cf_data', ['cf_configID' => $miner['ms_config'] ?? 0]);
echo $config['cf_data'] ?? 'OK';
echo $config['cf_data'] ?? json_encode(['response'=>'ok']);
28 changes: 26 additions & 2 deletions UnamWebPanel/assets/php/datatables.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
'db_column'=>'status',
'display'=>$larr['Status'],
'formatting'=>function($d, $s){
return unamtMinerStatus(isset($s['ms_lastConnection']) && ((strtotime(date("Y-m-d H:i:s")) - strtotime($s['ms_lastConnection'])) > 300) ? 6 : $d);
$offline = isset($s['ms_lastConnection']) && ((strtotime(date("Y-m-d H:i:s")) - strtotime($s['ms_lastConnection'])) > 300);
return unamtMinerStatus(empty($s['ms_pool']) ? 7 : ($offline ? -1 : $d)).($offline ? unamtStatusColor('red', " (".unamtTimeFormat((strtotime(date("Y-m-d H:i:s")) - strtotime($s['ms_lastConnection'])), true).")") : '');
}
],
'algorithm'=>[
Expand All @@ -45,7 +46,11 @@
],
'pool'=>[
'db_column'=>'pool',
'display'=>$larr['Pool']
'display'=>$larr['Pool'],
'formatting'=>function($d){
global $larr;
return $d ?? unamtStatusColor('red', $larr['pool_connection_error']);
}
],
'port'=>[
'db_column'=>'port',
Expand Down Expand Up @@ -75,6 +80,10 @@
'db_column'=>'type',
'display'=>$larr['Type']
],
'version'=>[
'db_column'=>'version',
'display'=>$larr['Version']
],
'gpu'=>[
'db_column'=>'gpu',
'display'=>'GPU'
Expand All @@ -83,6 +92,17 @@
'db_column'=>'cpu',
'display'=>'CPU'
],
'activewindow'=>[
'db_column'=>'activewindow',
'display'=>$larr['active_window']
],
'runtime'=>[
'db_column'=>'runtime',
'display'=>$larr['run_time'],
'formatting'=>function($d){
return unamtTimeFormat($d, false);
}
],
'remoteURL'=>[
'db_column'=>'remoteURL',
'display'=>"{$larr['Remote']} {$larr['URL']}"
Expand All @@ -91,6 +111,10 @@
'db_column'=>'lastConnection',
'display'=>$larr['last_connection'],
],
'creationDate'=>[
'db_column'=>'creationDate',
'display'=>$larr['first_connection'],
],
'config'=>[
'db_column'=>'config',
'display'=>$larr['Configuration'],
Expand Down
35 changes: 28 additions & 7 deletions UnamWebPanel/assets/php/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,43 @@ function unamtMinerStatus($status){
global $larr;
switch($status){
case 1:
return "<span class='text-status-red'>{$larr['Stopped']}</span>";
return unamtStatusColor('red', $larr['Stopped']);
case 2:
return "<span class='text-status-green'>{$larr['Active']}</span>";
return unamtStatusColor('green', $larr['Active']);
case 3:
return "<span class='text-status-green'>{$larr['Active']} ({$larr['Idle']})</span>";
return unamtStatusColor('green', "{$larr['Active']} ({$larr['Idle']})");
case 4:
return "<span class='text-status-yellow'>{$larr['Paused']} ({$larr['Stealth']})</span>";
return unamtStatusColor('yellow', "{$larr['Paused']} ({$larr['Stealth']})");
case 5:
return "<span class='text-status-yellow'>{$larr['not_enough_free_vram']}</span>";
return unamtStatusColor('yellow', $larr['not_enough_free_vram']);
case 6:
return "<span class='text-status-red'>{$larr['Offline']}</span>";
return unamtStatusColor('yellow', $larr['Starting']);
case 7:
return unamtStatusColor('red', $larr['Error']);
case -1:
return unamtStatusColor('red', $larr['Offline']);
default:
return "<span class='text-status-red'>{$larr['Unknown']}</span>";
return unamtStatusColor('red', $larr['Unknown']);
}
}

function unamtTimeFormat($timeline, $shortform) {
$periods = [($shortform ? 'd' : 'day') => 86400, ($shortform ? 'h' : 'hour') => 3600, ($shortform ? 'm' : 'minute') => 60, ($shortform ? 's' : 'second') => 1];
$ret = "";
foreach($periods AS $name => $seconds){
$num = floor($timeline / $seconds);
$timeline -= ($num * $seconds);
if($num > 0) {
$ret .= ($shortform ? "{$num}{$name} " : "{$num} {$name}".(($num > 1) ? 's' : '').' ');
}
}
return trim($ret);
}

function unamtStatusColor($color, $status){
return "<span class='text-status-{$color}'>{$status}</span>";
}

function unamtFormatHashrate($num)
{
$num = $num ?: 0;
Expand Down
2 changes: 0 additions & 2 deletions UnamWebPanel/class/class.ssp.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ private static function order ( $request, $options ) {
// Convert the column index into the column data property
$columnIdx = intval($request['order'][$i]['column']);
$requestColumn = $request['columns'][$columnIdx];

$columnIdx = array_search( $requestColumn['data'], $columns );
$column = $columns[ $columnIdx ];

if ( $requestColumn['orderable'] == 'true' ) {
Expand Down
3 changes: 2 additions & 1 deletion UnamWebPanel/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Made by Unam Sanctam https://github.com/UnamSanctam */
$config = [];

/* Change UnamSancam below to change the password. */
$config['password'] = 'UnamSanctam';

/*
Expand All @@ -22,6 +23,6 @@

$config['languages'] = ['en', 'sv', 'fr', 'de'];

$config['unam_version'] = "1.4.2";
$config['unam_version'] = "1.5.0";

global $config;
Loading

0 comments on commit 7654eb5

Please sign in to comment.