mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-10 05:42:58 +00:00
Compare commits
2 commits
c7c621b086
...
e1235a7232
| Author | SHA1 | Date | |
|---|---|---|---|
| e1235a7232 | |||
| ea140671bc |
13 changed files with 219 additions and 32 deletions
|
|
@ -19,11 +19,15 @@ class AuthController extends Controller
|
||||||
|
|
||||||
$authUser = User::updateOrCreate(
|
$authUser = User::updateOrCreate(
|
||||||
[ 'email' => $user->getEmail() ],
|
[ 'email' => $user->getEmail() ],
|
||||||
[ 'name' => $user->getName() ]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($authUser)
|
if ($authUser)
|
||||||
{
|
{
|
||||||
|
if ($authUser->name == '')
|
||||||
|
{
|
||||||
|
$authUser->name = $user->getName();
|
||||||
|
$authUser->save();
|
||||||
|
}
|
||||||
Auth::login($authUser);
|
Auth::login($authUser);
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ use Livewire\Component;
|
||||||
|
|
||||||
class Icon extends Component
|
class Icon extends Component
|
||||||
{
|
{
|
||||||
|
public string $family = 'classic';
|
||||||
|
public string $variant = 'light';
|
||||||
public string $name = 'paw-simple';
|
public string $name = 'paw-simple';
|
||||||
public string $label = '';
|
public string $label = '';
|
||||||
public string $style = '';
|
public string $style = '';
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace App\Livewire\Pages;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
use Livewire\Attributes\Validate;
|
use Livewire\Attributes\Validate;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithFileUploads;
|
use Livewire\WithFileUploads;
|
||||||
|
|
@ -14,15 +15,39 @@ class Profile extends Component
|
||||||
|
|
||||||
public User $user;
|
public User $user;
|
||||||
|
|
||||||
#[Validate('image|max:10240')]
|
|
||||||
public $avatar = null;
|
public $avatar = null;
|
||||||
|
public string $name = '';
|
||||||
|
|
||||||
|
public function mount(User $user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
$this->name = $user->name;
|
||||||
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.pages.profile')->title($this->user->name);
|
return view('livewire.pages.profile')->title($this->user->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updated()
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'avatar' => [
|
||||||
|
'nullable',
|
||||||
|
'image',
|
||||||
|
'max:10240',
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'min:2',
|
||||||
|
'max:40',
|
||||||
|
Rule::unique('users', 'name')->ignore($this->user),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updated($name, $value)
|
||||||
{
|
{
|
||||||
if (Auth::id() != $this->user->id)
|
if (Auth::id() != $this->user->id)
|
||||||
{
|
{
|
||||||
|
|
@ -31,10 +56,16 @@ class Profile extends Component
|
||||||
|
|
||||||
$this->validate();
|
$this->validate();
|
||||||
|
|
||||||
|
$this->user->update([ $name => $value ]);
|
||||||
|
|
||||||
|
if (isset($this->avatar))
|
||||||
|
{
|
||||||
$this->user->avatarExt = $this->avatar->getClientOriginalExtension();
|
$this->user->avatarExt = $this->avatar->getClientOriginalExtension();
|
||||||
$this->user->save();
|
$this->user->save();
|
||||||
|
|
||||||
$this->avatar->storeAs('avatars', $this->user->id);
|
$this->avatar->storeAs('avatars', $this->user->id);
|
||||||
return $this->redirect("/profiles/{$this->user->id}");
|
return $this->redirect("/profiles/{$this->user->id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ class Upload extends Component
|
||||||
$fullImg = Storage::get("posts/$post->id/full");
|
$fullImg = Storage::get("posts/$post->id/full");
|
||||||
|
|
||||||
// Create thumbnail preview
|
// Create thumbnail preview
|
||||||
$thumb = Image::read($fullImg)->scaleDown(width: 512, height: 512);
|
$thumb = Image::read($fullImg)->cover(width: 512, height: 512);
|
||||||
Storage::put("posts/$post->id/thumb", $thumb->encodeByExtension($post->extension, quality: 70));
|
Storage::put("posts/$post->id/thumb", $thumb->encodeByMediaType());
|
||||||
|
|
||||||
// Create smaller preview image
|
// Create smaller preview image
|
||||||
$preview = Image::read($fullImg)->scaleDown(width: 1280, height: 720);
|
$preview = Image::read($fullImg)->scaleDown(width: 1280, height: 720);
|
||||||
Storage::put("posts/$post->id/preview", $preview->encodeByExtension($post->extension, quality: 70));
|
Storage::put("posts/$post->id/preview", $preview->encodeByMediaType());
|
||||||
|
|
||||||
return $this->redirect("/posts/$post->id");
|
return $this->redirect("/posts/$post->id");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"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",
|
||||||
|
|
|
||||||
137
composer.lock
generated
137
composer.lock
generated
|
|
@ -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": "75207b40221a16fc6aa38c1290b281f5",
|
"content-hash": "5f2425ade7fd4df888b45f1bbc48bdf1",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
|
|
@ -1261,6 +1261,80 @@
|
||||||
],
|
],
|
||||||
"time": "2025-05-22T17:26:23+00:00"
|
"time": "2025-05-22T17:26:23+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "intervention/image-driver-vips",
|
||||||
|
"version": "1.0.6",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Intervention/image-driver-vips.git",
|
||||||
|
"reference": "67f92c78cbe94a303f28d7ed84afd464eefac7aa"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Intervention/image-driver-vips/zipball/67f92c78cbe94a303f28d7ed84afd464eefac7aa",
|
||||||
|
"reference": "67f92c78cbe94a303f28d7ed84afd464eefac7aa",
|
||||||
|
"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.6"
|
||||||
|
},
|
||||||
|
"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-06-10T14:30:21+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "intervention/image-laravel",
|
"name": "intervention/image-laravel",
|
||||||
"version": "1.5.6",
|
"version": "1.5.6",
|
||||||
|
|
@ -1345,6 +1419,67 @@
|
||||||
],
|
],
|
||||||
"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",
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,6 @@ return [
|
||||||
'autoOrientation' => true,
|
'autoOrientation' => true,
|
||||||
'decodeAnimation' => true,
|
'decodeAnimation' => true,
|
||||||
'blendingColor' => 'ffffff',
|
'blendingColor' => 'ffffff',
|
||||||
'strip' => false,
|
'strip' => true,
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "photos",
|
"name": "nyaabooru",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
<span class="wa-caption-l">© 2025 <a href="https://nyaastudios.io" target="_blank">NyaaStudios</a>; All rights reserved.</span>
|
<span class="wa-caption-l">© 2025 <a href="https://nyaastudios.io" target="_blank">NyaaStudios</a>; All rights reserved.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="wa-cluster wa-heading-m">
|
<div class="wa-cluster wa-heading-m">
|
||||||
<wa-icon-button family="brands" name="github" href="https://github.com/NyaaStudios/nyaabooru" target="_blank"></wa-icon-button>
|
<a href="https://github.com/NyaaStudios/nyaabooru" class="wa-link-plain" target="_blank">
|
||||||
|
<livewire:app.icon family="brands" name="github" />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<wa-icon
|
<wa-icon
|
||||||
name="{{ $name }}"
|
name="{{ $name }}"
|
||||||
variant="light"
|
family="{{ $family }}"
|
||||||
|
variant="{{ $variant }}"
|
||||||
label="{{ $label }}"
|
label="{{ $label }}"
|
||||||
fixed-width
|
fixed-width
|
||||||
@isset($slot)
|
@isset($slot)
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,6 @@
|
||||||
label="avatar for {{ $user->name }}"
|
label="avatar for {{ $user->name }}"
|
||||||
shape="{{ $shape }}"
|
shape="{{ $shape }}"
|
||||||
style="--size: {{ $size }}"
|
style="--size: {{ $size }}"
|
||||||
></wa-avatar>
|
>
|
||||||
|
<livewire:app.icon name="user" slot="icon" size="2.5rem" />
|
||||||
|
</wa-avatar>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
<article class="wa-stack nyaabooru-pfp">
|
<wa-card>
|
||||||
<a class="wa-frame wa-border-radius-l" style="inline-size: 15rem;" href="{{ url("/profiles/$user->id") }}" wire:navigate.hover>
|
<a class="wa-stack nyaabooru-pfp wa-link-plain" href="{{ url("/profiles/$user->id") }}" wire:navigate.hover>
|
||||||
@if (\Illuminate\Support\Facades\Storage::has("avatars/$user->id"))
|
<div class="wa-frame wa-border-radius-l" style="inline-size: 10rem;" >
|
||||||
<img src="{{ $user->getAvatarBase64() }}"/>
|
<livewire:app.pfp :$user size="10rem" />
|
||||||
@else
|
</div>
|
||||||
<livewire:app.icon name="user" />
|
|
||||||
@endif
|
|
||||||
</a>
|
|
||||||
<div class="wa-stack wa-gap-3xs">
|
<div class="wa-stack wa-gap-3xs">
|
||||||
<span class="wa-heading-s">{{ $user->name }}</span>
|
<span class="wa-heading-s">{{ $user->name }}</span>
|
||||||
<span class="wa-caption-m">Joined <wa-format-date value="{{ $user->created_at }}"></wa-format-date></span>
|
<span class="wa-caption-m">Joined <wa-format-date value="{{ $user->created_at }}"></wa-format-date></span>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</a>
|
||||||
|
</wa-card>
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
<h2>User settings</h2>
|
<h2>User settings</h2>
|
||||||
<form wire:submit>
|
<form wire:submit>
|
||||||
<wa-card>
|
<wa-card>
|
||||||
|
<div class="wa-stack wa-gap-l">
|
||||||
<div class="wa-stack">
|
<div class="wa-stack">
|
||||||
<span class="wa-heading-m">Profile picture</span>
|
<span class="wa-heading-m">Profile picture</span>
|
||||||
<input type="file" wire:model.live="avatar" wire:loading.attr="disabled" />
|
<input type="file" wire:model.live="avatar" wire:loading.attr="disabled" />
|
||||||
|
|
@ -30,6 +31,16 @@
|
||||||
<span class="wa-caption-m">{{ $message }}</span>
|
<span class="wa-caption-m">{{ $message }}</span>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<wa-divider></wa-divider>
|
||||||
|
|
||||||
|
<wa-input wire:model.live="name" label="Display name">
|
||||||
|
<livewire:app.icon slot="start" name="user-tag" />
|
||||||
|
</wa-input>
|
||||||
|
@error('name')
|
||||||
|
<span class="wa-caption-m">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
</wa-card>
|
</wa-card>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue