Compare commits

...

4 commits

Author SHA1 Message Date
b8032e9dec Merge remote-tracking branch 'origin/main'
Some checks failed
Docker / build (push) Has been cancelled
2025-05-25 18:04:35 -04:00
68d316cd86 Add image info, increase php limits 2025-05-25 18:04:31 -04:00
Jaiden
87e535ff98
Delete composer.lock 2025-05-25 17:22:06 -04:00
cb086c4708 Remove search for now, increase upload filesize limits 2025-05-25 17:14:11 -04:00
23 changed files with 131 additions and 9954 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()
{
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;
use App\Models\Post;
use App\Models\Tag;
use Livewire\Attributes\Title;
use Livewire\Attributes\Url;
use Livewire\Component;
use Livewire\WithPagination;

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

@ -78,6 +78,17 @@ class Post extends Model
return getimagesize($this->getFullUrl());
}
public function getDimensionsStr(): string
{
[$width, $height] = $this->getDimensions();
return "$width x $height";
}
public function getFileSize(): int
{
return Storage::size("posts/$this->id/full");
}
public function getAspectRatio(): string
{
list($width, $height) = $this->getDimensions();

View file

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

View file

@ -9,10 +9,8 @@ use Laravel\Sanctum\HasApiTokens;
use MongoDB\Laravel\Auth\User as Authenticatable;
use MongoDB\Laravel\Relations\HasMany;
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 $table = 'users';
@ -48,16 +46,6 @@ class User extends Authenticatable implements Searchable
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
{
$ext = $this->avatar_ext;

View file

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

9852
composer.lock generated

File diff suppressed because it is too large Load diff

View file

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

View file

@ -65,12 +65,13 @@ return [
'temporary_file_upload' => [
'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'
'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1'
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs...
'png', 'gif', 'bmp', 'svg',
'jpg', 'jpeg', 'webp',
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
'mov', 'avi', 'wmv', 'mp3', 'm4a',
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
],
'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs...

View file

@ -1,7 +1,7 @@
FROM dunglas/frankenphp
# Copy php.ini
COPY ./deploy/php.ini $PHP_INI_DIR/php.ini
COPY ./deploy/php.ini $PHP_INI_DIR/php-app-config.ini
RUN apt update -y && apt install -y --no-install-recommends git nodejs npm
COPY --from=composer:lts /usr/bin/composer /usr/bin/composer

View file

@ -1,2 +1,5 @@
upload_max_filesize = 64M
post_max_filesize = 72M
[php]
upload_max_filesize = 100M
post_max_filesize = 128M
memory_limit = 1G
max_execution_time = 120

View file

@ -5,10 +5,6 @@
{{-- {{ config('app.name') }}--}}
{{-- </h1>--}}
<h1>{{ config('app.name') }}</h1>
@auth
<livewire:search />
@endauth
</div>
<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 />
@endforeach
</div>
{{ $users->links('livewire.app.pagination') }}
</div>

View file

@ -40,12 +40,14 @@
<span>Tags</span>
</div>
<div class="wa-stack wa-gap-2xs" wire:poll>
@foreach ($tags as $postTag)
<div class="wa-split">
<span style="color: {{ $postTag->tagGroup->color }};">{{ $postTag->name }}</span>
<wa-icon-button name="times" appearance="plain" href="{{ url("/delete/post/$post->id/tag/$postTag->id") }}" wire:navigate></wa-icon-button>
<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>
</div>
@endforeach
</div>
<wa-divider></wa-divider>
@ -63,12 +65,11 @@
</div>
{{-- Main content --}}
<div class="wa-stack wa-gap-2xl">
<div>
<livewire:posts.image :$post lazy />
</div>
{{-- 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">
<span>Are you sure you want to delete this post?</span>
<div class="wa-split">
@ -81,6 +82,7 @@
</div>
</div>
</wa-dialog>
</div>
@script
<script>

View file

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

View file

@ -1,7 +1,7 @@
<div class="wa-flank wa-align-items-start wa-gap-3xl" style="--flank-size: 20rem;">
{{-- Sidebar --}}
<div class="wa-stack" wire:poll>
<div class="wa-stack">
{{-- Post navigation --}}
<div class="wa-cluster">
@ -49,6 +49,12 @@
</wa-format-date>
</div>
{{-- Post dimensions --}}
<div class="wa-cluster">
<wa-icon fixed-width name="image"></wa-icon>
<span>{{ $post->getDimensionsStr() }}, <wa-format-bytes value="{{ $post->getFileSize() }}"></wa-format-bytes> {{ $post->extension }}</span>
</div>
{{-- Post rating --}}
<div class="wa-cluster">
<wa-icon fixed-width name="face-hand-peeking"></wa-icon>
@ -63,9 +69,11 @@
<span>Tags</span>
</div>
<div class="wa-stack wa-gap-2xs" wire:poll>
@foreach ($post->tags as $tag)
<span style="color: {{ $tag->tagGroup->color }};">{{ $tag->name }}</span>
@endforeach
</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\Tags\Index as TagsIndexPage;
use App\Livewire\Tags\Groups as TagGroupsPage;
use App\Livewire\Tags\View as TagViewPage;
use App\Models\Post;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
@ -21,6 +22,7 @@ Route::middleware('auth')->group(function () {
Route::get('/upload', UploadPage::class)->name('upload');
Route::get('/profiles/{user}', ProfilePage::class);
Route::get('/users', UsersPage::class)->name('users');
Route::get('/phpinfo', function () { return phpinfo(); });
});
// Post routes
@ -36,6 +38,7 @@ Route::middleware('auth')->prefix('posts')->group(function () {
// Tag routes
Route::middleware('auth')->prefix('tags')->group(function () {
Route::get('/', TagsIndexPage::class)->name('tags.home');
Route::get('/view/{tag}', TagViewPage::class)->name('tags.view');
Route::get('/groups', TagGroupsPage::class)->name('tags.groups');
});