IP SQL Error (#36), VNC check conf (#27), GUI tune

This commit is contained in:
Luke S Thompson
2023-09-13 08:24:05 +10:00
parent 25ea01effb
commit b8da683746
3 changed files with 35 additions and 15 deletions

View File

@@ -4,12 +4,17 @@ All notable changes to Proxmox VE for WHMCS will be documented in this file.
## [1.2.2b] - Not yet released
### 🚀 Feature
- Power Actions now available in Admin Area as well as Client Area
- Power Actions: Now available in Admin Area as well as Client Area
- (Note: Suspend/Unsuspend/Terminate remain admin-only functions)
### 💅 Polish
- Client Area: Power Action wording amended (Soft Stop, Hard Stop)
- Admin, Module Config: Explain what the VNC Secret field is about
- Admin, Module Config: House-keeping to design, Support/Health tab
### 🐛 Bug Fix
- Admin, Create Service: Fails if Plan/Pool not assigned in WHMCS (#36)
- Client, VNC: Fails early if VNC Secret is not set or adequate (#27)
## [1.2.1b] - 2023-06-19

View File

@@ -35,21 +35,16 @@ function pvewhmcs_activate() {
$i++ ;
}
if (!$err)
return array('status'=>'success','description'=>'PVE for WHMCS installed successfuly.');
return array('status'=>'success','description'=>'Proxmox for WHMCS was installed successfuly.');
return array('status'=>'error','description'=>'PVE for WHMCS was not activated properly.');
return array('status'=>'error','description'=>'Proxmox for WHMCS was not activated properly.');
}
function pvewhmcs_deactivate() {
Capsule::statement('drop table mod_pvewhmcs_ip_addresses,mod_pvewhmcs_ip_pools,mod_pvewhmcs_plans,mod_pvewhmcs_vms,mod_pvewhmcs');
# Return Result
return array('status'=>'success','description'=>'PVE for WHMCS successfuly deactivated and all related tables deleted.');
return array('status'=>'error','description'=>'If an error occurs you can return an error
message for display here');
return array('status'=>'info','description'=>'If you want to give an info message to a user
you can return it here');
return array('status'=>'success','description'=>'Proxmox for WHMCS successfuly deactivated and all related tables deleted.');
}
function pvewhmcs_output($vars) {
@@ -103,7 +98,7 @@ function pvewhmcs_output($vars) {
echo '
<div id="plans" class="tab-pane '.($_GET['tab']=="vmplans" ? "active" : "").'">
<div class="btn-group btn-group-lg" role="group" aria-label="...">
<div class="btn-group" role="group" aria-label="...">
<a class="btn btn-default" href="'. pvewhmcs_BASEURL .'&amp;tab=vmplans&amp;action=planlist">
<i class="fa fa-list"></i>&nbsp; List: VM Plans
</a>
@@ -272,9 +267,9 @@ function pvewhmcs_output($vars) {
echo '<div id="health" class="tab-pane '.($_GET['tab']=="health" ? "active" : "").'" >' ;
echo ('<h2>System Environment</h2><b>Proxmox VE for WHMCS</b> v' . pvewhmcs_version() . '<br><b>PHP</b> v' . phpversion() . ' running on <b>' . $_SERVER['SERVER_SOFTWARE'] . '</b> Web Server<br><br>');
echo ('<h2>Updates & Codebase</h2><b>Proxmox for WHMCS is open-source and free to use & improve on! ❤️</b><br>Repo: <a href="https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/" target="_blank">https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/</a><br><br>');
echo ('<h2>Product & Reviewing</h2><b style="color:darkgreen;">Your 5-star review on WHMCS Marketplace will help the module grow!</b><br><a href="https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs" target="_blank">https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs</a><br><br>');
echo ('<h2>Product & Reviewing</h2><b style="color:darkgreen;">Your 5-star review on WHMCS Marketplace will help the module grow!</b><br>*****: <a href="https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs" target="_blank">https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs</a><br><br>');
echo ('<h2>Issues: Common Causes</h2>1. <b>WHMCS needs to have >100 Services, else it is an illegal Proxmox VMID.</b><br>2. Save your Package (Plan/Pool)! (configproducts.php?action=edit&id=...#tab=3)<br>3. Where possible, we pass-through the exact error to WHMCS Admin. Check it for info!<br><br>');
echo ('<h2>Module Tech Support</h2>Please raise an <a href="https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues/new" target="_blank"><u>Issue</u></a> on GitHub - include logs, steps to reproduce, etc.<br>Help is not guaranteed (FOSS). We will need your assistance. Thank you.<br><br>');
echo ('<h2>Module Technical Support</h2>Please raise an <a href="https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues/new" target="_blank"><u>Issue</u></a> on GitHub - include logs, steps to reproduce, etc.<br>Help is not guaranteed (FOSS). We will need your assistance. <b>Thank you.</b><br><br>');
echo '</div>';
// Config Tab

View File

@@ -60,6 +60,17 @@ function pvewhmcs_ConfigOptions() {
}
function pvewhmcs_CreateAccount($params) {
// Make sure "WHMCS Admin > Products/Services > Proxmox-based Service -> Plan + Pool" are set. Else, fail early. (Issue #36)
if (!isset($params['configoption1'], $params['configoption2'])) {
throw new Exception("PVEWHMCS Error: Missing Config. Service/Product WHMCS Config not saved (Plan/Pool not assigned to WHMCS Service type). Check Support/Health tab in Module Config for info. Quick and easy fix.");
}
if (empty($params['configoption1'])) {
throw new Exception("PVEWHMCS Error: Missing Config. Service/Product WHMCS Config not saved (Plan/Pool not assigned to WHMCS Service type). Check Support/Health tab in Module Config for info. Quick and easy fix.");
}
if (empty($params['configoption2'])) {
throw new Exception("PVEWHMCS Error: Missing Config. Service/Product WHMCS Config not saved (Plan/Pool not assigned to WHMCS Service type). Check Support/Health tab in Module Config for info. Quick and easy fix.");
}
// Retrieve Plan from table
$plan = Capsule::table('mod_pvewhmcs_plans')->where('id', '=', $params['configoption1'])->get()[0];
@@ -724,6 +735,11 @@ function pvewhmcs_vmStat($params) {
}
function pvewhmcs_noVNC($params) {
// Check if VNC Secret is configured in Module Config, fail early if not. (#27)
if (strlen(Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret')<15) {
throw new Exception("PVEWHMCS Error: VNC Secret in Module Config either not set or not long enough. Recommend 20+ characters for security.");
}
// Get login credentials then make the Proxmox connection attempt.
$serverip = $params["serverip"];
$serverusername = 'vnc';
$serverpassword = Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret');
@@ -741,12 +757,11 @@ function pvewhmcs_noVNC($params) {
$vncticket = $vm_vncproxy['ticket'];
// $path should only contain the actual path without any query parameters
$path = 'api2/json/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/vncwebsocket?port=' . $vm_vncproxy['port'] . '&vncticket=' . urlencode($vncticket);
// Construct the noVNC Router URL with the path already prepared now
$url = '/modules/servers/pvewhmcs/novnc_router.php?host=' . $serverip . '&pveticket=' . urlencode($pveticket) . '&path=' . urlencode($path) . '&vncticket=' . urlencode($vncticket);
// Build and deliver the noVNC Router hyperlink for access
$vncreply='<center><strong>Console (noVNC) prepared for usage. <a href="'.$url.'" target="_blanK">Click here</a> to open the noVNC window.</strong></center>' ;
return $vncreply;
} else {
$vncreply='Failed to prepare noVNC. Please contact Technical Support.';
return $vncreply;
@@ -754,6 +769,11 @@ function pvewhmcs_noVNC($params) {
}
function pvewhmcs_javaVNC($params){
// Check if VNC Secret is configured in Module Config, fail early if not. (#27)
if (strlen(Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret')<15) {
throw new Exception("PVEWHMCS Error: VNC Secret in Module Config either not set or not long enough. Recommend 20+ characters for security.");
}
// Get login credentials then make the Proxmox connection attempt.
$serverip = $params["serverip"];
$serverusername = 'vnc';
$serverpassword = Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret');