22 Commits
Author SHA1 Message Date
ArkHostandGitHub 9049937d8e v1.1.1
Fixed
- Firewall rules now accept source 0.0.0.0/0 for all IPs
- "ANY" protocol creates both TCP and UDP rules automatically
- Outbound firewall rules now use correct destination_ips field

Added
- Incoming/Outgoing direction support for firewall rules
- Proper CIDR notation validation (supports /0, /4, /8, /16, etc.)

Improved
- Removed description/note field from firewall interface
- Changed "Source/Destination" column to "IP/CIDR" for clarity
- Translated all firewall column headers to all supported languages
- Cleaned up unused language strings
2025-09-09 20:54:17 +02:00
ArkHostandGitHub fb4e94b086 Update ArkHostHetznerVPS.php 2025-09-08 21:24:45 +02:00
ArkHostandGitHub 3bfc327763 Update ArkHostHetznerVPS.php
- Firewall Display: Removed fake "default open" rules that didn't exist in Hetzner dashboard
- Firewall Creation: Fixed "name already used" error with unique timestamp naming
- Firewall Association: Fixed API errors when attaching firewalls to servers
2025-09-08 21:24:29 +02:00
ArkHostandGitHub 8b7d6b2c62 Merge pull request #5 from notelseit/main
Update README.md
2025-08-19 00:02:58 +02:00
Notelseit.comandGitHub 3c526260cd Update README.md
fix view  Server Type read me
2025-08-16 11:27:36 +02:00
Notelseit.comandGitHub 8d4673378c Update README.md
update list Operating System
2025-08-16 11:25:49 +02:00
Notelseit.comandGitHub 5421cd0b30 Update README.md
correct datacenter data
2025-08-16 11:17:43 +02:00
ArkHostandGitHub 8887733e0e Update README.md 2025-08-12 19:39:15 +02:00
ArkHostandGitHub af56d91bff translation strings fixes 2025-07-21 21:49:06 +02:00
ArkHostandGitHub 60fb7b0ce0 translation strings fixes 2025-07-21 21:48:33 +02:00
ArkHostandGitHub 64dde17f0e Update README.md 2025-07-21 21:47:58 +02:00
ArkHostandGitHub 6b29ab199c update screenshot - translation fix 2025-07-21 21:47:00 +02:00
ArkHostandGitHub ff62c3a64c missing translations 2025-07-21 21:27:45 +02:00
ArkHostandGitHub 0de4798583 Update README.md 2025-07-21 21:00:49 +02:00
ArkHostandGitHub ef4c336049 Update README.md 2025-07-21 21:00:16 +02:00
ArkHostandGitHub f7df8b6492 Update README.md 2025-07-21 15:30:36 +02:00
ArkHostandGitHub 7a846f7fba screenshots 2025-07-21 15:28:33 +02:00
ArkHostandGitHub 332e21970d Update README.md 2025-07-21 15:28:04 +02:00
ArkHostandGitHub 394f7e8af8 v1.0
Initial release
2025-07-21 15:25:29 +02:00
ArkHostandGitHub 16f72f786c Update LICENSE 2025-07-21 15:22:35 +02:00
ArkHostandGitHub 4181c45085 Update README.md 2025-07-21 15:22:09 +02:00
ArkHostandGitHub ff492c7d85 Initial commit 2025-07-21 15:15:42 +02:00
6 changed files with 46 additions and 435 deletions
+1 -1
View File
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
+28 -187
View File
@@ -12,7 +12,6 @@ WHMCS server module for Hetzner Cloud VPS management.
**Advanced**
- Cloud-init support for automated server configuration
- Floating IP management with reverse DNS
- Backup creation and restoration
- Firewall rule management
@@ -39,15 +38,14 @@ WHMCS server module for Hetzner Cloud VPS management.
## Installation
1. Upload files to `/path/to/whmcs/modules/servers/ArkHostHetznerVPS/`
2. Upload `hooks.php` to `/path/to/whmcs/includes/hooks/` (for enhanced UI)
3. Create server and add it to a server group:
2. Create server and add it to a server group:
- Setup → Products/Services → Servers → Create New Group
- Name: `Hetzner Cloud`
- Type: `ArkHostHetznerVPS`
- Hostname: `localhost`
- Username: Hetzner Project ID (optional)
- Password: Hetzner Cloud API Token
4. Create products:
3. Create products:
- Setup → Products/Services → Products/Services → Create New Product
- Type: `VPS/Dedicated Server`
- Module: `ArkHostHetznerVPS`
@@ -57,12 +55,11 @@ WHMCS server module for Hetzner Cloud VPS management.
**Module Settings**
- Server Type: `cx23`, `cx33`, `cx43`, `cx53` (Cost-Optimized), `cpx11`, `cpx21`, `cax11`, `ccx13`, etc.
- Operating System: `ubuntu-22.04`, `debian-11`, `rocky-9`, etc.
- Datacenter: `fsn1`, `nbg1`, `hel1`, `ash`, `hil`, `sin`
- Server Type: `cx11`, `cx21`, `cx31`, `cx41`, `cx51` , etc.
- Operating System: `ubuntu-20.04`, `debian-11`, etc.
- Datacenter: `fsn1`, `nbg1`, `hel1`, `ash`, `hil`
- Backups: On/Off
- Create Floating IP: On/Off
- Cloud-Init YAML: Optional custom cloud-init configuration
**Custom Field (Required)**
@@ -101,10 +98,6 @@ Create in Setup → Products/Services → Configurable Options:
- Option Name: `planid`
- Option Type: `Dropdown`
- Options:
- `cx23|CX23 - 2 vCPU, 4 GB RAM, 40 GB Disk, shared (Cost-Optimized)`
- `cx33|CX33 - 4 vCPU, 8 GB RAM, 80 GB Disk, shared (Cost-Optimized)`
- `cx43|CX43 - 8 vCPU, 16 GB RAM, 160 GB Disk, shared (Cost-Optimized)`
- `cx53|CX53 - 16 vCPU, 32 GB RAM, 320 GB Disk, shared (Cost-Optimized)`
- `cpx11|CPX 11 - 2 vCPU, 2 GB RAM, 40 GB Disk, shared`
- `cpx21|CPX 21 - 3 vCPU, 4 GB RAM, 80 GB Disk, shared`
- `cpx31|CPX 31 - 4 vCPU, 8 GB RAM, 160 GB Disk, shared`
@@ -128,36 +121,34 @@ Create in Setup → Products/Services → Configurable Options:
**4\. Operating System**
- Option Name: `osid`
- Option Type: `Dropdown`
- Option Name: `osid`
- Option Type: `Dropdown`
- Options:
- `lamp|lamp`
-`wordpress|wordpress`
-`jitsi|jitsi`
-`nextcloud|nextcloud`
- `docker-ce|docker-ce`
- `gitlab|gitlab`
- `debian-11|Debian 11`
- `debian-12|Debian 12`
- `debian-13|Debian 13`
- `rocky-8|Rocky Linux 8`
- `centos-stream-9|CentOS Stream 9`
- `ubuntu-22.04|Ubuntu 22.04`
- `ubuntu-24.04|Ubuntu 24.04`
- `prometheus-grafana|prometheus-grafana`
- `rocky-9|Rocky Linux 9`
- `wireguard|wireguard`
- `owncast|owncast`
- `photoprism|photoprism`
- `rustdesk|rustdesk`
- `centos-stream-9|CentOS Stream 9`
- `debian-11|Debian 11`
- `rocky-8|Rocky Linux 8`
- `rocky-9|Rocky Linux 9`
- `rocky-10|Rocky Linux 10`
- `ubuntu-22.04|Ubuntu 22.04`
- `alma-8|AlmaLinux 8`
- `alma-9|AlmaLinux 9`
- `alma-10|AlmaLinux 10`
- `centos-stream-9|CentOS Stream 9`
- `centos-stream-10|CentOS Stream 10`
- `opensuse-15|openSUSE 15`
- `fedora-41|Fedora 41`
- `fedora-42|Fedora 42`
- `docker-ce|Docker CE`
- `lamp|LAMP Stack`
- `wordpress|WordPress`
- `nextcloud|Nextcloud`
- `gitlab|GitLab`
- `jitsi|Jitsi`
- `wireguard|WireGuard`
- `prometheus-grafana|Prometheus + Grafana`
- `owncast|Owncast`
- `photoprism|PhotoPrism`
- `rustdesk|RustDesk`
- `jitsi|jitsi`
- `owncast|owncast`
@@ -192,102 +183,6 @@ This ensures proper key isolation and security for each customer.
We're exploring secure implementations using cloud-init or per-server user data to enable SSH key management while maintaining proper isolation.
## Cloud-Init Support
Cloud-init allows automatic server configuration during first boot. Unlike project-level SSH keys, cloud-init user_data is per-server, ensuring proper isolation in multi-tenant environments.
**Configuration:**
1. Navigate to Setup → Products/Services → Products/Services
2. Edit your product → Module Settings tab
3. Find "Cloud-Init YAML (Optional)" textarea
4. Enter your cloud-init configuration in YAML format
5. Leave empty to skip cloud-init
**Common Use Cases:**
**1. Change APT Mirrors** (original use case - avoid Hetzner mirrors):
```yaml
#cloud-config
apt:
primary:
- arches: [default]
uri: http://de.archive.ubuntu.com/ubuntu/
```
**2. Add SSH Keys** (secure alternative to project-level keys):
```yaml
#cloud-config
users:
- name: admin
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2E... user@laptop
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
```
**3. Install Docker:**
```yaml
#cloud-config
packages:
- docker.io
- docker-compose
runcmd:
- systemctl enable docker
- systemctl start docker
```
**4. Security Hardening:**
```yaml
#cloud-config
packages:
- fail2ban
- ufw
runcmd:
- ufw default deny incoming
- ufw default allow outgoing
- ufw allow 22/tcp
- ufw --force enable
- systemctl enable fail2ban
- systemctl start fail2ban
```
**5. Combined Configuration:**
```yaml
#cloud-config
apt:
primary:
- arches: [default]
uri: http://mirror.example.com/ubuntu/
users:
- name: admin
ssh_authorized_keys:
- ssh-rsa AAAAB3... admin@company
sudo: ALL=(ALL) NOPASSWD:ALL
packages:
- fail2ban
- ufw
- docker.io
runcmd:
- ufw allow 22/tcp
- ufw --force enable
- systemctl enable docker fail2ban
```
**Important Notes:**
- YAML must be valid syntax (use a YAML validator if unsure)
- If you don't start with `#cloud-config`, the module will add it automatically
- Cloud-init runs ONCE on first boot only
- Invalid YAML will cause provisioning to fail silently
- Maximum size: 32 KiB (Hetzner API limit)
- Documentation: https://docs.hetzner.cloud/#servers-create-a-server
## Screenshots
![Screenshot 1](screenshots/1.png)
![Screenshot 2](screenshots/2.png)
@@ -338,60 +233,6 @@ Free and open source. Commercial support available.
Check out our other WHMCS modules at [arkhost.com/whmcs-modules.php](https://arkhost.com/whmcs-modules.php "https://arkhost.com/whmcs-modules.php")
## Changelog
### v1.2.1
**Added:**
- Shutdown button functionality (graceful server shutdown)
- Enhanced backup permission detection (automatically detects Hetzner-enabled backups)
- Improved Actions sidebar with custom Font Awesome icons
- VNC console opens in new tab
- hooks.php for cleaner UI (hides default WHMCS elements)
**Fixed:**
- Backup creation/deletion API response format
- Shutdown action now properly whitelisted in ClientAreaAPI
### v1.2.0
**Added:**
- Cloud-init support (optional per-product YAML configuration)
- CX Gen3 server types: CX23, CX33, CX43, CX53
- OS images: Debian 13, AlmaLinux 10, Rocky 10, CentOS Stream 10, openSUSE 15, Fedora 41/42
- Password expiration (72-hour visibility window)
**Fixed:**
- API pagination - server types and OS images now show all available options (per_page=50)
- Password reset timestamp tracking
- Password display in client area after reset
**Documentation:**
- Cloud-init configuration examples
- Updated server types and OS lists
### v1.1.1
**Fixed:**
- Firewall rules now accept source 0.0.0.0/0 for all IPs
- "ANY" protocol creates both TCP and UDP rules automatically
- Outbound firewall rules now use correct destination_ips field
**Added:**
- Incoming/Outgoing direction support for firewall rules
- Proper CIDR notation validation (supports /0, /4, /8, /16, etc.)
**Improved:**
- Removed description/note field from firewall interface
- Changed "Source/Destination" column to "IP/CIDR" for clarity
- Translated all firewall column headers to all supported languages
- Cleaned up unused language strings
### v1.1
**Fixed:**
- Firewall Display: Removed fake "default open" rules that didn't exist in Hetzner dashboard
- Firewall Creation: Fixed "name already used" error with unique timestamp naming
- Firewall Association: Fixed API errors when attaching firewalls to servers
- API Compatibility: Corrected data formats for Hetzner API (ports as strings, proper server object structure)
### v1.0
- Initial release
© 2025 ArkHost
<br>
@@ -3,7 +3,7 @@
* WHMCS Server Module - Hetzner VPS
*
* @package WHMCS
* @version 1.2.1
* @version 1.1.1
* @copyright Copyright (c) ArkHost 2025
* @author ArkHost <support@arkhost.com>
* @link https://arkhost.com
@@ -116,12 +116,12 @@ function ArkHostHetznerVPS_API(array $params) {
break;
case 'Packages':
$url .= 'server_types?per_page=50';
$url .= 'server_types';
$method = 'GET';
break;
case 'Operating Systems':
$url .= 'images?type=system&per_page=50';
$url .= 'images?type=system';
$method = 'GET';
break;
@@ -176,21 +176,7 @@ function ArkHostHetznerVPS_API(array $params) {
if (ArkHostHetznerVPS_GetOption($params, 'ipv6') === 'on') {
$data['enable_ipv6'] = false;
}
// Handle Cloud-Init user_data if provided
$cloudInitYaml = ArkHostHetznerVPS_GetOption($params, 'cloud_init_yaml');
if ($cloudInitYaml && trim($cloudInitYaml) !== '') {
// Basic YAML validation - check if it starts with #cloud-config
$trimmedYaml = trim($cloudInitYaml);
if (strpos($trimmedYaml, '#cloud-config') !== 0) {
// Auto-prepend #cloud-config if missing
$cloudInitYaml = "#cloud-config\n" . $cloudInitYaml;
}
// Pass as plain text - Hetzner API accepts user_data as plain string (max 32KiB)
$data['user_data'] = $cloudInitYaml;
}
// Handle SSH keys from custom field if needed
// This would need to be implemented with a custom field
break;
@@ -253,7 +239,7 @@ function ArkHostHetznerVPS_API(array $params) {
break;
case 'Operating Systems - Server':
$url .= 'images?type=system&per_page=50';
$url .= 'images?type=system';
$method = 'GET';
break;
@@ -903,7 +889,7 @@ function ArkHostHetznerVPS_API(array $params) {
$responseData = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$responseData = json_decode($responseData, true);
if ($statusCode === 0) throw new Exception('cURL Error: ' . curl_error($curl));
@@ -1002,13 +988,6 @@ function ArkHostHetznerVPS_ConfigOptions() {
'Description' => 'Automatically create a floating IP when provisioning this server (additional cost - billed by Hetzner).',
'Type' => 'yesno',
),
'cloud_init_yaml' => array(
'FriendlyName' => 'Cloud-Init YAML (Optional)',
'Description' => 'Custom cloud-init configuration in YAML format (max 32KiB). Passed as user_data to Hetzner API during server creation. Leave empty to skip cloud-init. <a href="https://docs.hetzner.cloud/#servers-create-a-server" target="_blank">Documentation</a>',
'Type' => 'textarea',
'Rows' => '10',
'Cols' => '60',
),
);
try {
@@ -1175,17 +1154,12 @@ function ArkHostHetznerVPS_CreateAccount(array $params) {
$params['model']->serviceProperties->save([
'ArkHostHetznerVPS|VPS ID' => $create['server']['id'],
]);
// Store the root password if provided
if (isset($create['root_password'])) {
Capsule::table('tblhosting')->where('id', $params['serviceid'])->update([
'password' => encrypt($create['root_password'])
]);
// Save the timestamp when password was set for expiration tracking (72 hours)
$params['model']->serviceProperties->save([
'ArkHostHetznerVPS|Password Set Time' => time()
]);
}
// Handle floating IP creation if requested via Configurable Options or Module Settings
@@ -1529,7 +1503,7 @@ function ArkHostHetznerVPS_ClientAreaAPI(array $params) {
try {
$action = App::getFromRequest('api');
$actions = array('Server Info', 'Graphs', 'Reinstall', 'Reboot', 'Stop', 'Shutdown', 'Start', 'IPv4 Addresses', 'Hostname rDNS', 'Create backup', 'Delete backup', 'List backups', 'Restore backup', 'Get Firewall rules', 'Add Firewall rules', 'Delete Firewall rule', 'Commit Firewall rules', 'ISO Images', 'Load ISO', 'Eject ISO', 'Reset root', 'Create Snapshot', 'List Snapshots', 'Server Metrics', 'Rescue Mode', 'Disable Rescue Mode', 'GetFloatingIPStatus', 'AssignFloatingIP', 'UnassignFloatingIP', 'SetFloatingIPReverseDNS');
$actions = array('Server Info', 'Graphs', 'Reinstall', 'Reboot', 'Stop', 'Start', 'IPv4 Addresses', 'Hostname rDNS', 'Create backup', 'Delete backup', 'List backups', 'Restore backup', 'Get Firewall rules', 'Add Firewall rules', 'Delete Firewall rule', 'Commit Firewall rules', 'ISO Images', 'Load ISO', 'Eject ISO', 'Reset root', 'Create Snapshot', 'List Snapshots', 'Server Metrics', 'Rescue Mode', 'Disable Rescue Mode', 'GetFloatingIPStatus', 'AssignFloatingIP', 'UnassignFloatingIP', 'SetFloatingIPReverseDNS');
$results = array('result' => 'success');
if (in_array($action, $actions)) {
@@ -1542,39 +1516,22 @@ function ArkHostHetznerVPS_ClientAreaAPI(array $params) {
if (in_array($action, $backupActions)) {
// Check if backups are enabled either via module settings or configurable options
$backupsEnabled = false;
// Check module product settings
if (isset($params['backups']) && $params['backups'] == 'on') {
$backupsEnabled = true;
}
// Check configurable options
if (isset($params['configoptions']['Backups']) && $params['configoptions']['Backups'] == 'Yes') {
$backupsEnabled = true;
}
// If not enabled in WHMCS settings, check if backups are actually enabled on Hetzner's side
if (!$backupsEnabled) {
try {
$serverInfoParams = $params;
$serverInfoParams['action'] = 'Server Info';
$serverInfoResult = ArkHostHetznerVPS_API($serverInfoParams);
// Check if the server has backups enabled (indicated by backup_window being set)
if (isset($serverInfoResult['server']['backup_window']) && $serverInfoResult['server']['backup_window'] !== null) {
$backupsEnabled = true;
}
} catch (Exception $e) {
// If we can't check, assume not enabled
$backupsEnabled = false;
}
}
if (!$backupsEnabled) {
return array('jsonResponse' => array(
return array(
'result' => 'error',
'message' => 'Backups are not enabled for this service. Please upgrade your plan to enable backups.'
));
);
}
}
@@ -1947,12 +1904,7 @@ function ArkHostHetznerVPS_ClientAreaAPI(array $params) {
Capsule::table('tblhosting')
->where('id', $params['serviceid'])
->update(['password' => encrypt($result['root_password'])]);
// Save the timestamp when password was set for expiration tracking (72 hours)
$params['model']->serviceProperties->save([
'ArkHostHetznerVPS|Password Set Time' => time()
]);
$results['root_password'] = $result['root_password'];
$results['message'] = 'Server rebuild initiated. New root password has been saved.';
} else {
@@ -1989,21 +1941,6 @@ function ArkHostHetznerVPS_ClientAreaAPI(array $params) {
$results['result'] = 'error';
$results['message'] = 'Invalid floating IP ID for this service';
}
} else if ($action === 'Reset root') {
// Handle password reset from client area
$results = array_merge($results, is_array($result) ? $result : array('data' => $result));
// Store the new root password and timestamp if provided
if (isset($result['root_password'])) {
Capsule::table('tblhosting')->where('id', $params['serviceid'])->update([
'password' => encrypt($result['root_password'])
]);
// Save the timestamp when password was set for expiration tracking (72 hours)
$params['model']->serviceProperties->save([
'ArkHostHetznerVPS|Password Set Time' => time()
]);
}
} else {
$results = array_merge($results, is_array($result) ? $result : array('data' => $result));
}
@@ -2063,7 +2000,6 @@ function ArkHostHetznerVPS_ClientAreaCustomButtonArray() {
$_LANG['Start'] => 'Start',
$_LANG['Stop'] => 'Stop',
$_LANG['Restart'] => 'Reboot',
$_LANG['Shutdown'] => 'Shutdown',
$_LANG['VNC'] => 'VNC',
);
}
@@ -2112,7 +2048,7 @@ function ArkHostHetznerVPS_ClientArea(array $params) {
if (!is_array($response) || !isset($response['server'])) {
throw new Exception('Unable to retrieve server information from API');
}
// Extract server data from Hetzner response
$serverInfo = $response['server'];
@@ -2411,26 +2347,6 @@ function ArkHostHetznerVPS_ClientArea(array $params) {
$serverInfo['datacenter'] = isset($serverInfo['datacenter']['description']) ? $serverInfo['datacenter']['description'] : 'N/A';
$serverInfo['location'] = isset($serverInfo['datacenter']['location']['city']) ? $serverInfo['datacenter']['location']['city'] : 'N/A';
// Get root password with expiration check (72 hours)
$passwordSetTime = $params['model']->serviceProperties->get('ArkHostHetznerVPS|Password Set Time');
$currentTime = time();
$expirationPeriod = 72 * 3600; // 72 hours in seconds
if (!empty($params['password']) && $params['password'] !== 'managed-via-api') {
// If no timestamp exists, show the password (backward compatibility or initial setup)
// If timestamp exists, check if it's within the 72-hour window
if (!$passwordSetTime || ($currentTime - $passwordSetTime) < $expirationPeriod) {
// Password is still valid - WHMCS already decrypts it for us in $params
// No need to call decrypt() as $params['password'] is already plain text
$serverInfo['install_root'] = $params['password'];
} else {
// Password has expired (timestamp exists and is older than 72 hours)
$serverInfo['install_root'] = '';
}
} else {
$serverInfo['install_root'] = '';
}
// For now, always show backups tab - the API will handle permissions
$backupsEnabled = true;
@@ -2520,17 +2436,12 @@ function ArkHostHetznerVPS_ResetRoot(array $params) {
try {
$params['action'] = 'Reset root';
$result = ArkHostHetznerVPS_API($params);
// Store the new root password if provided
if (isset($result['root_password'])) {
Capsule::table('tblhosting')->where('id', $params['serviceid'])->update([
'password' => encrypt($result['root_password'])
]);
// Save the timestamp when password was set for expiration tracking (72 hours)
$params['model']->serviceProperties->save([
'ArkHostHetznerVPS|Password Set Time' => time()
]);
}
} catch (Exception $err) {
ArkHostHetznerVPS_Error(__FUNCTION__, $params, $err);
@@ -1,73 +0,0 @@
<?php
/**
* WHMCS Server Module - Hetzner VPS Hooks
*
* @package WHMCS
* @version 1.2.1
* @copyright Copyright (c) ArkHost 2025
* @author ArkHost <support@arkhost.com>
* @link https://arkhost.com
*/
use WHMCS\Database\Capsule;
/**
* Hide default WHMCS product details and cog icons for ArkHostHetznerVPS products
* Injects CSS early to prevent flash of content
*/
add_hook('ClientAreaHeadOutput', 1, function($vars) {
// Only run on product details page
if (!isset($_GET['action']) || $_GET['action'] !== 'productdetails') {
return '';
}
// Get the service ID from the request
$serviceId = isset($_GET['id']) ? (int) $_GET['id'] : 0;
if (!$serviceId) {
return '';
}
// Check if this service uses the ArkHostHetznerVPS module
try {
$service = Capsule::table('tblhosting')
->where('id', $serviceId)
->first();
if (!$service || $service->servertype !== 'ArkHostHetznerVPS') {
return '';
}
} catch (Exception $e) {
return '';
}
// Inject CSS early in the HEAD to prevent flash
// This works for both active and suspended services
return <<<HTML
<style>
/* Hide WHMCS default product details (Domain, Username, Server Name, IP, Visit Website) for ArkHostHetznerVPS */
#domain > .row:nth-child(2),
#domain > .row:nth-child(3),
#domain > .row:nth-child(4) {
display: none !important;
}
#domain > br {
display: none !important;
}
#domain > p {
display: none !important;
}
/* Hide cog icons from custom action buttons IMMEDIATELY */
.list-group-item[href*="modop=custom"] i.fa-cog,
.list-group-item[href*="modop=custom"] i.fas.fa-cog,
.list-group-item[href*="modop=custom"] .fa-cog,
.list-group-item[href*="modop=custom"] i.fa-wrench,
a[href*="modop=custom"] i.fa-cog,
a[href*="modop=custom"] i.fas.fa-cog,
a[href*="modop=custom"] .fa-cog {
display: none !important;
}
</style>
HTML;
});
@@ -756,66 +756,4 @@
</div>
</div>
<script>
// Wait for WHMCS jQuery to be ready and use it
jQuery(document).ready(function($) {
// Inject custom icons into sidebar action buttons
$('.list-group-item').each(function() {
var $link = $(this);
var href = $link.attr('href');
if (!href) return;
// Add custom Font Awesome icons based on action
if (href.indexOf('modop=custom&a=Start') !== -1) {
// Prepend play icon to Start button
$link.html('<i class="fa fa-play"></i> ' + $link.text().trim());
// Intercept click to use our API
$link.off('click').on('click', function(e) {
e.preventDefault();
e.stopImmediatePropagation();
ArkHostHetznerVPS_API('Start', true);
return false;
});
} else if (href.indexOf('modop=custom&a=Stop') !== -1) {
// Prepend stop icon to Stop button
$link.html('<i class="fa fa-stop"></i> ' + $link.text().trim());
$link.off('click').on('click', function(e) {
e.preventDefault();
e.stopImmediatePropagation();
confirmStop();
return false;
});
} else if (href.indexOf('modop=custom&a=Reboot') !== -1) {
// Prepend sync icon to Restart button
$link.html('<i class="fa fa-sync"></i> ' + $link.text().trim());
$link.off('click').on('click', function(e) {
e.preventDefault();
e.stopImmediatePropagation();
confirmRestart();
return false;
});
} else if (href.indexOf('modop=custom&a=Shutdown') !== -1) {
// Prepend power-off icon to Shutdown button
$link.html('<i class="fa fa-power-off"></i> ' + $link.text().trim());
$link.off('click').on('click', function(e) {
e.preventDefault();
e.stopImmediatePropagation();
confirmShutdown();
return false;
});
} else if (href.indexOf('modop=custom&a=VNC') !== -1) {
// Prepend desktop icon to VNC button
$link.html('<i class="fa fa-desktop"></i> ' + $link.text().trim());
// Open VNC in new tab
$link.attr('target', '_blank');
}
});
});
</script>
<script src="{$WEB_ROOT}/modules/servers/ArkHostHetznerVPS/template/script.js"></script>
@@ -224,12 +224,6 @@ function resetRootPassword() {
function() {
ArkHostHetznerVPS_API('Reset root', true, {}, function(data) {
if (data.root_password) {
// Update the password field on the page
var passwordField = document.getElementById('vpsPassword');
if (passwordField) {
passwordField.value = data.root_password;
}
// Show password in a special modal or notification
var passwordHtml = '<div class="alert alert-success">' +
'<h5>' + lang.newRootPassword + '</h5>' +
@@ -242,7 +236,7 @@ function resetRootPassword() {
'</div>' +
'<p class="mt-2 mb-0"><small>' + lang.savePassword + ' ' + lang.passwordSaved + '</small></p>' +
'</div>';
// Create a modal to show the password
var modal = document.createElement('div');
modal.className = 'arkhost-confirm-overlay show';