🆙 Fix cms as now on epicnabbo.nl 🆙

This commit is contained in:
Remco
2026-01-07 19:42:55 +01:00
parent dc418a51a1
commit 6bf99066a5
22 changed files with 142 additions and 27 deletions
+77
View File
@@ -0,0 +1,77 @@
name: Laravel
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
jobs:
tests:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:11
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: atomcms_testing
ports:
- 3306:3306
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: vendor
key: composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
- name: Install composer dependencies
run: |
composer install --no-scripts
- name: Install NPM dependencies
run: npm install
- name: Compile assets
run: npm run build:atom
- name: Prepare Laravel Application
run: |
cp .env.testing.example .env.testing
# Override database config for GitHub Actions
sed -i 's/DB_USERNAME=docker/DB_USERNAME=root/' .env.testing
sed -i 's/DB_PASSWORD=password/DB_PASSWORD=/' .env.testing
sed -i 's/DB_DATABASE=testing/DB_DATABASE=atomcms_testing/' .env.testing
php artisan key:generate --env=testing
- name: Debug Laravel Configuration
run: |
php artisan config:cache --env=testing
php artisan route:cache --env=testing
php artisan view:cache --env=testing
- name: Create storage directories
run: |
mkdir -p storage/app/public
mkdir -p storage/framework/cache
mkdir -p storage/framework/sessions
mkdir -p storage/framework/views
mkdir -p storage/logs
chmod -R 755 storage
- name: Run Test suite with debug
run: |
php artisan test --env=testing --stop-on-failure
+38
View File
@@ -0,0 +1,38 @@
name: Fix Code Style
on: [push]
permissions:
contents: write
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.4]
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer, pint
- name: Install composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Run Pint
run: pint
- name: Commit linted files
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'style: fix code style with Laravel Pint'
@@ -53,6 +53,6 @@ class TwoFactorAuthenticatedSessionController extends Controller
'ip_current' => $request->ip(), 'ip_current' => $request->ip(),
]); ]);
return app(TwoFactorLoginResponse::class); return resolve(TwoFactorLoginResponse::class);
} }
} }
@@ -120,7 +120,7 @@ class CreateNewUser implements CreatesNewUsers
'beta_code' => ['sometimes', 'string', new BetaCodeRule], 'beta_code' => ['sometimes', 'string', new BetaCodeRule],
'terms' => ['required', 'accepted'], 'terms' => ['required', 'accepted'],
'g-recaptcha-response' => ['sometimes', 'string', new GoogleRecaptchaRule], 'g-recaptcha-response' => ['sometimes', 'string', new GoogleRecaptchaRule],
'cf-turnstile-response' => [app(Turnstile::class)], 'cf-turnstile-response' => [resolve(Turnstile::class)],
]; ];
$messages = [ $messages = [
@@ -179,7 +179,7 @@ class RedirectIfTwoFactorAuthenticatable
} }
if (setting('cloudflare_turnstile_enabled') !== '' && setting('cloudflare_turnstile_enabled') !== '0') { if (setting('cloudflare_turnstile_enabled') !== '' && setting('cloudflare_turnstile_enabled') !== '0') {
$rules['cf-turnstile-response'] = ['required', app(Turnstile::class)]; $rules['cf-turnstile-response'] = ['required', resolve(Turnstile::class)];
} }
$messages = [ $messages = [
+2 -2
View File
@@ -123,7 +123,7 @@ class BadgePage extends Page
return; return;
} }
$badgeData = app(ExternalTextsParser::class)->getBadgeData($badgeCode); $badgeData = resolve(ExternalTextsParser::class)->getBadgeData($badgeCode);
$this->badgeWasPreviouslyCreated = is_array($badgeData['nitro']) || is_array($badgeData['flash']); $this->badgeWasPreviouslyCreated = is_array($badgeData['nitro']) || is_array($badgeData['flash']);
if ($this->badgeWasPreviouslyCreated) { if ($this->badgeWasPreviouslyCreated) {
@@ -202,7 +202,7 @@ class BadgePage extends Page
return; return;
} }
$externalTextsParser = app(ExternalTextsParser::class); $externalTextsParser = resolve(ExternalTextsParser::class);
if ((empty($this->data['nitro']) && $nitroEnabled) || (empty($this->data['flash']) && $flashEnabled)) { if ((empty($this->data['nitro']) && $nitroEnabled) || (empty($this->data['flash']) && $flashEnabled)) {
Notification::make() Notification::make()
+1 -1
View File
@@ -56,7 +56,7 @@ class Login extends \Filament\Auth\Pages\Login
session()->regenerate(); session()->regenerate();
return app(LoginResponse::class); return resolve(LoginResponse::class);
} }
protected function throwFailureValidationException(): never protected function throwFailureValidationException(): never
@@ -55,7 +55,7 @@ class BadgeTextEditorResource extends Resource
#[\Override] #[\Override]
public static function table(Table $table): Table public static function table(Table $table): Table
{ {
$settingsService = app(SettingsService::class); $settingsService = resolve(SettingsService::class);
$badgesPath = $settingsService->getOrDefault('badges_path', '/gamedata/c_images/album1584/'); $badgesPath = $settingsService->getOrDefault('badges_path', '/gamedata/c_images/album1584/');
return $table return $table
@@ -10,7 +10,7 @@ class CustomQueryBuilder extends Builder
public function __construct() public function __construct()
{ {
// Call the parent constructor with a dummy query // Call the parent constructor with a dummy query
parent::__construct(app('db')->query()); parent::__construct(resolve('db')->query());
} }
#[\Override] #[\Override]
@@ -58,7 +58,7 @@ class EditUser extends EditRecord
$this->halt(); $this->halt();
} }
$rcon = app(RconService::class); $rcon = resolve(RconService::class);
if (! $user->online) { if (! $user->online) {
DB::transaction(function () use ($user, $data): void { DB::transaction(function () use ($user, $data): void {
@@ -152,7 +152,7 @@ class EditUser extends EditRecord
return; return;
} }
app(SendCurrency::class)->execute($user, $currencyType, -$currency->amount + $updatedCurrencyAmount); resolve(SendCurrency::class)->execute($user, $currencyType, -$currency->amount + $updatedCurrencyAmount);
}); });
} }
@@ -83,7 +83,7 @@ class BadgesRelationManager extends RelationManager
->persistent() ->persistent()
->send(); ->send();
} else { } else {
$rcon = app(RconService::class); $rcon = resolve(RconService::class);
$data = $action->getFormData(); $data = $action->getFormData();
$rcon->sendSafelyFromDashboard('sendBadge', [$user, $data['badge_code']], 'RCON: Failed to send the badge'); $rcon->sendSafelyFromDashboard('sendBadge', [$user, $data['badge_code']], 'RCON: Failed to send the badge');
@@ -119,7 +119,7 @@ class BadgesRelationManager extends RelationManager
->persistent() ->persistent()
->send(); ->send();
} else { } else {
$rcon = app(RconService::class); $rcon = resolve(RconService::class);
$badge = $action instanceof DeleteAction $badge = $action instanceof DeleteAction
? $action->getRecord()?->badge_code ? $action->getRecord()?->badge_code
: $action->getRecords()->map(fn ($record) => $record->badge_code)->join(';'); : $action->getRecords()->map(fn ($record) => $record->badge_code)->join(';');
+3 -3
View File
@@ -9,21 +9,21 @@ use Illuminate\Support\Str;
if (! function_exists('setting')) { if (! function_exists('setting')) {
function setting(string $setting): string function setting(string $setting): string
{ {
return app(SettingsService::class)->getOrDefault($setting); return resolve(SettingsService::class)->getOrDefault($setting);
} }
} }
if (! function_exists('hasPermission')) { if (! function_exists('hasPermission')) {
function hasPermission(string $permission): string function hasPermission(string $permission): string
{ {
return app(PermissionsService::class)->getOrDefault($permission); return resolve(PermissionsService::class)->getOrDefault($permission);
} }
} }
if (! function_exists('hasHousekeepingPermission')) { if (! function_exists('hasHousekeepingPermission')) {
function hasHousekeepingPermission(string $permission): string function hasHousekeepingPermission(string $permission): string
{ {
return app(HousekeepingPermissionsService::class)->getOrDefault($permission); return resolve(HousekeepingPermissionsService::class)->getOrDefault($permission);
} }
} }
@@ -135,7 +135,7 @@ class ShopController extends Controller
public function handleFurniture(array $furniture) public function handleFurniture(array $furniture)
{ {
$sendFurniture = app(SendFurniture::class); $sendFurniture = resolve(SendFurniture::class);
$sendFurniture->execute(Auth::user(), $furniture); $sendFurniture->execute(Auth::user(), $furniture);
} }
@@ -17,7 +17,7 @@ class AccountSettingsFormRequest extends FormRequest
'mail' => ['required', 'email', Rule::unique('users')->ignore($this->user()->id), new WebsiteWordfilterRule], 'mail' => ['required', 'email', Rule::unique('users')->ignore($this->user()->id), new WebsiteWordfilterRule],
'motto' => ['nullable', 'string', 'max:127', new WebsiteWordfilterRule], 'motto' => ['nullable', 'string', 'max:127', new WebsiteWordfilterRule],
'g-recaptcha-response' => [new GoogleRecaptchaRule], 'g-recaptcha-response' => [new GoogleRecaptchaRule],
'cf-turnstile-response' => [app(Turnstile::class)], 'cf-turnstile-response' => [resolve(Turnstile::class)],
]; ];
} }
@@ -18,7 +18,7 @@ class PasswordSettingsFormRequest extends FormRequest
'current_password' => ['required', 'string', new CurrentPasswordRule], 'current_password' => ['required', 'string', new CurrentPasswordRule],
'password' => $this->passwordRules(), 'password' => $this->passwordRules(),
'g-recaptcha-response' => [new GoogleRecaptchaRule], 'g-recaptcha-response' => [new GoogleRecaptchaRule],
'cf-turnstile-response' => [app(Turnstile::class)], 'cf-turnstile-response' => [resolve(Turnstile::class)],
]; ];
} }
} }
@@ -18,7 +18,7 @@ class RegisterFormRequest extends FormRequest
'password' => ['required', 'string', 'confirmed', 'min:8'], 'password' => ['required', 'string', 'confirmed', 'min:8'],
'terms' => ['required', 'accepted'], 'terms' => ['required', 'accepted'],
'g-recaptcha-response' => [new GoogleRecaptchaRule], 'g-recaptcha-response' => [new GoogleRecaptchaRule],
'cf-turnstile-response' => [app(Turnstile::class)], 'cf-turnstile-response' => [resolve(Turnstile::class)],
]; ];
} }
@@ -13,7 +13,7 @@ class ShopVoucherFormRequest extends FormRequest
return [ return [
'code' => ['required', 'string'], 'code' => ['required', 'string'],
'g-recaptcha-response' => [new GoogleRecaptchaRule], 'g-recaptcha-response' => [new GoogleRecaptchaRule],
'cf-turnstile-response' => [app(Turnstile::class)], 'cf-turnstile-response' => [resolve(Turnstile::class)],
]; ];
} }
} }
@@ -13,7 +13,7 @@ class StaffApplicationFormRequest extends FormRequest
return [ return [
'content' => ['required', 'string'], 'content' => ['required', 'string'],
'g-recaptcha-response' => [new GoogleRecaptchaRule], 'g-recaptcha-response' => [new GoogleRecaptchaRule],
'cf-turnstile-response' => [app(Turnstile::class)], 'cf-turnstile-response' => [resolve(Turnstile::class)],
]; ];
} }
} }
+1 -1
View File
@@ -245,7 +245,7 @@ class User extends Authenticatable implements FilamentUser, HasName
public function confirmTwoFactorAuthentication($code) public function confirmTwoFactorAuthentication($code)
{ {
$codeIsValid = app(TwoFactorAuthenticationProvider::class) $codeIsValid = resolve(TwoFactorAuthenticationProvider::class)
->verify(decrypt($this->two_factor_secret), $code); ->verify(decrypt($this->two_factor_secret), $code);
if (! $codeIsValid) { if (! $codeIsValid) {
+2 -2
View File
@@ -20,7 +20,7 @@ class WebsiteAd extends Model
protected function imageUrl(): \Illuminate\Database\Eloquent\Casts\Attribute protected function imageUrl(): \Illuminate\Database\Eloquent\Casts\Attribute
{ {
return \Illuminate\Database\Eloquent\Casts\Attribute::make(get: function () { return \Illuminate\Database\Eloquent\Casts\Attribute::make(get: function () {
$settingsService = app(SettingsService::class); $settingsService = resolve(SettingsService::class);
$adsPicturePath = Cache::remember('ads_picture_path', 3600, fn () => $settingsService->getOrDefault('ads_picture_path')); $adsPicturePath = Cache::remember('ads_picture_path', 3600, fn () => $settingsService->getOrDefault('ads_picture_path'));
if (! str_starts_with((string) $adsPicturePath, 'http')) { if (! str_starts_with((string) $adsPicturePath, 'http')) {
$adsPicturePath = rtrim((string) config('app.url'), '/') . '/' . ltrim((string) $adsPicturePath, '/'); $adsPicturePath = rtrim((string) config('app.url'), '/') . '/' . ltrim((string) $adsPicturePath, '/');
@@ -56,7 +56,7 @@ class WebsiteAd extends Model
protected function configureAdsDisk(): void protected function configureAdsDisk(): void
{ {
$settingsService = app(SettingsService::class); $settingsService = resolve(SettingsService::class);
$adsPath = Cache::remember('ads_path_filesystem', 3600, fn () => $settingsService->getOrDefault('ads_path_filesystem')); $adsPath = Cache::remember('ads_path_filesystem', 3600, fn () => $settingsService->getOrDefault('ads_path_filesystem'));
@@ -56,7 +56,7 @@ class AppServiceProvider extends ServiceProvider
$table->paginated([10, 25, 50]); $table->paginated([10, 25, 50]);
}); });
$settingsService = app(SettingsService::class); $settingsService = resolve(SettingsService::class);
$badgePath = $settingsService->getOrDefault('badge_path_filesystem', '/var/www/gamedata/c_images/album1584'); $badgePath = $settingsService->getOrDefault('badge_path_filesystem', '/var/www/gamedata/c_images/album1584');
Config::set('filesystems.disks.badges.root', $badgePath); Config::set('filesystems.disks.badges.root', $badgePath);
+2 -2
View File
@@ -22,7 +22,7 @@ return RectorConfig::configure()
->withSets([ ->withSets([
LevelSetList::UP_TO_PHP_85, LevelSetList::UP_TO_PHP_85,
// Dit activeert de gratis "Laravel Shift" naar versie 12: // Dit activeert de gratis "Laravel Shift" naar versie 12:
LaravelLevelSetList::UP_TO_LARAVEL_120, LaravelLevelSetList::UP_TO_LARAVEL_120,
LaravelSetList::LARAVEL_CODE_QUALITY, LaravelSetList::LARAVEL_CODE_QUALITY,
SetList::CODE_QUALITY, SetList::CODE_QUALITY,
SetList::DEAD_CODE, SetList::DEAD_CODE,
@@ -30,4 +30,4 @@ return RectorConfig::configure()
->withSkip([ ->withSkip([
__DIR__ . '/lang/vendor', __DIR__ . '/lang/vendor',
__DIR__ . '/storage', // Altijd overslaan __DIR__ . '/storage', // Altijd overslaan
]); ]);