Compare commits

...

121 Commits
1.3 ... 1.8.2

Author SHA1 Message Date
Dennis
aa20c8a42b prod mix 2021-09-16 09:51:17 +02:00
Dennis
0f100d6159 Merge branch 'develop'
# Conflicts:
#	public/css/app.css
#	public/js/app.js
2021-09-16 09:50:07 +02:00
Dennis
7c896243a5 wip 2021-09-16 09:49:53 +02:00
Dennis
954fef7c3e Dynamic servers tab, fix for domain uppercase 2021-09-16 09:19:41 +02:00
Dennis
105126e498 prod mix 2021-08-25 09:20:18 +02:00
Dennis
7aa5a8949d Merge branch 'develop'
# Conflicts:
#	public/js/app.js
2021-08-25 09:19:45 +02:00
Dennis
27079928a7 added demo quick-login support 2021-08-25 09:19:10 +02:00
Dennis
99968e57ec wip 2021-08-17 13:00:47 +02:00
Dennis
f75bc1a551 Production mix 2021-08-12 11:25:19 +02:00
Dennis
ef347f9381 Merge branch 'develop' 2021-08-12 11:24:30 +02:00
Dennis
f1aace3d8f Ability to select allowed regions/plans per provider 2021-08-12 11:23:01 +02:00
Dennis
b2bec62766 Merge branch 'develop'
# Conflicts:
#	public/js/app.js
2021-08-12 11:03:51 +02:00
Dennis
3a8682bbed Textual change 2021-08-12 11:03:25 +02:00
Dennis
5cfc1f97fe Logo fix 2021-08-12 10:26:29 +02:00
Dennis
cfc8220f8e Wip 2021-08-12 10:23:23 +02:00
Dennis
ac5ffefaed Horizon status to system settings tab 2021-08-10 14:04:52 +02:00
Dennis
cbd2b8e0e9 Wip on terms & privacy page configurator 2021-08-10 13:51:37 +02:00
Dennis
f0f427a7bb General improvements 2021-08-05 11:31:38 +02:00
Dennis
7b6f651015 Consistent Ploi class instantiate 2021-08-05 11:14:16 +02:00
Dennis
c793daa79a wip 2021-08-05 11:08:19 +02:00
Dennis
71b436aebe Production mix 2021-08-04 10:17:42 +02:00
Dennis
06e108da5b Merge branch 'develop'
# Conflicts:
#	public/js/app.js
2021-08-04 10:17:03 +02:00
Dennis
5677c58dd2 Package updates 2021-08-04 10:07:36 +02:00
Dennis
58ca801e30 PSR formatting 2021-08-04 09:49:47 +02:00
Dennis
e750d7caba Cleaning 2021-08-04 09:49:24 +02:00
Dennis
3c0964ef0e Bugfixes in server settings, site creation 2021-08-04 09:46:11 +02:00
Dennis
33613cdf1c Sync all sites & servers, bugfix in pagination providers 2021-08-04 09:36:28 +02:00
Dennis
abfe174825 Autofocus on login page 2021-08-04 09:19:40 +02:00
Dennis
c750f469bb Updates
- Generic demo check in base controller
- Site synchronization
- User show pagination preserve scroll
2021-08-03 11:58:38 +02:00
Dennis
c7ac56d5cc Wip custom certificates 2021-07-29 09:59:20 +02:00
Dennis
6601f44013 wip custom certificates 2021-07-29 09:07:06 +02:00
Dennis
b7baf862b6 prod mix 2021-07-27 08:33:16 +02:00
Dennis
ca79f4cf21 Merge branch 'develop'
# Conflicts:
#	public/js/app.js
2021-07-27 08:32:39 +02:00
Dennis
58ffbe8c74 URL fixes 2021-07-27 08:32:30 +02:00
Dennis
dfa7b995fc wip 2021-07-23 13:46:53 +02:00
Dennis
59c65fe6ee prod 2021-07-18 10:12:47 +02:00
Dennis
087c042c14 Merge branch 'develop'
# Conflicts:
#	public/js/app.js
2021-07-18 10:12:15 +02:00
Dennis
d1ee488ffd fixes 2021-07-18 10:11:50 +02:00
Dennis
34100bc580 prod mix 2021-07-14 09:51:24 +02:00
Dennis
22d91517fb Merge branch 'develop'
# Conflicts:
#	public/js/app.js
2021-07-14 09:50:10 +02:00
Dennis
1c088bd4e0 Bugfixes and improvements 2021-07-14 09:50:00 +02:00
Dennis
fd5bbb7f5d Merge branch 'develop' 2021-07-13 14:49:03 +02:00
Dennis
426d39bec0 wip 2021-07-13 14:48:56 +02:00
Dennis
8244c2dfb2 Merge branch 'develop' 2021-07-13 14:23:54 +02:00
Dennis
e7f9d32f68 wip 2021-07-13 14:23:49 +02:00
Dennis
71158a0030 prod 2021-07-12 12:33:07 +02:00
Dennis
573ce14b7a Merge branch 'develop'
# Conflicts:
#	public/css/app.css
#	public/js/app.js
2021-07-12 12:31:37 +02:00
Dennis
00ef1f470f add debugging 2021-07-12 12:31:19 +02:00
Dennis
a9357034c8 THB currency, annual billing added 2021-07-12 12:26:21 +02:00
Dennis
a45f5157d4 wip 2021-07-09 11:48:12 +02:00
Dennis
0d1009b8db horizon config update 2021-07-09 11:45:57 +02:00
Dennis
4f0416cd45 Added user show, pagination simplified, package updates 2021-07-09 09:08:09 +02:00
Dennis
76655d76d5 Installation command improvements 2021-07-08 14:26:28 +02:00
Dennis
3b38cbe9ac Merge branch 'develop' 2021-06-17 09:18:34 +02:00
Dennis
acf37b8850 Suppport PHP 8 2021-06-17 09:18:28 +02:00
Dennis
f47a0699d3 Merge branch 'develop' 2021-06-07 09:18:21 +02:00
Dennis
8ae429b06b Tweak 2021-06-07 09:18:14 +02:00
Dennis
626dbbcb49 Fix 2021-06-05 20:30:22 +02:00
Dennis
b623dd80fd Merge branch 'develop' 2021-05-31 15:55:32 +02:00
Dennis
3978a7c9f7 User deleting fix 2021-05-31 15:53:58 +02:00
Dennis
7d2acb7438 Merge branch 'develop' 2021-05-31 08:55:21 +02:00
Dennis
096032301c Fix when deleting user with support tickets 2021-05-31 08:55:15 +02:00
Dennis
c3e99bf2ff Merge branch 'develop' 2021-05-25 07:37:34 +02:00
Dennis
9795642bc7 Bugfix 2021-05-25 07:37:28 +02:00
Dennis
4281a432fb Merge branch 'develop' 2021-05-22 09:36:29 +02:00
Dennis
18df5589b1 Fix title 2021-05-22 09:36:25 +02:00
Dennis
79536eac2e Fresh mix 2021-05-19 09:38:13 +02:00
Dennis
6df82fca04 Clean push 2021-05-19 09:36:22 +02:00
Dennis
cc14123d27 Merge branch 'develop' 2021-05-19 09:36:04 +02:00
Dennis
bd5e7b87ff Package update && password uncomprimised 2021-05-19 09:35:54 +02:00
Dennis
42568916d6 prod mix 2021-05-18 12:17:24 +02:00
Dennis
180803cd8a Merge branch 'develop'
# Conflicts:
#	public/js/app.js
2021-05-17 12:10:01 +02:00
Dennis
08fcb0ce01 Transform currencies properly 2021-05-17 12:07:52 +02:00
Dennis
120b4c9df7 prod mix 2021-05-13 20:37:41 +02:00
Dennis
0eb66c10f6 Merge branch 'develop' 2021-05-13 20:37:09 +02:00
Dennis
1a6b14a250 Ran psr formatting 2021-05-13 20:37:03 +02:00
Dennis
072c8569eb added indian rupee 2021-05-13 20:36:41 +02:00
Dennis
5b9378255b Loading state to select country dropdown 2021-05-11 14:59:34 +02:00
Dennis
ac3cf16377 Production mix 2021-05-11 11:55:08 +02:00
Dennis
31154d20f6 wip 2021-05-11 11:54:43 +02:00
Dennis
f8031ac71a Merge branch 'develop'
# Conflicts:
#	public/css/app.css
#	public/js/2035.js
#	public/js/2407.js
#	public/js/2741.js
#	public/js/4104.js
#	public/js/4627.js
#	public/js/547.js
#	public/js/5727.js
#	public/js/630.js
#	public/js/6341.js
#	public/js/6675.js
#	public/js/6974.js
#	public/js/7438.js
#	public/js/9039.js
#	public/js/9202.js
#	public/js/9737.js
#	public/js/9989.js
#	public/js/app.js
#	public/js/app.js.LICENSE.txt
2021-05-11 11:54:09 +02:00
Dennis
898ec6a454 Stripe billing details used for india regulations 2021-05-11 11:50:41 +02:00
Dennis
9dbd54fdf6 wip 2021-05-07 11:07:48 +02:00
Dennis
934017384d wip 2021-05-07 11:04:38 +02:00
Dennis
aee3dc0d93 Merge branch 'develop' 2021-05-05 15:50:42 +02:00
Dennis
8046687ae7 Bugfix for settings 2021-05-05 15:49:05 +02:00
Dennis
a89ee796c1 Prod mix 2021-05-05 11:25:07 +02:00
Dennis
af1d3c3edc wip 2021-05-05 11:24:19 +02:00
Dennis
e1a54c2781 wip 2021-05-05 11:23:54 +02:00
Dennis
2d9f7d49b5 Merge branch 'develop' 2021-05-05 11:22:23 +02:00
Dennis
d10b046033 New features
- Few bugfixes
- Updated to TW2.0
- Updated Laravel Mix
- Documentation is now working
2021-05-05 11:21:48 +02:00
Dennis
1725c0ff65 Merge branch 'develop' 2021-05-01 08:25:59 +02:00
Dennis
b852756c82 Bugfix 2021-05-01 08:25:46 +02:00
Dennis
f164d878d7 Linking storage 2021-04-01 09:49:44 +02:00
Dennis
ecc10fffcb Merge branch 'develop' 2021-03-15 10:51:30 +01:00
Dennis
5c75b015ba Register fix 2021-03-15 10:51:23 +01:00
Dennis
65f7dc697e Production mix 2021-03-12 14:20:30 +01:00
Dennis
d981f0f899 Merge branch 'develop'
# Conflicts:
#	public/js/13.js
#	public/js/23.js
#	public/js/app.js
2021-03-12 14:20:12 +01:00
Dennis
ab50beefab Package updates & GBP currency 2021-03-12 14:20:00 +01:00
Dennis
58d1215fd6 Production mix 2021-02-10 13:56:20 +01:00
Dennis
1dc137c314 Merge branch 'develop'
# Conflicts:
#	package-lock.json
#	public/js/10.js
#	public/js/11.js
#	public/js/12.js
#	public/js/13.js
#	public/js/14.js
#	public/js/15.js
#	public/js/16.js
#	public/js/17.js
#	public/js/18.js
#	public/js/19.js
#	public/js/20.js
#	public/js/21.js
#	public/js/22.js
#	public/js/23.js
#	public/js/24.js
#	public/js/25.js
#	public/js/26.js
#	public/js/27.js
#	public/js/28.js
#	public/js/29.js
#	public/js/30.js
#	public/js/31.js
#	public/js/32.js
#	public/js/33.js
#	public/js/58.js
#	public/js/62.js
#	public/js/63.js
#	public/js/64.js
#	public/js/65.js
#	public/js/66.js
#	public/js/67.js
#	public/js/68.js
#	public/js/69.js
#	public/js/70.js
#	public/js/71.js
#	public/js/72.js
#	public/js/73.js
#	public/js/74.js
#	public/js/75.js
#	public/js/76.js
#	public/js/77.js
#	public/js/78.js
#	public/js/79.js
#	public/js/8.js
#	public/js/80.js
#	public/js/9.js
#	public/js/app.js
2021-02-10 13:55:43 +01:00
Dennis
ca51e9bf5f package updates 2021-02-10 13:55:18 +01:00
Dennis
c588583dfc Few tweaks 2021-02-10 13:54:30 +01:00
Dennis
57c7c53eae Added spanish 2021-01-20 09:18:21 +01:00
Dennis
76a62d9992 rm 2021-01-20 09:16:43 +01:00
Dennis
575aa1c6b1 wip 2020-12-29 08:39:05 +01:00
Dennis
4867a61fd0 Production mixed 2020-12-14 12:55:09 +01:00
Dennis
a63e8f350b Merge branch 'develop'
# Conflicts:
#	public/js/52.js
#	public/js/app.js
2020-12-14 12:54:39 +01:00
Dennis
6c1b4f28af Portuguese added 2020-12-14 12:54:22 +01:00
Dennis
09adccf752 Flush version data 2020-12-02 11:00:28 +01:00
Dennis
79bb522dee Don’t allow horizon in production 2020-12-02 10:58:39 +01:00
Dennis
2adc4bc7ca Production mixed 2020-11-28 11:41:34 +01:00
Dennis
0a81d58051 Merge branch 'develop'
# Conflicts:
#	public/css/app.css
#	public/js/0.js
#	public/js/1.js
#	public/js/18.js
#	public/js/19.js
#	public/js/20.js
#	public/js/21.js
#	public/js/22.js
#	public/js/23.js
#	public/js/24.js
#	public/js/25.js
#	public/js/26.js
#	public/js/27.js
#	public/js/31.js
#	public/js/49.js
#	public/js/5.js
#	public/js/50.js
#	public/js/51.js
#	public/js/52.js
#	public/js/61.js
#	public/js/71.js
#	public/js/72.js
#	public/js/73.js
#	public/js/74.js
#	public/js/app.js
2020-11-28 11:41:00 +01:00
Dennis
cb84438778 Improve ping command 2020-11-28 11:12:54 +01:00
Dennis
b0a76d311c Change this 2020-11-28 10:23:26 +01:00
Dennis
5604503d26 wip 2020-11-28 09:48:50 +01:00
Dennis
bf55092b3a wip 2020-11-28 09:13:42 +01:00
Dennis
8286e7f9af customizing 2020-11-27 19:46:53 +01:00
Dennis
1255221550 wip 2020-11-26 15:59:48 +01:00
Dennis
f4062cd6e7 wip 2020-11-26 15:23:38 +01:00
Dennis
93377ae753 Ability to allow custom styling 2020-11-25 15:56:16 +01:00
396 changed files with 21897 additions and 12102 deletions

1
.gitignore vendored
View File

@@ -12,3 +12,4 @@ npm-debug.log
yarn-error.log
.idea
.php_cs.cache
/public/js/resources*.js

View File

@@ -8,11 +8,11 @@ $finder = Symfony\Component\Finder\Finder::create()
->name('*.php')
->notName('*.blade.php');
return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sortAlgorithm' => 'length'],
'ordered_imports' => ['sort_algorithm' => 'length'],
'no_unused_imports' => true,
])
->setFinder($finder);

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Console\Commands\Core;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class Css extends Command
{
protected $signature = 'core:css';
protected $description = 'Generates an theme.css file for you to customize';
public function handle()
{
if (file_exists(storage_path('app/public/theme.css')) && !$this->confirm('You seem to already have a theme.css published, are you sure you want to overwrite?')) {
$this->warn('Aborted publishing of theme.css.');
return 0;
}
$this->info('Publishing theme.css file..');
(new Filesystem)->copy(
__DIR__ . '/stubs/theme.css',
storage_path('app/public/theme.css')
);
$this->info('Done! You can edit the theme.css file inside storage/public/theme.css');
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Console\Commands\Core;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class CssBackup extends Command
{
protected $signature = 'core:css-backup';
protected $description = 'Creates a backup from your own created theme.css';
public function handle()
{
if (!file_exists(storage_path('app/public/theme.css'))) {
$this->warn('There is no custom theme.css, aborting backup.');
return 0;
}
$this->info('Backing up theme.css file..');
(new Filesystem)->copy(
storage_path('app/public/theme.css'),
storage_path('app/public/theme-backup.css')
);
$this->info('Done! You can find the CSS backup file here storage/public/theme-backup.css');
}
}

View File

@@ -7,16 +7,18 @@ use App\Models\User;
use RuntimeException;
use App\Models\Package;
use App\Services\Ploi\Ploi;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use App\Services\VersionChecker;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Artisan;
class Install extends Command
{
protected $company;
protected $signature = 'core:install';
protected $signature = 'core:install {--force}';
protected $description = 'Installation command for Ploi Core';
protected $versionChecker;
protected $installationFile = 'app/installation';
@@ -34,8 +36,14 @@ class Install extends Command
$this->askAboutDefaultPackages();
$this->checkApplicationUrl();
$this->createInstallationFile();
$this->linkStorage();
$this->info('Succes! Installation has finished.');
$this->info('Success! Installation has finished.');
$this->line(' ');
$this->writeSeparationLine();
$this->info('Make sure to also setup emailing, the cronjob and the queue worker.');
$this->writeSeparationLine();
$this->line(' ');
$this->info('Visit your platform at ' . env('APP_URL'));
}
@@ -98,7 +106,7 @@ class Install extends Command
Package::create([
'name' => 'Professional',
'maximum_sites' => 5,
'maximum_sites' => 30,
'site_permissions' => [
'create' => true,
'update' => true,
@@ -138,7 +146,9 @@ class Install extends Command
->get((new Ploi)->url . 'ping');
if (!$response->ok() || !$response->json()) {
return false;
return [
'error' => Arr::get($response->json(), 'message', 'An unknown error has occurred.')
];
}
return $response->json();
@@ -153,7 +163,7 @@ class Install extends Command
protected function intro()
{
$this->info('*---------------------------------------------------------------------------*');
$this->writeSeparationLine();
$this->line('Ploi Core Installation');
$this->line('Ploi Core version: ' . $this->versionChecker->currentVersion);
$this->line('Ploi Core remote: ' . $this->versionChecker->remoteVersion);
@@ -163,13 +173,13 @@ class Install extends Command
$this->line('Website: https://ploi-core.io');
$this->line('E-mail: core@ploi.io');
$this->line('Terms of service: https://ploi-core.io/terms');
$this->info('*---------------------------------------------------------------------------*');
$this->writeSeparationLine();
$this->line('');
}
protected function isInstalled()
{
if (file_exists(storage_path($this->installationFile))) {
if (file_exists(storage_path($this->installationFile)) && !$this->option('force')) {
$this->line('');
$this->comment('Ploi Core has already been installed before.');
$this->comment('If you still want to start installation, remove this file to continue: ./storage/' . $this->installationFile);
@@ -203,6 +213,11 @@ class Install extends Command
file_put_contents(storage_path($this->installationFile), json_encode($this->getInstallationPayload(), JSON_PRETTY_PRINT));
}
protected function linkStorage()
{
Artisan::call('storage:link');
}
protected function createDatabaseCredentials(): bool
{
$storeCredentials = $this->confirm(
@@ -269,6 +284,18 @@ class Install extends Command
exit();
}
if (isset($this->company['error'])) {
$this->error($this->company['error']);
exit();
}
if ($this->company['user']['subscription'] !== 'unlimited') {
$this->error('Your subscription does not cover the usage of Ploi Core. Please upgrade your subscription to Unlimited.');
exit();
}
$this->writeToEnvironmentFile('PLOI_TOKEN', $ploiApiToken);
$this->writeToEnvironmentFile('PLOI_CORE_TOKEN', $ploiCoreKey);
@@ -372,4 +399,9 @@ class Install extends Command
{
$this->laravel['config'][$key] = $value;
}
protected function writeSeparationLine()
{
$this->info('*---------------------------------------------------------------------------*');
}
}

View File

@@ -0,0 +1,78 @@
:root {
--font-body: 'Inter', sans-serif;
--color-white: #fff;
--color-gray-1: #f7f7f7;
--color-gray-2: #e6e6e6;
--color-gray-3: #cacaca;
--color-gray-4: #888;
--color-gray-5: #666;
--color-gray-6: #2f2f2f;
--color-gray-7: #1b1a1a;
--color-gray-8: #101010;
--color-primary: #1b8ae8;
--color-success: #17b35d;
--color-warning: #f5a623;
--color-danger: #c90c4c;
--color-text-high-emphasis: var(--color-gray-8);
--color-text-medium-emphasis: var(--color-gray-5);
--color-text-low-emphasis: var(--color-gray-3);
--color-text-on-primary: var(--color-white);
--color-text-on-success: var(--color-gray-8);
--color-text-on-warning: var(--color-white);
--color-text-on-danger: var(--color-white);
--color-border-high-emphasis: var(--color-gray-4);
--color-border-medium-emphasis: var(--color-gray-3);
--color-border-low-emphasis: var(--color-gray-2);
--color-backdrop: rgba(0, 0, 0, 0.5);
--color-overlay: rgba(255, 255, 255, 0.8);
--color-surface-1: var(--color-white);
--color-surface-2: var(--color-gray-1);
--color-surface-3: var(--color-white);
--border-radius: 0.5rem;
--border-radius-avatar: 4rem;
--border-radius-circle: 100%;
--top-bar-container: 64rem;
--top-bar-logo-height: 3.5rem;
--top-bar-background-color: var(--color-surface-1);
--top-bar-text-color: var(--color-text-medium-emphasis);
--tab-bar-background-color: var(--color-surface-2);
--tab-bar-item-active-background-color: var(--color-surface-1);
--tab-bar-item-text-color: var(--color-text-medium-emphasis);
--tab-bar-item-active-text-color: var(--color-text-high-emphasis);
--breadcrumbs-text-color: var(--color-text-medium-emphasis);
}
.theme--dark {
--color-primary: #63a6f5;
--color-success: #50e3c2;
--color-warning: #f5a623;
--color-danger: #d4667c;
--color-text-high-emphasis: var(--color-white);
--color-text-medium-emphasis: var(--color-gray-3);
--color-text-low-emphasis: var(--color-gray-5);
--color-text-on-primary: var(--color-gray-7);
--color-text-on-success: var(--color-gray-7);
--color-text-on-warning: var(--color-gray-7);
--color-text-on-danger: var(--color-gray-7);
--color-border-high-emphasis: var(--color-gray-4);
--color-border-medium-emphasis: var(--color-gray-5);
--color-border-low-emphasis: var(--color-gray-6);
--color-surface-1: var(--color-gray-7);
--color-surface-2: var(--color-gray-6);
--color-surface-3: var(--color-gray-6);
--color-overlay: rgba(0, 0, 0, 0.8);
}

View File

@@ -3,7 +3,9 @@
namespace App\Console;
use App\Jobs\Core\Ping;
use App\Console\Commands\Core\Css;
use App\Console\Commands\Core\Install;
use App\Console\Commands\Core\CssBackup;
use App\Console\Commands\Core\Synchronize;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
@@ -11,6 +13,8 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
protected $commands = [
Css::class,
CssBackup::class,
Install::class,
Synchronize::class,
];

281
app/Helpers/Country.php Normal file
View File

@@ -0,0 +1,281 @@
<?php
if (!function_exists('countries')) {
function countries($key = null)
{
$arr = [
'af' => 'Afghanistan',
'al' => 'Albania',
'dz' => 'Algeria',
'as' => 'American Samoa',
'ad' => 'Andorra',
'ao' => 'Angola',
'ai' => 'Anguilla',
'aq' => 'Antarctica',
'ag' => 'Antigua and Barbuda',
'ar' => 'Argentina',
'am' => 'Armenia',
'aw' => 'Aruba',
'au' => 'Australia',
'at' => 'Austria',
'az' => 'Azerbaijan',
'bs' => 'Bahamas',
'bh' => 'Bahrain',
'bd' => 'Bangladesh',
'bb' => 'Barbados',
'by' => 'Belarus',
'be' => 'Belgium',
'bz' => 'Belize',
'bj' => 'Benin',
'bm' => 'Bermuda',
'bt' => 'Bhutan',
'bo' => 'Bolivia',
'ba' => 'Bosnia and Herzegovina',
'bw' => 'Botswana',
'bv' => 'Bouvet Island',
'br' => 'Brazil',
'bq' => 'British Antarctic Territory',
'io' => 'British Indian Ocean Territory',
'vg' => 'British Virgin Islands',
'bn' => 'Brunei',
'bg' => 'Bulgaria',
'bf' => 'Burkina Faso',
'bi' => 'Burundi',
'kh' => 'Cambodia',
'cm' => 'Cameroon',
'ca' => 'Canada',
'ct' => 'Canton and Enderbury Islands',
'cv' => 'Cape Verde',
'ky' => 'Cayman Islands',
'cf' => 'Central African Republic',
'td' => 'Chad',
'cl' => 'Chile',
'cn' => 'China',
'cx' => 'Christmas Island',
'cc' => 'Cocos [Keeling] Islands',
'co' => 'Colombia',
'km' => 'Comoros',
'cg' => 'Congo - Brazzaville',
'cd' => 'Congo - Kinshasa',
'ck' => 'Cook Islands',
'cr' => 'Costa Rica',
'hr' => 'Croatia',
'cu' => 'Cuba',
'cy' => 'Cyprus',
'cz' => 'Czech Republic',
'ci' => 'Côte dIvoire',
'dk' => 'Denmark',
'dj' => 'Djibouti',
'dm' => 'Dominica',
'do' => 'Dominican Republic',
'nq' => 'Dronning Maud Land',
'dd' => 'East Germany',
'ec' => 'Ecuador',
'eg' => 'Egypt',
'sv' => 'El Salvador',
'gq' => 'Equatorial Guinea',
'er' => 'Eritrea',
'ee' => 'Estonia',
'et' => 'Ethiopia',
'fk' => 'Falkland Islands',
'fo' => 'Faroe Islands',
'fj' => 'Fiji',
'fi' => 'Finland',
'fr' => 'France',
'gf' => 'French Guiana',
'pf' => 'French Polynesia',
'tf' => 'French Southern Territories',
'fq' => 'French Southern and Antarctic Territories',
'ga' => 'Gabon',
'gm' => 'Gambia',
'ge' => 'Georgia',
'de' => 'Germany',
'gh' => 'Ghana',
'gi' => 'Gibraltar',
'gr' => 'Greece',
'gl' => 'Greenland',
'gd' => 'Grenada',
'gp' => 'Guadeloupe',
'gu' => 'Guam',
'gt' => 'Guatemala',
'gg' => 'Guernsey',
'gn' => 'Guinea',
'gw' => 'Guinea-Bissau',
'gy' => 'Guyana',
'ht' => 'Haiti',
'hm' => 'Heard Island and McDonald Islands',
'hn' => 'Honduras',
'hk' => 'Hong Kong SAR China',
'hu' => 'Hungary',
'is' => 'Iceland',
'in' => 'India',
'id' => 'Indonesia',
'ir' => 'Iran',
'iq' => 'Iraq',
'ie' => 'Ireland',
'im' => 'Isle of Man',
'il' => 'Israel',
'it' => 'Italy',
'jm' => 'Jamaica',
'jp' => 'Japan',
'je' => 'Jersey',
'jt' => 'Johnston Island',
'jo' => 'Jordan',
'kz' => 'Kazakhstan',
'ke' => 'Kenya',
'ki' => 'Kiribati',
'kw' => 'Kuwait',
'kg' => 'Kyrgyzstan',
'la' => 'Laos',
'lv' => 'Latvia',
'lb' => 'Lebanon',
'ls' => 'Lesotho',
'lr' => 'Liberia',
'ly' => 'Libya',
'li' => 'Liechtenstein',
'lt' => 'Lithuania',
'lu' => 'Luxembourg',
'mo' => 'Macau SAR China',
'mk' => 'Macedonia',
'mg' => 'Madagascar',
'mw' => 'Malawi',
'my' => 'Malaysia',
'mv' => 'Maldives',
'ml' => 'Mali',
'mt' => 'Malta',
'mh' => 'Marshall Islands',
'mq' => 'Martinique',
'mr' => 'Mauritania',
'mu' => 'Mauritius',
'yt' => 'Mayotte',
'fx' => 'Metropolitan France',
'mx' => 'Mexico',
'fm' => 'Micronesia',
'mi' => 'Midway Islands',
'md' => 'Moldova',
'mc' => 'Monaco',
'mn' => 'Mongolia',
'me' => 'Montenegro',
'ms' => 'Montserrat',
'ma' => 'Morocco',
'mz' => 'Mozambique',
'mm' => 'Myanmar [Burma]',
'na' => 'Namibia',
'nr' => 'Nauru',
'np' => 'Nepal',
'nl' => 'Netherlands',
'an' => 'Netherlands Antilles',
'nt' => 'Neutral Zone',
'nc' => 'New Caledonia',
'nz' => 'New Zealand',
'ni' => 'Nicaragua',
'ne' => 'Niger',
'ng' => 'Nigeria',
'nu' => 'Niue',
'nf' => 'Norfolk Island',
'kp' => 'North Korea',
'vd' => 'North Vietnam',
'mp' => 'Northern Mariana Islands',
'no' => 'Norway',
'om' => 'Oman',
'pc' => 'Pacific Islands Trust Territory',
'pk' => 'Pakistan',
'pw' => 'Palau',
'ps' => 'Palestinian Territories',
'pa' => 'Panama',
'pz' => 'Panama Canal Zone',
'pg' => 'Papua New Guinea',
'py' => 'Paraguay',
'yd' => 'People\'s Democratic Republic of Yemen',
'pe' => 'Peru',
'ph' => 'Philippines',
'pn' => 'Pitcairn Islands',
'pl' => 'Poland',
'pt' => 'Portugal',
'pr' => 'Puerto Rico',
'qa' => 'Qatar',
'ro' => 'Romania',
'ru' => 'Russia',
'rw' => 'Rwanda',
're' => 'Réunion',
'bl' => 'Saint Barthélemy',
'sh' => 'Saint Helena',
'kn' => 'Saint Kitts and Nevis',
'lc' => 'Saint Lucia',
'mf' => 'Saint Martin',
'pm' => 'Saint Pierre and Miquelon',
'vc' => 'Saint Vincent and the Grenadines',
'ws' => 'Samoa',
'sm' => 'San Marino',
'sa' => 'Saudi Arabia',
'sn' => 'Senegal',
'rs' => 'Serbia',
'cs' => 'Serbia and Montenegro',
'sc' => 'Seychelles',
'sl' => 'Sierra Leone',
'sg' => 'Singapore',
'sk' => 'Slovakia',
'si' => 'Slovenia',
'sb' => 'Solomon Islands',
'so' => 'Somalia',
'za' => 'South Africa',
'gs' => 'South Georgia and the South Sandwich Islands',
'kr' => 'South Korea',
'es' => 'Spain',
'lk' => 'Sri Lanka',
'sd' => 'Sudan',
'sr' => 'Suriname',
'sj' => 'Svalbard and Jan Mayen',
'sz' => 'Swaziland',
'se' => 'Sweden',
'ch' => 'Switzerland',
'sy' => 'Syria',
'st' => 'São Tomé and Príncipe',
'tw' => 'Taiwan',
'tj' => 'Tajikistan',
'tz' => 'Tanzania',
'th' => 'Thailand',
'tl' => 'Timor-Leste',
'tg' => 'Togo',
'tk' => 'Tokelau',
'to' => 'Tonga',
'tt' => 'Trinidad and Tobago',
'tn' => 'Tunisia',
'tr' => 'Turkey',
'tm' => 'Turkmenistan',
'tc' => 'Turks and Caicos Islands',
'tv' => 'Tuvalu',
'um' => 'U.S. Minor Outlying Islands',
'pu' => 'U.S. Miscellaneous Pacific Islands',
'vi' => 'U.S. Virgin Islands',
'ug' => 'Uganda',
'ua' => 'Ukraine',
'su' => 'Union of Soviet Socialist Republics',
'ae' => 'United Arab Emirates',
'en' => 'United Kingdom (EN)',
'uk' => 'United Kingdom (UK)',
'gb' => 'United Kingdom (GB)',
'us' => 'United States',
'zz' => 'Unknown or Invalid Region',
'uy' => 'Uruguay',
'uz' => 'Uzbekistan',
'vu' => 'Vanuatu',
'va' => 'Vatican City',
've' => 'Venezuela',
'vn' => 'Vietnam',
'wk' => 'Wake Island',
'wf' => 'Wallis and Futuna',
'eh' => 'Western Sahara',
'ye' => 'Yemen',
'zm' => 'Zambia',
'zw' => 'Zimbabwe',
'ax' => 'Åland Islands',
];
if ($key && array_key_exists($key, $arr)) {
return $arr[strtolower($key)];
}
return $arr;
}
}

View File

@@ -1,7 +1,7 @@
<?php
if (!function_exists('languages')) {
function languages()
function languages(): array
{
$languages = [
'en'

View File

@@ -2,10 +2,9 @@
namespace App\Http\Controllers\Admin;
use App\Models\Alert;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\AlertRequest;
use App\Models\Alert;
use Illuminate\Http\Request;
class AlertController extends Controller
{

View File

@@ -14,6 +14,8 @@ class ProviderController extends Controller
return inertia('Admin/Services/Provider/Edit', [
'provider' => $provider,
'availablePlans' => $provider->plans()->pluck('label', 'id'),
'availableRegions' => $provider->regions()->pluck('label', 'id'),
]);
}

View File

@@ -12,8 +12,8 @@ class ServiceController extends Controller
public function index()
{
return inertia('Admin/Services/Index', [
'servers' => Server::withCount('sites')->latest()->paginate(5, ['*'], 'servers_per_page'),
'sites' => Site::with('server:id,name')->latest()->paginate(5, ['*'], 'sites_per_page'),
'servers' => Server::query()->withCount('sites', 'users')->latest()->paginate(5, ['*'], 'servers_per_page'),
'sites' => Site::with('server:id,name')->withCount('users')->latest()->paginate(5, ['*'], 'sites_per_page'),
'providers' => Provider::query()
->withCount('regions', 'plans', 'servers')
->latest()

View File

@@ -3,7 +3,10 @@
namespace App\Http\Controllers\Admin;
use App\Models\Package;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;
use App\Http\Requests\Admin\SettingRequest;
class SettingController extends Controller
@@ -54,11 +57,73 @@ class SettingController extends Controller
$value = encrypt($value);
}
if ($key === 'default_package' && $value === 'false') {
$value = null;
}
if ($value === 'false') {
$value = 0;
}
if ($value === 'true') {
$value = 1;
}
setting([$key => $value]);
}
if ($logo = $request->file('logo')) {
// If we previously had a logo, rotate that
if ($oldLogo = setting('logo')) {
Storage::delete(str_replace('/storage/', '/public/', $oldLogo));
}
$version = Str::random();
$request->file('logo')->storePubliclyAs('logo', 'logo-' . $version . '.' . $request->file('logo')->extension(), 'public');
setting(['logo' => '/storage/logo/logo-' . $version . '.' . $request->file('logo')->extension()]);
}
cache()->forget('core.settings');
return redirect()->route('admin.settings')->with('success', __('Settings have been updated'));
}
public function terms()
{
return inertia('Admin/Terms', [
'settings' => [
'logo' => setting('logo'),
'name' => setting('name'),
'terms_required' => setting('accept_terms_required'),
'terms' => setting('terms'),
'privacy' => setting('privacy')
]
]);
}
public function updateTerms(Request $request)
{
setting(['accept_terms_required' => $request->input('terms_required'),]);
setting(['terms' => $request->input('terms'),]);
setting(['privacy' => $request->input('privacy'),]);
return redirect()->route('admin.settings.terms')->with('success', __('Terms have been updated'));
}
public function termsTemplate(Request $request)
{
$template = file_get_contents(storage_path('templates/terms-of-service.md'));
$template = str_replace([
'{NAME}',
'{WEBSITE}',
'{DATE}'
], [
setting('name'),
config('app.url'),
date('Y-m-d')
], $template);
return ['content' => $template];
}
}

View File

@@ -11,15 +11,15 @@ class SynchronizeProviderController extends Controller
{
public function index()
{
if (config('app.demo')) {
if ($this->isDemo()) {
return redirect('/')->with('info', __('This feature is not available in demo mode.'));
}
$ploi = new Ploi(config('services.ploi.token'));
$availableProviders = $this->getPloi()->user()->serverProviders()->getData();
$availableProviders = $ploi->user()->serverProviders()->getData();
$currentProviders = Provider::whereNotIn('id', array_keys((array)$availableProviders))->get();
$currentProviders = Provider::query()
->whereNotIn('id', array_keys((array)$availableProviders))
->get();
return inertia('Admin/Services/Providers', [
'availableProviders' => $availableProviders,
@@ -29,7 +29,7 @@ class SynchronizeProviderController extends Controller
public function synchronize(Request $request, $providerId)
{
$ploiProvider = (new Ploi)->user()->serverProviders($providerId)->getData();
$ploiProvider = $this->getPloi()->user()->serverProviders($providerId)->getData();
$provider = Provider::updateOrCreate([
'ploi_id' => $ploiProvider->id,

View File

@@ -3,7 +3,6 @@
namespace App\Http\Controllers\Admin;
use App\Models\Server;
use App\Services\Ploi\Ploi;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
@@ -11,15 +10,15 @@ class SynchronizeServerController extends Controller
{
public function index()
{
if (config('app.demo')) {
if ($this->isDemo()) {
return redirect('/')->with('info', __('This feature is not available in demo mode.'));
}
$ploi = new Ploi(config('services.ploi.token'));
$availableServers = $this->getPloi()->synchronize()->servers()->getData();
$availableServers = $ploi->synchronize()->servers()->getData();
$currentServers = Server::whereNotIn('id', array_keys((array)$availableServers))->get();
$currentServers = Server::query()
->whereNotIn('id', array_keys((array)$availableServers))
->get();
return inertia('Admin/Services/Servers', [
'availableServers' => $availableServers,
@@ -29,15 +28,37 @@ class SynchronizeServerController extends Controller
public function synchronizeServer(Request $request)
{
Server::updateOrCreate([
'ploi_id' => $request->input('id')
], [
'status' => $request->input('status'),
'name' => $request->input('name'),
'ip' => $request->input('ip_address'),
'ssh_port' => $request->input('ssh_port', 22),
'internal_ip' => $request->input('internal_ip'),
'available_php_versions' => $request->input('installed_php_versions')
]);
Server::query()
->updateOrCreate([
'ploi_id' => $request->input('id')
], [
'status' => $request->input('status'),
'name' => $request->input('name'),
'ip' => $request->input('ip_address'),
'ssh_port' => $request->input('ssh_port', 22),
'internal_ip' => $request->input('internal_ip'),
'available_php_versions' => $request->input('installed_php_versions')
]);
}
public function synchronizeAll(Request $request)
{
$availableServers = $this->getPloi()->synchronize()->servers()->getData();
foreach ($availableServers as $availableServer) {
Server::query()
->updateOrCreate([
'ploi_id' => $availableServer->id
], [
'status' => $availableServer->status,
'name' => $availableServer->name,
'ip' => $availableServer->ip_address,
'ssh_port' => $availableServer->ssh_port,
'internal_ip' => $availableServer->internal_ip,
'available_php_versions' => $availableServer->installed_php_versions
]);
}
return response('ok');
}
}

View File

@@ -2,12 +2,66 @@
namespace App\Http\Controllers\Admin;
use App\Models\Site;
use App\Models\Server;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class SynchronizeSiteController extends Controller
{
public function index()
{
return inertia('Admin/Services/Sites');
if ($this->isDemo()) {
return redirect('/')->with('info', __('This feature is not available in demo mode.'));
}
$availableSites = $this->getPloi()->synchronize()->sites()->getData();
$currentSites = Site::query()
->whereNotIn('id', array_keys((array)$availableSites))
->get();
return inertia('Admin/Services/Sites', [
'availableSites' => $availableSites,
'currentSites' => $currentSites
]);
}
public function synchronizeSite(Request $request)
{
$server = Server::query()->where('ploi_id', $request->input('server_id'))->firstOrFail();
$site = Site::query()
->updateOrCreate([
'ploi_id' => $request->input('id')
], [
'domain' => $request->input('domain'),
'php_version' => $request->input('php_version'),
]);
$site->status = $request->input('status');
$site->server_id = $server->id;
$site->save();
}
public function synchronizeAll(Request $request)
{
$availableSites = $this->getPloi()->synchronize()->sites()->getData();
foreach ($availableSites as $availableSite) {
$server = Server::query()->where('ploi_id', $availableSite->server_id)->firstOrFail();
$site = Site::query()
->updateOrCreate([
'ploi_id' => $availableSite->server_id
], [
'domain' => $availableSite->domain,
'php_version' => $availableSite->php_version,
]);
$site->status = $availableSite->status;
$site->server_id = $server->id;
$site->save();
}
}
}

View File

@@ -6,10 +6,11 @@ use Illuminate\Http\Request;
use App\Jobs\Core\UpdateSystem;
use App\Services\VersionChecker;
use App\Http\Controllers\Controller;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
class SystemController extends Controller
{
public function index()
public function index(MasterSupervisorRepository $masterSupervisorRepository)
{
if (config('app.demo')) {
return redirect('/')->with('info', __('This feature is not available in demo mode.'));
@@ -17,12 +18,18 @@ class SystemController extends Controller
$version = (new VersionChecker)->getVersions();
$horizonRunning = true;
if (!$masterSupervisorRepository->all()) {
$horizonRunning = false;
}
return inertia('Admin/System', [
'version' => [
'out_of_date' => $version->isOutOfDate(),
'current' => $version->currentVersion,
'remote' => $version->remoteVersion
]
],
'horizonRunning' => $horizonRunning
]);
}

View File

@@ -45,8 +45,8 @@ class UserController extends Controller
$user->save();
}
if ($package = $request->input('package')) {
$user->package_id = $package;
if ($request->input('package') && Package::find($request->input('package'))) {
$user->package_id = $request->input('package');
$user->save();
}
@@ -55,7 +55,17 @@ class UserController extends Controller
public function show($id)
{
// TODO: Implement show feature for a user
$user = User::query()->findOrFail($id);
$servers = $user->servers()->withCount('sites')->latest()->paginate(5, ['*'], 'page_servers');
$sites = $user->sites()->with('server:id,name')->latest()->paginate(5, ['*'], 'page_sites');
return inertia('Admin/Users/Show', [
'user' => $user,
'sites' => $sites,
'servers' => $servers,
]);
}
public function edit($id)

View File

@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rules\Password;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
@@ -27,11 +28,27 @@ class RegisterController extends Controller
protected function validator(array $data)
{
return Validator::make($data, [
$rules = [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
'password' => [
'required',
'string',
'confirmed',
Password::min(6)
->letters()
->numbers()
->uncompromised()
],
];
if (setting('accept_terms_required')) {
$rules['terms'] = [
'accepted'
];
}
return Validator::make($data, $rules);
}
protected function create(array $data)
@@ -45,8 +62,8 @@ class RegisterController extends Controller
protected function registered(Request $request, $user)
{
if ($defaultPackage = setting('default_package')) {
$user->package_id = $defaultPackage;
if (setting('default_package') && setting('default_package') != 'false') {
$user->package_id = setting('default_package');
$user->save();
}
}

View File

@@ -2,11 +2,17 @@
namespace App\Http\Controllers;
use App\Traits\HasPloi;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use ValidatesRequests, AuthorizesRequests;
use ValidatesRequests, AuthorizesRequests, HasPloi;
protected function isDemo()
{
return config('app.demo');
}
}

View File

@@ -2,17 +2,43 @@
namespace App\Http\Controllers;
use Illuminate\Support\Str;
use App\Models\DocumentationItem;
use App\Http\Resources\DocumentationItemResource;
use App\Models\DocumentationCategory;
use App\Http\Resources\DocumentationCategoryRouteResource;
class DocumentationController extends Controller
{
public function index()
{
$documentationItems = DocumentationItem::latest()->paginate();
$items = DocumentationCategory::query()->oldest()->get();
return inertia('Documentation/Index', [
'items' => DocumentationItemResource::collection($documentationItems)
'items' => DocumentationCategoryRouteResource::collection($items)
]);
}
public function show(DocumentationCategory $documentationCategory)
{
$items = DocumentationCategory::query()->oldest()->get();
return inertia('Documentation/Show', [
'category' => $documentationCategory,
'articles' => $documentationCategory->items()->latest()->get(),
'items' => DocumentationCategoryRouteResource::collection($items)
]);
}
public function showArticle(DocumentationCategory $documentationCategory, DocumentationItem $documentationItem)
{
$items = DocumentationCategory::query()->oldest()->get();
$documentationItem->content = Str::markdown($documentationItem->content);
return inertia('Documentation/Article', [
'category' => $documentationCategory,
'article' => $documentationItem,
'items' => DocumentationCategoryRouteResource::collection($items)
]);
}
}

View File

@@ -2,10 +2,29 @@
namespace App\Http\Controllers;
use Illuminate\Support\Str;
class PageController extends Controller
{
public function installationIncomplete()
{
return inertia('Core/InstallationIncomplete');
}
public function show($slug)
{
if ($slug === 'terms-of-service' && setting('terms')) {
return inertia('Pages/Terms', [
'content' => Str::markdown(setting('terms'))
]);
}
if ($slug === 'privacy-policy' && setting('privacy')) {
return inertia('Pages/Privacy', [
'content' => Str::markdown(setting('privacy'))
]);
}
abort(404);
}
}

View File

@@ -22,7 +22,11 @@ class ProfileBillingController extends Controller
$packages = Package::query()
->where(function ($query) {
return $query
->where('price_monthly', '>', 0)
->where(function ($query) {
return $query
->where('price_monthly', '>', 0)
->orWhere('price_yearly', '>', 0);
})
->whereNotNull('plan_id');
})
->when($request->input('sortBy.' . $sortByType), function ($query, $value) use ($sortByType) {
@@ -53,27 +57,32 @@ class ProfileBillingController extends Controller
})
->get()
->transform(function (Package $package) {
$currencies = [
Package::CURRENCY_EURO => '€',
Package::CURRENCY_USD => '$',
Package::CURRENCY_NOK => 'KR ',
Package::CURRENCY_CAD => 'CAD $',
Package::CURRENCY_AUD => 'AUD $',
];
$currency = $this->transformCurrency($package->currency);
$package->price_monthly = ($currencies[$package->currency] ?? '[Unknown currency]') . number_format($package->price_monthly, 2, ',', '.');
$package->period = 'monthly';
if ($package->price_yearly > 0) {
$package->period = 'yearly';
}
$package->price_monthly = ($currency ?? '[Unknown currency]') . number_format($package->price_monthly, 2, ',', '.');
$package->price_yearly = ($currency ?? '[Unknown currency]') . number_format($package->price_yearly, 2, ',', '.');
return $package;
});
try {
$clientSecret = $user->createSetupIntent()->client_secret;
} catch (\Exception $exception) {
return inertia('Profile/BillingError');
}
return inertia('Profile/Billing', [
'packages' => $packages,
'countries' => countries(),
'subscription' => $user->subscription('default'),
'public_key' => config('cashier.key'),
'data_client_secret' => function () use ($user) {
$intent = $user->createSetupIntent();
return $intent->client_secret;
},
'data_client_secret' => $clientSecret,
'card' => [
'last_four' => $user->card_last_four,
'brand' => $user->card_brand
@@ -92,8 +101,14 @@ class ProfileBillingController extends Controller
$user = $request->user();
$user->createOrGetStripeCustomer([
'name' => $user->name,
'description' => $request->input('billing_details')
'name' => $request->input('billing_details.name'),
'description' => 'Ploi Core Customer ' . $request->input('billing_details.name'),
'address' => [
'line1' => $request->input('billing_details.address.line1'),
'postal_code' => $request->input('billing_details.address.postal_code'),
'city' => $request->input('billing_details.address.city'),
'country' => $request->input('billing_details.address.country'),
]
]);
foreach ($user->paymentMethods() as $paymentMethod) {
@@ -163,7 +178,7 @@ class ProfileBillingController extends Controller
public function invoices(Request $request)
{
return $request->user()->invoices()->map(function ($invoice) {
$symbol = $invoice->currency === Package::CURRENCY_EURO ? '€' : '$';
$symbol = $this->transformCurrency($invoice->currency);
return [
'id' => $invoice->id,
@@ -183,4 +198,20 @@ class ProfileBillingController extends Controller
'product' => 'Webhosting'
]);
}
protected function transformCurrency($key)
{
$currencies = [
Package::CURRENCY_EURO => '€',
Package::CURRENCY_USD => '$',
Package::CURRENCY_NOK => 'KR ',
Package::CURRENCY_CAD => 'CAD $',
Package::CURRENCY_AUD => 'AUD $',
Package::CURRENCY_GBP => 'GBP £',
Package::CURRENCY_INR => 'INR ₹',
Package::CURRENCY_THB => 'THB ',
];
return $currencies[strtolower($key)] ?? '$';
}
}

View File

@@ -12,7 +12,8 @@ class ProfileController extends Controller
public function index()
{
return inertia('Profile/Index', [
'profile' => new UserProfileResource(auth()->user())
'profile' => new UserProfileResource(auth()->user()),
'countries' => countries()
]);
}
@@ -36,4 +37,21 @@ class ProfileController extends Controller
return $mode;
}
public function destroy(Request $request)
{
/* @var $user \App\Models\User */
$user = $request->user();
$user->sites()->detach();
$user->servers()->detach();
$user->supportTicketReplies()->delete();
$user->supportTickets()->delete();
$user->delete();
auth()->logout();
return redirect()->route('login');
}
}

View File

@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Profile;
use App\Models\UserProvider;
use App\Http\Controllers\Controller;
use App\Http\Requests\ProfileIntegrationRequest;
use App\Models\UserProvider;
use Illuminate\Http\Request;
class ProfileIntegrationController extends Controller
{
public function index()
{
$providers = auth()->user()->providers()->latest()->get()->map(function($provider){
$providers = auth()->user()->providers()->latest()->get()->map(function ($provider) {
return [
'id' => $provider->id,
'type' => $provider->type,
@@ -28,7 +27,7 @@ class ProfileIntegrationController extends Controller
{
$request->user()->providers()->updateOrCreate([
'type' => UserProvider::TYPE_CLOUDFLARE
],[
], [
'type' => UserProvider::TYPE_CLOUDFLARE,
'token' => $request->input('meta.api_key'),
'meta' => [

View File

@@ -104,9 +104,21 @@ class ServerController extends Controller
{
$provider = $request->user()->package->providers()->findOrFail($providerId);
$regions = $provider->regions()
->when($provider->allowed_regions, function ($query) use ($provider) {
return $query->whereIn('id', $provider->allowed_regions);
})
->pluck('label', 'id');
$plans = $provider->plans()
->when($provider->allowed_plans, function ($query) use ($provider) {
return $query->whereIn('id', $provider->allowed_plans);
})
->pluck('label', 'id');
return [
'regions' => $provider->regions()->pluck('label', 'id'),
'plans' => $provider->plans()->pluck('label', 'id'),
'regions' => $regions,
'plans' => $plans,
];
}
}

View File

@@ -25,6 +25,9 @@ class SiteCertificateController extends Controller
$certificate = $site->certificates()->create([
'domain' => $request->input('domain'),
'type' => $request->input('type', 'letsencrypt'),
'certificate' => $request->input('certificate'),
'private' => $request->input('private')
]);
$certificate->server_id = $site->server_id;

View File

@@ -37,7 +37,18 @@ class SiteController extends Controller
$server = $request->user()->servers()->findOrFail($serverId);
} else {
$server = Server::query()
->doesntHave('users')
->where('maximum_sites', '>', 0)
->where(function ($query) {
return $query
->where(function ($query) {
return $query->whereHas('users', function ($query) {
return $query->where('user_id', auth()->id());
});
})
->orWhere(function ($query) {
return $query->doesntHave('users');
});
})
->withCount('sites')
->inRandomOrder()
->first();

View File

@@ -2,12 +2,12 @@
namespace App\Http\Controllers;
use App\Http\Requests\SiteDnsRequest;
use App\Models\Site;
use Illuminate\Support\Arr;
use App\Models\UserProvider;
use App\Services\Cloudflare;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use App\Http\Requests\SiteDnsRequest;
class SiteDnsController extends Controller
{

View File

@@ -68,6 +68,7 @@ class Kernel extends HttpKernel
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'has.access' => \App\Http\Middleware\HasAccessToThisGroup::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'global.api.authenticated' => \App\Http\Middleware\GlobalApiAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,

View File

@@ -10,7 +10,7 @@ class Demo
protected $safeRoutes = [
'login',
'logout',
//'profile/toggle-theme'
'profile/toggle-theme'
];
protected $allowedIps = [

View File

@@ -3,9 +3,9 @@
namespace App\Http\Middleware;
use App\Models\Alert;
use App\Models\UserProvider;
use Inertia\Middleware;
use Illuminate\Support\Arr;
use App\Models\UserProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
@@ -61,6 +61,10 @@ class HandleInertiaRequests extends Middleware
'theme' => Auth::user()->theme,
'keyboard_shortcuts' => Auth::user()->keyboard_shortcuts,
'requires_password_for_ftp' => Auth::user()->requires_password_for_ftp,
'address' => Auth::user()->address,
'country' => Auth::user()->country,
'zip' => Auth::user()->zip,
'city' => Auth::user()->city,
] : null,
'package' => auth()->user() && auth()->user()->package ? [
'name' => auth()->user()->package->name,
@@ -83,7 +87,10 @@ class HandleInertiaRequests extends Middleware
'documentation' => setting('documentation', false),
'logo' => setting('logo'),
'allow_registration' => setting('allow_registration'),
'billing' => config('cashier.key') && config('cashier.secret')
'billing' => config('cashier.key') && config('cashier.secret'),
'has_terms' => (bool)setting('terms'),
'has_privacy' => (bool)setting('privacy'),
'accept_terms_required' => (bool)setting('accept_terms_required')
];
},
'flash' => function () {

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
class HasAccessToThisGroup
{
public function handle(Request $request, Closure $next, $group)
{
if ($group === 'servers') {
$package = $request->user()->package ?? [];
if (
!Arr::get($package->server_permissions, 'create', false) &&
!Arr::get($package->server_permissions, 'update', false) &&
!Arr::get($package->server_permissions, 'delete', false)
) {
abort(404);
}
}
return $next($request);
}
}

View File

@@ -3,8 +3,8 @@
namespace App\Http\Requests\Admin;
use App\Models\Alert;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
class AlertRequest extends FormRequest
{

View File

@@ -39,6 +39,9 @@ class PackageRequest extends FormRequest
Package::CURRENCY_NOK,
Package::CURRENCY_AUD,
Package::CURRENCY_CAD,
Package::CURRENCY_GBP,
Package::CURRENCY_INR,
Package::CURRENCY_THB,
])
],
'maximum_sites' => [
@@ -56,7 +59,11 @@ class PackageRequest extends FormRequest
],
'price_monthly' => [
'nullable',
'numeric'
'numeric',
],
'price_yearly' => [
'nullable',
'numeric',
],
'server_permissions' => [
'array'
@@ -76,8 +83,12 @@ class PackageRequest extends FormRequest
$merge['price_monthly'] = 0.000;
}
if (!$this->price_yearly) {
$merge['price_yearly'] = 0.000;
}
// If we don't have the currency filled in, merge a default
if (!$this->price_monthly) {
if (!$this->price_monthly || !$this->price_yearly) {
$merge['currency'] = Package::CURRENCY_USD;
}

View File

@@ -28,6 +28,14 @@ class ProviderRequest extends FormRequest
'required',
'string',
'max:255'
],
'allowed_plans' => [
'nullable',
'array'
],
'allowed_regions' => [
'nullable',
'array'
]
];
}

View File

@@ -33,6 +33,12 @@ class SettingRequest extends FormRequest
'email' => [
'nullable',
'email'
],
'logo' => [
'nullable',
'image',
'max:2000'
]
];
}

View File

@@ -3,9 +3,9 @@
namespace App\Http\Requests;
use App\Models\UserProvider;
use Illuminate\Validation\Rule;
use App\Rules\CloudflareGeneralTest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProfileIntegrationRequest extends FormRequest
{

View File

@@ -25,15 +25,36 @@ class SiteCertificateRequest extends FormRequest
*/
public function rules()
{
return [
'domain' => [
'required',
'string',
Rule::unique('certificates', 'domain')->where(function ($query) {
return $query->where('site_id', $this->route('site'));
}),
new LetsEncryptMatchHostWithIp($this->route('site'))
]
];
$rules = [];
if ($this->input('type') === 'letsencrypt') {
$rules = [
'domain' => [
'required',
'string',
Rule::unique('certificates', 'domain')->where(function ($query) {
return $query->where('site_id', $this->route('site'));
}),
new LetsEncryptMatchHostWithIp($this->route('site'))
]
];
}
if ($this->input('type') === 'custom') {
$rules = [
'certificate' => [
'required',
'string',
'min:5'
],
'private' => [
'required',
'string',
'min:5'
]
];
}
return $rules;
}
}

View File

@@ -41,6 +41,22 @@ class UserProfileRequest extends FormRequest
'required',
'string',
Rule::in(languages()),
],
'address' => [
'nullable',
'string'
],
'country' => [
'nullable',
'string'
],
'zip' => [
'nullable',
'string'
],
'city' => [
'nullable',
'string'
]
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class DocumentationCategoryRouteResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'title' => $this->title,
'to' => route('documentation.show', $this->id),
'active' => object_get(request()->route('documentationCategory'), 'id') === $this->id ? true : false
];
}
}

View File

@@ -19,7 +19,11 @@ class UserProfileResource extends JsonResource
return [
'name' => $this->name,
'email' => $this->email,
'language' => $this->language
'language' => $this->language,
'address' => $this->address,
'country' => $this->country,
'zip' => $this->zip,
'city' => $this->city
];
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Jobs\Apps;
use App\Models\Site;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -12,9 +13,9 @@ use Illuminate\Foundation\Bus\Dispatchable;
class InstallApp implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $site;
public Site $site;
public $type;
public $options;
@@ -25,7 +26,7 @@ class InstallApp implements ShouldQueue
* @param string $type
* @param array $options
*/
public function __construct(Site $site, $type = Site::PROJECT_WORDPRESS, array $options = [])
public function __construct(Site $site, string $type = Site::PROJECT_WORDPRESS, array $options = [])
{
$this->site = $site;
$this->type = $type;
@@ -39,8 +40,10 @@ class InstallApp implements ShouldQueue
*/
public function handle()
{
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->site->server->ploi_id)->sites($this->site->ploi_id)->app()->install($this->type, $this->options);
$this->getPloi()
->server($this->site->server->ploi_id)
->sites($this->site->ploi_id)
->app()
->install($this->type, $this->options);
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Jobs\Apps;
use App\Models\Site;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -12,9 +13,9 @@ use Illuminate\Foundation\Bus\Dispatchable;
class UninstallApp implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $site;
public Site $site;
/**
* Create a new job instance.
@@ -37,9 +38,11 @@ class UninstallApp implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->site->server->ploi_id)->sites($this->site->ploi_id)->app()->uninstall($this->site->project);
$this->getPloi()
->server($this->site->server->ploi_id)
->sites($this->site->ploi_id)
->app()
->uninstall($this->site->project);
$this->site->project = null;
$this->site->save();

View File

@@ -4,6 +4,7 @@ namespace App\Jobs\Certificates;
use App\Models\Certificate;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -12,38 +13,44 @@ use Illuminate\Foundation\Bus\Dispatchable;
class CreateCertificate implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $certificate;
public Certificate $certificate;
/**
* Create a new job instance.
*
* @param Certificate $certificate
*/
public function __construct(Certificate $certificate)
{
$this->certificate = $certificate;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$ploi = new Ploi(config('services.ploi.token'));
if ($this->certificate->type === 'letsencrypt') {
$ploiCertificate = $this->getPloi()
->server($this->certificate->server->ploi_id)
->sites($this->certificate->site->ploi_id)
->certificates()
->create(
$this->certificate->domain
);
$ploiCertificate = $ploi->server($this->certificate->server->ploi_id)
->sites($this->certificate->site->ploi_id)
->certificates()
->create(
$this->certificate->domain
);
$this->certificate->ploi_id = $ploiCertificate->id;
$this->certificate->save();
}
$this->certificate->ploi_id = $ploiCertificate->id;
$this->certificate->save();
if ($this->certificate->type === 'custom') {
$ploiCertificate = $this->getPloi()
->server($this->certificate->server->ploi_id)
->sites($this->certificate->site->ploi_id)
->certificates()
->create(
$this->certificate->certificate,
$this->certificate->type,
$this->certificate->private
);
$this->certificate->ploi_id = $ploiCertificate->id;
$this->certificate->save();
}
// Lets fetch the status after 5 seconds
dispatch(new FetchCertificateStatus($this->certificate))->delay(now()->addSeconds(5));

View File

@@ -3,6 +3,7 @@
namespace App\Jobs\Certificates;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -11,7 +12,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class DeleteCertificate implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $serverPloiId;
public $sitePloiId;
@@ -42,9 +43,8 @@ class DeleteCertificate implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->serverPloiId)
$this->getPloi()
->server($this->serverPloiId)
->sites($this->sitePloiId)
->certificates()
->delete($this->certificatePloiId);

View File

@@ -4,6 +4,7 @@ namespace App\Jobs\Certificates;
use App\Models\Certificate;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use App\Traits\JobHasThresholds;
use Illuminate\Queue\SerializesModels;
@@ -13,7 +14,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class FetchCertificateStatus implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds, HasPloi;
public $certificate;
@@ -23,7 +24,7 @@ class FetchCertificateStatus implements ShouldQueue
* @param Certificate $certificate
* @param int $threshold
*/
public function __construct(Certificate $certificate, $threshold = 0)
public function __construct(Certificate $certificate, int $threshold = 0)
{
$this->certificate = $certificate;
$this->setThreshold($threshold);
@@ -43,9 +44,8 @@ class FetchCertificateStatus implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploiCronjob = $ploi->server($this->certificate->server->ploi_id)
$ploiCronjob = $this->getPloi()
->server($this->certificate->server->ploi_id)
->sites($this->certificate->site->ploi_id)
->certificates()
->get($this->certificate->ploi_id)

View File

@@ -4,6 +4,7 @@ namespace App\Jobs\Core;
use App\Services\Ploi\Ploi;
use Illuminate\Bus\Queueable;
use App\Services\VersionChecker;
use Illuminate\Support\Facades\Http;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -16,21 +17,29 @@ class Ping implements ShouldQueue
public function handle()
{
$version = new VersionChecker;
$version->flushVersionData();
$response = Http::withHeaders([
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'X-Ploi-Core-Key' => config('services.ploi.core-token')
])
->withToken(config('services.ploi.token'))
->get((new Ploi)->url . 'ping');
->post((new Ploi)->url . 'ping', [
'version' => $version->getApplicationVersion(),
'php_version' => phpversion(),
'panel_url' => config('app.url')
]);
if (!$response->ok() || !$response->json()) {
// Something went wrong..
return;
return 1;
}
$response->json();
return 0;
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Jobs\Cronjobs;
use App\Models\Cronjob;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -12,7 +13,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class CreateCronjob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $cronjob;
@@ -35,13 +36,14 @@ class CreateCronjob implements ShouldQueue
{
$owner = $this->cronjob->site->users()->first();
$ploi = new Ploi(config('services.ploi.token'));
$ploiCronjob = $ploi->server($this->cronjob->server->ploi_id)->cronjobs()->create(
$this->cronjob->command,
$this->cronjob->frequency,
$owner->user_name
);
$ploiCronjob = $this->getPloi()
->server($this->cronjob->server->ploi_id)
->cronjobs()
->create(
$this->cronjob->command,
$this->cronjob->frequency,
$owner->user_name
);
$this->cronjob->ploi_id = $ploiCronjob->id;
$this->cronjob->save();

View File

@@ -3,6 +3,7 @@
namespace App\Jobs\Cronjobs;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -11,7 +12,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class DeleteCronjob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $serverPloiId;
public $cronjobPloiId;
@@ -39,8 +40,9 @@ class DeleteCronjob implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->serverPloiId)->cronjobs()->delete($this->cronjobPloiId);
$this->getPloi()
->server($this->serverPloiId)
->cronjobs()
->delete($this->cronjobPloiId);
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Jobs\Cronjobs;
use App\Models\Cronjob;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use App\Traits\JobHasThresholds;
use Illuminate\Queue\SerializesModels;
@@ -13,7 +14,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class FetchCronjobStatus implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds, HasPloi;
public $cronjob;
@@ -23,7 +24,7 @@ class FetchCronjobStatus implements ShouldQueue
* @param Cronjob $cronjob
* @param int $threshold
*/
public function __construct(Cronjob $cronjob, $threshold = 0)
public function __construct(Cronjob $cronjob, int $threshold = 0)
{
$this->cronjob = $cronjob;
$this->setThreshold($threshold);
@@ -43,9 +44,11 @@ class FetchCronjobStatus implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploiCronjob = $ploi->server($this->cronjob->server->ploi_id)->cronjobs()->get($this->cronjob->ploi_id)->getData();
$ploiCronjob = $this->getPloi()
->server($this->cronjob->server->ploi_id)
->cronjobs()
->get($this->cronjob->ploi_id)
->getData();
if ($ploiCronjob->status !== Cronjob::STATUS_ACTIVE) {
$this->incrementThreshold();

View File

@@ -2,8 +2,8 @@
namespace App\Jobs\Databases;
use App\Traits\HasPloi;
use App\Models\Database;
use App\Services\Ploi\Ploi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -12,7 +12,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class CreateDatabase implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $database;
public $password;
@@ -38,9 +38,10 @@ class CreateDatabase implements ShouldQueue
{
$databaseUser = $this->database->users()->first();
$ploi = new Ploi(config('services.ploi.token'));
$ploiDatabase = $ploi->server($this->database->server->ploi_id)->databases()->create($this->database->name, $databaseUser->name, $this->password);
$ploiDatabase = $this->getPloi()
->server($this->database->server->ploi_id)
->databases()
->create($this->database->name, $databaseUser->name, $this->password);
$this->database->ploi_id = $ploiDatabase->id;
$this->database->save();

View File

@@ -3,6 +3,7 @@
namespace App\Jobs\Databases;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -11,7 +12,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class DeleteDatabase implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $serverPloiId;
public $databasePloiId;
@@ -40,8 +41,6 @@ class DeleteDatabase implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->serverPloiId)->databases()->delete($this->databasePloiId);
$this->getPloi()->server($this->serverPloiId)->databases()->delete($this->databasePloiId);
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Jobs\Databases;
use App\Traits\HasPloi;
use App\Models\Database;
use App\Services\Ploi\Ploi;
use Illuminate\Bus\Queueable;
use App\Traits\JobHasThresholds;
use Illuminate\Queue\SerializesModels;
@@ -13,7 +13,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class FetchDatabaseStatus implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds, HasPloi;
public $database;
@@ -23,7 +23,7 @@ class FetchDatabaseStatus implements ShouldQueue
* @param Database $database
* @param int $threshold
*/
public function __construct(Database $database, $threshold = 0)
public function __construct(Database $database, int $threshold = 0)
{
$this->database = $database;
$this->setThreshold($threshold);
@@ -43,9 +43,11 @@ class FetchDatabaseStatus implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploiDatabase = $ploi->server($this->database->server->ploi_id)->databases()->get($this->database->ploi_id)->getData();
$ploiDatabase = $this->getPloi()
->server($this->database->server->ploi_id)
->databases()
->get($this->database->ploi_id)
->getData();
if ($ploiDatabase->status !== Database::STATUS_ACTIVE) {
$this->incrementThreshold();

View File

@@ -2,8 +2,8 @@
namespace App\Jobs\Redirects;
use App\Traits\HasPloi;
use App\Models\Redirect;
use App\Services\Ploi\Ploi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -12,7 +12,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class CreateRedirect implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $redirect;
@@ -33,9 +33,7 @@ class CreateRedirect implements ShouldQueue
*/
public function handle()
{
$ploi = new Ploi(config('services.ploi.token'));
$ploiRedirect = $ploi
$ploiRedirect = $this->getPloi()
->server($this->redirect->server->ploi_id)
->sites($this->redirect->site->ploi_id)
->redirects()

View File

@@ -2,7 +2,7 @@
namespace App\Jobs\Redirects;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -11,7 +11,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class DeleteRedirect implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $serverPloiId;
public $sitePloiId;
@@ -42,9 +42,8 @@ class DeleteRedirect implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->serverPloiId)
$this->getPloi()
->server($this->serverPloiId)
->sites($this->sitePloiId)
->redirects()
->delete($this->redirectPloiId);

View File

@@ -2,8 +2,8 @@
namespace App\Jobs\Redirects;
use App\Traits\HasPloi;
use App\Models\Redirect;
use App\Services\Ploi\Ploi;
use Illuminate\Bus\Queueable;
use App\Traits\JobHasThresholds;
use Illuminate\Queue\SerializesModels;
@@ -13,7 +13,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class FetchRedirectStatus implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds, HasPloi;
public $redirect;
@@ -23,7 +23,7 @@ class FetchRedirectStatus implements ShouldQueue
* @param Redirect $redirect
* @param int $threshold
*/
public function __construct(Redirect $redirect, $threshold = 0)
public function __construct(Redirect $redirect, int $threshold = 0)
{
$this->redirect = $redirect;
$this->setThreshold($threshold);
@@ -43,9 +43,8 @@ class FetchRedirectStatus implements ShouldQueue
return;
}
$ploi = new Ploi(config('services.ploi.token'));
$ploiRedirect = $ploi->server($this->redirect->server->ploi_id)
$ploiRedirect = $this->getPloi()
->server($this->redirect->server->ploi_id)
->sites($this->redirect->site->ploi_id)
->redirects()
->get($this->redirect->ploi_id)->getData();

View File

@@ -3,7 +3,7 @@
namespace App\Jobs\Servers;
use App\Models\Server;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -12,7 +12,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class CreateServer implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $server;
public $tries = 1;
@@ -34,9 +34,7 @@ class CreateServer implements ShouldQueue
*/
public function handle()
{
$ploi = new Ploi(config('services.ploi.token'));
$ploiServer = $ploi->server()->create(
$ploiServer = $this->getPloi()->server()->create(
$this->server->name,
$this->server->provider->ploi_id,
$this->server->providerRegion->region_id,

View File

@@ -2,7 +2,7 @@
namespace App\Jobs\Servers;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -11,7 +11,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class DeleteServer implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $serverPloiId;
@@ -32,8 +32,6 @@ class DeleteServer implements ShouldQueue
*/
public function handle()
{
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->serverPloiId)->delete();
$this->getPloi()->server($this->serverPloiId)->delete();
}
}

View File

@@ -3,7 +3,7 @@
namespace App\Jobs\Servers;
use App\Models\Server;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use App\Traits\JobHasThresholds;
use Illuminate\Queue\SerializesModels;
@@ -13,7 +13,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class FetchServerStatus implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds, HasPloi;
public $server;
@@ -43,9 +43,7 @@ class FetchServerStatus implements ShouldQueue
return;
}
$ploi = new Ploi;
$ploiServer = $ploi->server($this->server->ploi_id)->get()->getData();
$ploiServer = $this->getPloi()->server($this->server->ploi_id)->get()->getData();
if ($ploiServer->status !== Server::STATUS_ACTIVE) {
$this->incrementThreshold();

View File

@@ -1,35 +0,0 @@
<?php
namespace App\Jobs\Servers;
use App\Models\Server;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class SynchronizeServers implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$ploi = new \App\Services\Ploi\Ploi(config('services.ploi.token'));
$servers = $ploi->server()->get()->getData();
foreach ($servers as $server) {
Server::firstOrCreate([
'ip' => $server->ip_address,
], [
'name' => $server->name
]);
}
}
}

View File

@@ -3,7 +3,7 @@
namespace App\Jobs\Sites;
use App\Models\Site;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -12,7 +12,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class ChangePhpVersion implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $site;
public $version;
@@ -36,9 +36,7 @@ class ChangePhpVersion implements ShouldQueue
*/
public function handle()
{
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->site->server->ploi_id)->sites($this->site->ploi_id)->phpVersion($this->version);
$this->getPloi()->server($this->site->server->ploi_id)->sites($this->site->ploi_id)->phpVersion($this->version);
$this->site->php_version = $this->version;
$this->site->save();

View File

@@ -3,7 +3,7 @@
namespace App\Jobs\Sites;
use App\Models\Site;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Support\Arr;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
@@ -13,7 +13,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class CreateSite implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $site;
@@ -34,11 +34,9 @@ class CreateSite implements ShouldQueue
*/
public function handle()
{
$ploi = new Ploi(config('services.ploi.token'));
$systemUser = $this->site->getSystemUser();
$ploiSite = $ploi->server($this->site->server->ploi_id)->sites()->create(
$ploiSite = $this->getPloi()->server($this->site->server->ploi_id)->sites()->create(
$this->site->domain,
'/public',
'/',

View File

@@ -2,7 +2,7 @@
namespace App\Jobs\Sites;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@@ -11,7 +11,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class DeleteSite implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $serverPloiId;
public $sitePloiId;
@@ -34,8 +34,6 @@ class DeleteSite implements ShouldQueue
*/
public function handle()
{
$ploi = new Ploi(config('services.ploi.token'));
$ploi->server($this->serverPloiId)->sites()->delete($this->sitePloiId);
$this->getPloi()->server($this->serverPloiId)->sites()->delete($this->sitePloiId);
}
}

View File

@@ -3,7 +3,7 @@
namespace App\Jobs\Sites;
use App\Models\Site;
use App\Services\Ploi\Ploi;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use App\Traits\JobHasThresholds;
use Illuminate\Queue\SerializesModels;
@@ -13,7 +13,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
class FetchSiteStatus implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, JobHasThresholds, HasPloi;
public $site;
@@ -43,9 +43,7 @@ class FetchSiteStatus implements ShouldQueue
return;
}
$ploi = new Ploi;
$ploiSite = $ploi->server($this->site->server->ploi_id)->sites()->get($this->site->ploi_id)->getData();
$ploiSite = $this->getPloi()->server($this->site->server->ploi_id)->sites()->get($this->site->ploi_id)->getData();
if ($ploiSite->status !== Site::STATUS_ACTIVE) {
$this->incrementThreshold();

View File

@@ -18,6 +18,8 @@ class Certificate extends Model
public $fillable = [
'domain',
'type'
'type',
'certificate',
'private',
];
}

View File

@@ -12,6 +12,9 @@ class Package extends Model
const CURRENCY_NOK = 'nok';
const CURRENCY_AUD = 'aud';
const CURRENCY_CAD = 'cad';
const CURRENCY_GBP = 'gbp';
const CURRENCY_INR = 'inr';
const CURRENCY_THB = 'thb';
public $fillable = [
'name',
@@ -19,6 +22,7 @@ class Package extends Model
'currency',
'price_hourly',
'price_monthly',
'price_yearly',
'maximum_sites',
'maximum_servers',
'site_permissions',

View File

@@ -8,6 +8,11 @@ class Provider extends Model
{
protected $guarded = [];
protected $casts = [
'allowed_plans' => 'json',
'allowed_regions' => 'json',
];
public function getNameWithLabelAttribute()
{
$string = $this->name;
@@ -41,12 +46,12 @@ class Provider extends Model
public static function booted()
{
static::deleting(function(self $provider){
static::deleting(function (self $provider) {
$provider->regions()->delete();
$provider->plans()->delete();
$provider->packages()->detach();
foreach($provider->servers as $server){
foreach ($provider->servers as $server) {
$server->provider_id = null;
$server->provider_plan_id = null;
$server->provider_region_id = null;

View File

@@ -5,6 +5,9 @@ namespace App\Models;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
/**
* @property mixed|string domain
*/
class Site extends Model
{
const STATUS_BUSY = 'busy';
@@ -95,6 +98,10 @@ class Site extends Model
public static function booted()
{
static::creating(function (self $site) {
$site->domain = strtolower($site->domain);
});
static::created(function (self $site) {
$site->systemUsers()->create();
});

View File

@@ -28,6 +28,7 @@ class User extends Authenticatable implements HasLocalePreference
'address',
'city',
'country',
'zip',
'notes',
'language',
'blocked',
@@ -109,6 +110,11 @@ class User extends Authenticatable implements HasLocalePreference
return $this->hasMany(SupportTicket::class);
}
public function supportTicketReplies()
{
return $this->hasMany(SupportTicketReply::class);
}
public function systemLogs()
{
return $this->hasMany(SystemLog::class);
@@ -138,6 +144,10 @@ class User extends Authenticatable implements HasLocalePreference
$user->systemLogs()->delete();
$user->servers()->detach();
$user->sites()->detach();
foreach ($user->supportTickets as $supportTicket) {
$supportTicket->replies()->delete();
}
$user->supportTickets()->delete();
});
}
}

View File

@@ -3,19 +3,10 @@
namespace App\Providers;
use App\Models\Setting;
use Illuminate\Support\Collection;
use Illuminate\Pagination\UrlWindow;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\ServiceProvider;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->singleton('settings', function ($app) {
@@ -27,75 +18,5 @@ class AppServiceProvider extends ServiceProvider
}
});
});
if (!$this->app->request->is('api*')) {
$this->registerLengthAwarePaginator();
}
}
protected function registerLengthAwarePaginator()
{
$this->app->bind(LengthAwarePaginator::class, function ($app, $values) {
return new class(...array_values($values)) extends LengthAwarePaginator {
public function only(...$attributes)
{
return $this->transform(function ($item) use ($attributes) {
return $item->only($attributes);
});
}
public function transform($callback)
{
$this->items->transform($callback);
return $this;
}
public function toArray()
{
return [
'data' => $this->items->toArray(),
'links' => $this->links(),
'per_page' => $this->perPage(),
'total' => $this->total(),
];
}
public function links($view = null, $data = [])
{
$this->appends(Request::all());
$window = UrlWindow::make($this);
$elements = array_filter([
$window['first'],
is_array($window['slider']) ? '...' : null,
$window['slider'],
is_array($window['last']) ? '...' : null,
$window['last'],
]);
return Collection::make($elements)->flatMap(function ($item) {
if (is_array($item)) {
return Collection::make($item)->map(function ($url, $page) {
return [
'url' => $url,
'label' => $page,
'active' => $this->currentPage() === $page,
];
});
} else {
return [
[
'url' => null,
'label' => '...',
'active' => false,
],
];
}
});
}
};
});
}
}

View File

@@ -34,7 +34,7 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
protected function gate()
{
Gate::define('viewHorizon', function ($user) {
return $user->isAdmin();
return $user->isAdmin() && !config('app.demo');
});
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Services;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Str;
use GuzzleHttp\Exception\ClientException;
class Cloudflare
{

View File

@@ -21,4 +21,9 @@ class Unauthenticated extends Exception
{
parent::__construct($message);
}
public function render($request)
{
return redirect()->route('dashboard')->with('error', 'Unable to authenticate with backend server, please check API keys and connection.');
}
}

View File

@@ -43,7 +43,7 @@ class Certificate extends Resource
return $this->getPloi()->makeAPICall($this->getEndpoint());
}
public function create(string $certificate, string $type = 'letsencrypt'): stdClass
public function create(string $certificate, string $type = 'letsencrypt', string $private = null): stdClass
{
// Remove the id
$this->setId(null);
@@ -51,8 +51,9 @@ class Certificate extends Resource
// Set the options
$options = [
'body' => json_encode([
'certificate' => $certificate,
'type' => $type,
'certificate' => $certificate,
'private' => $private,
]),
];

View File

@@ -61,9 +61,9 @@ class Server extends Resource
public function create(
string $name,
int $provider,
int $region,
int $plan
$provider,
$region,
$plan
): stdClass {
// Remove the id
@@ -89,8 +89,6 @@ class Server extends Resource
} catch (NotValid $exception) {
$errors = json_decode($exception->getMessage())->errors;
dd($errors);
throw $exception;
}

View File

@@ -98,6 +98,13 @@ class Site extends Resource
}
throw $exception;
} catch (\Exception $exception) {
info($exception->getMessage());
}
// TODO: Debugging purposes
if (!$response->getJson() || !isset($response->getJson()->data)) {
throw new \Exception($response->getJson()->error ?? 'Unknown error has occured');
}
// Set the id of the site
@@ -142,7 +149,7 @@ class Site extends Resource
return $response->getJson()->data;
}
public function phpVersion($version = '7.4') :stdClass
public function phpVersion($version = '7.4'): stdClass
{
// Set the options
$options = [

View File

@@ -19,4 +19,9 @@ class Synchronize extends Resource
{
return $this->getPloi()->makeAPICall($this->getEndpoint() . '/servers');
}
public function sites()
{
return $this->getPloi()->makeAPICall($this->getEndpoint() . '/sites');
}
}

View File

@@ -34,4 +34,13 @@ class VersionChecker
{
return $this->currentVersion < $this->remoteVersion || $this->currentVersion != $this->remoteVersion;
}
public function flushVersionData()
{
try {
cache()->forget('ploi-core-current-version');
cache()->forget('ploi-core-remote-version');
} catch (\Exception $exception) {
}
}
}

13
app/Traits/HasPloi.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
namespace App\Traits;
use App\Services\Ploi\Ploi;
trait HasPloi
{
protected function getPloi()
{
return new Ploi(config('services.ploi.token'));
}
}

View File

@@ -9,30 +9,32 @@
],
"license": "MIT",
"require": {
"php": "^7.3",
"php": "^7.4|^8.0",
"ext-json": "*",
"cloudflare/sdk": "^1.1",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.2|^7.0.1",
"inertiajs/inertia-laravel": "^0.3.1",
"inertiajs/inertia-laravel": "^v0.4.3",
"laravel/cashier": "^12.3",
"laravel/framework": "^8.4",
"laravel/horizon": "^5.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.1",
"laravel/ui": "^2.1|^3.3.0",
"league/glide": "^1.6",
"pragmarx/google2fa-laravel": "^1.3",
"tightenco/ziggy": "^0.9.4"
"predis/predis": "^1.1",
"tightenco/ziggy": "^1.3"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.3",
"facade/ignition": "^2.3",
"friendsofphp/php-cs-fixer": "^2.16",
"fzaninotto/faker": "^1.9.1",
"laravel/dusk": "^6.15",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^8.5"
"phpunit/phpunit": "^9.5.4"
},
"config": {
"optimize-autoloader": true,

4203
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@ return [
|
*/
'domain' => null,
'domain' => env('HORIZON_DOMAIN', null),
/*
|--------------------------------------------------------------------------
@@ -28,7 +28,7 @@ return [
|
*/
'path' => 'horizon',
'path' => env('HORIZON_PATH', 'horizon'),
/*
|--------------------------------------------------------------------------
@@ -145,13 +145,13 @@ return [
| Memory Limit (MB)
|--------------------------------------------------------------------------
|
| This value describes the maximum amount of memory the Horizon worker
| may consume before it is terminated and restarted. You should set
| this value according to the resources available to your server.
| This value describes the maximum amount of memory the Horizon master
| supervisor may consume before it is terminated and restarted. For
| configuring these limits on your workers, see the next section.
|
*/
'memory_limit' => 64,
'memory_limit' => env('HORIZON_MEMORY_LIMIT', 64),
/*
|--------------------------------------------------------------------------
@@ -164,6 +164,9 @@ return [
|
*/
'defaults' => [
],
'environments' => [
'production' => [
'supervisor-1' => [

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAlertsTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddMetaToUserProvidersTable extends Migration
{

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddZipToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('zip')->after('city')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('zip');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddPriceYearlyToPackagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('packages', function (Blueprint $table) {
$table->decimal('price_yearly', 10, 4)->after('price_monthly')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('packages', function (Blueprint $table) {
$table->dropColumn('price_yearly');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddColumnsToCertificatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('certificates', function (Blueprint $table) {
$table->after('domain', function ($table) {
$table->longText('certificate')->nullable();
$table->longText('private')->nullable();
});
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('certificates', function (Blueprint $table) {
//
});
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAllowedRegionsAndPlansToProvidersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('providers', function (Blueprint $table) {
$table->json('allowed_plans')->nullable()->after('name');
$table->json('allowed_regions')->nullable()->after('allowed_plans');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('providers', function (Blueprint $table) {
$table->dropColumn('allowed_plans', 'allowed_regions');
});
}
}

20186
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,34 +2,40 @@
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"production": "mix --production"
},
"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@inertiajs/inertia": "^0.4.3",
"@inertiajs/inertia-vue": "^0.3.2",
"@inertiajs/progress": "^0.1.2",
"@tailwindcss/ui": "^0.3.0",
"axios": "^0.19",
"@inertiajs/inertia": "^0.10.0",
"@inertiajs/inertia-vue": "^0.7.1",
"@inertiajs/progress": "^0.2.6",
"@tailwindcss/forms": "^0.3.2",
"@tailwindcss/typography": "^0.4.1",
"autoprefixer": "^10.2.5",
"axios": "^0.21.1",
"balloon-css": "^1.2.0",
"cross-env": "^7.0",
"laravel-mix": "^5.0.1",
"cross-env": "^7.0.3",
"laravel-mix": "^6.0.25",
"lodash": "^4.17.15",
"portal-vue": "^2.1.7",
"postcss": "^8.2.13",
"resolve-url-loader": "^3.1.0",
"sass": "^1.15.2",
"sass-loader": "^8.0.0",
"tailwindcss": "^1.9.6",
"v-click-outside": "^3.0.1",
"tailwindcss": "^2.2.4",
"v-click-outside": "^3.1.2",
"vue": "^2.6.11",
"vue-clipboard2": "^0.3.1",
"vue-loader": "^15.9.6",
"vue-meta": "^2.4.0",
"vue-template-compiler": "^2.6.11",
"vuex": "^3.5.1"
"vuex": "^3.6.2"
},
"dependencies": {
"vue-simplemde": "^2.0.0"
}
}

6
public/css/app.css vendored

File diff suppressed because one or more lines are too long

1
public/js/0.js vendored

File diff suppressed because one or more lines are too long

1
public/js/1.js vendored

File diff suppressed because one or more lines are too long

1
public/js/10.js vendored

File diff suppressed because one or more lines are too long

1
public/js/11.js vendored

File diff suppressed because one or more lines are too long

1
public/js/1171.js vendored Normal file

File diff suppressed because one or more lines are too long

1
public/js/12.js vendored

File diff suppressed because one or more lines are too long

1
public/js/13.js vendored

File diff suppressed because one or more lines are too long

1
public/js/1331.js vendored Normal file

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More