Remove search for now, increase upload filesize limits

This commit is contained in:
yuriko 🦊 2025-05-25 17:14:11 -04:00
parent 1442dbfa60
commit cb086c4708
21 changed files with 117 additions and 244 deletions

View file

@ -0,0 +1,13 @@
<?php
namespace App\Livewire\App;
use Livewire\Component;
class Pagination extends Component
{
public function render()
{
return view('livewire.app.pagination');
}
}

View file

@ -9,6 +9,6 @@ class Users extends Component
{ {
public function render() public function render()
{ {
return view('livewire.pages.users', [ 'users' => User::all() ]); return view('livewire.pages.users', [ 'users' => User::paginate(10) ]);
} }
} }

View file

@ -3,7 +3,9 @@
namespace App\Livewire\Posts; namespace App\Livewire\Posts;
use App\Models\Post; use App\Models\Post;
use App\Models\Tag;
use Livewire\Attributes\Title; use Livewire\Attributes\Title;
use Livewire\Attributes\Url;
use Livewire\Component; use Livewire\Component;
use Livewire\WithPagination; use Livewire\WithPagination;
@ -14,7 +16,7 @@ class Index extends Component
#[Title('Posts')] #[Title('Posts')]
public function render() public function render()
{ {
return view('livewire.posts.index', [ return view('livewire.posts.index', [
'posts' => Post::orderBy('created_at', 'desc')->paginate(25), 'posts' => Post::orderBy('created_at', 'desc')->paginate(25),
]); ]);
} }

View file

@ -1,29 +0,0 @@
<?php
namespace App\Livewire;
use App\Models\User;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Spatie\Searchable\ModelSearchAspect;
use Spatie\Searchable\Search as SpatieSearch;
class Search extends Component
{
#[Validate('string|min:3')]
public string $searchText = '';
public $searchResults = [];
public function render()
{
return view('livewire.search');
}
public function updated()
{
$this->searchResults = (new SpatieSearch())
->registerModel(User::class, 'name')
->perform($this->searchText);
}
}

View file

@ -0,0 +1,13 @@
<?php
namespace App\Livewire\Tags;
use Livewire\Component;
class View extends Component
{
public function render()
{
return view('livewire.tags.view');
}
}

View file

@ -5,8 +5,6 @@ namespace App\Models;
use MongoDB\Laravel\Eloquent\Model; use MongoDB\Laravel\Eloquent\Model;
use MongoDB\Laravel\Relations\BelongsTo; use MongoDB\Laravel\Relations\BelongsTo;
use MongoDB\Laravel\Relations\BelongsToMany; use MongoDB\Laravel\Relations\BelongsToMany;
use MongoDB\Laravel\Relations\HasMany;
use MongoDB\Laravel\Relations\MorphToMany;
class Tag extends Model class Tag extends Model
{ {

View file

@ -9,10 +9,8 @@ use Laravel\Sanctum\HasApiTokens;
use MongoDB\Laravel\Auth\User as Authenticatable; use MongoDB\Laravel\Auth\User as Authenticatable;
use MongoDB\Laravel\Relations\HasMany; use MongoDB\Laravel\Relations\HasMany;
use Overtrue\LaravelFavorite\Traits\Favoriter; use Overtrue\LaravelFavorite\Traits\Favoriter;
use Spatie\Searchable\Searchable;
use Spatie\Searchable\SearchResult;
class User extends Authenticatable implements Searchable class User extends Authenticatable
{ {
protected $connection = 'mongodb'; protected $connection = 'mongodb';
protected $table = 'users'; protected $table = 'users';
@ -48,16 +46,6 @@ class User extends Authenticatable implements Searchable
return $this->hasMany(Comment::class); return $this->hasMany(Comment::class);
} }
public function getSearchResult(): SearchResult
{
$url = url("/profiles/$this->id");
return new SearchResult(
$this,
$this->name,
$url
);
}
public function getAvatarBase64(): string public function getAvatarBase64(): string
{ {
$ext = $this->avatar_ext; $ext = $this->avatar_ext;

View file

@ -11,7 +11,6 @@
"require": { "require": {
"php": "^8.2", "php": "^8.2",
"ext-gmp": "*", "ext-gmp": "*",
"intervention/image-driver-vips": "^1.0",
"intervention/image-laravel": "^1.5", "intervention/image-laravel": "^1.5",
"laravel/framework": "^12.0", "laravel/framework": "^12.0",
"laravel/octane": "^2.9", "laravel/octane": "^2.9",

151
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "8b27de9cde91a749385c346c0d27d3e0", "content-hash": "5de9119745206eabc310e39501de5f17",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -1261,80 +1261,6 @@
], ],
"time": "2025-05-22T17:26:23+00:00" "time": "2025-05-22T17:26:23+00:00"
}, },
{
"name": "intervention/image-driver-vips",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/Intervention/image-driver-vips.git",
"reference": "080de0e638bcf508b5e79c2d88e82b0fd91b12b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/image-driver-vips/zipball/080de0e638bcf508b5e79c2d88e82b0fd91b12b0",
"reference": "080de0e638bcf508b5e79c2d88e82b0fd91b12b0",
"shasum": ""
},
"require": {
"intervention/image": "^3.11.0",
"jcupitt/vips": "^2.4",
"php": "^8.1"
},
"require-dev": {
"ext-fileinfo": "*",
"phpstan/phpstan": "^2",
"phpunit/phpunit": "^10.0 || ^11.0 || ^12.0",
"slevomat/coding-standard": "~8.0",
"squizlabs/php_codesniffer": "^3.8"
},
"type": "library",
"autoload": {
"psr-4": {
"Intervention\\Image\\Drivers\\Vips\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Oliver Vogel",
"email": "oliver@intervention.io",
"homepage": "https://intervention.io/"
},
{
"name": "Thomas Picquet",
"email": "thomas@sctr.net"
}
],
"description": "libvips driver for Intervention Image",
"homepage": "https://image.intervention.io/",
"keywords": [
"image",
"libvips",
"vips"
],
"support": {
"issues": "https://github.com/Intervention/image-driver-vips/issues",
"source": "https://github.com/Intervention/image-driver-vips/tree/1.0.5"
},
"funding": [
{
"url": "https://paypal.me/interventionio",
"type": "custom"
},
{
"url": "https://github.com/Intervention",
"type": "github"
},
{
"url": "https://ko-fi.com/interventionphp",
"type": "ko_fi"
}
],
"time": "2025-05-05T13:53:52+00:00"
},
{ {
"name": "intervention/image-laravel", "name": "intervention/image-laravel",
"version": "1.5.6", "version": "1.5.6",
@ -1419,67 +1345,6 @@
], ],
"time": "2025-04-04T15:09:55+00:00" "time": "2025-04-04T15:09:55+00:00"
}, },
{
"name": "jcupitt/vips",
"version": "v2.5.0",
"source": {
"type": "git",
"url": "https://github.com/libvips/php-vips.git",
"reference": "a54c1cceea581b592a199edd61a7c06f44a24c08"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/libvips/php-vips/zipball/a54c1cceea581b592a199edd61a7c06f44a24c08",
"reference": "a54c1cceea581b592a199edd61a7c06f44a24c08",
"shasum": ""
},
"require": {
"ext-ffi": "*",
"php": ">=7.4",
"psr/log": "^1.1.3|^2.0|^3.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpdocumentor/shim": "^3.3",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Jcupitt\\Vips\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "John Cupitt",
"email": "jcupitt@gmail.com",
"homepage": "https://github.com/jcupitt",
"role": "Developer"
}
],
"description": "A high-level interface to the libvips image processing library.",
"homepage": "https://github.com/libvips/php-vips",
"keywords": [
"image",
"libvips",
"processing"
],
"support": {
"issues": "https://github.com/libvips/php-vips/issues",
"source": "https://github.com/libvips/php-vips/tree/v2.5.0"
},
"time": "2025-04-04T17:10:13+00:00"
},
{ {
"name": "laminas/laminas-diactoros", "name": "laminas/laminas-diactoros",
"version": "3.6.0", "version": "3.6.0",
@ -3050,21 +2915,21 @@
}, },
{ {
"name": "mongodb/mongodb", "name": "mongodb/mongodb",
"version": "2.0.0", "version": "1.21.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/mongodb/mongo-php-library.git", "url": "https://github.com/mongodb/mongo-php-library.git",
"reference": "04cd7edc6a28950e3fab6eccb2869d72a0541232" "reference": "37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/04cd7edc6a28950e3fab6eccb2869d72a0541232", "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a",
"reference": "04cd7edc6a28950e3fab6eccb2869d72a0541232", "reference": "37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer-runtime-api": "^2.0", "composer-runtime-api": "^2.0",
"ext-mongodb": "^2.0", "ext-mongodb": "^1.21.0",
"php": "^8.1", "php": "^8.1",
"psr/log": "^1.1.4|^2|^3" "psr/log": "^1.1.4|^2|^3"
}, },
@ -3120,9 +2985,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/mongodb/mongo-php-library/issues", "issues": "https://github.com/mongodb/mongo-php-library/issues",
"source": "https://github.com/mongodb/mongo-php-library/tree/2.0.0" "source": "https://github.com/mongodb/mongo-php-library/tree/1.21.1"
}, },
"time": "2025-04-10T08:34:11+00:00" "time": "2025-02-28T17:24:20+00:00"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",

View file

@ -4,7 +4,7 @@ return [
/** /**
* Use uuid as primary key. * Use uuid as primary key.
*/ */
'uuids' => false, 'uuids' => true,
/* /*
* User tables foreign key name. * User tables foreign key name.

View file

@ -65,12 +65,13 @@ return [
'temporary_file_upload' => [ 'temporary_file_upload' => [
'disk' => null, // Example: 'local', 's3' | Default: 'default' 'disk' => null, // Example: 'local', 's3' | Default: 'default'
'rules' => ['required', 'file', 'max:12288'], // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB) 'rules' => ['file', 'max:81920'], // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB)
'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp' 'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp'
'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1' 'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1'
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs... 'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs...
'png', 'gif', 'bmp', 'svg', 'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
'jpg', 'jpeg', 'webp', 'mov', 'avi', 'wmv', 'mp3', 'm4a',
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
], ],
'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated... 'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs... 'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs...

View file

@ -1,2 +1,2 @@
upload_max_filesize = 64M upload_max_filesize = 80M
post_max_filesize = 72M post_max_filesize = 100M

View file

@ -5,10 +5,6 @@
{{-- {{ config('app.name') }}--}} {{-- {{ config('app.name') }}--}}
{{-- </h1>--}} {{-- </h1>--}}
<h1>{{ config('app.name') }}</h1> <h1>{{ config('app.name') }}</h1>
@auth
<livewire:search />
@endauth
</div> </div>
<livewire:post-feature lazy /> <livewire:post-feature lazy />

View file

@ -0,0 +1,34 @@
<div class="wa-stack">
<wa-divider></wa-divider>
<div class="wa-split">
<span class="wa-caption-l">Showing {{ $paginator->firstItem() }}-{{ $paginator->lastItem() }} of {{ $paginator->total() }} results</span>
<div class="wa-cluster wa-gap-xs">
<wa-button
appearance="outlined"
@if($paginator->onFirstPage())
disabled
@else
wire:click="previousPage"
wire:loading.attr="disabled"
rel="prev"
@endif
>
<wa-icon name="arrow-left" slot="prefix"></wa-icon>
Previous
</wa-button>
<wa-button
appearance="outlined"
@if($paginator->onLastPage())
disabled
@else
wire:click="nextPage"
wire:loading.attr="disabled"
rel="prev"
@endif
>
Next
<wa-icon name="arrow-right" slot="suffix"></wa-icon>
</wa-button>
</div>
</div>
</div>

View file

@ -6,4 +6,6 @@
<livewire:app.user-card :$user /> <livewire:app.user-card :$user />
@endforeach @endforeach
</div> </div>
{{ $users->links('livewire.app.pagination') }}
</div> </div>

View file

@ -40,12 +40,14 @@
<span>Tags</span> <span>Tags</span>
</div> </div>
@foreach ($tags as $postTag) <div class="wa-stack wa-gap-2xs" wire:poll>
<div class="wa-split"> @foreach ($tags as $postTag)
<span style="color: {{ $postTag->tagGroup->color }};">{{ $postTag->name }}</span> <div class="wa-split">
<wa-icon-button name="times" appearance="plain" href="{{ url("/delete/post/$post->id/tag/$postTag->id") }}" wire:navigate></wa-icon-button> <span style="color: {{ $postTag->tagGroup->color }};">{{ $postTag->name }}</span>
</div> <wa-icon-button name="times" appearance="plain" href="{{ url("/delete/post/$post->id/tag/$postTag->id") }}" style="color: var(--wa-color-danger-on-quiet);" wire:navigate></wa-icon-button>
@endforeach </div>
@endforeach
</div>
<wa-divider></wa-divider> <wa-divider></wa-divider>
@ -63,24 +65,24 @@
</div> </div>
{{-- Main content --}} {{-- Main content --}}
<div class="wa-stack wa-gap-2xl"> <div>
<livewire:posts.image :$post lazy /> <livewire:posts.image :$post lazy />
</div>
{{-- Confirm deletion dialog --}} {{-- Confirm deletion dialog --}}
<wa-dialog label="Confirm post deletion" without-header light-dismiss id="modal-confirm-post-delete" style="--width: 360px;"> <wa-dialog label="Confirm post deletion" without-header light-dismiss id="modal-confirm-post-delete" style="--width: 360px;" wire:ignore>
<div class="wa-stack wa-align-items-center"> <div class="wa-stack wa-align-items-center">
<span>Are you sure you want to delete this post?</span> <span>Are you sure you want to delete this post?</span>
<div class="wa-split"> <div class="wa-split">
<wa-button variant="neutral" appearance="outlined" data-dialog="close"> <wa-button variant="neutral" appearance="outlined" data-dialog="close">
No, go back No, go back
</wa-button> </wa-button>
<wa-button href="{{ url("delete/post/$post->id") }}" appearance="outlined" variant="danger" wire:navigate> <wa-button href="{{ url("delete/post/$post->id") }}" appearance="outlined" variant="danger" wire:navigate>
Yes, delete it Yes, delete it
</wa-button> </wa-button>
</div>
</div> </div>
</div> </wa-dialog>
</wa-dialog> </div>
@script @script
<script> <script>

View file

@ -5,4 +5,5 @@
<livewire:posts.thumbnail :$post lazy /> <livewire:posts.thumbnail :$post lazy />
@endforeach @endforeach
</div> </div>
{{ $posts->links('livewire.app.pagination') }}
</div> </div>

View file

@ -1,7 +1,7 @@
<div class="wa-flank wa-align-items-start wa-gap-3xl" style="--flank-size: 20rem;"> <div class="wa-flank wa-align-items-start wa-gap-3xl" style="--flank-size: 20rem;">
{{-- Sidebar --}} {{-- Sidebar --}}
<div class="wa-stack" wire:poll> <div class="wa-stack">
{{-- Post navigation --}} {{-- Post navigation --}}
<div class="wa-cluster"> <div class="wa-cluster">
@ -63,9 +63,11 @@
<span>Tags</span> <span>Tags</span>
</div> </div>
@foreach ($post->tags as $tag) <div class="wa-stack wa-gap-2xs" wire:poll>
<span style="color: {{ $tag->tagGroup->color }};">{{ $tag->name }}</span> @foreach ($post->tags as $tag)
@endforeach <span style="color: {{ $tag->tagGroup->color }};">{{ $tag->name }}</span>
@endforeach
</div>
</div> </div>

View file

@ -1,19 +0,0 @@
<form wire:submit>
<wa-input wire:model.live="searchText" type="text" placeholder="Search for posts, tags, users, etc.">
<wa-icon slot="prefix" name="magnifying-glass"></wa-icon>
</wa-input>
<wa-popup
placement="bottom-end"
distance="10"
sync="width"
auto-size="vertical"
auto-size-padding="10"
{{ $searchResults ? 'active' : '' }}>
<wa-card>
@isset($searchResults)
<pre><code>{{ var_dump($searchResults) }}</code></pre>
@endisset
</wa-card>
</wa-popup>
</form>

View file

@ -0,0 +1,3 @@
<div>
{{-- To attain knowledge, add things every day; To attain wisdom, subtract things every day. --}}
</div>

View file

@ -10,6 +10,7 @@ use App\Livewire\Posts\Edit as EditPost;
use App\Livewire\Posts\View as ViewPost; use App\Livewire\Posts\View as ViewPost;
use App\Livewire\Tags\Index as TagsIndexPage; use App\Livewire\Tags\Index as TagsIndexPage;
use App\Livewire\Tags\Groups as TagGroupsPage; use App\Livewire\Tags\Groups as TagGroupsPage;
use App\Livewire\Tags\View as TagViewPage;
use App\Models\Post; use App\Models\Post;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@ -36,6 +37,7 @@ Route::middleware('auth')->prefix('posts')->group(function () {
// Tag routes // Tag routes
Route::middleware('auth')->prefix('tags')->group(function () { Route::middleware('auth')->prefix('tags')->group(function () {
Route::get('/', TagsIndexPage::class)->name('tags.home'); Route::get('/', TagsIndexPage::class)->name('tags.home');
Route::get('/view/{tag}', TagViewPage::class)->name('tags.view');
Route::get('/groups', TagGroupsPage::class)->name('tags.groups'); Route::get('/groups', TagGroupsPage::class)->name('tags.groups');
}); });