Compare commits

..

1 Commits

Author SHA1 Message Date
notCharles
a4fb2bb8ad spotlight 2026-02-01 19:26:23 -05:00
186 changed files with 2054 additions and 2938 deletions

View File

@@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.3, 8.4, 8.5]
php: [8.2, 8.3, 8.4, 8.5]
env:
DB_CONNECTION: sqlite
DB_DATABASE: testing.sqlite
@@ -79,8 +79,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.5]
database: ["mysql:8.4", "mysql:9.6"]
php: [8.2, 8.3, 8.4, 8.5]
database: ["mysql:8"]
services:
database:
image: ${{ matrix.database }}
@@ -147,8 +147,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.5]
database: ["mariadb:10.11", "mariadb:11.4"]
php: [8.2, 8.3, 8.4, 8.5]
database: ["mariadb:10.6", "mariadb:10.11", "mariadb:11.4"]
services:
database:
image: ${{ matrix.database }}
@@ -215,8 +215,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.5]
database: ["postgres:17", "postgres:18"]
php: [8.2, 8.3, 8.4, 8.5]
database: ["postgres:14"]
services:
database:
image: ${{ matrix.database }}

View File

@@ -68,8 +68,6 @@ RUN apk add --no-cache \
# required for installing plugins. Pulled from https://github.com/pelican-dev/panel/pull/2034
zip unzip 7zip bzip2-dev yarn git
# Copy composer binary for runtime plugin dependency management
COPY --from=composer /usr/local/bin/composer /usr/local/bin/composer
COPY --chown=root:www-data --chmod=770 --from=composerbuild /build .
COPY --chown=root:www-data --chmod=770 --from=yarnbuild /build/public ./public
@@ -85,7 +83,8 @@ RUN mkdir -p /pelican-data/storage /pelican-data/plugins /var/run/supervisord \
# Allow www-data write permissions where necessary
&& chown -R www-data: /pelican-data .env ./storage ./plugins ./bootstrap/cache /var/run/supervisord /var/www/html/public/storage \
&& chmod -R 770 /pelican-data ./storage ./bootstrap/cache /var/run/supervisord \
&& chown -R www-data: /usr/local/etc/php/ /usr/local/etc/php-fpm.d/ /var/www/html/composer.json /var/www/html/composer.lock
&& chown -R www-data: /usr/local/etc/php/ /usr/local/etc/php-fpm.d/
# Configure Supervisor
COPY docker/supervisord.conf /etc/supervisord.conf
COPY docker/Caddyfile /etc/caddy/Caddyfile

View File

@@ -73,8 +73,6 @@ RUN apk add --no-cache \
# required for installing plugins. Pulled from https://github.com/pelican-dev/panel/pull/2034
zip unzip 7zip bzip2-dev yarn git
# Copy composer binary for runtime plugin dependency management
COPY --from=composer /usr/local/bin/composer /usr/local/bin/composer
COPY --chown=root:www-data --chmod=770 --from=composerbuild /build .
COPY --chown=root:www-data --chmod=770 --from=yarnbuild /build/public ./public
@@ -90,7 +88,7 @@ RUN mkdir -p /pelican-data/storage /pelican-data/plugins /var/run/supervisord \
# Allow www-data write permissions where necessary
&& chown -R www-data: /pelican-data .env ./storage ./plugins ./bootstrap/cache /var/run/supervisord /var/www/html/public/storage \
&& chmod -R 770 /pelican-data ./storage ./bootstrap/cache /var/run/supervisord \
&& chown -R www-data: /usr/local/etc/php/ /usr/local/etc/php-fpm.d/ /var/www/html/composer.json /var/www/html/composer.lock
&& chown -R www-data: /usr/local/etc/php/ /usr/local/etc/php-fpm.d/
# Configure Supervisor
COPY docker/supervisord.conf /etc/supervisord.conf

View File

@@ -8,6 +8,7 @@ use App\Services\Eggs\Sharing\EggExporterService;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use JsonException;
use Symfony\Component\Yaml\Yaml;
class CheckEggUpdatesCommand extends Command
@@ -21,12 +22,14 @@ class CheckEggUpdatesCommand extends Command
try {
$this->check($egg, $exporterService);
} catch (Exception $exception) {
$this->error("$egg->name: Error ({$exception->getMessage()})");
$this->error("{$egg->name}: Error ({$exception->getMessage()})");
}
}
}
/** @throws Exception */
/**
* @throws JsonException
*/
private function check(Egg $egg, EggExporterService $exporterService): void
{
if (is_null($egg->update_url)) {
@@ -42,13 +45,7 @@ class CheckEggUpdatesCommand extends Command
? Yaml::parse($exporterService->handle($egg->id, EggFormat::YAML))
: json_decode($exporterService->handle($egg->id, EggFormat::JSON), true);
$remote = Http::timeout(5)->connectTimeout(1)->get($egg->update_url);
if ($remote->failed()) {
throw new Exception("HTTP request returned status code {$remote->status()}");
}
$remote = $remote->body();
$remote = Http::timeout(5)->connectTimeout(1)->get($egg->update_url)->throw()->body();
$remote = $isYaml ? Yaml::parse($remote) : json_decode($remote, true);
unset($local['exported_at'], $remote['exported_at']);

View File

@@ -16,7 +16,7 @@ class DisablePluginCommand extends Command
{
$id = $this->argument('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
$plugin = Plugin::find(str($id)->lower()->toString());
$plugin = Plugin::find($id);
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@@ -18,7 +18,7 @@ class InstallPluginCommand extends Command
{
$id = $this->argument('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
$plugin = Plugin::find(str($id)->lower()->toString());
$plugin = Plugin::find($id);
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@@ -18,7 +18,7 @@ class UninstallPluginCommand extends Command
{
$id = $this->argument('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
$plugin = Plugin::find(str($id)->lower()->toString());
$plugin = Plugin::find($id);
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@@ -17,7 +17,7 @@ class UpdatePluginCommand extends Command
{
$id = $this->argument('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
$plugin = Plugin::find(str($id)->lower()->toString());
$plugin = Plugin::find($id);
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@@ -12,7 +12,6 @@ enum CustomizationKey: string
case DashboardLayout = 'dashboard_layout';
case ButtonStyle = 'button_style';
case RedirectToAdmin = 'redirect_to_admin';
public function getDefaultValue(): string|int|bool
{
@@ -24,7 +23,6 @@ enum CustomizationKey: string
self::TopNavigation => config('panel.filament.default-navigation', 'sidebar'),
self::DashboardLayout => 'grid',
self::ButtonStyle => true,
self::RedirectToAdmin => false,
};
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Exceptions;
use App\Exceptions\Solutions\ManifestDoesNotExistSolution;
use Exception;
use Spatie\Ignition\Contracts\ProvidesSolution;
use Spatie\Ignition\Contracts\Solution;
class ManifestDoesNotExistException extends Exception implements ProvidesSolution
{
public function getSolution(): Solution
{
return new ManifestDoesNotExistSolution();
}
}

View File

@@ -1,7 +0,0 @@
<?php
namespace App\Exceptions;
use Exception;
class PluginIdMismatchException extends Exception {}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Exceptions\Solutions;
use Spatie\Ignition\Contracts\Solution;
class ManifestDoesNotExistSolution implements Solution
{
public function getSolutionTitle(): string
{
return "The manifest.json file hasn't been generated yet";
}
public function getSolutionDescription(): string
{
return 'Run yarn run build:production to build the frontend first.';
}
public function getDocumentationLinks(): array
{
return [
'Docs' => 'https://github.com/pelican/panel/blob/master/package.json',
];
}
}

View File

@@ -14,14 +14,13 @@ use Boquizo\FilamentLogViewer\Utils\Level;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Filament\Tables\Table;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Facades\Http;
class ListLogs extends BaseListLogs
{
protected string $view = 'filament.components.list-logs';
public function getHeading(): string|null|Htmlable
public function getHeading(): string|null|\Illuminate\Contracts\Support\Htmlable
{
return trans('admin/log.navigation.panel_logs');
}

View File

@@ -13,8 +13,6 @@ use App\Traits\Filament\CanCustomizeHeaderActions;
use App\Traits\Filament\CanCustomizeHeaderWidgets;
use App\Traits\Filament\CanCustomizeTabs;
use BackedEnum;
use BladeUI\Icons\Exceptions\SvgNotFound;
use BladeUI\Icons\Factory as IconFactory;
use Exception;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
@@ -70,8 +68,6 @@ class Settings extends Page implements HasSchemas
protected CaptchaService $captchaService;
protected IconFactory $iconFactory;
/** @var array<mixed>|null */
public ?array $data = [];
@@ -80,12 +76,11 @@ class Settings extends Page implements HasSchemas
$this->form->fill();
}
public function boot(OAuthService $oauthService, AvatarService $avatarService, CaptchaService $captchaService, IconFactory $iconFactory): void
public function boot(OAuthService $oauthService, AvatarService $avatarService, CaptchaService $captchaService): void
{
$this->oauthService = $oauthService;
$this->avatarService = $avatarService;
$this->captchaService = $captchaService;
$this->iconFactory = $iconFactory;
}
public static function canAccess(): bool
@@ -570,18 +565,9 @@ class Settings extends Page implements HasSchemas
foreach ($oauthSchemas as $schema) {
$key = $schema->getConfigKey();
$icon = $schema->getIcon();
if (is_string($icon)) {
try {
$this->iconFactory->svg($icon);
} catch (SvgNotFound) {
$icon = null;
}
}
$formFields[] = Section::make($schema->getName())
->columns(5)
->icon($icon ?? TablerIcon::BrandOauth)
->icon($schema->getIcon() ?? TablerIcon::BrandOauth)
->collapsed(fn () => !$schema->isEnabled())
->collapsible()
->schema([

View File

@@ -22,7 +22,6 @@ use Filament\Forms\Components\ToggleButtons;
use Filament\Resources\Pages\PageRegistration;
use Filament\Resources\Resource;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
@@ -114,44 +113,12 @@ class ApiKeyResource extends Resource
*/
public static function defaultForm(Schema $schema): Schema
{
$permissionList = ApiKey::getPermissionList();
return $schema
->components([
Section::make(trans('admin/apikey.permissions.all'))
->description(trans('admin/apikey.permissions.all_description'))
->columnSpanFull()
->schema([
ToggleButtons::make('permissions_all')
->hiddenLabel()
->inline()
->options([
0 => trans('admin/apikey.permissions.none'),
1 => trans('admin/apikey.permissions.read'),
3 => trans('admin/apikey.permissions.read_write'),
])
->icons([
0 => TablerIcon::BookOff,
1 => TablerIcon::Book,
3 => TablerIcon::Writing,
])
->colors([
0 => 'success',
1 => 'warning',
3 => 'danger',
])
->live()
->afterStateUpdated(function ($state, callable $set) use ($permissionList) {
foreach ($permissionList as $resource) {
$set('permissions_' . $resource, $state);
}
})
->default(0),
]),
Fieldset::make('Permissions')
->columnSpanFull()
->schema(
collect($permissionList)->map(fn ($resource) => ToggleButtons::make('permissions_' . $resource)
collect(ApiKey::getPermissionList())->map(fn ($resource) => ToggleButtons::make('permissions_' . $resource)
->label(str($resource)->replace('_', ' ')->title())->inline()
->options([
0 => trans('admin/apikey.permissions.none'),

View File

@@ -101,7 +101,7 @@ class DatabaseHostResource extends Resource
->toolbarActions([
CreateAction::make(),
BulkActionGroup::make([
DeleteBulkAction::make('exclude_bulk_delete'),
DeleteBulkAction::make(),
]),
])
->emptyStateIcon(TablerIcon::Database)

View File

@@ -8,7 +8,6 @@ use App\Services\Databases\Hosts\HostCreationService;
use App\Traits\Filament\CanCustomizeHeaderActions;
use App\Traits\Filament\CanCustomizeHeaderWidgets;
use Exception;
use Filament\Actions\Action;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
@@ -46,17 +45,6 @@ class CreateDatabaseHost extends CreateRecord
$this->service = $service;
}
protected function getCreateFormAction(): Action
{
$hasFormWrapper = $this->hasFormWrapper();
return Action::make('exclude_create')
->label(trans('filament-panels::resources/pages/create-record.form.actions.create.label'))
->submit($hasFormWrapper ? $this->getSubmitFormLivewireMethodName() : null)
->action($hasFormWrapper ? null : $this->getSubmitFormLivewireMethodName())
->keyBindings(['mod+s']);
}
/** @return Step[]
* @throws Exception
*/

View File

@@ -175,8 +175,7 @@ class CreateEgg extends CreateRecord
->addActionLabel(trans('admin/egg.add_new_variable'))
->grid()
->relationship('variables')
->orderColumn()
->reorderAction(fn (Action $action) => $action->hiddenLabel()->tooltip(fn () => $action->getLabel()))
->reorderable()->orderColumn()
->collapsible()->collapsed()
->columnSpan(2)
->defaultItems(0)

View File

@@ -318,7 +318,6 @@ class EditEgg extends EditRecord
->helperText(trans('admin/egg.start_config_help')),
Textarea::make('config_files')->rows(10)->json()
->label(trans('admin/egg.config_files'))
->dehydrateStateUsing(fn ($state) => blank($state) ? '{}' : $state)
->helperText(trans('admin/egg.config_files_help')),
Textarea::make('config_logs')->rows(10)->json()
->label(trans('admin/egg.log_config'))
@@ -333,9 +332,9 @@ class EditEgg extends EditRecord
->hiddenLabel()
->grid()
->relationship('variables')
->orderColumn()
->reorderAction(fn (Action $action) => $action->hiddenLabel()->tooltip(fn () => $action->getLabel()))
->reorderable()
->collapsible()->collapsed()
->orderColumn()
->addActionLabel(trans('admin/egg.add_new_variable'))
->itemLabel(fn (array $state) => $state['name'])
->mutateRelationshipDataBeforeCreateUsing(function (array $data): array {
@@ -451,7 +450,17 @@ class EditEgg extends EditRecord
return [
DeleteAction::make()
->disabled(fn (Egg $egg): bool => $egg->servers()->count() > 0)
->tooltip(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? trans('filament-actions::delete.single.label') : trans('admin/egg.in_use')),
->tooltip(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? trans('filament-actions::delete.single.label') : trans('admin/egg.in_use'))
->successNotification(fn (Egg $egg) => Notification::make()
->success()
->title(trans('admin/egg.delete_success'))
->body(trans('admin/egg.deleted', ['egg' => $egg->name]))
)
->failureNotification(fn (Egg $egg) => Notification::make()
->danger()
->title(trans('admin/egg.delete_failed'))
->body(trans('admin/egg.could_not_delete', ['egg' => $egg->name]))
),
ExportEggAction::make(),
ImportEggAction::make()
->multiple(false),
@@ -485,20 +494,18 @@ class EditEgg extends EditRecord
],
]);
$normalizedExtension = match ($extension) {
'svg+xml', 'svg' => 'svg',
'jpeg', 'jpg' => 'jpg',
'png' => 'png',
'webp' => 'webp',
default => throw new Exception(trans('admin/egg.import.unknown_extension')),
};
$data = @file_get_contents($imageUrl, false, $context, 0, 1048576); // 1024KB
if (empty($data)) {
throw new Exception(trans('admin/egg.import.invalid_url'));
}
$normalizedExtension = match ($extension) {
'svg+xml' => 'svg',
'jpeg' => 'jpg',
default => $extension,
};
Storage::disk('public')->put(Egg::ICON_STORAGE_PATH . "/$egg->uuid.$normalizedExtension", $data);
}

View File

@@ -86,7 +86,7 @@ class ListEggs extends ListRecords
->multiple(),
CreateAction::make(),
BulkActionGroup::make([
DeleteBulkAction::make('exclude_bulk_delete')
DeleteBulkAction::make()
->before(function (Collection &$records) {
$eggsWithServers = $records->filter(fn (Egg $egg) => $egg->servers_count > 0);
@@ -106,7 +106,7 @@ class ListEggs extends ListRecords
$this->halt();
}
}),
UpdateEggBulkAction::make('exclude_bulk_update')
UpdateEggBulkAction::make()
->before(function (Collection &$records) {
$eggsWithoutUpdateUrl = $records->filter(fn (Egg $egg) => $egg->update_url === null);

View File

@@ -104,7 +104,7 @@ class MountResource extends Resource
->toolbarActions([
CreateAction::make(),
BulkActionGroup::make([
DeleteBulkAction::make('exclude_bulk_delete'),
DeleteBulkAction::make(),
]),
])
->emptyStateIcon(TablerIcon::LayersLinked)

View File

@@ -278,14 +278,6 @@ class CreateNode extends CreateRecord
->default(256)
->minValue(1)
->suffix(config('panel.use_binary_prefix') ? 'MiB' : 'MB'),
TextInput::make('daemon_base')
->label(trans('admin/node.daemon_base'))
->placeholder('/var/lib/pelican/volumes')
->hintIcon(TablerIcon::QuestionMark, trans('admin/node.daemon_base_help'))
->columnSpan(1)
->required()
->default('/var/lib/pelican/volumes')
->rule('regex:/^([\/][\d\w.\-\/]+)$/'),
TextInput::make('daemon_sftp')
->columnSpan(1)
->label(trans('admin/node.sftp_port'))
@@ -295,7 +287,7 @@ class CreateNode extends CreateRecord
->required()
->integer(),
TextInput::make('daemon_sftp_alias')
->columnSpan(1)
->columnSpan(2)
->label(trans('admin/node.sftp_alias'))
->helperText(trans('admin/node.sftp_alias_help')),
Grid::make()

View File

@@ -314,7 +314,7 @@ class EditNode extends EditRecord
'default' => 1,
'sm' => 1,
'md' => 2,
'lg' => 3,
'lg' => 2,
]),
TextInput::make('upload_size')
->columnSpan([
@@ -329,24 +329,12 @@ class EditNode extends EditRecord
->required()
->minValue(1)
->suffix(config('panel.use_binary_prefix') ? 'MiB' : 'MB'),
TextInput::make('daemon_base')
->label(trans('admin/node.daemon_base'))
->placeholder('/var/lib/pelican/volumes')
->hintIcon(TablerIcon::QuestionMark, trans('admin/node.daemon_base_help'))
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 2,
'lg' => 2,
])
->required()
->rule('regex:/^([\/][\d\w.\-\/]+)$/'),
TextInput::make('daemon_sftp')
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 2,
'lg' => 1,
'md' => 1,
'lg' => 3,
])
->label(trans('admin/node.sftp_port'))
->minValue(1)
@@ -358,8 +346,8 @@ class EditNode extends EditRecord
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 2,
'lg' => 2,
'md' => 1,
'lg' => 3,
])
->label(trans('admin/node.sftp_alias'))
->helperText(trans('admin/node.sftp_alias_help')),
@@ -368,7 +356,7 @@ class EditNode extends EditRecord
'default' => 1,
'sm' => 1,
'md' => 1,
'lg' => 2,
'lg' => 3,
])
->label(trans('admin/node.use_for_deploy'))
->inline()
@@ -386,7 +374,7 @@ class EditNode extends EditRecord
'default' => 1,
'sm' => 1,
'md' => 1,
'lg' => 2,
'lg' => 3,
])
->label(trans('admin/node.maintenance_mode'))
->inline()
@@ -584,7 +572,7 @@ class EditNode extends EditRecord
->columnSpanFull()
->schema([
Actions::make([
Action::make('exclude_autoDeploy')
Action::make('autoDeploy')
->label(trans('admin/node.auto_deploy'))
->color('primary')
->modalHeading(trans('admin/node.auto_deploy'))
@@ -622,7 +610,7 @@ class EditNode extends EditRecord
}),
])->fullWidth(),
Actions::make([
Action::make('exclude_resetKey')
Action::make('resetKey')
->label(trans('admin/node.reset_token'))
->color('danger')
->requiresConfirmation()
@@ -735,7 +723,7 @@ class EditNode extends EditRecord
$set('pulled', false);
$set('uploaded', true);
} catch (Exception $e) {
} catch (\Exception $e) {
Notification::make()
->title(trans('admin/node.diagnostics.upload_failed'))
->body($e->getMessage())

View File

@@ -4,7 +4,6 @@ namespace App\Filament\Admin\Resources\Nodes\Pages;
use App\Enums\TablerIcon;
use App\Filament\Admin\Resources\Nodes\NodeResource;
use App\Filament\Components\Tables\Columns\NodeClientHealthColumn;
use App\Filament\Components\Tables\Columns\NodeHealthColumn;
use App\Filament\Components\Tables\Filters\TagsFilter;
use App\Models\Node;
@@ -35,7 +34,6 @@ class ListNodes extends ListRecords
->searchable()
->hidden(),
NodeHealthColumn::make('health'),
NodeClientHealthColumn::make('reachable'),
TextColumn::make('name')
->label(trans('admin/node.table.name'))
->sortable()

View File

@@ -91,10 +91,7 @@ class AllocationsRelationManager extends RelationManager
->icon(TablerIcon::WorldPlus)
->schema(fn () => [
Select::make('allocation_ip')
->options(fn (Get $get) => collect($this->getOwnerRecord()->ipAddresses())
->when($get('allocation_ip'), fn ($ips, $current) => $ips->push($current))
->unique()
->mapWithKeys(fn (string $ip) => [$ip => $ip]))
->options(fn () => collect($this->getOwnerRecord()->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
->label(trans('admin/node.ip_address'))
->inlineLabel()
->ip()
@@ -103,25 +100,12 @@ class AllocationsRelationManager extends RelationManager
->live()
->hintAction(
Action::make('hint_refresh')
->hiddenLabel()
->icon(TablerIcon::Refresh)
->tooltip(trans('admin/node.refresh'))
->action(function () {
cache()->forget("nodes.{$this->getOwnerRecord()->id}.ips");
})
)
->suffixAction(
Action::make('custom_ip')
->icon(TablerIcon::Keyboard)
->tooltip(trans('admin/node.custom_ip'))
->schema([
TextInput::make('custom_ip')
->label(trans('admin/node.ip_address'))
->ip()
->required(),
])
->action(fn (array $data, Set $set) => $set('allocation_ip', $data['custom_ip']))
)
->required(),
TextInput::make('allocation_alias')
->label(trans('admin/node.table.alias'))

View File

@@ -5,9 +5,6 @@ namespace App\Filament\Admin\Resources\Plugins;
use App\Enums\PluginStatus;
use App\Enums\TablerIcon;
use App\Filament\Admin\Resources\Plugins\Pages\ListPlugins;
use App\Jobs\Plugin\InstallPlugin;
use App\Jobs\Plugin\UninstallPlugin;
use App\Jobs\Plugin\UpdatePlugin;
use App\Models\Plugin;
use App\Services\Helpers\PluginService;
use BackedEnum;
@@ -122,14 +119,15 @@ class PluginResource extends Resource
->icon(TablerIcon::Terminal)
->color('success')
->hidden(fn (Plugin $plugin) => $plugin->status !== PluginStatus::NotInstalled)
->action(function (Plugin $plugin) {
->action(function (Plugin $plugin, $livewire, PluginService $pluginService) {
try {
InstallPlugin::dispatch(user(), $plugin);
$pluginService->installPlugin($plugin, !$plugin->isTheme() || !$pluginService->hasThemePluginEnabled());
redirect(ListPlugins::getUrl(['tab' => $livewire->activeTab]));
Notification::make()
->success()
->title(trans('admin/plugin.notifications.install_started'))
->body(trans('admin/plugin.notifications.background_info'))
->title(trans('admin/plugin.notifications.installed'))
->send();
} catch (Exception $exception) {
Notification::make()
@@ -145,14 +143,15 @@ class PluginResource extends Resource
->icon(TablerIcon::Download)
->color('success')
->visible(fn (Plugin $plugin) => $plugin->status !== PluginStatus::NotInstalled && $plugin->isUpdateAvailable())
->action(function (Plugin $plugin) {
->action(function (Plugin $plugin, $livewire, PluginService $pluginService) {
try {
UpdatePlugin::dispatch(user(), $plugin);
$pluginService->updatePlugin($plugin);
redirect(ListPlugins::getUrl(['tab' => $livewire->activeTab]));
Notification::make()
->success()
->title(trans('admin/plugin.notifications.update_started'))
->body(trans('admin/plugin.notifications.background_info'))
->title(trans('admin/plugin.notifications.updated'))
->send();
} catch (Exception $exception) {
Notification::make()
@@ -203,7 +202,7 @@ class PluginResource extends Resource
->icon(TablerIcon::Trash)
->color('danger')
->requiresConfirmation()
->visible(fn (Plugin $plugin) => $plugin->status === PluginStatus::NotInstalled || $plugin->status === PluginStatus::Errored)
->visible(fn (Plugin $plugin) => $plugin->status === PluginStatus::NotInstalled)
->action(function (Plugin $plugin, $livewire, PluginService $pluginService) {
$pluginService->deletePlugin($plugin);
@@ -221,14 +220,15 @@ class PluginResource extends Resource
->color('danger')
->requiresConfirmation()
->hidden(fn (Plugin $plugin) => $plugin->status === PluginStatus::NotInstalled || $plugin->status === PluginStatus::Errored)
->action(function (Plugin $plugin) {
->action(function (Plugin $plugin, $livewire, PluginService $pluginService) {
try {
UninstallPlugin::dispatch(user(), $plugin);
$pluginService->uninstallPlugin($plugin);
redirect(ListPlugins::getUrl(['tab' => $livewire->activeTab]));
Notification::make()
->success()
->title(trans('admin/plugin.notifications.uninstall_started'))
->body(trans('admin/plugin.notifications.background_info'))
->title(trans('admin/plugin.notifications.uninstalled'))
->send();
} catch (Exception $exception) {
Notification::make()

View File

@@ -106,7 +106,7 @@ class RoleResource extends Resource
->toolbarActions([
CreateAction::make(),
BulkActionGroup::make([
DeleteBulkAction::make('exclude_bulk_delete'),
DeleteBulkAction::make(),
]),
])
->checkIfRecordIsSelectableUsing(fn (Role $role) => !$role->isRootAdmin() && $role->users_count <= 0);

View File

@@ -251,10 +251,7 @@ class CreateServer extends CreateRecord
return [
Select::make('allocation_ip')
->options(fn (Get $get) => collect(Node::find($getPage('node_id'))?->ipAddresses())
->when($get('allocation_ip'), fn ($ips, $current) => $ips->push($current))
->unique()
->mapWithKeys(fn (string $ip) => [$ip => $ip]))
->options(fn () => collect(Node::find($get('node_id'))?->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
->label(trans('admin/server.ip_address'))->inlineLabel()
->helperText(trans('admin/server.ip_address_helper'))
->afterStateUpdated(fn (Set $set) => $set('allocation_ports', []))
@@ -269,18 +266,6 @@ class CreateServer extends CreateRecord
cache()->forget("nodes.{$get('node_id')}.ips");
})
)
->suffixAction(
Action::make('custom_ip')
->icon(TablerIcon::Keyboard)
->tooltip(trans('admin/node.custom_ip'))
->schema([
TextInput::make('custom_ip')
->label(trans('admin/node.ip_address'))
->ip()
->required(),
])
->action(fn (array $data, Set $set) => $set('allocation_ip', $data['custom_ip']))
)
->required(),
TextInput::make('allocation_alias')
->label(trans('admin/server.alias'))->inlineLabel()

View File

@@ -121,7 +121,6 @@ class EditServer extends EditRecord
->columnSpan(2)
->alignJustify(),
Action::make('uploadIcon')
->hiddenLabel()
->icon(TablerIcon::PhotoUp)
->tooltip(trans('admin/server.import_image'))
->modal()
@@ -150,17 +149,17 @@ class EditServer extends EditRecord
try {
if (!in_array(parse_url($state, PHP_URL_SCHEME), ['http', 'https'], true)) {
throw new Exception(trans('admin/egg.import.invalid_url'));
throw new \Exception(trans('admin/egg.import.invalid_url'));
}
if (!filter_var($state, FILTER_VALIDATE_URL)) {
throw new Exception(trans('admin/egg.import.invalid_url'));
throw new \Exception(trans('admin/egg.import.invalid_url'));
}
$extension = strtolower(pathinfo(parse_url($state, PHP_URL_PATH), PATHINFO_EXTENSION));
if (!array_key_exists($extension, Server::IMAGE_FORMATS)) {
throw new Exception(trans('admin/egg.import.unsupported_format', ['format' => implode(', ', array_keys(Server::IMAGE_FORMATS))]));
throw new \Exception(trans('admin/egg.import.unsupported_format', ['format' => implode(', ', array_keys(Server::IMAGE_FORMATS))]));
}
$host = parse_url($state, PHP_URL_HOST);
@@ -169,14 +168,14 @@ class EditServer extends EditRecord
if (
filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false
) {
throw new Exception(trans('admin/egg.import.no_local_ip'));
throw new \Exception(trans('admin/egg.import.no_local_ip'));
}
$set('imageUrl', $state);
$set('imageExtension', $extension);
$set('image_url_error', null);
} catch (Exception $e) {
} catch (\Exception $e) {
$set('image_url_error', $e->getMessage());
$set('imageUrl', null);
$set('imageExtension', null);
@@ -321,7 +320,7 @@ class EditServer extends EditRecord
try {
$logs = $serverRepository->setServer($server)->getInstallLogs();
return convert_to_utf8($logs);
return mb_convert_encoding($logs, 'UTF-8', ['UTF-8', 'UTF-16', 'ISO-8859-1', 'ASCII']);
} catch (ConnectionException) {
Notification::make()
->title(trans('admin/server.notifications.error_connecting', ['node' => $server->node->name]))
@@ -936,7 +935,7 @@ class EditServer extends EditRecord
->send();
}
}),
Action::make('exclude_toggle_unsuspend')
Action::make('toggleUnsuspend')
->label(trans('admin/server.unsuspend'))
->color('success')
->hidden(fn (Server $server) => !$server->isSuspended())
@@ -1127,7 +1126,7 @@ class EditServer extends EditRecord
->hidden(fn () => $canForceDelete)
->authorize(fn (Server $server) => user()?->can('delete server', $server))
->icon(TablerIcon::Trash),
Action::make('exclude_force_delete')
Action::make('ForceDelete')
->color('danger')
->label(trans('filament-actions::force-delete.single.label'))
->modalHeading(trans('filament-actions::force-delete.single.modal.heading', ['label' => $this->getRecordTitle()]))
@@ -1219,20 +1218,18 @@ class EditServer extends EditRecord
],
]);
$normalizedExtension = match ($extension) {
'svg+xml', 'svg' => 'svg',
'jpeg', 'jpg' => 'jpg',
'png' => 'png',
'webp' => 'webp',
default => throw new Exception(trans('admin/egg.import.unknown_extension')),
};
$data = @file_get_contents($imageUrl, false, $context, 0, 262144); //256KB
if (empty($data)) {
throw new Exception(trans('admin/egg.import.invalid_url'));
throw new \Exception(trans('admin/egg.import.invalid_url'));
}
$normalizedExtension = match ($extension) {
'svg+xml' => 'svg',
'jpeg' => 'jpg',
default => $extension,
};
Storage::disk('public')->put(Server::ICON_STORAGE_PATH . "/$server->uuid.$normalizedExtension", $data);
}
}

View File

@@ -113,10 +113,7 @@ class AllocationsRelationManager extends RelationManager
->createAnother(false)
->schema(fn () => [
Select::make('allocation_ip')
->options(fn (Get $get) => collect($this->getOwnerRecord()->node->ipAddresses())
->when($get('allocation_ip'), fn ($ips, $current) => $ips->push($current))
->unique()
->mapWithKeys(fn (string $ip) => [$ip => $ip]))
->options(fn () => collect($this->getOwnerRecord()->node->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
->label(trans('admin/server.ip_address'))
->inlineLabel()
->ip()
@@ -129,18 +126,6 @@ class AllocationsRelationManager extends RelationManager
cache()->forget("nodes.{$this->getOwnerRecord()->node->id}.ips");
})
)
->suffixAction(
Action::make('custom_ip')
->icon(TablerIcon::Keyboard)
->tooltip(trans('admin/node.custom_ip'))
->schema([
TextInput::make('custom_ip')
->label(trans('admin/node.ip_address'))
->ip()
->required(),
])
->action(fn (array $data, Set $set) => $set('allocation_ip', $data['custom_ip']))
)
->afterStateUpdated(fn (Set $set) => $set('allocation_ports', []))
->required(),
TextInput::make('allocation_alias')

View File

@@ -142,7 +142,7 @@ class UserResource extends Resource
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make('exclude_bulk_delete'),
DeleteBulkAction::make(),
]),
CreateAction::make()
->hiddenLabel()

View File

@@ -114,7 +114,7 @@ class WebhookResource extends Resource
->toolbarActions([
CreateAction::make(),
BulkActionGroup::make([
DeleteBulkAction::make('exclude_bulk_delete'),
DeleteBulkAction::make(),
]),
])
->emptyStateIcon(TablerIcon::Webhook)

View File

@@ -16,15 +16,13 @@ class RotateDatabasePasswordAction extends Action
{
public static function getDefaultName(): ?string
{
return 'exclude_hint_rotate';
return 'hint_rotate';
}
protected function setUp(): void
{
parent::setUp();
$this->hiddenLabel();
$this->tooltip(trans('admin/databasehost.rotate'));
$this->icon(TablerIcon::Refresh);

View File

@@ -1,43 +0,0 @@
<?php
namespace App\Filament\Components\Tables\Columns;
use Filament\Support\Enums\Alignment;
use Filament\Tables\Columns\IconColumn;
use Illuminate\Support\Facades\Blade;
class NodeClientHealthColumn extends IconColumn
{
protected function setUp(): void
{
parent::setUp();
$this->label(trans('admin/node.table.reachable'));
$this->alignCenter();
}
public function toEmbeddedHtml(): string
{
$alignment = $this->getAlignment();
$attributes = $this->getExtraAttributeBag()
->class([
'fi-ta-icon',
'fi-inline' => $this->isInline(),
'fi-ta-icon-has-line-breaks' => $this->isListWithLineBreaks(),
'fi-wrapped' => $this->canWrap(),
($alignment instanceof Alignment) ? "fi-align-{$alignment->value}" : (is_string($alignment) ? $alignment : ''),
])
->toHtml();
return Blade::render(<<<'BLADE'
<div <?= $attributes ?>>
@livewire('node-client-connectivity', ['node' => $record, 'lazy' => true])
</div>
BLADE, [
'attributes' => $attributes,
'record' => $this->getRecord(),
]);
}
}

View File

@@ -254,7 +254,7 @@ class EditProfile extends BaseEditProfile
->columnSpanFull(),
])
->headerActions([
Action::make('exclude_create_api_key')
Action::make('create_api_key')
->label(trans('filament-actions::create.single.modal.actions.create.label'))
->disabled(fn (Get $get) => empty($get('description')))
->successRedirectUrl(self::getUrl(['tab' => 'api-keys::data::tab'], panel: 'app'))
@@ -343,7 +343,7 @@ class EditProfile extends BaseEditProfile
->live(),
])
->headerActions([
Action::make('exclude_create_ssh_key')
Action::make('create_ssh_key')
->label(trans('filament-actions::create.single.modal.actions.create.label'))
->disabled(fn (Get $get) => empty($get('name')) || empty($get('public_key')))
->successRedirectUrl(self::getUrl(['tab' => 'ssh-keys::data::tab'], panel: 'app'))
@@ -426,13 +426,13 @@ class EditProfile extends BaseEditProfile
->label(trans('profile.tabs.activity'))
->icon(TablerIcon::History)
->schema([
Repeater::make('activity') // TODO: move to a table
->label(trans('profile.activity_info'))
Repeater::make('activity')
->hiddenLabel()
->inlineLabel(false)
->deletable(false)
->addable(false)
->relationship(null, function (Builder $query) {
$query->orderBy('timestamp', 'desc')->limit(50);
$query->orderBy('timestamp', 'desc');
})
->schema([
TextEntry::make('log')
@@ -474,17 +474,6 @@ class EditProfile extends BaseEditProfile
false => 'Icon Button',
]),
]),
Section::make(trans('profile.admin'))
->collapsible()
->icon(TablerIcon::Shield)
->visible(fn (User $user) => $user->isAdmin())
->schema([
ToggleButtons::make('redirect_to_admin')
->label(trans('profile.redirect_to_admin'))
->helperText(trans('profile.redirect_to_admin_help'))
->inline()
->boolean(),
]),
Section::make(trans('profile.console'))
->collapsible()
->icon(TablerIcon::Terminal2)
@@ -610,7 +599,6 @@ class EditProfile extends BaseEditProfile
'dashboard_layout' => $data['dashboard_layout'],
'top_navigation' => $data['top_navigation'],
'button_style' => $data['button_style'],
'redirect_to_admin' => $data['redirect_to_admin'] ?? $this->getUser()->getCustomization(CustomizationKey::RedirectToAdmin),
];
unset(
@@ -620,7 +608,6 @@ class EditProfile extends BaseEditProfile
$data['dashboard_layout'],
$data['top_navigation'],
$data['button_style'],
$data['redirect_to_admin'],
);
$data['customization'] = json_encode($customization);
@@ -636,7 +623,6 @@ class EditProfile extends BaseEditProfile
$data['console_graph_period'] = (int) $this->getUser()->getCustomization(CustomizationKey::ConsoleGraphPeriod);
$data['dashboard_layout'] = $this->getUser()->getCustomization(CustomizationKey::DashboardLayout);
$data['button_style'] = $this->getUser()->getCustomization(CustomizationKey::ButtonStyle);
$data['redirect_to_admin'] = $this->getUser()->getCustomization(CustomizationKey::RedirectToAdmin);
// Handle migration from boolean to string navigation types
$topNavigation = $this->getUser()->getCustomization(CustomizationKey::TopNavigation);

View File

@@ -4,8 +4,6 @@ namespace App\Filament\Pages\Auth;
use App\Extensions\Captcha\CaptchaService;
use App\Extensions\OAuth\OAuthService;
use BladeUI\Icons\Exceptions\SvgNotFound;
use BladeUI\Icons\Factory as IconFactory;
use Filament\Actions\Action;
use Filament\Auth\Pages\Login as BaseLogin;
use Filament\Forms\Components\TextInput;
@@ -21,13 +19,10 @@ class Login extends BaseLogin
protected CaptchaService $captchaService;
protected IconFactory $iconFactory;
public function boot(OAuthService $oauthService, CaptchaService $captchaService, IconFactory $iconFactory): void
public function boot(OAuthService $oauthService, CaptchaService $captchaService): void
{
$this->oauthService = $oauthService;
$this->captchaService = $captchaService;
$this->iconFactory = $iconFactory;
}
public function form(Schema $schema): Schema
@@ -71,14 +66,6 @@ class Login extends BaseLogin
->extraInputAttributes(['tabindex' => 1]);
}
protected function getPasswordFormComponent(): Component
{
/** @var TextInput $component */
$component = parent::getPasswordFormComponent();
return $component->extraInputAttributes(['tabindex' => 2]);
}
protected function getOAuthFormComponent(): Component
{
$actions = [];
@@ -92,18 +79,9 @@ class Login extends BaseLogin
$color = $schema->getHexColor();
$color = is_string($color) ? Color::hex($color) : null;
$icon = $schema->getIcon();
if (is_string($icon)) {
try {
$this->iconFactory->svg($icon);
} catch (SvgNotFound) {
$icon = null;
}
}
$actions[] = Action::make("oauth_$id")
->label($schema->getName())
->icon($icon)
->icon($schema->getIcon())
->color($color)
->url(route('auth.oauth.redirect', ['driver' => $id], false));
}

View File

@@ -78,15 +78,11 @@ class Console extends Page
$feature = data_get($data, 'key');
$feature = $this->featureService->get($feature);
if (!$feature) {
if (!$feature || $this->getMountedAction()) {
return;
}
if ($this->getMountedAction()) {
$this->replaceMountedAction($feature->getId());
} else {
$this->mountAction($feature->getId());
}
$this->mountAction($feature->getId());
sleep(2); // TODO find a better way
}
public function getWidgetData(): array

View File

@@ -118,17 +118,17 @@ class Settings extends ServerFormPage
try {
if (!in_array(parse_url($state, PHP_URL_SCHEME), ['http', 'https'], true)) {
throw new Exception(trans('admin/egg.import.invalid_url'));
throw new \Exception(trans('admin/egg.import.invalid_url'));
}
if (!filter_var($state, FILTER_VALIDATE_URL)) {
throw new Exception(trans('admin/egg.import.invalid_url'));
throw new \Exception(trans('admin/egg.import.invalid_url'));
}
$extension = strtolower(pathinfo(parse_url($state, PHP_URL_PATH), PATHINFO_EXTENSION));
if (!array_key_exists($extension, Server::IMAGE_FORMATS)) {
throw new Exception(trans('admin/egg.import.unsupported_format', ['format' => implode(', ', array_keys(Server::IMAGE_FORMATS))]));
throw new \Exception(trans('admin/egg.import.unsupported_format', ['format' => implode(', ', array_keys(Server::IMAGE_FORMATS))]));
}
$host = parse_url($state, PHP_URL_HOST);
@@ -137,14 +137,14 @@ class Settings extends ServerFormPage
if (
filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false
) {
throw new Exception(trans('admin/egg.import.no_local_ip'));
throw new \Exception(trans('admin/egg.import.no_local_ip'));
}
$set('imageUrl', $state);
$set('imageExtension', $extension);
$set('image_url_error', null);
} catch (Exception $e) {
} catch (\Exception $e) {
$set('image_url_error', $e->getMessage());
$set('imageUrl', null);
$set('imageExtension', null);
@@ -462,20 +462,18 @@ class Settings extends ServerFormPage
],
]);
$normalizedExtension = match ($extension) {
'svg+xml', 'svg' => 'svg',
'jpeg', 'jpg' => 'jpg',
'png' => 'png',
'webp' => 'webp',
default => throw new Exception(trans('admin/egg.import.unknown_extension')),
};
$data = @file_get_contents($imageUrl, false, $context, 0, 262144); //256KB
if (empty($data)) {
throw new Exception(trans('admin/egg.import.invalid_url'));
throw new \Exception(trans('admin/egg.import.invalid_url'));
}
$normalizedExtension = match ($extension) {
'svg+xml' => 'svg',
'jpeg' => 'jpg',
default => $extension,
};
Storage::disk('public')->put(Server::ICON_STORAGE_PATH . "/$server->uuid.$normalizedExtension", $data);
}

View File

@@ -139,7 +139,6 @@ class ActivityResource extends Resource
]);
}
/** @return Builder<ActivityLog> */
public static function getEloquentQuery(): Builder
{
/** @var Server $server */

View File

@@ -27,6 +27,7 @@ use BackedEnum;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Facades\Filament;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Textarea;
@@ -76,7 +77,7 @@ class BackupResource extends Resource
/** @var Server $server */
$server = Filament::getTenant();
return $server->backup_limit ?? 0;
return $server->backup_limit;
}
public static function defaultForm(Schema $schema): Schema
@@ -127,7 +128,7 @@ class BackupResource extends Resource
])
->recordActions([
ActionGroup::make([
Action::make('exclude_rename')
Action::make('rename')
->icon(TablerIcon::Pencil)
->authorize(fn () => user()?->can(SubuserPermission::BackupDelete, $server))
->label(trans('server/backup.actions.rename.title'))
@@ -157,14 +158,14 @@ class BackupResource extends Resource
->send();
})
->visible(fn (Backup $backup) => $backup->status === BackupStatus::Successful),
Action::make('exclude_lock')
Action::make('lock')
->iconSize(IconSize::Large)
->icon(fn (Backup $backup) => !$backup->is_locked ? TablerIcon::Lock : TablerIcon::LockOpen)
->authorize(fn () => user()?->can(SubuserPermission::BackupDelete, $server))
->label(fn (Backup $backup) => !$backup->is_locked ? trans('server/backup.actions.lock.lock') : trans('server/backup.actions.lock.unlock'))
->action(fn (BackupController $backupController, Backup $backup, Request $request) => $backupController->toggleLock($request, $server, $backup))
->visible(fn (Backup $backup) => $backup->status === BackupStatus::Successful),
Action::make('exclude_download')
Action::make('download')
->label(trans('server/backup.actions.download'))
->iconSize(IconSize::Large)
->color('primary')
@@ -172,7 +173,7 @@ class BackupResource extends Resource
->authorize(fn () => user()?->can(SubuserPermission::BackupDownload, $server))
->url(fn (DownloadLinkService $downloadLinkService, Backup $backup, Request $request) => $downloadLinkService->handle($backup, $request->user()), true)
->visible(fn (Backup $backup) => $backup->status === BackupStatus::Successful),
Action::make('exclude_restore')
Action::make('restore')
->label(trans('server/backup.actions.restore.title'))
->iconSize(IconSize::Large)
->color('success')
@@ -225,12 +226,7 @@ class BackupResource extends Resource
->send();
})
->visible(fn (Backup $backup) => $backup->status === BackupStatus::Successful),
Action::make('exclude_delete')
->icon(TablerIcon::Trash)
->color('danger')
->requiresConfirmation()
->authorize(fn () => user()?->can(SubuserPermission::BackupDelete, $server))
->label(trans('filament-actions::delete.single.label'))
DeleteAction::make('delete')
->iconSize(IconSize::Large)
->disabled(fn (Backup $backup) => $backup->is_locked && $backup->status !== BackupStatus::Failed)
->modalDescription(fn (Backup $backup) => trans('server/backup.actions.delete.description', ['backup' => $backup->name]))

View File

@@ -62,7 +62,7 @@ class DatabaseResource extends Resource
/** @var Server $server */
$server = Filament::getTenant();
return $server->database_limit ?? 0;
return $server->database_limit;
}
/**

View File

@@ -149,7 +149,7 @@ class EditFiles extends Page
try {
$contents = $this->getDaemonFileRepository()->getContent($this->path, config('panel.files.max_edit_size'));
return convert_to_utf8($contents);
return mb_convert_encoding($contents, 'UTF-8', ['UTF-8', 'UTF-16', 'ISO-8859-1', 'ASCII']);
} catch (FileSizeTooLargeException) {
AlertBanner::make('file_too_large')
->title(trans('server/file.alerts.file_too_large.title', ['name' => basename($this->path)]))
@@ -259,9 +259,9 @@ class EditFiles extends Page
return $this->fileRepository;
}
public static function getUrl(array $parameters = [], bool $isAbsolute = true, ?string $panel = null, ?Model $tenant = null, bool $shouldGuessMissingParameters = false, ?string $configuration = null): string
public static function getUrl(array $parameters = [], bool $isAbsolute = true, ?string $panel = null, ?Model $tenant = null, bool $shouldGuessMissingParameters = false): string
{
return parent::getUrl($parameters, $isAbsolute, $panel, $tenant, $shouldGuessMissingParameters, $configuration) . '/';
return parent::getUrl($parameters, $isAbsolute, $panel, $tenant) . '/';
}
public static function route(string $path): PageRegistration

View File

@@ -209,18 +209,16 @@ class ListFiles extends ListRecords
->required()
->live(),
TextEntry::make('new_location')
->state(fn (Get $get, File $file) => resolve_path(join_paths($this->path, str_ends_with($get('location') ?? '/', '/') ? join_paths($get('location') ?? '/', $file->name) : $get('location') ?? '/'))),
->state(fn (Get $get, File $file) => resolve_path(join_paths($this->path, $get('location') ?? '/', $file->name))),
])
->action(function ($data, File $file) {
$location = $data['location'];
$endsWithSlash = str_ends_with($location, '/');
$to = $endsWithSlash ? join_paths($location, $file->name) : $location;
$files = [['to' => $to, 'from' => $file->name]];
$files = [['to' => join_paths($location, $file->name), 'from' => $file->name]];
$this->getDaemonFileRepository()->renameFiles($this->path, $files);
$oldLocation = join_paths($this->path, $file->name);
$newLocation = resolve_path(join_paths($this->path, $to));
$newLocation = resolve_path(join_paths($this->path, $location, $file->name));
Activity::event('server:file.rename')
->property('directory', $this->path)

View File

@@ -8,7 +8,6 @@ use App\Models\Schedule;
use App\Models\Server;
use App\Traits\Filament\CanCustomizeHeaderActions;
use App\Traits\Filament\CanCustomizeHeaderWidgets;
use Filament\Actions\Action;
use Filament\Facades\Filament;
use Filament\Resources\Pages\CreateRecord;
@@ -21,17 +20,6 @@ class CreateSchedule extends CreateRecord
protected static bool $canCreateAnother = false;
protected function getCreateFormAction(): Action
{
$hasFormWrapper = $this->hasFormWrapper();
return Action::make('exclude_create')
->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'))
->submit($hasFormWrapper ? $this->getSubmitFormLivewireMethodName() : null)
->action($hasFormWrapper ? null : $this->getSubmitFormLivewireMethodName())
->keyBindings(['mod+s']);
}
protected function afterCreate(): void
{
/** @var Schedule $schedule */

View File

@@ -7,7 +7,6 @@ use App\Facades\Activity;
use App\Models\Schedule;
use App\Models\Task;
use Exception;
use Filament\Actions\Action;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
@@ -74,7 +73,6 @@ class TasksRelationManager extends RelationManager
return $table
->reorderable('sequence_id')
->defaultSort('sequence_id')
->reorderRecordsTriggerAction(fn (Action $action, bool $isReordering) => $action->hiddenLabel()->tooltip(fn () => $action->getLabel()))
->columns([
TextColumn::make('action')
->label(trans('server/schedule.tasks.actions.title'))

View File

@@ -97,7 +97,8 @@ class ScheduleResource extends Resource
->formatStateUsing(fn (?Schedule $schedule) => $schedule?->status->value ?? 'new')
->options(fn (?Schedule $schedule) => [$schedule?->status->value ?? 'new' => $schedule?->status->getLabel() ?? 'New'])
->visibleOn('view'),
Section::make(trans('server/schedule.cron'))
Section::make('Cron')
->label(trans('server/schedule.cron'))
->description(function (Get $get) {
try {
$nextRun = Utilities::getScheduleNextRunDate($get('cron_minute'), $get('cron_hour'), $get('cron_day_of_month'), $get('cron_month'), $get('cron_day_of_week'))->timezone(user()->timezone ?? 'UTC');
@@ -109,22 +110,22 @@ class ScheduleResource extends Resource
})
->schema([
Actions::make([
CronPresetAction::make('exclude_hourly')
CronPresetAction::make('hourly')
->label(trans('server/schedule.time.hourly'))
->cron('0', '*', '*', '*', '*'),
CronPresetAction::make('exclude_daily')
CronPresetAction::make('daily')
->label(trans('server/schedule.time.daily'))
->cron('0', '0', '*', '*', '*'),
CronPresetAction::make('exclude_weekly_monday')
CronPresetAction::make('weekly_monday')
->label(trans('server/schedule.time.weekly_mon'))
->cron('0', '0', '*', '*', '1'),
CronPresetAction::make('exclude_weekly_sunday')
CronPresetAction::make('weekly_sunday')
->label(trans('server/schedule.time.weekly_sun'))
->cron('0', '0', '*', '*', '0'),
CronPresetAction::make('exclude_monthly')
CronPresetAction::make('monthly')
->label(trans('server/schedule.time.monthly'))
->cron('0', '0', '1', '*', '*'),
CronPresetAction::make('exclude_every_x_minutes')
CronPresetAction::make('every_x_minutes')
->label(trans('server/schedule.time.every_min'))
->color(fn (Get $get) => str($get('cron_minute'))->startsWith('*/')
&& $get('cron_hour') == '*'
@@ -147,7 +148,7 @@ class ScheduleResource extends Resource
$set('cron_month', '*');
$set('cron_day_of_week', '*');
}),
CronPresetAction::make('exclude_every_x_hours')
CronPresetAction::make('every_x_hours')
->color(fn (Get $get) => $get('cron_minute') == '0'
&& str($get('cron_hour'))->startsWith('*/')
&& $get('cron_day_of_month') == '*'
@@ -169,7 +170,7 @@ class ScheduleResource extends Resource
$set('cron_month', '*');
$set('cron_day_of_week', '*');
}),
CronPresetAction::make('exclude_every_x_days')
CronPresetAction::make('every_x_days')
->color(fn (Get $get) => $get('cron_minute') == '0'
&& $get('cron_hour') == '0'
&& str($get('cron_day_of_month'))->startsWith('*/')
@@ -191,7 +192,7 @@ class ScheduleResource extends Resource
$set('cron_month', '*');
$set('cron_day_of_week', '*');
}),
CronPresetAction::make('exclude_every_x_months')
CronPresetAction::make('every_x_months')
->color(fn (Get $get) => $get('cron_minute') == '0'
&& $get('cron_hour') == '0'
&& $get('cron_day_of_month') == '1'
@@ -213,7 +214,7 @@ class ScheduleResource extends Resource
$set('cron_month', '*/' . $data['x']);
$set('cron_day_of_week', '*');
}),
CronPresetAction::make('exclude_every_x_day_of_week')
CronPresetAction::make('every_x_day_of_week')
->color(fn (Get $get) => $get('cron_minute') == '0'
&& $get('cron_hour') == '0'
&& $get('cron_day_of_month') == '*'

View File

@@ -123,6 +123,18 @@ class SubuserResource extends Resource
),
])
->recordActions([
DeleteAction::make()
->label(trans('server/user.delete'))
->hidden(fn (Subuser $subuser) => user()?->id === $subuser->user->id)
->successNotificationTitle(null)
->action(function (Subuser $subuser, SubuserDeletionService $subuserDeletionService) use ($server) {
$subuserDeletionService->handle($subuser, $server);
Notification::make()
->title(trans('server/user.notification_delete'))
->success()
->send();
}),
EditAction::make()
->label(trans('server/user.edit'))
->hidden(fn (Subuser $subuser) => user()?->id === $subuser->user->id)
@@ -167,7 +179,7 @@ class SubuserResource extends Resource
])
->formatStateUsing(fn (Subuser $subuser) => $subuser->user->email),
Actions::make([
Action::make('exclude_assignAll')
Action::make('assignAll')
->label(trans('server/user.assign_all'))
->action(function (Set $set) use ($permissionsArray) {
$permissions = $permissionsArray;
@@ -202,19 +214,6 @@ class SubuserResource extends Resource
return $data;
}),
DeleteAction::make()
->label(trans('server/user.delete'))
->hidden(fn (Subuser $subuser) => user()?->id === $subuser->user->id)
->authorize(fn () => user()?->can(SubuserPermission::UserDelete, $server))
->successNotificationTitle(null)
->action(function (Subuser $subuser, SubuserDeletionService $subuserDeletionService) use ($server) {
$subuserDeletionService->handle($subuser, $server);
Notification::make()
->title(trans('server/user.notification_delete'))
->success()
->send();
}),
])
->toolbarActions([
CreateAction::make('invite')
@@ -244,7 +243,7 @@ class SubuserResource extends Resource
])
->required(),
Actions::make([
Action::make('exclude_assignAll')
Action::make('assignAll')
->label(trans('server/user.assign_all'))
->action(function (Set $set, Get $get) use ($permissionsArray) {
$permissions = $permissionsArray;

View File

@@ -77,7 +77,7 @@ class FileController extends ClientApiController
->property('file', $request->get('file'))
->log();
return new Response(convert_to_utf8($response), Response::HTTP_OK, ['Content-Type' => 'text/plain; charset=utf-8']);
return new Response($response, Response::HTTP_OK, ['Content-Type' => 'text/plain']);
}
/**

View File

@@ -74,7 +74,7 @@ class OAuthController extends Controller
$email = $oauthUser->getEmail();
if (!$email) {
return $this->errorRedirect('No email was linked to your account on the OAuth provider.');
return $this->errorRedirect();
}
$user = User::whereEmail($email)->first();

View File

@@ -23,7 +23,7 @@ class RequireTwoFactorAuthentication
* order to perform actions. If so, we check the level at which it is required (all users
* or just admins) and then check if the user has enabled it for their account.
*
* @throws TwoFactorAuthRequiredException
* @throws \App\Exceptions\Http\TwoFactorAuthRequiredException
*/
public function handle(Request $request, \Closure $next): mixed
{

View File

@@ -87,7 +87,7 @@ abstract class ApplicationApiRequest extends FormRequest
$value = $this->route()->parameter($key);
Assert::isInstanceOf($value, $expect);
Assert::isInstanceOf($value, Model::class); // @phpstan-ignore staticMethod.alreadyNarrowedType
Assert::isInstanceOf($value, Model::class);
Assert::true($value->exists);
/* @var T $value */

View File

@@ -3,7 +3,6 @@
namespace App\Http\Requests\Api\Remote;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ReportBackupCompleteRequest extends FormRequest
{
@@ -11,37 +10,13 @@ class ReportBackupCompleteRequest extends FormRequest
public function rules(): array
{
return [
'successful' => [
'required',
'boolean',
],
'checksum' => [
'nullable',
'string',
Rule::requiredIf(fn () => $this->boolean('successful')),
],
'checksum_type' => [
'nullable',
'string',
Rule::requiredIf(fn () => $this->boolean('successful')),
],
'size' => [
'nullable',
'numeric',
Rule::requiredIf(fn () => $this->boolean('successful')),
],
'parts' => [
'nullable',
'array',
],
'parts.*.etag' => [
'required',
'string',
],
'parts.*.part_number' => [
'required',
'numeric',
],
'successful' => 'required|boolean',
'checksum' => 'nullable|string|required_if:successful,true',
'checksum_type' => 'nullable|string|required_if:successful,true',
'size' => 'nullable|numeric|required_if:successful,true',
'parts' => 'nullable|array',
'parts.*.etag' => 'required|string',
'parts.*.part_number' => 'required|numeric',
];
}
}

View File

@@ -3,7 +3,6 @@
namespace App\Http\Requests\Api\Remote;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class SftpAuthenticationFormRequest extends FormRequest
{
@@ -23,10 +22,7 @@ class SftpAuthenticationFormRequest extends FormRequest
public function rules(): array
{
return [
'type' => [
'nullable',
Rule::in(['password', 'public_key']),
],
'type' => ['nullable', 'in:password,public_key'],
'username' => ['required', 'string'],
'password' => ['required', 'string'],
];

View File

@@ -1,25 +0,0 @@
<?php
namespace App\Http\Responses;
use App\Enums\CustomizationKey;
use App\Models\User;
use Filament\Auth\Http\Responses\Contracts\LoginResponse as LoginResponseContract;
use Filament\Facades\Filament;
use Illuminate\Http\RedirectResponse;
use Livewire\Features\SupportRedirects\Redirector;
class LoginResponse implements LoginResponseContract
{
public function toResponse($request): RedirectResponse|Redirector
{
/** @var User|null $user */
$user = Filament::auth()->user();
if ($user?->getCustomization(CustomizationKey::RedirectToAdmin) && $user->canAccessPanel(Filament::getPanel('admin'))) {
return redirect()->intended(Filament::getPanel('admin')->getUrl());
}
return redirect()->intended(Filament::getUrl());
}
}

View File

@@ -1,55 +0,0 @@
<?php
namespace App\Jobs\Plugin;
use App\Filament\Admin\Resources\Plugins\Pages\ListPlugins;
use App\Models\Plugin;
use App\Models\User;
use App\Services\Helpers\PluginService;
use Exception;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class InstallPlugin implements ShouldBeUnique, ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(public User $user, public Plugin $plugin) {}
public function handle(PluginService $pluginService): void
{
try {
$pluginService->installPlugin($this->plugin, !$this->plugin->isTheme() || !$pluginService->hasThemePluginEnabled());
Notification::make()
->success()
->title(trans('admin/plugin.notifications.installed'))
->body($this->plugin->name)
->actions([
Action::make('goto_plugins')
->label(trans('admin/plugin.notifications.goto_plugins'))
->url(ListPlugins::getUrl(panel: 'admin')),
])
->sendToDatabase($this->user);
} catch (Exception $exception) {
report($exception);
Notification::make()
->danger()
->title(trans('admin/plugin.notifications.install_error'))
->body($exception->getMessage())
->sendToDatabase($this->user);
}
}
public function uniqueId(): string
{
return 'plugin:install:' . $this->plugin->id;
}
}

View File

@@ -1,55 +0,0 @@
<?php
namespace App\Jobs\Plugin;
use App\Filament\Admin\Resources\Plugins\Pages\ListPlugins;
use App\Models\Plugin;
use App\Models\User;
use App\Services\Helpers\PluginService;
use Exception;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class UninstallPlugin implements ShouldBeUnique, ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(public User $user, public Plugin $plugin) {}
public function handle(PluginService $pluginService): void
{
try {
$pluginService->uninstallPlugin($this->plugin);
Notification::make()
->success()
->title(trans('admin/plugin.notifications.uninstalled'))
->body($this->plugin->name)
->actions([
Action::make('goto_plugins')
->label(trans('admin/plugin.notifications.goto_plugins'))
->url(ListPlugins::getUrl(panel: 'admin')),
])
->sendToDatabase($this->user);
} catch (Exception $exception) {
report($exception);
Notification::make()
->danger()
->title(trans('admin/plugin.notifications.uninstall_error'))
->body($exception->getMessage())
->sendToDatabase($this->user);
}
}
public function uniqueId(): string
{
return 'plugin:uninstall:' . $this->plugin->id;
}
}

View File

@@ -1,55 +0,0 @@
<?php
namespace App\Jobs\Plugin;
use App\Filament\Admin\Resources\Plugins\Pages\ListPlugins;
use App\Models\Plugin;
use App\Models\User;
use App\Services\Helpers\PluginService;
use Exception;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class UpdatePlugin implements ShouldBeUnique, ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(public User $user, public Plugin $plugin) {}
public function handle(PluginService $pluginService): void
{
try {
$pluginService->updatePlugin($this->plugin);
Notification::make()
->success()
->title(trans('admin/plugin.notifications.updated'))
->body($this->plugin->name)
->actions([
Action::make('goto_plugins')
->label(trans('admin/plugin.notifications.goto_plugins'))
->url(ListPlugins::getUrl(panel: 'admin')),
])
->sendToDatabase($this->user);
} catch (Exception $exception) {
report($exception);
Notification::make()
->danger()
->title(trans('admin/plugin.notifications.update_error'))
->body($exception->getMessage())
->sendToDatabase($this->user);
}
}
public function uniqueId(): string
{
return 'plugin:update:' . $this->plugin->id;
}
}

View File

@@ -34,10 +34,6 @@ class ProcessWebhook implements ShouldQueue
$data = reset($data);
}
if (is_object($data)) {
$data = get_object_vars($data);
}
if (is_string($data)) {
$data = Arr::wrap(json_decode($data, true) ?? []);
}

View File

@@ -10,7 +10,6 @@ use Filament\Notifications\Concerns\HasStatus;
use Filament\Notifications\Concerns\HasTitle;
use Filament\Support\Components\ViewComponent;
use Illuminate\Contracts\Support\Arrayable;
use Livewire\Livewire;
final class AlertBanner extends ViewComponent implements Arrayable
{
@@ -84,13 +83,7 @@ final class AlertBanner extends ViewComponent implements Arrayable
public function send(): AlertBanner
{
$data = $this->toArray();
if (Livewire::isLivewireRequest()) {
$data['from_livewire'] = true;
}
session()->push('alert-banners', $data);
session()->push('alert-banners', $this->toArray());
return $this;
}

View File

@@ -1,15 +0,0 @@
<?php
namespace App\Livewire;
use Filament\Notifications\Collection;
class AlertBannerCollection extends Collection
{
public static function fromLivewire($value): static
{
return (new static($value))->transform(
fn (array $alertBanner): AlertBanner => AlertBanner::fromArray($alertBanner),
);
}
}

View File

@@ -2,35 +2,25 @@
namespace App\Livewire;
use Filament\Notifications\Collection;
use Illuminate\Contracts\View\View;
use Livewire\Attributes\On;
use Livewire\Component;
class AlertBannerContainer extends Component
{
public AlertBannerCollection $alertBanners;
public Collection $alertBanners;
public function mount(): void
{
$this->alertBanners = new AlertBannerCollection();
foreach (session()->pull('alert-banners', []) as $alertBanner) {
// Alerts created during Livewire requests should have been consumed by the event handler on the same page.
if (!empty($alertBanner['from_livewire'])) {
// If they weren't, then discard them instead of showing on the wrong page.
continue;
}
$alertBanner = AlertBanner::fromArray($alertBanner);
$this->alertBanners->put($alertBanner->getId(), $alertBanner);
}
$this->alertBanners = new Collection();
$this->pullFromSession();
}
#[On('alertBannerSent')]
public function pullFromSession(): void
{
foreach (session()->pull('alert-banners', []) as $alertBanner) {
unset($alertBanner['from_livewire']);
$alertBanner = AlertBanner::fromArray($alertBanner);
$this->alertBanners->put($alertBanner->getId(), $alertBanner);
}

View File

@@ -1,95 +0,0 @@
<?php
namespace App\Livewire;
use App\Enums\TablerIcon;
use App\Models\Node;
use App\Services\Nodes\NodeJWTService;
use App\Services\Servers\GetUserPermissionsService;
use Filament\Support\Enums\IconSize;
use Filament\Tables\View\Components\Columns\IconColumnComponent\IconComponent;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\ComponentAttributeBag;
use Livewire\Attributes\Locked;
use Livewire\Component;
use function Filament\Support\generate_icon_html;
class NodeClientConnectivity extends Component
{
#[Locked]
public Node $node;
private GetUserPermissionsService $getUserPermissionsService;
private NodeJWTService $nodeJWTService;
public function boot(GetUserPermissionsService $getUserPermissionsService, NodeJWTService $nodeJWTService): void
{
$this->getUserPermissionsService = $getUserPermissionsService;
$this->nodeJWTService = $nodeJWTService;
}
public function render(): View
{
$httpUrl = $this->node->getConnectionAddress();
$wsUrl = null;
$wsToken = null;
$server = $this->node->servers()->first();
if ($server) {
$user = Auth::user();
$permissions = $this->getUserPermissionsService->handle($server, $user);
$wsToken = $this->nodeJWTService
->setExpiresAt(now()->addMinute()->toImmutable())
->setUser($user)
->setClaims([
'server_uuid' => $server->uuid,
'permissions' => $permissions,
])
->handle($this->node, $user->id . $server->uuid)->toString();
$wsUrl = str_replace(['https://', 'http://'], ['wss://', 'ws://'], $this->node->getConnectionAddress());
$wsUrl .= sprintf('/api/servers/%s/ws', $server->uuid);
}
return view('livewire.node-client-connectivity', [
'httpUrl' => $httpUrl,
'wsUrl' => $wsUrl,
'wsToken' => $wsToken,
'loadingIcon' => $this->makeIcon(TablerIcon::WorldQuestion, 'warning', 'Checking...'),
'offlineIcon' => $this->makeIcon(TablerIcon::WorldX, 'danger', 'Node is not reachable from your browser'),
'onlineIcon' => $this->makeIcon(TablerIcon::WorldCheck, 'success', 'Node is reachable'),
'warningIcon' => $this->makeIcon(TablerIcon::WorldExclamation, 'warning', 'Node is reachable, but WebSocket failed. Check reverse proxy config.'),
'onlineNoWsIcon' => $this->makeIcon(TablerIcon::WorldCheck, 'success', 'Node is reachable (WebSocket not tested — no servers)'),
]);
}
private function makeIcon(TablerIcon $icon, string $color, string $tooltip): string
{
return generate_icon_html($icon, attributes: (new ComponentAttributeBag())
->merge([
'x-tooltip' => '{
content: "' . $tooltip . '",
theme: $store.theme,
allowHTML: true,
placement: "bottom",
}',
'style' => 'color: var(--dark-text, var(--text))',
], escape: false)
->color(IconComponent::class, $color), size: IconSize::Large)
->toHtml();
}
public function placeholder(): string
{
return generate_icon_html(TablerIcon::WorldQuestion, attributes: (new ComponentAttributeBag())
->color(IconComponent::class, 'warning'), size: IconSize::Large)
->toHtml();
}
}

View File

@@ -6,6 +6,7 @@ use App\Enums\TablerIcon;
use App\Events\ActivityLogged;
use App\Traits\HasValidation;
use BackedEnum;
use Carbon\Carbon;
use Filament\Facades\Filament;
use Filament\Support\Contracts\HasIcon;
use Filament\Support\Contracts\HasLabel;
@@ -16,7 +17,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Str;
@@ -31,28 +31,28 @@ use LogicException;
* @property string|null $description
* @property string|null $actor_type
* @property int|null $actor_id
* @property Collection<array-key, mixed> $properties
* @property Carbon $timestamp
* @property int|null $api_key_id
* @property-read Model|\Eloquent|null $actor
* @property-read ApiKey|null $apiKey
* @property-read \Illuminate\Database\Eloquent\Collection<int, ActivityLogSubject> $subjects
* @property-read int|null $subjects_count
* @property Collection|null $properties
* @property \Carbon\Carbon $timestamp
* @property Model|\Eloquent $actor
* @property \Illuminate\Database\Eloquent\Collection|ActivityLogSubject[] $subjects
* @property int|null $subjects_count
* @property ApiKey|null $apiKey
*
* @method static Builder<static>|ActivityLog forActor(\Illuminate\Database\Eloquent\Model $actor)
* @method static Builder<static>|ActivityLog forEvent(string $action)
* @method static Builder<static>|ActivityLog newModelQuery()
* @method static Builder<static>|ActivityLog newQuery()
* @method static Builder<static>|ActivityLog query()
* @method static Builder<static>|ActivityLog whereActorId($value)
* @method static Builder<static>|ActivityLog whereActorType($value)
* @method static Builder<static>|ActivityLog whereApiKeyId($value)
* @method static Builder<static>|ActivityLog whereDescription($value)
* @method static Builder<static>|ActivityLog whereEvent($value)
* @method static Builder<static>|ActivityLog whereId($value)
* @method static Builder<static>|ActivityLog whereIp($value)
* @method static Builder<static>|ActivityLog whereProperties($value)
* @method static Builder<static>|ActivityLog whereTimestamp($value)
* @method static Builder|ActivityLog forActor(Model $actor)
* @method static Builder|ActivityLog forEvent(string $action)
* @method static Builder|ActivityLog newModelQuery()
* @method static Builder|ActivityLog newQuery()
* @method static Builder|ActivityLog query()
* @method static Builder|ActivityLog whereActorId($value)
* @method static Builder|ActivityLog whereActorType($value)
* @method static Builder|ActivityLog whereApiKeyId($value)
* @method static Builder|ActivityLog whereDescription($value)
* @method static Builder|ActivityLog whereEvent($value)
* @method static Builder|ActivityLog whereId($value)
* @method static Builder|ActivityLog whereIp($value)
* @method static Builder|ActivityLog whereProperties($value)
* @method static Builder|ActivityLog whereTimestamp($value)
*/
class ActivityLog extends Model implements HasIcon, HasLabel
{

View File

@@ -14,18 +14,14 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
*
* @property int $id
* @property int $activity_log_id
* @property string $subject_type
* @property int $subject_id
* @property-read ActivityLog $activityLog
* @property-read Model|\Eloquent $subject
* @property string $subject_type
* @property ActivityLog|null $activityLog
* @property Model|\Eloquent $subject
*
* @method static Builder<static>|ActivityLogSubject newModelQuery()
* @method static Builder<static>|ActivityLogSubject newQuery()
* @method static Builder<static>|ActivityLogSubject query()
* @method static Builder<static>|ActivityLogSubject whereActivityLogId($value)
* @method static Builder<static>|ActivityLogSubject whereId($value)
* @method static Builder<static>|ActivityLogSubject whereSubjectId($value)
* @method static Builder<static>|ActivityLogSubject whereSubjectType($value)
* @method static Builder|ActivityLogSubject newModelQuery()
* @method static Builder|ActivityLogSubject newQuery()
* @method static Builder|ActivityLogSubject query()
*/
class ActivityLogSubject extends Pivot
{

View File

@@ -4,12 +4,13 @@ namespace App\Models;
use App\Exceptions\Service\Allocation\ServerUsingAllocationException;
use App\Traits\HasValidation;
use Carbon\Carbon;
use Database\Factories\AllocationFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;
/**
* App\Models\Allocation.
@@ -17,33 +18,32 @@ use Illuminate\Support\Carbon;
* @property int $id
* @property int $node_id
* @property string $ip
* @property string|null $ip_alias
* @property int $port
* @property int|null $server_id
* @property string|null $notes
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $ip_alias
* @property string|null $notes
* @property string $alias
* @property bool $has_alias
* @property string $address
* @property Server|null $server
* @property Node $node
* @property bool $is_locked
* @property-read string $address
* @property-read string $alias
* @property-read bool $has_alias
* @property-read Node $node
* @property-read Server|null $server
*
* @method static \Database\Factories\AllocationFactory factory($count = null, $state = [])
* @method static Builder<static>|Allocation newModelQuery()
* @method static Builder<static>|Allocation newQuery()
* @method static Builder<static>|Allocation query()
* @method static Builder<static>|Allocation whereCreatedAt($value)
* @method static Builder<static>|Allocation whereId($value)
* @method static Builder<static>|Allocation whereIp($value)
* @method static Builder<static>|Allocation whereIpAlias($value)
* @method static Builder<static>|Allocation whereIsLocked($value)
* @method static Builder<static>|Allocation whereNodeId($value)
* @method static Builder<static>|Allocation whereNotes($value)
* @method static Builder<static>|Allocation wherePort($value)
* @method static Builder<static>|Allocation whereServerId($value)
* @method static Builder<static>|Allocation whereUpdatedAt($value)
* @method static AllocationFactory factory(...$parameters)
* @method static Builder|Allocation newModelQuery()
* @method static Builder|Allocation newQuery()
* @method static Builder|Allocation query()
* @method static Builder|Allocation whereCreatedAt($value)
* @method static Builder|Allocation whereId($value)
* @method static Builder|Allocation whereIp($value)
* @method static Builder|Allocation whereIpAlias($value)
* @method static Builder|Allocation whereNodeId($value)
* @method static Builder|Allocation whereNotes($value)
* @method static Builder|Allocation wherePort($value)
* @method static Builder|Allocation whereServerId($value)
* @method static Builder|Allocation whereUpdatedAt($value)
*/
class Allocation extends Model
{

View File

@@ -4,6 +4,7 @@ namespace App\Models;
use App\Services\Acl\Api\AdminAcl;
use App\Traits\HasValidation;
use Database\Factories\ApiKeyFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -16,35 +17,41 @@ use Webmozart\Assert\Assert;
* App\Models\ApiKey.
*
* @property int $id
* @property string $token
* @property string[] $allowed_ips
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int|null $user_id
* @property string|null $memo
* @property string|null $identifier
* @property int $user_id
* @property int $key_type
* @property string $identifier
* @property string $token
* @property string[]|null $permissions
* @property string[]|null $allowed_ips
* @property string|null $memo
* @property Carbon|null $last_used_at
* @property Carbon|null $expires_at
* @property array<string, int> $permissions
* @property-read User|null $user
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property User $tokenable
* @property User $user
*
* @method static \Database\Factories\ApiKeyFactory factory($count = null, $state = [])
* @method static Builder<static>|ApiKey newModelQuery()
* @method static Builder<static>|ApiKey newQuery()
* @method static Builder<static>|ApiKey query()
* @method static Builder<static>|ApiKey whereAllowedIps($value)
* @method static Builder<static>|ApiKey whereCreatedAt($value)
* @method static Builder<static>|ApiKey whereExpiresAt($value)
* @method static Builder<static>|ApiKey whereId($value)
* @method static Builder<static>|ApiKey whereIdentifier($value)
* @method static Builder<static>|ApiKey whereKeyType($value)
* @method static Builder<static>|ApiKey whereLastUsedAt($value)
* @method static Builder<static>|ApiKey whereMemo($value)
* @method static Builder<static>|ApiKey wherePermissions($value)
* @method static Builder<static>|ApiKey whereToken($value)
* @method static Builder<static>|ApiKey whereUpdatedAt($value)
* @method static Builder<static>|ApiKey whereUserId($value)
* @method static ApiKeyFactory factory(...$parameters)
* @method static Builder|ApiKey newModelQuery()
* @method static Builder|ApiKey newQuery()
* @method static Builder|ApiKey query()
* @method static Builder|ApiKey whereAllowedIps($value)
* @method static Builder|ApiKey whereCreatedAt($value)
* @method static Builder|ApiKey whereId($value)
* @method static Builder|ApiKey whereIdentifier($value)
* @method static Builder|ApiKey whereKeyType($value)
* @method static Builder|ApiKey whereLastUsedAt($value)
* @method static Builder|ApiKey whereMemo($value)
* @method static Builder|ApiKey whereRAllocations($value)
* @method static Builder|ApiKey whereRDatabaseHosts($value)
* @method static Builder|ApiKey whereREggs($value)
* @method static Builder|ApiKey whereRNodes($value)
* @method static Builder|ApiKey whereRServerDatabases($value)
* @method static Builder|ApiKey whereRServers($value)
* @method static Builder|ApiKey whereRUsers($value)
* @method static Builder|ApiKey whereToken($value)
* @method static Builder|ApiKey whereUpdatedAt($value)
* @method static Builder|ApiKey whereUserId($value)
*/
class ApiKey extends PersonalAccessToken
{

View File

@@ -18,44 +18,20 @@ use Illuminate\Database\Query\Builder;
* @property int $id
* @property int $server_id
* @property string $uuid
* @property bool $is_successful
* @property bool $is_locked
* @property string $name
* @property string[] $ignored_files
* @property string $disk
* @property string|null $checksum
* @property int $bytes
* @property CarbonImmutable|null $completed_at
* @property CarbonImmutable|null $created_at
* @property CarbonImmutable|null $updated_at
* @property CarbonImmutable|null $deleted_at
* @property bool $is_successful
* @property string|null $upload_id
* @property bool $is_locked
* @property-read Server $server
* @property-read BackupStatus $status
*
* @method static \Database\Factories\BackupFactory factory($count = null, $state = [])
* @method static BackupQueryBuilder<static>|Backup newModelQuery()
* @method static BackupQueryBuilder<static>|Backup newQuery()
* @method static BackupQueryBuilder<static>|Backup nonFailed()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Backup onlyTrashed()
* @method static BackupQueryBuilder<static>|Backup query()
* @method static BackupQueryBuilder<static>|Backup whereBytes($value)
* @method static BackupQueryBuilder<static>|Backup whereChecksum($value)
* @method static BackupQueryBuilder<static>|Backup whereCompletedAt($value)
* @method static BackupQueryBuilder<static>|Backup whereCreatedAt($value)
* @method static BackupQueryBuilder<static>|Backup whereDeletedAt($value)
* @method static BackupQueryBuilder<static>|Backup whereDisk($value)
* @method static BackupQueryBuilder<static>|Backup whereId($value)
* @method static BackupQueryBuilder<static>|Backup whereIgnoredFiles($value)
* @method static BackupQueryBuilder<static>|Backup whereIsLocked($value)
* @method static BackupQueryBuilder<static>|Backup whereIsSuccessful($value)
* @method static BackupQueryBuilder<static>|Backup whereName($value)
* @method static BackupQueryBuilder<static>|Backup whereServerId($value)
* @method static BackupQueryBuilder<static>|Backup whereUpdatedAt($value)
* @method static BackupQueryBuilder<static>|Backup whereUploadId($value)
* @method static BackupQueryBuilder<static>|Backup whereUuid($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Backup withTrashed(bool $withTrashed = true)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Backup withoutTrashed()
* @property CarbonImmutable|null $completed_at
* @property BackupStatus $status
* @property CarbonImmutable $created_at
* @property CarbonImmutable $updated_at
* @property CarbonImmutable|null $deleted_at
* @property Server $server
*/
class Backup extends Model implements Validatable
{

View File

@@ -4,11 +4,11 @@ namespace App\Models;
use App\Contracts\Validatable;
use App\Traits\HasValidation;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;
use PDOException;
/**
@@ -19,27 +19,12 @@ use PDOException;
* @property string $username
* @property string $remote
* @property string $password
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int|null $max_connections
* @property-read DatabaseHost $host
* @property-read string $jdbc
* @property-read Server $server
*
* @method static \Database\Factories\DatabaseFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereDatabase($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereDatabaseHostId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereMaxConnections($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereRemote($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereServerId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Database whereUsername($value)
* @property ?int $max_connections
* @property string $jdbc
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Server $server
* @property DatabaseHost $host
*/
class Database extends Model implements Validatable
{

View File

@@ -21,26 +21,13 @@ use Illuminate\Support\Facades\DB;
* @property string $username
* @property string $password
* @property int|null $max_databases
* @property CarbonImmutable|null $created_at
* @property CarbonImmutable|null $updated_at
* @property-read Collection<int, Database> $databases
* @property-read int|null $databases_count
* @property-read Collection<int, Node> $nodes
* @property-read int|null $nodes_count
*
* @method static \Database\Factories\DatabaseHostFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost whereHost($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost whereMaxDatabases($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost wherePort($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|DatabaseHost whereUsername($value)
* @property int|null $node_id
* @property CarbonImmutable $created_at
* @property CarbonImmutable $updated_at
* @property Collection|Node[] $nodes
* @property int|null $nodes_count
* @property Collection|Database[] $databases
* @property int|null $databases_count
*/
class DatabaseHost extends Model implements Validatable
{

View File

@@ -6,90 +6,57 @@ use App\Contracts\Validatable;
use App\Exceptions\Service\Egg\HasChildrenException;
use App\Exceptions\Service\HasActiveServersException;
use App\Traits\HasValidation;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* @property int $id
* @property string $uuid
* @property string $author
* @property string $name
* @property string|null $description
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int|null $config_from
* @property string|null $config_stop
* @property string|null $config_logs
* @property string|null $config_startup
* @property string|null $config_files
* @property string|null $script_install
* @property bool $script_is_privileged
* @property string $script_entry
* @property string $script_container
* @property int|null $copy_script_from
* @property string|null $uuid
* @property string $author
* @property string|null $image
* @property string[]|null $features
* @property array<string, string> $docker_images
* @property string|null $update_url
* @property string[]|null $file_denylist
* @property bool $force_outgoing_ip
* @property string[] $tags
* @property string[]|null $file_denylist
* @property string|null $config_files
* @property string|null $config_startup
* @property string|null $config_logs
* @property string|null $config_stop
* @property int|null $config_from
* @property array<string, string> $startup_commands
* @property-read Collection<int, Egg> $children
* @property-read int|null $children_count
* @property-read Egg|null $configFrom
* @property-read string $copy_script_container
* @property-read string $copy_script_entry
* @property-read string|null $copy_script_install
* @property-read string|null $image
* @property-read string|null $inherit_config_files
* @property-read string|null $inherit_config_logs
* @property-read string|null $inherit_config_startup
* @property-read string|null $inherit_config_stop
* @property-read string[]|null $inherit_features
* @property-read string[]|null $inherit_file_denylist
* @property-read Collection<int, Mount> $mounts
* @property-read int|null $mounts_count
* @property-read Egg|null $scriptFrom
* @property-read Collection<int, Server> $servers
* @property-read int|null $servers_count
* @property-read Collection<int, EggVariable> $variables
* @property-read int|null $variables_count
*
* @method static \Database\Factories\EggFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereAuthor($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereConfigFiles($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereConfigFrom($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereConfigLogs($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereConfigStartup($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereConfigStop($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereCopyScriptFrom($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereDockerImages($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereFeatures($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereFileDenylist($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereForceOutgoingIp($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereScriptContainer($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereScriptEntry($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereScriptInstall($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereScriptIsPrivileged($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereStartupCommands($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereTags($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereUpdateUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Egg whereUuid($value)
* @property bool $script_is_privileged
* @property string|null $script_install
* @property string $script_entry
* @property string $script_container
* @property int|null $copy_script_from
* @property Carbon $created_at
* @property Carbon $updated_at
* @property string|null $copy_script_install
* @property string $copy_script_entry
* @property string $copy_script_container
* @property string|null $inherit_config_files
* @property string|null $inherit_config_startup
* @property string|null $inherit_config_logs
* @property string|null $inherit_config_stop
* @property string $inherit_file_denylist
* @property string[]|null $inherit_features
* @property string[] $tags
* @property Collection|Server[] $servers
* @property int|null $servers_count
* @property Collection|EggVariable[] $variables
* @property int|null $variables_count
* @property \App\Models\Egg|null $scriptFrom
* @property \App\Models\Egg|null $configFrom
*/
class Egg extends Model implements Validatable
{

View File

@@ -5,7 +5,6 @@ namespace App\Models;
use App\Contracts\Validatable;
use App\Traits\HasValidation;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -14,6 +13,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* @property int $id
* @property int $egg_id
* @property null $sort
* @property string $name
* @property string $description
* @property string $env_variable
@@ -21,32 +21,15 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
* @property bool $user_viewable
* @property bool $user_editable
* @property string[] $rules
* @property CarbonImmutable|null $created_at
* @property CarbonImmutable|null $updated_at
* @property int|null $sort
* @property-read Egg|null $egg
* @property-read bool $required
* @property-read Collection<int, ServerVariable> $serverVariable
* @property-read int|null $server_variable_count
* @property CarbonImmutable $created_at
* @property CarbonImmutable $updated_at
* @property bool $required
* @property Egg $egg
* @property ServerVariable $serverVariable
*
* @method static \Database\Factories\EggVariableFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereDefaultValue($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereEggId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereEnvVariable($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereRules($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereSort($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereUserEditable($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|EggVariable whereUserViewable($value)
*
* @property string|null $server_value This variable is only present on the object if you've loaded this model using the server relationship.
* The "server_value" variable is only present on the object if you've loaded this model
* using the server relationship.
* @property string|null $server_value
*/
class EggVariable extends Model implements Validatable
{

View File

@@ -6,12 +6,12 @@ use App\Enums\TablerIcon;
use App\Livewire\AlertBanner;
use App\Repositories\Daemon\DaemonFileRepository;
use BackedEnum;
use Carbon\Carbon;
use Closure;
use Exception;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Carbon;
use Sushi\Sushi;
/**
@@ -28,21 +28,6 @@ use Sushi\Sushi;
* @property bool $is_file
* @property bool $is_symlink
* @property string $mime_type
*
* @method static Builder<static>|File newModelQuery()
* @method static Builder<static>|File newQuery()
* @method static Builder<static>|File query()
* @method static Builder<static>|File whereCreatedAt($value)
* @method static Builder<static>|File whereId($value)
* @method static Builder<static>|File whereIsDirectory($value)
* @method static Builder<static>|File whereIsFile($value)
* @method static Builder<static>|File whereIsSymlink($value)
* @method static Builder<static>|File whereMimeType($value)
* @method static Builder<static>|File whereMode($value)
* @method static Builder<static>|File whereModeBits($value)
* @method static Builder<static>|File whereModifiedAt($value)
* @method static Builder<static>|File whereName($value)
* @method static Builder<static>|File whereSize($value)
*/
class File extends Model
{
@@ -153,9 +138,6 @@ class File extends Model
return [
'created_at' => 'datetime',
'modified_at' => 'datetime',
'is_directory' => 'boolean',
'is_file' => 'boolean',
'is_symlink' => 'boolean',
];
}

View File

@@ -12,29 +12,14 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
* @property int $id
* @property string $uuid
* @property string $name
* @property string|null $description
* @property string $description
* @property string $source
* @property string $target
* @property bool $read_only
* @property bool $user_mountable
* @property-read Collection<int, Egg> $eggs
* @property-read int|null $eggs_count
* @property-read Collection<int, Node> $nodes
* @property-read int|null $nodes_count
* @property-read Collection<int, Server> $servers
* @property-read int|null $servers_count
*
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount whereReadOnly($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount whereSource($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount whereTarget($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount whereUserMountable($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Mount whereUuid($value)
* @property Egg[]|Collection $eggs
* @property Node[]|Collection $nodes
* @property Server[]|Collection $servers
*/
class Mount extends Model implements Validatable
{

View File

@@ -6,6 +6,7 @@ use App\Contracts\Validatable;
use App\Exceptions\Service\HasActiveServersException;
use App\Repositories\Daemon\DaemonSystemRepository;
use App\Traits\HasValidation;
use Carbon\Carbon;
use Exception;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -14,84 +15,46 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Notifications\DatabaseNotificationCollection;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use Symfony\Component\Yaml\Yaml;
/**
* @property int $id
* @property string $uuid
* @property bool $public
* @property string $name
* @property string|null $description
* @property string $fqdn
* @property string $scheme
* @property bool $behind_proxy
* @property bool $maintenance_mode
* @property int $memory
* @property int $memory_overallocate
* @property int $disk
* @property int $disk_overallocate
* @property string $daemon_token
* @property int $daemon_listen
* @property int $daemon_sftp
* @property string $daemon_base
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $upload_size
* @property bool $behind_proxy
* @property string|null $description
* @property bool $maintenance_mode
* @property string|null $uuid
* @property string|null $daemon_token_id
* @property array<array-key, mixed>|null $tags
* @property int $cpu
* @property int $cpu_overallocate
* @property string|null $daemon_sftp_alias
* @property int $upload_size
* @property string $daemon_token_id
* @property string $daemon_token
* @property int $daemon_listen
* @property int $daemon_connect
* @property-read Collection<int, Allocation> $allocations
* @property-read int|null $allocations_count
* @property-read Collection<int, DatabaseHost> $databaseHosts
* @property-read int|null $database_hosts_count
* @property-read Collection<int, Mount> $mounts
* @property-read int|null $mounts_count
* @property-read DatabaseNotificationCollection<int, DatabaseNotification> $notifications
* @property-read int|null $notifications_count
* @property-read Collection<int, Role> $roles
* @property-read int|null $roles_count
* @property-read Collection<int, Server> $servers
* @property-read int|null $servers_count
*
* @method static \Database\Factories\NodeFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereBehindProxy($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereCpu($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereCpuOverallocate($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDaemonBase($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDaemonConnect($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDaemonListen($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDaemonSftp($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDaemonSftpAlias($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDaemonToken($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDaemonTokenId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDisk($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereDiskOverallocate($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereFqdn($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereMaintenanceMode($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereMemory($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereMemoryOverallocate($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node wherePublic($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereScheme($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereTags($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereUploadSize($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Node whereUuid($value)
* @property int $daemon_sftp
* @property string|null $daemon_sftp_alias
* @property string $daemon_base
* @property string[] $tags
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Mount[]|Collection $mounts
* @property int|null $mounts_count
* @property Server[]|Collection $servers
* @property int|null $servers_count
* @property Allocation[]|Collection $allocations
* @property int|null $allocations_count
* @property Role[]|Collection $roles
* @property int|null $roles_count
*/
class Node extends Model implements Validatable
{
@@ -292,8 +255,6 @@ class Node extends Model implements Validatable
/**
* Gets the servers associated with a node.
*
* @return HasMany<Server, $this>
*/
public function servers(): HasMany
{
@@ -397,7 +358,7 @@ class Node extends Model implements Validatable
'disk_used' => 0,
];
return cache()->flexible("nodes.$this->id.statistics", [5, 30], function () use ($default) {
return cache()->remember("nodes.$this->id.statistics", now()->addSeconds(360), function () use ($default) {
try {
$data = Http::daemon($this)

View File

@@ -4,16 +4,6 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* @property int $node_id
* @property int $role_id
*
* @method static \Illuminate\Database\Eloquent\Builder<static>|NodeRole newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|NodeRole newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|NodeRole query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|NodeRole whereNodeId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|NodeRole whereRoleId($value)
*/
class NodeRole extends Pivot
{
protected $table = 'node_role';

View File

@@ -5,7 +5,6 @@ namespace App\Models;
use App\Contracts\Plugins\HasPluginSettings;
use App\Enums\PluginCategory;
use App\Enums\PluginStatus;
use App\Exceptions\PluginIdMismatchException;
use App\Facades\Plugins;
use Exception;
use Filament\Schemas\Components\Component;
@@ -34,26 +33,6 @@ use Sushi\Sushi;
* @property PluginStatus $status
* @property string|null $status_message
* @property int $load_order
*
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereAuthor($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereCategory($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereClass($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereComposerPackages($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereLoadOrder($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereNamespace($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin wherePanelVersion($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin wherePanels($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereStatusMessage($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereUpdateUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Plugin whereVersion($value)
*/
class Plugin extends Model implements HasPluginSettings
{
@@ -131,10 +110,9 @@ class Plugin extends Model implements HasPluginSettings
try {
$data = File::json($path, JSON_THROW_ON_ERROR);
$data['id'] = Str::lower($data['id']);
if ($data['id'] !== Str::lower($plugin)) {
throw new PluginIdMismatchException("Plugin id mismatch for folder name ($plugin) and id in plugin.json ({$data['id']})!");
if ($data['id'] !== $plugin) {
throw new Exception("Plugin id mismatch for folder name ($plugin) and id in plugin.json ({$data['id']})!");
}
$panels = null;
@@ -179,13 +157,13 @@ class Plugin extends Model implements HasPluginSettings
if (!$exception instanceof JsonException) {
$plugins[] = [
'id' => $exception instanceof PluginIdMismatchException ? $plugin : ($data['id'] ?? Str::uuid()),
'name' => $data['name'] ?? Str::headline($plugin),
'id' => $data['id'] ?? Str::uuid(),
'name' => $data['name'] ?? $plugin,
'author' => $data['author'] ?? 'Unknown',
'version' => $data['version'] ?? '0.0.0',
'description' => $exception instanceof PluginIdMismatchException ? $exception->getMessage() : 'Plugin.json is invalid!',
'version' => '0.0.0',
'description' => 'Plugin.json is invalid!',
'category' => PluginCategory::Plugin->value,
'url' => $data['url'] ?? null,
'url' => null,
'update_url' => null,
'namespace' => 'Error',
'class' => 'Error',
@@ -219,7 +197,7 @@ class Plugin extends Model implements HasPluginSettings
public function shouldLoad(?string $panelId = null): bool
{
return $this->fullClass() !== '\\Error\\Error' && ($this->status === PluginStatus::Enabled || $this->status === PluginStatus::Errored) && (is_null($panelId) || !$this->panels || in_array($panelId, explode(',', $this->panels)));
return ($this->status === PluginStatus::Enabled || $this->status === PluginStatus::Errored) && (is_null($panelId) || !$this->panels || in_array($panelId, explode(',', $this->panels)));
}
public function canEnable(): bool

View File

@@ -9,7 +9,6 @@ use BackedEnum;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Carbon;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role as BaseRole;
@@ -17,27 +16,12 @@ use Spatie\Permission\Models\Role as BaseRole;
* @property int $id
* @property string $name
* @property string $guard_name
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property-read NodeRole|null $pivot
* @property-read Collection<int, Node> $nodes
* @property-read int|null $nodes_count
* @property-read Collection<int, Permission> $permissions
* @property-read int|null $permissions_count
* @property-read Collection<int, User> $users
* @property-read int|null $users_count
*
* @method static \Database\Factories\RoleFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role permission($permissions, $without = false)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role whereGuardName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Role withoutPermission($permissions)
* @property Collection|Permission[] $permissions
* @property int|null $permissions_count
* @property Collection|User[] $users
* @property int|null $users_count
* @property Collection|Node[] $nodes
* @property int|null $nodes_count
*/
class Role extends BaseRole
{

View File

@@ -6,55 +6,34 @@ use App\Contracts\Validatable;
use App\Enums\ScheduleStatus;
use App\Helpers\Utilities;
use App\Traits\HasValidation;
use Carbon\Carbon;
use Exception;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
/**
* @property int $id
* @property int $server_id
* @property string $name
* @property string $cron_day_of_week
* @property string $cron_month
* @property string $cron_day_of_month
* @property string $cron_hour
* @property string $cron_minute
* @property bool $is_active
* @property bool $is_processing
* @property bool $only_when_online
* @property Carbon|null $last_run_at
* @property Carbon|null $next_run_at
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string $cron_month
* @property bool $only_when_online
* @property-read Server $server
* @property-read ScheduleStatus $status
* @property-read Collection<int, Task> $tasks
* @property-read int|null $tasks_count
*
* @method static \Database\Factories\ScheduleFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereCronDayOfMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereCronDayOfWeek($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereCronHour($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereCronMinute($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereCronMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereIsActive($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereIsProcessing($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereLastRunAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereNextRunAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereOnlyWhenOnline($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereServerId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Schedule whereUpdatedAt($value)
* @property ScheduleStatus $status
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Server $server
* @property Task[]|Collection $tasks
*/
class Schedule extends Model implements Validatable
{

View File

@@ -11,6 +11,7 @@ use App\Repositories\Daemon\DaemonServerRepository;
use App\Services\Subusers\SubuserDeletionService;
use App\Traits\HasValidation;
use Carbon\CarbonInterface;
use Database\Factories\ServerFactory;
use Filament\Models\Contracts\HasAvatar;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -36,95 +37,100 @@ use Psr\Http\Message\ResponseInterface;
* \App\Models\Server.
*
* @property int $id
* @property string|null $external_id
* @property string $uuid
* @property string $uuid_short
* @property int $node_id
* @property string $name
* @property string $description
* @property ServerState|null $status
* @property bool $skip_scripts
* @property int $owner_id
* @property int $memory
* @property int $swap
* @property int $disk
* @property int $io
* @property int $cpu
* @property string|null $threads
* @property bool $oom_killer
* @property int|null $allocation_id
* @property int $egg_id
* @property string $startup
* @property string $image
* @property string|null $icon
* @property int|null $allocation_limit
* @property int|null $database_limit
* @property int|null $backup_limit
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int|null $allocation_id
* @property string $image
* @property string|null $description
* @property bool $skip_scripts
* @property string|null $external_id
* @property int|null $database_limit
* @property int|null $allocation_limit
* @property string|null $threads
* @property int $backup_limit
* @property ServerState|null $status
* @property Carbon|null $installed_at
* @property bool $oom_killer
* @property array<array-key, mixed>|null $docker_labels
* @property-read Collection<int, ActivityLog> $activity
* @property-read int|null $activity_count
* @property-read Allocation|null $allocation
* @property-read Collection<int, Allocation> $allocations
* @property-read int|null $allocations_count
* @property-read Collection<int, Backup> $backups
* @property-read int|null $backups_count
* @property-read ServerState|ContainerStatus $condition
* @property-read Collection<int, Database> $databases
* @property-read int|null $databases_count
* @property-read Egg $egg
* @property Collection|ActivityLog[] $activity
* @property int|null $activity_count
* @property Allocation|null $allocation
* @property Collection|Allocation[] $allocations
* @property int|null $allocations_count
* @property Collection|Backup[] $backups
* @property int|null $backups_count
* @property Collection|Database[] $databases
* @property int|null $databases_count
* @property Egg $egg
* @property Collection|Mount[] $mounts
* @property int|null $mounts_count
* @property Node $node
* @property DatabaseNotificationCollection|DatabaseNotification[] $notifications
* @property int|null $notifications_count
* @property Collection|Schedule[] $schedules
* @property int|null $schedules_count
* @property Collection|Subuser[] $subusers
* @property int|null $subusers_count
* @property ServerTransfer|null $transfer
* @property User $user
* @property Collection|EggVariable[] $variables
* @property int|null $variables_count
*
* @method static ServerFactory factory(...$parameters)
* @method static Builder|Server newModelQuery()
* @method static Builder|Server newQuery()
* @method static Builder|Server query()
* @method static Builder|Server whereAllocationId($value)
* @method static Builder|Server whereAllocationLimit($value)
* @method static Builder|Server whereBackupLimit($value)
* @method static Builder|Server whereCpu($value)
* @method static Builder|Server whereCreatedAt($value)
* @method static Builder|Server whereDatabaseLimit($value)
* @method static Builder|Server whereDescription($value)
* @method static Builder|Server whereDisk($value)
* @method static Builder|Server whereEggId($value)
* @method static Builder|Server whereExternalId($value)
* @method static Builder|Server whereId($value)
* @method static Builder|Server whereImage($value)
* @method static Builder|Server whereIo($value)
* @method static Builder|Server whereMemory($value)
* @method static Builder|Server whereName($value)
* @method static Builder|Server whereNodeId($value)
* @method static Builder|Server whereOomKiller($value)
* @method static Builder|Server whereOwnerId($value)
* @method static Builder|Server whereSkipScripts($value)
* @method static Builder|Server whereStartup($value)
* @method static Builder|Server whereStatus($value)
* @method static Builder|Server whereSwap($value)
* @method static Builder|Server whereThreads($value)
* @method static Builder|Server whereUpdatedAt($value)
* @method static Builder|Server whereUuid($value)
* @method static Builder|Server whereuuid_short($value)
*
* @property string[]|null $docker_labels
* @property string|null $ports
* @property-read ContainerStatus|ServerState $condition
* @property-read Collection<int, EggVariable> $eggVariables
* @property-read int|null $egg_variables_count
* @property-read string|null $icon
* @property-read Collection<int, Mount> $mounts
* @property-read int|null $mounts_count
* @property-read Node $node
* @property-read DatabaseNotificationCollection<int, DatabaseNotification> $notifications
* @property-read int|null $notifications_count
* @property-read Collection<int, Schedule> $schedules
* @property-read int|null $schedules_count
* @property-read Collection<int, ServerVariable> $serverVariables
* @property-read int|null $server_variables_count
* @property-read Collection<int, Subuser> $subusers
* @property-read int|null $subusers_count
* @property-read ServerTransfer|null $transfer
* @property-read User $user
* @property-read Collection<int, EggVariable> $variables
* @property-read int|null $variables_count
*
* @method static \Database\Factories\ServerFactory factory($count = null, $state = [])
* @method static Builder<static>|Server newModelQuery()
* @method static Builder<static>|Server newQuery()
* @method static Builder<static>|Server query()
* @method static Builder<static>|Server whereAllocationId($value)
* @method static Builder<static>|Server whereAllocationLimit($value)
* @method static Builder<static>|Server whereBackupLimit($value)
* @method static Builder<static>|Server whereCpu($value)
* @method static Builder<static>|Server whereCreatedAt($value)
* @method static Builder<static>|Server whereDatabaseLimit($value)
* @method static Builder<static>|Server whereDescription($value)
* @method static Builder<static>|Server whereDisk($value)
* @method static Builder<static>|Server whereDockerLabels($value)
* @method static Builder<static>|Server whereEggId($value)
* @method static Builder<static>|Server whereExternalId($value)
* @method static Builder<static>|Server whereId($value)
* @method static Builder<static>|Server whereImage($value)
* @method static Builder<static>|Server whereInstalledAt($value)
* @method static Builder<static>|Server whereIo($value)
* @method static Builder<static>|Server whereMemory($value)
* @method static Builder<static>|Server whereName($value)
* @method static Builder<static>|Server whereNodeId($value)
* @method static Builder<static>|Server whereOomKiller($value)
* @method static Builder<static>|Server whereOwnerId($value)
* @method static Builder<static>|Server whereSkipScripts($value)
* @method static Builder<static>|Server whereStartup($value)
* @method static Builder<static>|Server whereStatus($value)
* @method static Builder<static>|Server whereSwap($value)
* @method static Builder<static>|Server whereThreads($value)
* @method static Builder<static>|Server whereUpdatedAt($value)
* @method static Builder<static>|Server whereUuid($value)
* @method static Builder<static>|Server whereUuidShort($value)
* @method static Builder|Server whereDockerLabels($value)
* @method static Builder|Server whereInstalledAt($value)
* @method static Builder|Server wherePorts($value)
* @method static Builder|Server whereUuidShort($value)
*/
class Server extends Model implements HasAvatar, Validatable
{

View File

@@ -4,43 +4,27 @@ namespace App\Models;
use App\Contracts\Validatable;
use App\Traits\HasValidation;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Support\Carbon;
/**
* @property int $id
* @property int $server_id
* @property bool|null $successful
* @property int $old_node
* @property int $new_node
* @property int|null $old_allocation
* @property int|null $new_allocation
* @property int[]|null $old_additional_allocations
* @property int[]|null $new_additional_allocations
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property array<int>|null $old_additional_allocations array of allocation.id's
* @property array<int>|null $new_additional_allocations array of allocation.id's
* @property bool|null $successful
* @property bool $archived
* @property-read Node|null $newNode
* @property-read Node|null $oldNode
* @property-read Server $server
*
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereArchived($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereNewAdditionalAllocations($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereNewAllocation($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereNewNode($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereOldAdditionalAllocations($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereOldAllocation($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereOldNode($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereServerId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereSuccessful($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerTransfer whereUpdatedAt($value)
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Server $server
* @property Node $oldNode
* @property Node $newNode
*/
class ServerTransfer extends Model implements Validatable
{

View File

@@ -15,18 +15,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property string $variable_value
* @property CarbonImmutable|null $created_at
* @property CarbonImmutable|null $updated_at
* @property-read Server $server
* @property-read EggVariable $variable
*
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable whereServerId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable whereVariableId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|ServerVariable whereVariableValue($value)
* @property EggVariable $variable
* @property Server $server
*/
class ServerVariable extends Model implements Validatable
{

View File

@@ -5,32 +5,21 @@ namespace App\Models;
use App\Contracts\Validatable;
use App\Enums\SubuserPermission;
use App\Traits\HasValidation;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Carbon;
/**
* @property int $id
* @property int $user_id
* @property int $server_id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string[]|null $permissions
* @property-read Server $server
* @property-read User $user
*
* @method static \Database\Factories\SubuserFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser wherePermissions($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser whereServerId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Subuser whereUserId($value)
* @property string[] $permissions
* @property Carbon $created_at
* @property Carbon $updated_at
* @property User $user
* @property Server $server
*/
class Subuser extends Model implements Validatable
{

View File

@@ -6,11 +6,11 @@ use App\Contracts\Validatable;
use App\Extensions\Tasks\TaskSchemaInterface;
use App\Extensions\Tasks\TaskService;
use App\Traits\HasValidation;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
use Illuminate\Support\Carbon;
/**
* @property int $id
@@ -20,26 +20,11 @@ use Illuminate\Support\Carbon;
* @property string $payload
* @property int $time_offset
* @property bool $is_queued
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property bool $continue_on_failure
* @property-read Schedule $schedule
* @property-read Server|null $server
*
* @method static \Database\Factories\TaskFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereAction($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereContinueOnFailure($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereIsQueued($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task wherePayload($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereScheduleId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereSequenceId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereTimeOffset($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Task whereUpdatedAt($value)
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Schedule $schedule
* @property Server $server
*/
class Task extends Model implements Validatable
{

View File

@@ -4,14 +4,13 @@ namespace App\Models\Traits;
use App\Extensions\Laravel\Sanctum\NewAccessToken;
use App\Models\ApiKey;
use App\Models\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Str;
use Laravel\Sanctum\HasApiTokens;
use Laravel\Sanctum\Sanctum;
/**
* @mixin Model
* @mixin \App\Models\Model
*/
trait HasAccessTokens
{

View File

@@ -10,6 +10,7 @@ use App\Extensions\Avatar\AvatarService;
use App\Models\Traits\HasAccessTokens;
use App\Traits\HasValidation;
use BackedEnum;
use Database\Factories\UserFactory;
use DateTimeZone;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
@@ -42,75 +43,56 @@ use Illuminate\Support\Facades\Context;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules\In;
use ResourceBundle;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Traits\HasRoles;
/**
* App\Models\User.
*
* @property int $id
* @property string|null $external_id
* @property bool $is_managed_externally
* @property string $uuid
* @property string $username
* @property string $email
* @property string $password
* @property string|null $remember_token
* @property string $language
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string $username
* @property string|null $external_id
* @property string $timezone
* @property array<string, mixed>|null $oauth
* @property string|array<string, mixed>|null $customization
* @property string[]|null $oauth
* @property string|null $mfa_app_secret
* @property string[]|null $mfa_app_recovery_codes
* @property bool $mfa_email_enabled
* @property bool $is_managed_externally
* @property-read \Illuminate\Database\Eloquent\Collection<int, ActivityLog> $activity
* @property-read int|null $activity_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, ApiKey> $apiKeys
* @property-read int|null $api_keys_count
* @property-read DatabaseNotificationCollection<int, DatabaseNotification> $notifications
* @property-read int|null $notifications_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, Permission> $permissions
* @property-read int|null $permissions_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, Role> $roles
* @property-read int|null $roles_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, Server> $servers
* @property-read int|null $servers_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, UserSSHKey> $sshKeys
* @property-read int|null $ssh_keys_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, Server> $subServers
* @property-read int|null $sub_servers_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, Subuser> $subusers
* @property-read int|null $subusers_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, ApiKey> $tokens
* @property-read int|null $tokens_count
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property \Illuminate\Database\Eloquent\Collection|ApiKey[] $apiKeys
* @property int|null $api_keys_count
* @property DatabaseNotificationCollection|DatabaseNotification[] $notifications
* @property int|null $notifications_count
* @property \Illuminate\Database\Eloquent\Collection|Server[] $servers
* @property int|null $servers_count
* @property \Illuminate\Database\Eloquent\Collection|UserSSHKey[] $sshKeys
* @property int|null $ssh_keys_count
* @property \Illuminate\Database\Eloquent\Collection|ApiKey[] $tokens
* @property int|null $tokens_count
* @property \Illuminate\Database\Eloquent\Collection|Role[] $roles
* @property int|null $roles_count
* @property string|array<string, mixed>|null $customization
*
* @method static \Database\Factories\UserFactory factory($count = null, $state = [])
* @method static Builder<static>|User newModelQuery()
* @method static Builder<static>|User newQuery()
* @method static Builder<static>|User permission($permissions, $without = false)
* @method static Builder<static>|User query()
* @method static Builder<static>|User role($roles, $guard = null, $without = false)
* @method static Builder<static>|User whereCreatedAt($value)
* @method static Builder<static>|User whereCustomization($value)
* @method static Builder<static>|User whereEmail($value)
* @method static Builder<static>|User whereExternalId($value)
* @method static Builder<static>|User whereId($value)
* @method static Builder<static>|User whereIsManagedExternally($value)
* @method static Builder<static>|User whereLanguage($value)
* @method static Builder<static>|User whereMfaAppRecoveryCodes($value)
* @method static Builder<static>|User whereMfaAppSecret($value)
* @method static Builder<static>|User whereMfaEmailEnabled($value)
* @method static Builder<static>|User whereOauth($value)
* @method static Builder<static>|User wherePassword($value)
* @method static Builder<static>|User whereRememberToken($value)
* @method static Builder<static>|User whereTimezone($value)
* @method static Builder<static>|User whereUpdatedAt($value)
* @method static Builder<static>|User whereUsername($value)
* @method static Builder<static>|User whereUuid($value)
* @method static Builder<static>|User withoutPermission($permissions)
* @method static Builder<static>|User withoutRole($roles, $guard = null)
* @method static UserFactory factory(...$parameters)
* @method static Builder|User newModelQuery()
* @method static Builder|User newQuery()
* @method static Builder|User query()
* @method static Builder|User whereCreatedAt($value)
* @method static Builder|User whereEmail($value)
* @method static Builder|User whereExternalId($value)
* @method static Builder|User whereId($value)
* @method static Builder|User whereLanguage($value)
* @method static Builder|User whereTimezone($value)
* @method static Builder|User wherePassword($value)
* @method static Builder|User whereRememberToken($value)
* @method static Builder|User whereUpdatedAt($value)
* @method static Builder|User whereUsername($value)
* @method static Builder|User whereUuid($value)
*/
class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract, FilamentUser, HasAppAuthentication, HasAppAuthenticationRecovery, HasAvatar, HasEmailAuthentication, HasName, HasTenants, Validatable
{
@@ -201,7 +183,6 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
'is_managed_externally' => 'boolean',
'mfa_app_secret' => 'encrypted',
'mfa_app_recovery_codes' => 'encrypted:array',
'mfa_email_enabled' => 'boolean',
'oauth' => 'array',
'customization' => 'array',
];

View File

@@ -3,6 +3,7 @@
namespace App\Models;
use App\Traits\HasValidation;
use Database\Factories\UserSSHKeyFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@@ -21,23 +22,23 @@ use Illuminate\Support\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property-read User $user
* @property User $user
*
* @method static \Database\Factories\UserSSHKeyFactory factory($count = null, $state = [])
* @method static Builder<static>|UserSSHKey newModelQuery()
* @method static Builder<static>|UserSSHKey newQuery()
* @method static Builder<static>|UserSSHKey onlyTrashed()
* @method static Builder<static>|UserSSHKey query()
* @method static Builder<static>|UserSSHKey whereCreatedAt($value)
* @method static Builder<static>|UserSSHKey whereDeletedAt($value)
* @method static Builder<static>|UserSSHKey whereFingerprint($value)
* @method static Builder<static>|UserSSHKey whereId($value)
* @method static Builder<static>|UserSSHKey whereName($value)
* @method static Builder<static>|UserSSHKey wherePublicKey($value)
* @method static Builder<static>|UserSSHKey whereUpdatedAt($value)
* @method static Builder<static>|UserSSHKey whereUserId($value)
* @method static Builder<static>|UserSSHKey withTrashed(bool $withTrashed = true)
* @method static Builder<static>|UserSSHKey withoutTrashed()
* @method static Builder|UserSSHKey newModelQuery()
* @method static Builder|UserSSHKey newQuery()
* @method static \Illuminate\Database\Query\Builder|UserSSHKey onlyTrashed()
* @method static Builder|UserSSHKey query()
* @method static Builder|UserSSHKey whereCreatedAt($value)
* @method static Builder|UserSSHKey whereDeletedAt($value)
* @method static Builder|UserSSHKey whereFingerprint($value)
* @method static Builder|UserSSHKey whereId($value)
* @method static Builder|UserSSHKey whereName($value)
* @method static Builder|UserSSHKey wherePublicKey($value)
* @method static Builder|UserSSHKey whereUpdatedAt($value)
* @method static Builder|UserSSHKey whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|UserSSHKey withTrashed()
* @method static \Illuminate\Database\Query\Builder|UserSSHKey withoutTrashed()
* @method static UserSSHKeyFactory factory(...$parameters)
*/
class UserSSHKey extends Model
{

View File

@@ -2,33 +2,19 @@
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\MassPrunable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
/**
* @property int $id
* @property int $webhook_configuration_id
* @property string $event
* @property string $endpoint
* @property Carbon|null $successful_at
* @property \Illuminate\Support\Carbon|null $successful_at
* @property array<array-key, mixed> $payload
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @method static Builder<static>|Webhook newModelQuery()
* @method static Builder<static>|Webhook newQuery()
* @method static Builder<static>|Webhook query()
* @method static Builder<static>|Webhook whereCreatedAt($value)
* @method static Builder<static>|Webhook whereEndpoint($value)
* @method static Builder<static>|Webhook whereEvent($value)
* @method static Builder<static>|Webhook whereId($value)
* @method static Builder<static>|Webhook wherePayload($value)
* @method static Builder<static>|Webhook whereSuccessfulAt($value)
* @method static Builder<static>|Webhook whereUpdatedAt($value)
* @method static Builder<static>|Webhook whereWebhookConfigurationId($value)
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
*/
class Webhook extends Model
{

View File

@@ -14,36 +14,15 @@ use Illuminate\Support\Facades\File;
use Livewire\Features\SupportEvents\HandlesEvents;
/**
* @property int $id
* @property string|array<string, mixed>|null $payload
* @property string $endpoint
* @property string $description
* @property string[] $events
* @property WebhookType|string|null $type
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property WebhookType|null $type
* @property string|array<array-key, mixed>|null $payload
* @property array<array-key, mixed>|null $headers
* @property-read \Illuminate\Database\Eloquent\Collection<int, Webhook> $webhooks
* @property-read int|null $webhooks_count
*
* @method static \Database\Factories\WebhookConfigurationFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereEndpoint($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereEvents($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereHeaders($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration wherePayload($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereType($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration withTrashed(bool $withTrashed = true)
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebhookConfiguration withoutTrashed()
* @property array<string, string>|null $headers
*/
class WebhookConfiguration extends Model
{

View File

@@ -23,16 +23,14 @@ class AccountCreated extends Notification implements ShouldQueue
public function toMail(User $notifiable): MailMessage
{
$locale = $notifiable->language ?? 'en';
$message = (new MailMessage())
->greeting(trans('mail.greeting', ['name' => $notifiable->username], $locale))
->line(trans('mail.account_created.body', ['app' => config('app.name')], $locale))
->line(trans('mail.account_created.username', ['username' => $notifiable->username], $locale))
->line(trans('mail.account_created.email', ['email' => $notifiable->email], $locale));
->greeting('Hello ' . $notifiable->username . '!')
->line('You are receiving this email because an account has been created for you on ' . config('app.name') . '.')
->line('Username: ' . $notifiable->username)
->line('Email: ' . $notifiable->email);
if (!is_null($this->token)) {
return $message->action(trans('mail.account_created.action', locale: $locale), Filament::getPanel('app')->getResetPasswordUrl($this->token, $notifiable));
return $message->action('Setup Your Account', Filament::getPanel('app')->getResetPasswordUrl($this->token, $notifiable));
}
return $message;

View File

@@ -24,12 +24,10 @@ class AddedToServer extends Notification implements ShouldQueue
public function toMail(User $notifiable): MailMessage
{
$locale = $notifiable->language ?? 'en';
return (new MailMessage())
->greeting(trans('mail.greeting', ['name' => $notifiable->username], $locale))
->line(trans('mail.added_to_server.body', locale: $locale))
->line(trans('mail.added_to_server.server_name', ['name' => $this->server->name], $locale))
->action(trans('mail.added_to_server.action', locale: $locale), Console::getUrl(panel: 'server', tenant: $this->server));
->greeting('Hello ' . $notifiable->username . '!')
->line('You have been added as a subuser for the following server, allowing you certain control over the server.')
->line('Server Name: ' . $this->server->name)
->action('Visit Server', Console::getUrl(panel: 'server', tenant: $this->server));
}
}

View File

@@ -20,11 +20,9 @@ class MailTested extends Notification
public function toMail(): MailMessage
{
$locale = $this->user->language ?? 'en';
return (new MailMessage())
->subject(trans('mail.mail_tested.subject', locale: $locale))
->greeting(trans('mail.greeting', ['name' => $this->user->username], $locale))
->line(trans('mail.mail_tested.body', locale: $locale));
->subject('Panel Test Message')
->greeting('Hello ' . $this->user->username . '!')
->line('This is a test of the Panel mail system. You\'re good to go!');
}
}

View File

@@ -23,13 +23,11 @@ class RemovedFromServer extends Notification implements ShouldQueue
public function toMail(User $notifiable): MailMessage
{
$locale = $notifiable->language ?? 'en';
return (new MailMessage())
->error()
->greeting(trans('mail.greeting', ['name' => $notifiable->username], $locale))
->line(trans('mail.removed_from_server.body', locale: $locale))
->line(trans('mail.removed_from_server.server_name', ['name' => $this->server->name], $locale))
->action(trans('mail.removed_from_server.action', locale: $locale), url(''));
->greeting('Hello ' . $notifiable->username . '.')
->line('You have been removed as a subuser for the following server.')
->line('Server Name: ' . $this->server->name)
->action('Visit Panel', url(''));
}
}

View File

@@ -24,12 +24,10 @@ class ServerInstalled extends Notification implements ShouldQueue
public function toMail(User $notifiable): MailMessage
{
$locale = $notifiable->language ?? 'en';
return (new MailMessage())
->greeting(trans('mail.greeting', ['name' => $notifiable->username], $locale))
->line(trans('mail.server_installed.body', locale: $locale))
->line(trans('mail.server_installed.server_name', ['name' => $this->server->name], $locale))
->action(trans('mail.server_installed.action', locale: $locale), Console::getUrl(panel: 'server', tenant: $this->server));
->greeting('Hello ' . $notifiable->username . '.')
->line('Your server has finished installing and is now ready for you to use.')
->line('Server Name: ' . $this->server->name)
->action('Login and Begin Using', Console::getUrl(panel: 'server', tenant: $this->server));
}
}

View File

@@ -10,7 +10,6 @@ use App\Checks\NodeVersionsCheck;
use App\Checks\PanelVersionCheck;
use App\Checks\ScheduleCheck;
use App\Checks\UsedDiskSpaceCheck;
use App\Http\Responses\LoginResponse;
use App\Models\Allocation;
use App\Models\ApiKey;
use App\Models\Backup;
@@ -28,7 +27,6 @@ use App\Services\Helpers\SoftwareVersionService;
use Dedoc\Scramble\Scramble;
use Dedoc\Scramble\Support\Generator\OpenApi;
use Dedoc\Scramble\Support\Generator\SecurityScheme;
use Filament\Auth\Http\Responses\Contracts\LoginResponse as LoginResponseContract;
use Illuminate\Config\Repository;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Foundation\Application;
@@ -127,8 +125,6 @@ class AppServiceProvider extends ServiceProvider
*/
public function register(): void
{
$this->app->bind(LoginResponseContract::class, LoginResponse::class);
Scramble::ignoreDefaultRoutes();
/** @var PluginService $pluginService */

View File

@@ -34,7 +34,7 @@ use Illuminate\Support\ServiceProvider;
use Livewire\Component;
use Livewire\Livewire;
use function Livewire\before;
use function Livewire\on;
use function Livewire\store;
class FilamentServiceProvider extends ServiceProvider
@@ -74,7 +74,7 @@ class FilamentServiceProvider extends ServiceProvider
fn () => Blade::render("@vite(['resources/js/app.js'])"),
);
before('dehydrate', function (Component $component) {
on('dehydrate', function (Component $component) {
if (!Livewire::isLivewireRequest()) {
return;
}

View File

@@ -22,6 +22,7 @@ use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use pxlrbt\FilamentSpotlight\SpotlightPlugin;
abstract class PanelProvider extends BasePanelProvider
{
@@ -29,9 +30,6 @@ abstract class PanelProvider extends BasePanelProvider
{
return $panel
->spa(fn () => !request()->routeIs('filament.server.pages.console'))
->spaUrlExceptions([
'*/oauth/redirect/*',
])
->databaseNotifications()
->brandName(config('app.name', 'Pelican'))
->brandLogo(config('app.logo'))
@@ -74,6 +72,9 @@ abstract class PanelProvider extends BasePanelProvider
->authMiddleware([
Authenticate::class,
RequireTwoFactorAuthentication::class,
])
->plugins([
SpotlightPlugin::make(),
]);
}
}

View File

@@ -21,7 +21,7 @@ class DatabaseManagementService
* The regex used to validate that the database name passed through to the function is
* in the expected format.
*
* @see DatabaseManagementService::generateUniqueDatabaseName()
* @see \App\Services\Databases\DatabaseManagementService::generateUniqueDatabaseName()
*/
private const MATCH_NAME_REGEX = '/^(s[\d]+_)(.*)$/';
@@ -136,7 +136,7 @@ class DatabaseManagementService
/**
* Updates a password for a given database.
*
* @throws Exception
* @throws \Exception
*/
public function rotatePassword(Database $database): void
{

View File

@@ -32,10 +32,10 @@ class EggConfigurationService
*/
public function handle(Server $server): array
{
$configFiles = json_decode($server->egg->inherit_config_files ?? '{}');
$configs = is_object($configFiles) || is_array($configFiles)
? $this->replacePlaceholders($server, $configFiles)
: [];
$configs = $this->replacePlaceholders(
$server,
json_decode($server->egg->inherit_config_files)
);
return [
'startup' => $this->convertStartupToNewFormat(json_decode($server->egg->inherit_config_startup, true)),

View File

@@ -92,7 +92,7 @@ class EggExporterService
return $this->yamlExport($decoded);
}
return str_replace("\r\n", "\n", $data);
return str_replace(["\r\n", '\\r\\n', '\\n'], "\n", $data);
}
if (is_array($data)) {

View File

@@ -189,18 +189,6 @@ class EggImporterService
}
}
// Convert YAML booleans to strings to prevent Laravel from converting them to 1/0
// when saving to TEXT field. Required for validation rules like "in:true,false".
if (isset($parsed['variables'])) {
$parsed['variables'] = array_map(function ($variable) {
if (isset($variable['default_value']) && is_bool($variable['default_value'])) {
$variable['default_value'] = $variable['default_value'] ? 'true' : 'false';
}
return $variable;
}, $parsed['variables']);
}
// Reserved env var name handling
[$forbidden, $allowed] = collect($parsed['variables'])
->map(fn ($variable) => array_merge(
@@ -264,7 +252,7 @@ class EggImporterService
return;
}
$extension = strtolower($matches[1]);
$extension = $matches[1];
$data = base64_decode($matches[2]);
if (!$data) {
@@ -272,17 +260,11 @@ class EggImporterService
}
$normalizedExtension = match ($extension) {
'svg+xml', 'svg' => 'svg',
'jpeg', 'jpg' => 'jpg',
'png' => 'png',
'webp' => 'webp',
default => null,
'svg+xml' => 'svg',
'jpeg' => 'jpg',
default => $extension,
};
if (is_null($normalizedExtension)) {
return;
}
Storage::disk('public')->put(Egg::ICON_STORAGE_PATH . "/$egg->uuid.$normalizedExtension", $data);
}

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