Skip to content

Commit

Permalink
v1.2.1: noVNC OK, Tidy-up GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
lsthompson committed Jun 19, 2023
1 parent bac101e commit f44647c
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog
All notable changes to Proxmox VE for WHMCS will be documented in this file.

## [1.2.1b] - 2023-06-20
## [1.2.1b] - 2023-06-19

### Added
- Module Config tab, allowing for configuration of the VNC Secret
- Reboot command/action added to Client Area (ie. on/off/hard-off)
- Link from Health tab of Admin GUI to WHMCS Marketplace re: reviews
- Images for all supported Operating Systems & Kernel types (some fixed)
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ To access VNC via WHMCS Client Area, you need to:
2. PVE and WHMCS on the same Domain Name*
3. Have valid PTR/rDNS for the PVE Address

**WIP NOTE:** noVNC is being overhauled. It is not yet properly operational as it stands.
**WIP NOTE:** noVNC has been overhauled. It is not guaranteed, nor the project at all. :-)

At the moment, the vnc_secret field in the DB (mod_pvewhmcs tables) can't be set via GUI.
\* = You must use different Subdomains on the same Domain Name, for the cookie (anti-CSRF).

* = You must use different Subdomains on the same Domain Name, so the PVEAuthCookie works.

* = If your Domain Name has a 2-part TLD (ie. co.uk) then you will need to amend the code.
\* = If your Domain Name has a 2-part TLD (ie. co.uk) then you will need to amend the code.

### 👥 PROXMOX USER REQUIREMENT:

Expand All @@ -47,7 +45,8 @@ For the VNC User in Proxmox you need to:
1. Create User Group "VNC" via PVE > Datacenter / Permissions / Group
2. Create new User "vnc" > Datacenter / Permissions / Users - select Group: "VNC", Realm: pve
3. Create new Role -> Datacenter / Permissions / Roles - select Name: "VNC", Privileges: VM.Console (only)
3. Add permission to access VNC -> Datacenter / Node / VM / Permissions / Add Group Permissions - select Group: "VNC", Role: "VNC"
4. Add permission to access VNC -> Datacenter / Node / VM / Permissions / Add Group Permissions - select Group: "VNC", Role: "VNC"
5. Configure the WHMCS > Modules > Proxmox VE for WHMCS > Module Config > VNC Secret with 'vnc' password.

### 🤬 ABUSE - ZERO TOLERANCE:

Expand Down
49 changes: 49 additions & 0 deletions modules/addons/pvewhmcs/pvewhmcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function pvewhmcs_output($vars) {
<li class="'.($_GET['tab']=="vmplans" ? "active" : "").'"><a id="tabLink1" data-toggle="tab" role="tab" href="#plans">VM Plans</a></li>
<li class="'.($_GET['tab']=="ippools" ? "active" : "").'"><a id="tabLink2" data-toggle="tab" role="tab" href="#ippools">IP Pools</a></li>
<li class="'.($_GET['tab']=="health" ? "active" : "").'"><a id="tabLink3" data-toggle="tab" role="tab" href="#health">Support / Health</a></li>
<li class="'.($_GET['tab']=="config" ? "active" : "").'"><a id="tabLink4" data-toggle="tab" role="tab" href="#config">Module Config</a></li>
</ul>
</div>
<div class="tab-content admin-tabs">
Expand Down Expand Up @@ -276,7 +277,55 @@ function pvewhmcs_output($vars) {

echo '</div>';

// Config Tab
$config= Capsule::table('mod_pvewhmcs')->where('id', '=', '1')->get()[0];
echo '<div id="config" class="tab-pane '.($_GET['tab']=="config" ? "active" : "").'" >' ;
echo '
<form method="post">
<table class="form" border="0" cellpadding="3" cellspacing="1" width="100%">
<tr>
<td class="fieldlabel">VNC Secret</td>
<td class="fieldarea">
<input type="text" size="35" name="vnc_secret" id="vnc_secret" value="'.$config->vnc_secret.'">
</td>
</tr>
</table>
<div class="btn-container">
<input type="submit" class="btn btn-primary" value="Save Changes" name="save_config" id="save_config">
<input type="reset" class="btn btn-default" value="Cancel Changes">
</div>
</form>
';

echo '</div>';

echo '</div>'; // end of tab-content

if (isset($_POST['save_config'])) {
save_config() ;
}
}

/* commit module config to DB */
function save_config() {
try {
Capsule::connection()->transaction(
function ($connectionManager)
{
/** @var \Illuminate\Database\Connection $connectionManager */
$connectionManager->table('mod_pvewhmcs')->update(
[
'vnc_secret' => $_POST['vnc_secret'],
]
);
}
);
$_SESSION['pvewhmcs']['infomsg']['title']='Module Config saved.' ;
$_SESSION['pvewhmcs']['infomsg']['message']='New options have been successfully saved.' ;
header("Location: ".pvewhmcs_BASEURL."&tab=config");
} catch (\Exception $e) {
echo "Uh oh! That didn't work, but I was able to rollback. {$e->getMessage()}";
}
}

/* adding a KVM plan */
Expand Down

0 comments on commit f44647c

Please sign in to comment.