Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Jun 23, 2024
1 parent bf07591 commit d2a2db6
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/Http/Resources/Models/PhotoResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ private function preformatted(?SizeVariant $original): array
'resolution' => $original?->width . ' x ' . $original?->height,
'latitude' => Helpers::decimalToDegreeMinutesSeconds($this->resource->latitude, true),
'longitude' => Helpers::decimalToDegreeMinutesSeconds($this->resource->longitude, false),
'altitude' => round($this->resource->altitude, 1) . 'm',
'altitude' => $this->resource->altitude !== null ? round($this->resource->altitude, 1) . 'm' : '',
'license' => $this->resource->license !== LicenseType::NONE ? $this->resource->license->localization() : '',
'description' => ($this->resource->description ?? '') === '' ? '' : Markdown::convert($this->resource->description)->getContent(),
];
}

/**
* @return array<string,mixed>
* @return array<string,bool>
*/
private function precomputed(): array
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Album.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public function newEloquentBuilder($query): AlbumBuilder
*/
protected function getAlbumThumbAspectRatioAttribute(): ?AspectRatioType
{
return AspectRatioType::tryFrom($this->attributes['album_thumb_aspect_ratio']);
return AspectRatioType::tryFrom($this->attributes['album_thumb_aspect_ratio'] ?? '1/1');
}

/**
Expand Down
1 change: 1 addition & 0 deletions app/Models/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ protected function getLivePhotoUrlAttribute(): ?string
$path = $this->live_photo_short_path;
$disk_name = $this->size_variants->getOriginal()?->storage_disk?->value ?? StorageDiskType::LOCAL->value;

/** @disregard P1013 */
return ($path === null || $path === '') ? null : Storage::disk($disk_name)->url($path);
}

Expand Down
5 changes: 5 additions & 0 deletions app/Models/SizeVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ public function getUrlAttribute(): string
!Configs::getValueAsBool('SL_enable') ||
(!Configs::getValueAsBool('SL_for_admin') && Auth::user()?->may_administrate === true)
) {
/** @disregard P1013 */
return $imageDisk->url($this->short_path);
}

/** @disregard P1013 */
$storageAdapter = $imageDisk->getAdapter();
if ($storageAdapter instanceof AwsS3V3Adapter) {
return $this->getAwsUrl();
Expand All @@ -218,9 +220,11 @@ private function getAwsUrl(): string
// Return the public URL in case the S3 bucket is set to public, otherwise generate a temporary URL
$visibility = config('filesystems.disks.s3.visibility', 'private');
if ($visibility === 'public') {
/** @disregard P1013 */
return $imageDisk->url($this->short_path);
}

/** @disregard P1013 */
return $imageDisk->temporaryUrl($this->short_path, now()->addSeconds($maxLifetime));
}

Expand Down Expand Up @@ -260,6 +264,7 @@ private function getSymLinkUrl(): string
*/
public function getFullPathAttribute(): string
{
/** @disregard P1013 */
return Storage::disk($this->storage_disk->value)->path($this->short_path);
}

Expand Down
2 changes: 1 addition & 1 deletion public/vendor/log-viewer/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/vendor/log-viewer/app.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/vendor/log-viewer/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"/app.js": "/app.js?id=735ecf8ed11308c93eed8ab901094929",
"/app.css": "/app.css?id=4d9629388ead48c1e8115f0f9d44caaf",
"/app.js": "/app.js?id=035385b07dcacbe9110f48c4eecdea37",
"/app.css": "/app.css?id=66a27926e151e853bb42c8fe0f587a17",
"/img/log-viewer-128.png": "/img/log-viewer-128.png?id=d576c6d2e16074d3f064e60fe4f35166",
"/img/log-viewer-32.png": "/img/log-viewer-32.png?id=f8ec67d10f996aa8baf00df3b61eea6d",
"/img/log-viewer-64.png": "/img/log-viewer-64.png?id=8902d596fc883ca9eb8105bb683568c6"
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/header/actions-menus.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<x-header.button href="{{ route('livewire-frame', ['albumId' => $this->albumId]) }}" wire:navigate icon="monitor" />
@endif
{{-- No selection --}}
@can(App\Policies\AlbumPolicy::CAN_UPLOAD, [App\Contracts\Models\AbstractAlbum::class, $this->album ?? null])
@if($this->rights->can_upload)
<x-header.button x-show='select.selectedPhotos.length === 0 && select.selectedAlbums.length === 0 ' wire:click='openContextMenu' icon='plus' />
@endcan
@endif
@if($this->rights->can_edit)
{{-- Albums selection --}}
<x-header.button x-cloak x-show='select.selectedAlbums.length > 0' fill='fill-primary-400 hover:fill-primary-200' x-on:click='renameAlbums' icon='pencil' />
Expand Down
4 changes: 2 additions & 2 deletions resources/views/livewire/forms/album/set-header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class="my-[1px] text-text-main-0 rounded bg-black/30 inline-block text-2xs align
<div class=" translate-x-[8.75rem] z-50 absolute bg-bg-900 text-xs rounded"
x-show.transition.opacity="isSearchPhotoOpen">
<ul class="max-h-[50vh] overflow-y-auto">
@if(strlen( $search ) === 0)
@if(strlen( $search ?? '' ) === 0)
<li class="border-b border-bg-800 cursor-pointer transition-all ease-in-out duration-300
hover:bg-gradient-to-b hover:from-primary-500 hover:to-primary-600 hover:text-text-main-0"
wire:click="select('{{ \App\Livewire\Components\Forms\Album\SetHeader::COMPACT_HEADER }}','{{ __('lychee.SET_COMPACT_HEADER') }}')">
Expand All @@ -48,7 +48,7 @@ class="my-[1px] text-text-main-0 rounded bg-black/30 inline-block text-2xs align
</a>
</li>
@empty
@if(strlen( $search ) > 0)
@if(strlen( $search ?? '' ) > 0)
<li class="border-b border-bg-800 cursor-pointer transition-all ease-in-out duration-300
hover:bg-gradient-to-b hover:from-primary-500 hover:to-primary-600 hover:text-text-main-0">
<a class="px-3 py-1 flex items-center">No results for "{{ $search }}"</a>
Expand Down
Empty file.
31 changes: 31 additions & 0 deletions resources/views/vendor/log-viewer/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="shortcut icon" href="{{ asset(mix('img/log-viewer-32.png', 'vendor/log-viewer')) }}">

<title>Log Viewer{{ config('app.name') ? ' - ' . config('app.name') : '' }}</title>

<!-- Style sheets-->
<link href="{{ asset(mix('app.css', 'vendor/log-viewer')) }}" rel="stylesheet" onerror="alert('app.css failed to load. Please refresh the page, re-publish Log Viewer assets, or fix routing for vendor assets.')">
</head>

<body class="h-full px-3 lg:px-5 bg-gray-100 dark:bg-gray-900">
<div id="log-viewer" class="flex h-full max-h-screen max-w-full">
<router-view></router-view>
</div>

<!-- Global LogViewer Object -->
<script>
window.LogViewer = @json($logViewerScriptVariables);
// Add additional headers for LogViewer requests like so:
// window.LogViewer.headers['Authorization'] = 'Bearer xxxxxxx';
</script>
<script src="{{ asset(mix('app.js', 'vendor/log-viewer')) }}" onerror="alert('app.js failed to load. Please refresh the page, re-publish Log Viewer assets, or fix routing for vendor assets.')"></script>
</body>
</html>

0 comments on commit d2a2db6

Please sign in to comment.