Merge branch 'main' of github.com:CloudVisionApps/PhyrePanel
This commit is contained in:
commit
bc7c932770
9 changed files with 272 additions and 11 deletions
|
@ -2,7 +2,13 @@
|
|||
|
||||
namespace Modules\Microweber\Filament\Clusters\Microweber\Pages;
|
||||
|
||||
use App\ShellApi;
|
||||
use Filament\Pages\Page;
|
||||
use MicroweberPackages\ComposerClient\Client;
|
||||
use MicroweberPackages\SharedServerScripts\MicroweberAppPathHelper;
|
||||
use MicroweberPackages\SharedServerScripts\MicroweberDownloader;
|
||||
use MicroweberPackages\SharedServerScripts\MicroweberModuleConnectorsDownloader;
|
||||
use MicroweberPackages\SharedServerScripts\MicroweberTemplatesDownloader;
|
||||
use Modules\Microweber\Filament\Clusters\MicroweberCluster;
|
||||
|
||||
class Version extends Page
|
||||
|
@ -13,7 +19,108 @@ class Version extends Page
|
|||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'modules.microweber.filament.admin.pages.version';
|
||||
protected static string $view = 'microweber::filament.admin.pages.version';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
|
||||
public $currentVersionOfApp = 0;
|
||||
public $latestVersionOfApp = 0;
|
||||
public $latestDownloadDateOfApp = 0;
|
||||
|
||||
public $supportedTemplates = [];
|
||||
public $supportedLanguages = [];
|
||||
|
||||
|
||||
protected function getViewData(): array
|
||||
{
|
||||
$release = $this->__getMicroweberDownloaderInstance()->getRelease();
|
||||
|
||||
$sharedPath = new MicroweberAppPathHelper();
|
||||
$sharedPath->setPath(config('microweber.sharedPaths.app'));
|
||||
|
||||
$this->supportedLanguages = $sharedPath->getSupportedLanguages();
|
||||
$this->supportedTemplates = $sharedPath->getSupportedTemplates();
|
||||
$this->latestVersionOfApp = $this->__getMicroweberDownloaderInstance()->getVersion();
|
||||
$this->currentVersionOfApp = $sharedPath->getCurrentVersion();
|
||||
$this->latestDownloadDateOfApp = $sharedPath->getCreatedAt();
|
||||
|
||||
return [
|
||||
'appVersion' => $this->currentVersionOfApp,
|
||||
'latestAppVersion' => $this->latestVersionOfApp,
|
||||
'latestAppDownloadDate' => $this->latestDownloadDateOfApp,
|
||||
'totalAppTemplates' => count($this->supportedTemplates),
|
||||
'appTemplates' => $this->supportedTemplates,
|
||||
'supportedLanguages' => $this->supportedLanguages,
|
||||
'supportedTemplates' => $this->supportedTemplates
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function checkForUpdates()
|
||||
{
|
||||
$sharedAppPath = config('microweber.sharedPaths.app');
|
||||
|
||||
ShellApi::exec('mkdir -p ' . dirname($sharedAppPath));
|
||||
ShellApi::exec('chown www-data:www-data ' . dirname($sharedAppPath));
|
||||
ShellApi::exec('chmod 775 ' . dirname($sharedAppPath));
|
||||
|
||||
if (!is_dir(dirname($sharedAppPath))) {
|
||||
mkdir(dirname($sharedAppPath));
|
||||
}
|
||||
|
||||
// Download core app
|
||||
$status = $this->__getMicroweberDownloaderInstance()
|
||||
->download(config('microweber.sharedPaths.app'));
|
||||
|
||||
// Download modules
|
||||
$modulesDownloader = new MicroweberModuleConnectorsDownloader();
|
||||
$modulesDownloader->setComposerClient($this->__getComposerClientInstance());
|
||||
$status = $modulesDownloader->download(config('microweber.sharedPaths.modules'));
|
||||
|
||||
// Download templates
|
||||
$templatesDownloader = new MicroweberTemplatesDownloader();
|
||||
$templatesDownloader->setComposerClient($this->__getComposerLicensedInstance());
|
||||
$status = $templatesDownloader->download(config('microweber.sharedPaths.templates'));
|
||||
|
||||
}
|
||||
|
||||
private function __getComposerClientInstance()
|
||||
{
|
||||
// The module connector must have own instance of composer client
|
||||
$composerClient = new Client();
|
||||
$composerClient->packageServers = [
|
||||
'https://market.microweberapi.com/packages/microweberserverpackages/packages.json'
|
||||
];
|
||||
|
||||
return $composerClient;
|
||||
}
|
||||
|
||||
private function __getComposerLicensedInstance()
|
||||
{
|
||||
$composerClientLicensed = new Client();
|
||||
// if (Option::getOption('license_key_status', 'whitelabel_license') == 'valid') {
|
||||
// $composerClientLicensed->addLicense([
|
||||
// 'local_key' => Option::getOption('license_key', 'whitelabel_license')
|
||||
// ]);
|
||||
// }
|
||||
|
||||
return $composerClientLicensed;
|
||||
}
|
||||
|
||||
private function __getMicroweberDownloaderInstance()
|
||||
{
|
||||
$coreDownloader = new MicroweberDownloader();
|
||||
|
||||
$updateAppChannel = 'stable';
|
||||
if ($updateAppChannel == 'stable') {
|
||||
$coreDownloader->setReleaseSource(MicroweberDownloader::STABLE_RELEASE);
|
||||
} else {
|
||||
$coreDownloader->setReleaseSource(MicroweberDownloader::DEV_RELEASE);
|
||||
}
|
||||
|
||||
$coreDownloader->setComposerClient($this->__getComposerClientInstance());
|
||||
|
||||
return $coreDownloader;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,9 @@ class Whitelabel extends BaseSettings
|
|||
Section::make('Whitelabel')
|
||||
->schema([
|
||||
|
||||
TextInput::make('whitelabel_license_key')
|
||||
->label('License Key'),
|
||||
|
||||
TextInput::make('microweber.whitelabel.brand_name')
|
||||
->label('Brand Name'),
|
||||
|
||||
|
|
|
@ -2,4 +2,9 @@
|
|||
|
||||
return [
|
||||
'name' => 'Microweber',
|
||||
'sharedPaths'=>[
|
||||
'app'=>'/usr/share/microweber/latest',
|
||||
'modules'=>'/usr/share/microweber/latest/userfiles/modules',
|
||||
'templates'=>'/usr/share/microweber/latest/userfiles/templates'
|
||||
]
|
||||
];
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<x-filament-panels::page>
|
||||
|
||||
<h3 class="text-2xl font-bold tracking-tight text-gray-950 dark:text-white sm:text-3xl">
|
||||
Microweber App Version
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
Your app version is: {{ $appVersion }}<br>
|
||||
Latest app version is: {{ $latestAppVersion }}<br>
|
||||
Latest app download date: {{ $latestAppDownloadDate }}
|
||||
</p>
|
||||
|
||||
<h3 class="text-2xl font-bold tracking-tight text-gray-950 dark:text-white sm:text-3xl">
|
||||
Microweber App Templates
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
Available App Templates ({{ $totalAppTemplates }})
|
||||
</p>
|
||||
|
||||
<div>
|
||||
@foreach ($appTemplates as $appTemplate)
|
||||
<span>{{ $appTemplate['name'] }}</span>
|
||||
@if (!$loop->last)
|
||||
,
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
{{-- <div class="p-4 text-white rounded bg-green-500/90 dark:bg-green-500/30">
|
||||
Your app and templates is up-to-date!
|
||||
</div>--}}
|
||||
|
||||
<x-filament::button wire:click="checkForUpdates" class="w-[16rem]">
|
||||
Check for updates
|
||||
</x-filament::button>
|
||||
|
||||
</x-filament-panels::page>
|
|
@ -6,7 +6,16 @@ class FileManagerApi
|
|||
{
|
||||
public function isDir($path)
|
||||
{
|
||||
return is_dir($path);
|
||||
return ShellApi::exec('test -d ' . $path);
|
||||
}
|
||||
|
||||
public function isFile($path)
|
||||
{
|
||||
return is_file($path);
|
||||
}
|
||||
public function isWritable($path)
|
||||
{
|
||||
return is_writable($path);
|
||||
}
|
||||
|
||||
public function mkdir($path)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
PHYRE_PHP=/usr/local/phyre/php/bin/php
|
||||
|
||||
#rm -rf composer.lock
|
||||
#$PHYRE_PHP composer.phar i
|
||||
#$PHYRE_PHP composer.phar dump-autoload
|
||||
rm -rf composer.lock
|
||||
$PHYRE_PHP composer.phar i
|
||||
$PHYRE_PHP composer.phar dump-autoload
|
||||
|
||||
$PHYRE_PHP artisan migrate
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<x-filament-panels::page>
|
||||
|
||||
</x-filament-panels::page>
|
|
@ -1,3 +0,0 @@
|
|||
<x-filament-panels::page>
|
||||
|
||||
</x-filament-panels::page>
|
|
@ -27,6 +27,110 @@
|
|||
{{ strip_tags(filament()->getBrandName()) }}
|
||||
</title>
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
custom: {
|
||||
50: 'rgba(var(--c-50), <alpha-value>)',
|
||||
100: 'rgba(var(--c-100), <alpha-value>)',
|
||||
200: 'rgba(var(--c-200), <alpha-value>)',
|
||||
300: 'rgba(var(--c-300), <alpha-value>)',
|
||||
400: 'rgba(var(--c-400), <alpha-value>)',
|
||||
500: 'rgba(var(--c-500), <alpha-value>)',
|
||||
600: 'rgba(var(--c-600), <alpha-value>)',
|
||||
700: 'rgba(var(--c-700), <alpha-value>)',
|
||||
800: 'rgba(var(--c-800), <alpha-value>)',
|
||||
900: 'rgba(var(--c-900), <alpha-value>)',
|
||||
950: 'rgba(var(--c-950), <alpha-value>)',
|
||||
},
|
||||
danger: {
|
||||
50: 'rgba(var(--danger-50), <alpha-value>)',
|
||||
100: 'rgba(var(--danger-100), <alpha-value>)',
|
||||
200: 'rgba(var(--danger-200), <alpha-value>)',
|
||||
300: 'rgba(var(--danger-300), <alpha-value>)',
|
||||
400: 'rgba(var(--danger-400), <alpha-value>)',
|
||||
500: 'rgba(var(--danger-500), <alpha-value>)',
|
||||
600: 'rgba(var(--danger-600), <alpha-value>)',
|
||||
700: 'rgba(var(--danger-700), <alpha-value>)',
|
||||
800: 'rgba(var(--danger-800), <alpha-value>)',
|
||||
900: 'rgba(var(--danger-900), <alpha-value>)',
|
||||
950: 'rgba(var(--danger-950), <alpha-value>)',
|
||||
},
|
||||
gray: {
|
||||
50: 'rgba(var(--gray-50), <alpha-value>)',
|
||||
100: 'rgba(var(--gray-100), <alpha-value>)',
|
||||
200: 'rgba(var(--gray-200), <alpha-value>)',
|
||||
300: 'rgba(var(--gray-300), <alpha-value>)',
|
||||
400: 'rgba(var(--gray-400), <alpha-value>)',
|
||||
500: 'rgba(var(--gray-500), <alpha-value>)',
|
||||
600: 'rgba(var(--gray-600), <alpha-value>)',
|
||||
700: 'rgba(var(--gray-700), <alpha-value>)',
|
||||
800: 'rgba(var(--gray-800), <alpha-value>)',
|
||||
900: 'rgba(var(--gray-900), <alpha-value>)',
|
||||
950: 'rgba(var(--gray-950), <alpha-value>)',
|
||||
},
|
||||
info: {
|
||||
50: 'rgba(var(--info-50), <alpha-value>)',
|
||||
100: 'rgba(var(--info-100), <alpha-value>)',
|
||||
200: 'rgba(var(--info-200), <alpha-value>)',
|
||||
300: 'rgba(var(--info-300), <alpha-value>)',
|
||||
400: 'rgba(var(--info-400), <alpha-value>)',
|
||||
500: 'rgba(var(--info-500), <alpha-value>)',
|
||||
600: 'rgba(var(--info-600), <alpha-value>)',
|
||||
700: 'rgba(var(--info-700), <alpha-value>)',
|
||||
800: 'rgba(var(--info-800), <alpha-value>)',
|
||||
900: 'rgba(var(--info-900), <alpha-value>)',
|
||||
950: 'rgba(var(--info-950), <alpha-value>)',
|
||||
},
|
||||
primary: {
|
||||
50: 'rgba(var(--primary-50), <alpha-value>)',
|
||||
100: 'rgba(var(--primary-100), <alpha-value>)',
|
||||
200: 'rgba(var(--primary-200), <alpha-value>)',
|
||||
300: 'rgba(var(--primary-300), <alpha-value>)',
|
||||
400: 'rgba(var(--primary-400), <alpha-value>)',
|
||||
500: 'rgba(var(--primary-500), <alpha-value>)',
|
||||
600: 'rgba(var(--primary-600), <alpha-value>)',
|
||||
700: 'rgba(var(--primary-700), <alpha-value>)',
|
||||
800: 'rgba(var(--primary-800), <alpha-value>)',
|
||||
900: 'rgba(var(--primary-900), <alpha-value>)',
|
||||
950: 'rgba(var(--primary-950), <alpha-value>)',
|
||||
},
|
||||
success: {
|
||||
50: 'rgba(var(--success-50), <alpha-value>)',
|
||||
100: 'rgba(var(--success-100), <alpha-value>)',
|
||||
200: 'rgba(var(--success-200), <alpha-value>)',
|
||||
300: 'rgba(var(--success-300), <alpha-value>)',
|
||||
400: 'rgba(var(--success-400), <alpha-value>)',
|
||||
500: 'rgba(var(--success-500), <alpha-value>)',
|
||||
600: 'rgba(var(--success-600), <alpha-value>)',
|
||||
700: 'rgba(var(--success-700), <alpha-value>)',
|
||||
800: 'rgba(var(--success-800), <alpha-value>)',
|
||||
900: 'rgba(var(--success-900), <alpha-value>)',
|
||||
950: 'rgba(var(--success-950), <alpha-value>)',
|
||||
},
|
||||
warning: {
|
||||
50: 'rgba(var(--warning-50), <alpha-value>)',
|
||||
100: 'rgba(var(--warning-100), <alpha-value>)',
|
||||
200: 'rgba(var(--warning-200), <alpha-value>)',
|
||||
300: 'rgba(var(--warning-300), <alpha-value>)',
|
||||
400: 'rgba(var(--warning-400), <alpha-value>)',
|
||||
500: 'rgba(var(--warning-500), <alpha-value>)',
|
||||
600: 'rgba(var(--warning-600), <alpha-value>)',
|
||||
700: 'rgba(var(--warning-700), <alpha-value>)',
|
||||
800: 'rgba(var(--warning-800), <alpha-value>)',
|
||||
900: 'rgba(var(--warning-900), <alpha-value>)',
|
||||
950: 'rgba(var(--warning-950), <alpha-value>)',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::STYLES_BEFORE, scopes: $livewire->getRenderHookScopes()) }}
|
||||
|
||||
<style>
|
||||
|
|
Loading…
Reference in a new issue