mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-10 05:42:58 +00:00
Compare commits
No commits in common. "b8032e9dec44b662b535021fe34154fcddf2444a" and "1442dbfa60d6951cb96c24ddd7acc8dd294842ae" have entirely different histories.
b8032e9dec
...
1442dbfa60
23 changed files with 9955 additions and 132 deletions
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\App;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class Pagination extends Component
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.app.pagination');
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,6 @@ class Users extends Component
|
|||
{
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.pages.users', [ 'users' => User::paginate(10) ]);
|
||||
return view('livewire.pages.users', [ 'users' => User::all() ]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
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;
|
||||
|
||||
|
|
@ -16,7 +14,7 @@ class Index extends Component
|
|||
#[Title('Posts')]
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.posts.index', [
|
||||
return view('livewire.posts.index', [
|
||||
'posts' => Post::orderBy('created_at', 'desc')->paginate(25),
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
29
app/Livewire/Search.php
Normal file
29
app/Livewire/Search.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Tags;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class View extends Component
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.tags.view');
|
||||
}
|
||||
}
|
||||
|
|
@ -78,17 +78,6 @@ 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();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ 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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ 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
|
||||
class User extends Authenticatable implements Searchable
|
||||
{
|
||||
protected $connection = 'mongodb';
|
||||
protected $table = 'users';
|
||||
|
|
@ -46,6 +48,16 @@ class User extends Authenticatable
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"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
Normal file
9852
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,7 @@ return [
|
|||
/**
|
||||
* Use uuid as primary key.
|
||||
*/
|
||||
'uuids' => true,
|
||||
'uuids' => false,
|
||||
|
||||
/*
|
||||
* User tables foreign key name.
|
||||
|
|
|
|||
|
|
@ -65,13 +65,12 @@ return [
|
|||
|
||||
'temporary_file_upload' => [
|
||||
'disk' => null, // Example: 'local', 's3' | Default: 'default'
|
||||
'rules' => ['file', 'max:81920'], // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB)
|
||||
'rules' => ['required', 'file', 'max:12288'], // 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', 'wav', 'mp4',
|
||||
'mov', 'avi', 'wmv', 'mp3', 'm4a',
|
||||
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
|
||||
'png', 'gif', 'bmp', 'svg',
|
||||
'jpg', 'jpeg', 'webp',
|
||||
],
|
||||
'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
|
||||
'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs...
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
FROM dunglas/frankenphp
|
||||
|
||||
# Copy php.ini
|
||||
COPY ./deploy/php.ini $PHP_INI_DIR/php-app-config.ini
|
||||
COPY ./deploy/php.ini $PHP_INI_DIR/php.ini
|
||||
|
||||
RUN apt update -y && apt install -y --no-install-recommends git nodejs npm
|
||||
COPY --from=composer:lts /usr/bin/composer /usr/bin/composer
|
||||
|
|
|
|||
|
|
@ -1,5 +1,2 @@
|
|||
[php]
|
||||
upload_max_filesize = 100M
|
||||
post_max_filesize = 128M
|
||||
memory_limit = 1G
|
||||
max_execution_time = 120
|
||||
upload_max_filesize = 64M
|
||||
post_max_filesize = 72M
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@
|
|||
{{-- {{ config('app.name') }}--}}
|
||||
{{-- </h1>--}}
|
||||
<h1>{{ config('app.name') }}</h1>
|
||||
|
||||
@auth
|
||||
<livewire:search />
|
||||
@endauth
|
||||
</div>
|
||||
|
||||
<livewire:post-feature lazy />
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
<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>
|
||||
|
|
@ -6,6 +6,4 @@
|
|||
<livewire:app.user-card :$user />
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{ $users->links('livewire.app.pagination') }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,14 +40,12 @@
|
|||
<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") }}" style="color: var(--wa-color-danger-on-quiet);" wire:navigate></wa-icon-button>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<wa-divider></wa-divider>
|
||||
|
||||
|
|
@ -65,25 +63,25 @@
|
|||
</div>
|
||||
|
||||
{{-- Main content --}}
|
||||
<div>
|
||||
<div class="wa-stack wa-gap-2xl">
|
||||
<livewire:posts.image :$post lazy />
|
||||
|
||||
{{-- Confirm deletion dialog --}}
|
||||
<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">
|
||||
<wa-button variant="neutral" appearance="outlined" data-dialog="close">
|
||||
No, go back
|
||||
</wa-button>
|
||||
<wa-button href="{{ url("delete/post/$post->id") }}" appearance="outlined" variant="danger" wire:navigate>
|
||||
Yes, delete it
|
||||
</wa-button>
|
||||
</div>
|
||||
</div>
|
||||
</wa-dialog>
|
||||
</div>
|
||||
|
||||
{{-- Confirm deletion dialog --}}
|
||||
<wa-dialog label="Confirm post deletion" without-header light-dismiss id="modal-confirm-post-delete" style="--width: 360px;">
|
||||
<div class="wa-stack wa-align-items-center">
|
||||
<span>Are you sure you want to delete this post?</span>
|
||||
<div class="wa-split">
|
||||
<wa-button variant="neutral" appearance="outlined" data-dialog="close">
|
||||
No, go back
|
||||
</wa-button>
|
||||
<wa-button href="{{ url("delete/post/$post->id") }}" appearance="outlined" variant="danger" wire:navigate>
|
||||
Yes, delete it
|
||||
</wa-button>
|
||||
</div>
|
||||
</div>
|
||||
</wa-dialog>
|
||||
|
||||
@script
|
||||
<script>
|
||||
const dialog = document.querySelector('#modal-confirm-post-delete');
|
||||
|
|
|
|||
|
|
@ -5,5 +5,4 @@
|
|||
<livewire:posts.thumbnail :$post lazy />
|
||||
@endforeach
|
||||
</div>
|
||||
{{ $posts->links('livewire.app.pagination') }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="wa-flank wa-align-items-start wa-gap-3xl" style="--flank-size: 20rem;">
|
||||
|
||||
{{-- Sidebar --}}
|
||||
<div class="wa-stack">
|
||||
<div class="wa-stack" wire:poll>
|
||||
|
||||
{{-- Post navigation --}}
|
||||
<div class="wa-cluster">
|
||||
|
|
@ -49,12 +49,6 @@
|
|||
</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>
|
||||
|
|
@ -69,11 +63,9 @@
|
|||
<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>
|
||||
@foreach ($post->tags as $tag)
|
||||
<span style="color: {{ $tag->tagGroup->color }};">{{ $tag->name }}</span>
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
19
resources/views/livewire/search.blade.php
Normal file
19
resources/views/livewire/search.blade.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<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>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
<div>
|
||||
{{-- To attain knowledge, add things every day; To attain wisdom, subtract things every day. --}}
|
||||
</div>
|
||||
|
|
@ -10,7 +10,6 @@ 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;
|
||||
|
|
@ -22,7 +21,6 @@ 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
|
||||
|
|
@ -38,7 +36,6 @@ 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');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue