Skip to content

Commit

Permalink
Updated to v1.3
Browse files Browse the repository at this point in the history
* Added Unique ID generation on the panel side instead of the miner side
* Changed all file calls to be relative to allow easier deployment of the panel in subfolders
* Removed unnecessary configuration options due to everything being relative now
  • Loading branch information
UnamSanctam committed Nov 9, 2021
1 parent 1df8202 commit 167b1d5
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 55 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### v1.3 (09/11/2021)
* Added Unique ID generation on the panel side instead of the miner side
* Changed all file calls to be relative to allow easier deployment of the panel in subfolders
* Removed unnecessary configuration options due to everything being relative now
### v1.2 (09/11/2021)
* Added GPU and CPU to the miners datatable
* Added GPU and CPU to the database
Expand Down
6 changes: 5 additions & 1 deletion 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.2
# UnamWebPanel v1.3

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 Down Expand Up @@ -28,6 +28,10 @@ You can find the wiki [here](https://github.com/UnamSanctam/SilentCryptoMiner/wi

## Changelog

### v1.3 (09/11/2021)
* Added Unique ID generation on the panel side instead of the miner side
* Changed all file calls to be relative to allow easier deployment of the panel in subfolders
* Removed unnecessary configuration options due to everything being relative now
### v1.2 (09/11/2021)
* Added GPU and CPU to the miners datatable
* Added GPU and CPU to the database
Expand Down
2 changes: 1 addition & 1 deletion UnamWebPanel/api/endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function getData($key){
return $data[$key] ?? '';
}

$uqhash = getData('uqhash');
$uqhash = substr(md5(getData('computername').getData('cpu')), 0, 16);
$type = getData('type');

$miner = $base->unam_dbSelect(getConn(), 'miners', 'ms_minerID, ms_config', ['ms_uqhash' => $uqhash, 'ms_type'=>$type]);
Expand Down
66 changes: 34 additions & 32 deletions UnamWebPanel/assets/php/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,42 @@
require_once 'session-header.php';

function generalJSIncludes(){
return "<script src='/assets/modules/jquery/jquery.min.js'></script>
<script src='/assets/modules/jquery-confirm/jquery-confirm.js'></script>
<script src='/assets/modules/datatables/jquery.dataTables.min.js'></script>
<script src='/assets/modules/datatables-bs4/js/dataTables.bootstrap4.min.js'></script>
<script src='/assets/modules/datatables-responsive/js/dataTables.responsive.min.js'></script>
<script src='/assets/modules/datatables-responsive/js/responsive.bootstrap4.min.js'></script>
<script src='/assets/modules/datatables-buttons/js/dataTables.buttons.min.js'></script>
<script src='/assets/modules/datatables-buttons/js/buttons.bootstrap4.min.js'></script>
<script src='/assets/modules/datatables-buttons/js/buttons.html5.min.js'></script>
<script src='/assets/modules/datatables-buttons/js/buttons.print.min.js'></script>
<script src='/assets/modules/datatables-buttons/js/buttons.colVis.min.js'></script>
<script src='/assets/modules/select2/js/select2.min.js'></script>
<script src='/assets/modules/sweetalert2/sweetalert2.min.js'></script>
<script src='/assets/modules/izitoast/js/iziToast.min.js'></script>
<script src='/assets/modules/bootstrap/js/bootstrap.bundle.min.js'></script>
<script src='/assets/modules/overlayScrollbars/js/jquery.overlayScrollbars.min.js'></script>
<script src='/assets/modules/jquery-mousewheel/jquery.mousewheel.js'></script>
<script src='/assets/modules/raphael/raphael.min.js'></script>
<script src='/assets/js/adminlte.js'></script>
<script src='/__UNAM_LIB/unam_lib.js'></script>";
global $config;
return "<script src='assets/modules/jquery/jquery.min.js'></script>
<script src='assets/modules/jquery-confirm/jquery-confirm.js'></script>
<script src='assets/modules/datatables/jquery.dataTables.min.js'></script>
<script src='assets/modules/datatables-bs4/js/dataTables.bootstrap4.min.js'></script>
<script src='assets/modules/datatables-responsive/js/dataTables.responsive.min.js'></script>
<script src='assets/modules/datatables-responsive/js/responsive.bootstrap4.min.js'></script>
<script src='assets/modules/datatables-buttons/js/dataTables.buttons.min.js'></script>
<script src='assets/modules/datatables-buttons/js/buttons.bootstrap4.min.js'></script>
<script src='assets/modules/datatables-buttons/js/buttons.html5.min.js'></script>
<script src='assets/modules/datatables-buttons/js/buttons.print.min.js'></script>
<script src='assets/modules/datatables-buttons/js/buttons.colVis.min.js'></script>
<script src='assets/modules/select2/js/select2.min.js'></script>
<script src='assets/modules/sweetalert2/sweetalert2.min.js'></script>
<script src='assets/modules/izitoast/js/iziToast.min.js'></script>
<script src='assets/modules/bootstrap/js/bootstrap.bundle.min.js'></script>
<script src='assets/modules/overlayScrollbars/js/jquery.overlayScrollbars.min.js'></script>
<script src='assets/modules/jquery-mousewheel/jquery.mousewheel.js'></script>
<script src='assets/modules/raphael/raphael.min.js'></script>
<script src='assets/js/adminlte.js'></script>
<script src='__UNAM_LIB/unam_lib.js'></script>";
}

function generalCSSIncludes(){
return "<link rel='stylesheet' href='/assets/modules/fontawesome-free/css/all.min.css'>
<link rel='stylesheet' href='/assets/modules/izitoast/css/iziToast.css'>
<link rel='stylesheet' href='/assets/modules/jquery-confirm/jquery-confirm.css'>
<link rel='stylesheet' href='/assets/modules/select2/css/select2.min.css'>
<link rel='stylesheet' href='/assets/modules/sweetalert2/sweetalert2.min.css'>
<link rel='stylesheet' href='/assets/modules/overlayScrollbars/css/OverlayScrollbars.min.css'>
<link rel='stylesheet' href='/assets/modules/datatables-bs4/css/dataTables.bootstrap4.min.css'>
<link rel='stylesheet' href='/assets/modules/datatables-responsive/css/responsive.bootstrap4.min.css'>
<link rel='stylesheet' href='/assets/modules/datatables-buttons/css/buttons.bootstrap4.min.css'>
<link rel='stylesheet' href='/assets/css/adminlte.min.css'>
<link rel='stylesheet' href='/assets/css/custom.css'>";
global $config;
return "<link rel='stylesheet' href='assets/modules/fontawesome-free/css/all.min.css'>
<link rel='stylesheet' href='assets/modules/izitoast/css/iziToast.css'>
<link rel='stylesheet' href='assets/modules/jquery-confirm/jquery-confirm.css'>
<link rel='stylesheet' href='assets/modules/select2/css/select2.min.css'>
<link rel='stylesheet' href='assets/modules/sweetalert2/sweetalert2.min.css'>
<link rel='stylesheet' href='assets/modules/overlayScrollbars/css/OverlayScrollbars.min.css'>
<link rel='stylesheet' href='assets/modules/datatables-bs4/css/dataTables.bootstrap4.min.css'>
<link rel='stylesheet' href='assets/modules/datatables-responsive/css/responsive.bootstrap4.min.css'>
<link rel='stylesheet' href='assets/modules/datatables-buttons/css/buttons.bootstrap4.min.css'>
<link rel='stylesheet' href='assets/css/adminlte.min.css'>
<link rel='stylesheet' href='assets/css/custom.css'>";
}

function unamtFormGroup($content, $options=[]){
Expand Down Expand Up @@ -225,7 +227,7 @@ function templateExternalPage($title, $content, $options=[]){
<script>
$('.unamLogin').on('submit', function(e){
e.preventDefault();
unam_jsonAjax('POST', '/{$config['url_authajax']}', $(this).serialize(), function(data){
unam_jsonAjax('POST', 'auth-ajax.php', $(this).serialize(), function(data){
location.reload();
}, function(error){ iziToast.error({ title: 'Error', message: error, position: 'topRight' });
});
Expand Down
16 changes: 4 additions & 12 deletions UnamWebPanel/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@

/*
* If your web server uses Apache then there is no need to
* change the db location since the .htaccess file will
* protect the database file from being accessed.
* change the db file location since the .htaccess file
* will protect the database file from being accessed.
*
* You can test if you are vulnerable by trying to access
* WEBSITEURL/unamwebpanel.db (replace WEBSITEURL with your URL),
* if it returns a 403 Forbidden error then you are protected
*/
$config['db_file'] = dirname(__FILE__)."/unamwebpanel.db";

$config['url_pages'] = 'index.php';
$config['url_login'] = 'login.php';
$config['url_pageloader'] = 'page-loader.php';
$config['url_authajax'] = 'auth-ajax.php';
$config['url_customtable'] = "api/custom-table.php";
$config['url_ajaxactions'] = "api/ajax-actions.php";
$config['url_ajaxsitewide'] = "api/ajax-sitewide.php";
$config['db_file'] = dirname(__FILE__)."/unamwebpanel.db";

$config['failedlogin_blocktime'] = 15;
$config['failedlogin_blocktries'] = 5;
Expand All @@ -30,6 +22,6 @@

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

$config['unam_version'] = "1.1";
$config['unam_version'] = "1.3";

global $config;
12 changes: 6 additions & 6 deletions UnamWebPanel/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</nav>

<aside class="main-sidebar sidebar-dark-primary elevation-4">
<a href="#" class="brand-link">
<a href="index.php" class="brand-link">
<img src="assets/img/unam.png" alt="Unam Sanctam" class="brand-image">
<span class="brand-text font-weight-light">Unam Web Panel</span>
</a>
Expand Down Expand Up @@ -114,12 +114,12 @@
let scope = $(this);
loadPageContentAjax(this, 'GET', scope.data('page'), { id: scope.val() });
}).on('select2:select', '.nav-lang', function(e){
unam_jsonAjax('POST', '<?php echo $config['url_ajaxsitewide']; ?>', {method: 'lang-change', newlangID: e.params.data.id}, function(data){
unam_jsonAjax('POST', 'api/ajax-sitewide.php', {method: 'lang-change', newlangID: e.params.data.id}, function(data){
location.reload();
}, function(error){ errorMessage(error); });
}).on('change', '.select-miner-config', function(e){
let scope = $(this);
unam_jsonAjax('POST', '<?php echo $config['url_ajaxactions']; ?>', Object.assign({}, {method: scope.data('method'), index: scope.data('index'), config: scope.val()}, scope.data('extradata') || {} ), function(data){
unam_jsonAjax('POST', 'api/ajax-actions.php', Object.assign({}, {method: scope.data('method'), index: scope.data('index'), config: scope.val()}, scope.data('extradata') || {} ), function(data){
if(data.successmsg){
successMessage(data.successmsg);
}
Expand All @@ -138,7 +138,7 @@ function datatableTemplate(table, _data={}, minmode=false, _columnDefs=[]){
sScrollX: "100%",
<?php if($langID != 'en' && file_exists(__DIR__."/lang/datatables/{$langID}.json")){ echo "language: ".file_get_contents(__DIR__."/lang/datatables/{$langID}.json").","; } ?>
ajax: {
url: "<?php echo $config['url_customtable']; ?>",
url: "api/custom-table.php",
type: "POST",
data: Object.assign({}, {method: 'datatable-get', tableid: table, cid: paramID}, _data)
},
Expand Down Expand Up @@ -208,7 +208,7 @@ function reloadDatatables(){
function ajaxAction(scope){
let indexval = (scope.data('index') ? scope.data('index') : scope.closest('tr').find('td').html());
let extradata = Object.assign({}, (scope.hasClass('ajax-action-checkbox') ? {checked: scope.is(':checked') ? 1 : 0} : {}), scope.data('extradata'));
unam_jsonAjax('POST', '<?php echo $config['url_ajaxactions']; ?>', Object.assign({}, {
unam_jsonAjax('POST', 'api/ajax-actions.php', Object.assign({}, {
method: scope.data('method'),
index: indexval
}, extradata), function (data) {
Expand Down Expand Up @@ -261,7 +261,7 @@ function loadPageContentAjax(scope, _type, _url, _data={}, _container='.ajaxcont
jQuery.ajax(
{
type: _type,
url: '<?php echo $config['url_pageloader']; ?>',
url: 'page-loader.php',
dataType: 'html',
headers: {
'UNAM-Request-Type': 'AJAX'
Expand Down
2 changes: 1 addition & 1 deletion UnamWebPanel/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_once 'assets/php/templates.php';

if($loggedin){
header("Location:/".$config['url_pages']);
header("Location: index.php");
}

echo templateExternalPage("Unam Web Panel &mdash; {$larr['Login']}",
Expand Down
2 changes: 1 addition & 1 deletion UnamWebPanel/logout.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
include 'assets/php/session-header.php';
$base->unsetSession();
header("Location:/".$config['url_login']);
header("Location: login.php");
2 changes: 1 addition & 1 deletion UnamWebPanel/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function logoutFunction(){
if(isset($_SERVER['HTTP_UNAM_REQUEST_TYPE']) && $_SERVER['HTTP_UNAM_REQUEST_TYPE'] == 'AJAX'){
echo json_encode(['sessionExpired'=>1]);
}else{
header("Location:/".$config['url_login']);
header("Location: login.php");
}
die();
}
Expand Down

0 comments on commit 167b1d5

Please sign in to comment.