Cut over-engineering found by a repo-wide audit
- Config: auth, services, logging, queue and database only repeated the
framework's own files and are gone; the others keep only the keys that
differ (app version, cache serializable_classes, session cookie name,
Markdown mail theme, the shares disk, three Octane values, Livewire's
pagination theme and payload guards).
- Email verification is removed: User never implemented MustVerifyEmail,
so it was never enforced, and SealShare has a single admin and no
registration. CreateNewUser goes with it.
- FileEncryptionService::encryptFile() and generateSalt() were only used
by tests; tests build files with encryptTestFile() in tests/Pest.php.
- The expiration options are defined once, as Share::EXPIRATIONS. "30 Days"
now lasts 30 days instead of a calendar month, and Admin settings only
save a default expiration that is one of the options.
- One-caller helpers are inlined, the uploader reads chunk responses with
XHR's responseType, and starter-kit leftovers are removed.
- Docker: PHP reads the PHP_* limits from the environment itself
(${VAR:-default} in uploads.ini); both entrypoints stop writing the ini.
docker-compose.yml shares the app and scheduler variables through one
anchor. The dev image installs gd for the screenshot publisher and fake
test images.
- Development runs in Docker only: the composer dev script, concurrently,
laravel/pail, laravel/sail, autoprefixer and the shell-quote override
are gone.
- phpunit.xml forces the test environment with <server> entries, so tests
run in the dev container no longer use its real database.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a62edbcefb
commit
4530298398
@@ -202,10 +202,11 @@ document.addEventListener('alpine:init', () => {
|
||||
xhr.setRequestHeader('Content-Type', 'application/octet-stream')
|
||||
xhr.setRequestHeader('Accept', 'application/json')
|
||||
xhr.setRequestHeader('X-CSRF-TOKEN', csrfToken)
|
||||
xhr.responseType = 'json'
|
||||
xhr.upload.onprogress = (event) => onProgress(event.loaded)
|
||||
xhr.onload = () => {
|
||||
this.request = null
|
||||
resolve({ status: xhr.status, uploadedChunks: parseUploadedChunks(xhr.responseText) })
|
||||
resolve({ status: xhr.status, uploadedChunks: xhr.response?.uploaded_chunks })
|
||||
}
|
||||
xhr.onerror = () => {
|
||||
this.request = null
|
||||
@@ -307,11 +308,3 @@ function chunkNonce(prefix, index, isLast) {
|
||||
|
||||
return nonce
|
||||
}
|
||||
|
||||
function parseUploadedChunks(responseText) {
|
||||
try {
|
||||
return JSON.parse(responseText).uploaded_chunks
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" {{ $attributes }}>
|
||||
{{-- Document outline with folded corner --}}
|
||||
<path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Z" stroke="currentColor" stroke-width="1.5" />
|
||||
<path d="M14 2v5a1 1 0 0 0 1 1h5" stroke="currentColor" stroke-width="1.5" />
|
||||
{{-- Upload arrow --}}
|
||||
<path d="M12 17v-6m0 0-2.5 2.5M12 11l2.5 2.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 517 B |
@@ -161,14 +161,7 @@
|
||||
wire:model="defaultExpiration"
|
||||
:label="__('Default Expiration')"
|
||||
:placeholder="$allowNeverExpire ? __('None') : null"
|
||||
:options="[
|
||||
['id' => '1h', 'name' => __('1 Hour')],
|
||||
['id' => '24h', 'name' => __('24 Hours')],
|
||||
['id' => '48h', 'name' => __('48 Hours')],
|
||||
['id' => '7d', 'name' => __('7 Days')],
|
||||
['id' => '14d', 'name' => __('14 Days')],
|
||||
['id' => '30d', 'name' => __('30 Days')],
|
||||
]"
|
||||
:options="collect(\App\Models\Share::EXPIRATIONS)->map(fn (array $option, string $id): array => ['id' => $id, 'name' => __($option['label'])])->values()->all()"
|
||||
/>
|
||||
|
||||
<x-input full
|
||||
|
||||
@@ -127,14 +127,7 @@
|
||||
wire:model="expiration"
|
||||
:label="__('Expiration')"
|
||||
:placeholder="$allowNeverExpire ? __('Never') : null"
|
||||
:options="[
|
||||
['id' => '1h', 'name' => __('1 Hour')],
|
||||
['id' => '24h', 'name' => __('24 Hours')],
|
||||
['id' => '48h', 'name' => __('48 Hours')],
|
||||
['id' => '7d', 'name' => __('7 Days')],
|
||||
['id' => '14d', 'name' => __('14 Days')],
|
||||
['id' => '30d', 'name' => __('30 Days')],
|
||||
]"
|
||||
:options="collect(\App\Models\Share::EXPIRATIONS)->map(fn (array $option, string $id): array => ['id' => $id, 'name' => __($option['label'])])->values()->all()"
|
||||
/>
|
||||
|
||||
<x-input full
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<x-layouts::app :title="__('Verify email')">
|
||||
<x-page brand>
|
||||
<x-card
|
||||
:title="__('Verify your email')"
|
||||
:subtitle="__('Please verify your email address by clicking on the link we just emailed to you.')"
|
||||
heading="h2"
|
||||
variant="outlined"
|
||||
>
|
||||
<x-stack gap="space300">
|
||||
@if (session('status') == 'verification-link-sent')
|
||||
<x-alert color="success">
|
||||
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
|
||||
</x-alert>
|
||||
@endif
|
||||
|
||||
<x-stack gap="space100">
|
||||
<x-form method="POST" action="{{ route('verification.send') }}">
|
||||
@csrf
|
||||
<x-slot:actions>
|
||||
<x-button type="submit" :label="__('Resend verification email')" variant="filled" />
|
||||
</x-slot:actions>
|
||||
</x-form>
|
||||
|
||||
{{-- Log out posts elsewhere, so it is a form of its own; it sits under Resend at the same end
|
||||
edge, the card's two actions end-aligned below its content. --}}
|
||||
<x-row as="form" justify="end" method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<x-button type="submit" :label="__('Log out')" data-test="logout-button" />
|
||||
</x-row>
|
||||
</x-stack>
|
||||
</x-stack>
|
||||
</x-card>
|
||||
</x-page>
|
||||
</x-layouts::app>
|
||||
@@ -1,12 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Concerns\ProfileValidationRules;
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Livewire\Attributes\Computed;
|
||||
use Livewire\Component;
|
||||
use NoNameWeb\LivewireMaterial\Concerns\Toasts;
|
||||
|
||||
@@ -35,72 +30,19 @@ new class extends Component {
|
||||
|
||||
$validated = $this->validate($this->profileRules($user->id));
|
||||
|
||||
$user->fill($validated);
|
||||
|
||||
if ($user->isDirty('email')) {
|
||||
$user->email_verified_at = null;
|
||||
}
|
||||
|
||||
$user->save();
|
||||
$user->fill($validated)->save();
|
||||
|
||||
$this->dispatch('profile-updated', name: $user->name);
|
||||
|
||||
$this->success(__('Saved.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an email verification notification to the current user.
|
||||
*/
|
||||
public function resendVerificationNotification(): void
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user->hasVerifiedEmail()) {
|
||||
$this->redirectIntended(default: route('admin.dashboard', absolute: false));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$user->sendEmailVerificationNotification();
|
||||
|
||||
Session::flash('status', 'verification-link-sent');
|
||||
}
|
||||
|
||||
#[Computed]
|
||||
public function hasUnverifiedEmail(): bool
|
||||
{
|
||||
return Auth::user() instanceof MustVerifyEmail && ! Auth::user()->hasVerifiedEmail();
|
||||
}
|
||||
|
||||
#[Computed]
|
||||
public function showDeleteUser(): bool
|
||||
{
|
||||
return ! Auth::user() instanceof MustVerifyEmail
|
||||
|| (Auth::user() instanceof MustVerifyEmail && Auth::user()->hasVerifiedEmail());
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<x-pages::settings.layout :heading="__('Profile')" :subheading="__('Update your name and email address')">
|
||||
<x-form wire:submit="updateProfileInformation">
|
||||
<x-input full wire:model="name" :label="__('Name')" type="text" required autofocus autocomplete="name" icon="person" />
|
||||
|
||||
<x-stack gap="space100">
|
||||
<x-input full wire:model="email" :label="__('Email')" type="email" required autocomplete="email" icon="mail" />
|
||||
|
||||
@if ($this->hasUnverifiedEmail)
|
||||
<p class="md-type-body-md md-ink-variant">
|
||||
{{ __('Your email address is unverified.') }}
|
||||
|
||||
<button type="button" class="md-link" wire:click.prevent="resendVerificationNotification">
|
||||
{{ __('Click here to re-send the verification email.') }}
|
||||
</button>
|
||||
</p>
|
||||
|
||||
@if (session('status') === 'verification-link-sent')
|
||||
<x-alert color="success">{{ __('A new verification link has been sent to your email address.') }}</x-alert>
|
||||
@endif
|
||||
@endif
|
||||
</x-stack>
|
||||
<x-input full wire:model="email" :label="__('Email')" type="email" required autocomplete="email" icon="mail" />
|
||||
|
||||
<x-slot:actions>
|
||||
<x-button type="submit" :label="__('Save')" variant="filled" spinner="updateProfileInformation" data-test="update-profile-button" />
|
||||
@@ -108,8 +50,6 @@ new class extends Component {
|
||||
</x-form>
|
||||
|
||||
<x-slot:after>
|
||||
@if ($this->showDeleteUser)
|
||||
<livewire:pages::settings.delete-user-form />
|
||||
@endif
|
||||
<livewire:pages::settings.delete-user-form />
|
||||
</x-slot:after>
|
||||
</x-pages::settings.layout>
|
||||
|
||||
Reference in New Issue
Block a user