Skip to content

Commit d711f96

Browse files
author
Kristan Kenney
committed
Merge remote-tracking branch 'jaapmarcus/fix/improve-adding-new-webapps' into main
2 parents 872df51 + 33f55b6 commit d711f96

File tree

20 files changed

+145
-27
lines changed

20 files changed

+145
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ All notable changes to this project will be documented in this file.
4545
- Disabled changing backup folder via Web UI because it used symbolic link instead of mount causing issues with restore mail / user files.
4646
- Fixed XSS vulnerability in `v-add-sys-ip` and user history log (thanks **@numanturle**).
4747
- Fixed remote code execution vulnerability which could occur when deleting SSH keys (thanks **@numanturle**).
48+
- Improve how Quick install of web apps are handled and allow users added apps to be maintained in list view.
4849

4950
## [1.3.5] - Service Release
5051
### Features

web/add/webapp/index.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,12 @@
3030
exit;
3131
}
3232

33-
$v_web_apps = [
34-
[ 'name'=>'Wordpress', 'group'=>'cms', 'enabled'=>true, 'version'=>'latest', 'thumbnail'=>'/images/webapps/wp-thumb.png' ],
35-
[ 'name'=>'Drupal', 'group'=>'cms', 'enabled'=>false,'version'=>'latest', 'thumbnail'=>'/images/webapps/drupal-thumb.png' ],
36-
[ 'name'=>'Joomla', 'group'=>'cms', 'enabled'=>false,'version'=>'latest', 'thumbnail'=>'/images/webapps/joomla-thumb.png' ],
37-
38-
[ 'name'=>'Opencart', 'group'=>'ecommerce', 'enabled'=>true, 'version'=>'3.0.3.3', 'thumbnail'=>'/images/webapps/opencart-thumb.png' ],
39-
[ 'name'=>'Prestashop', 'group'=>'ecommerce', 'enabled'=>true, 'version'=>'1.7.7.1', 'thumbnail'=>'/images/webapps/prestashop-thumb.png' ],
40-
41-
[ 'name'=>'Laravel', 'group'=>'starter', 'enabled'=>true, 'version'=>'7.x', 'thumbnail'=>'/images/webapps/laravel-thumb.png' ],
42-
[ 'name'=>'Symfony', 'group'=>'starter', 'enabled'=>true, 'version'=>'4.3.x', 'thumbnail'=>'/images/webapps/symfony-thumb.png' ],
43-
];
44-
4533
// Check GET request
4634
if (!empty($_GET['app'])) {
4735
$app = basename($_GET['app']);
4836

4937
$hestia = new \Hestia\System\HestiaApp();
50-
$app_installer_class = '\Hestia\WebApp\Installers\\' . $app . 'Setup';
38+
$app_installer_class = '\Hestia\WebApp\Installers\\'.$app.'\\' . $app . 'Setup';
5139
if(class_exists($app_installer_class)) {
5240
try {
5341
$app_installer = new $app_installer_class($v_domain, $hestia);
@@ -94,6 +82,19 @@
9482
if(!empty($installer)) {
9583
render_page($user, $TAB, 'setup_webapp');
9684
} else {
85+
$appInstallers = glob(__DIR__.'/../../src/app/WebApp/Installers/*/*.php');
86+
$v_web_apps = array();
87+
foreach($appInstallers as $app){
88+
$hestia = new \Hestia\System\HestiaApp();
89+
if( preg_match('/Installers\/([a-zA-Z0-0].*)\/([a-zA-Z0-0].*).php/', $app, $matches)){
90+
if ($matches[1] != "Resources"){
91+
$app_installer_class = '\Hestia\WebApp\Installers\\'.$matches[1].'\\' . $matches[1] . 'Setup';
92+
$app_installer = new $app_installer_class($v_domain, $hestia);
93+
$v_web_apps[] = $app_installer -> info();
94+
95+
}
96+
}
97+
}
9798
render_page($user, $TAB, 'list_webapps');
9899
}
99100

-61.9 KB
Binary file not shown.
-32.6 KB
Binary file not shown.

web/src/app/WebApp/Installers/BaseSetup.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ abstract class BaseSetup implements InstallerInterface {
1414

1515
protected $domain;
1616
protected $extractsubdir;
17-
17+
18+
public function info(){
19+
return $this -> appInfo;
20+
}
1821
public function __construct($domain, HestiaApp $appcontext)
1922
{
2023
if(filter_var($domain, FILTER_VALIDATE_DOMAIN) === false) {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Hestia\WebApp\Installers\Drupal;
4+
5+
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
6+
7+
class DrupalSetup extends BaseSetup {
8+
9+
protected $appname = 'drupal';
10+
11+
protected $appInfo = [
12+
'name' => 'Drupal',
13+
'group' => 'cms',
14+
'enabled' => false,
15+
'version' => 'latest',
16+
'thumbnail' => 'drupal-thumb.png'
17+
];
18+
19+
protected $config = [
20+
'form' => [
21+
],
22+
'database' => true,
23+
'resources' => [
24+
25+
],
26+
];
27+
28+
public function install(array $options=null) : bool
29+
{
30+
exit( "Installer missing" );
31+
}
32+
}
File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Hestia\WebApp\Installers\Joomla;
4+
5+
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
6+
7+
class JoomlaSetup extends BaseSetup {
8+
9+
protected $appname = 'joomla';
10+
11+
protected $appInfo = [
12+
'name' => 'Joomla',
13+
'group' => 'cms',
14+
'enabled' => false,
15+
'version' => 'latest',
16+
'thumbnail' => 'joomla-thumb.png'
17+
];
18+
19+
protected $config = [
20+
'form' => [
21+
],
22+
'database' => true,
23+
'resources' => [
24+
25+
],
26+
];
27+
28+
public function install(array $options=null) : bool
29+
{
30+
exit( "Installer missing" );
31+
}
32+
}
File renamed without changes.

web/src/app/WebApp/Installers/LaravelSetup.php renamed to web/src/app/WebApp/Installers/Laravel/LaravelSetup.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
<?php
22

3-
namespace Hestia\WebApp\Installers;
3+
namespace Hestia\WebApp\Installers\Laravel;
4+
5+
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
46

57
class LaravelSetup extends BaseSetup {
68

79
protected $appname = 'laravel';
8-
10+
11+
protected $appInfo = [
12+
'name' => 'Laravel',
13+
'group' => 'framework',
14+
'enabled' => true,
15+
'version' => '7.x',
16+
'thumbnail' => 'laravel-thumb.png'
17+
];
18+
919
protected $config = [
1020
'form' => [
1121
],

0 commit comments

Comments
 (0)