Skip to content

Commit 8ad85ec

Browse files
authored
Enable user uuid set (#3901)
and a few more.
1 parent cd0895e commit 8ad85ec

22 files changed

+989
-253
lines changed

.dockerignore

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
# dependencies
1414
composer-cache
15+
vendor/
16+
node_modules/
1517

1618
# Documentation
1719
README.md
@@ -21,19 +23,36 @@ docs/
2123
.editorconfig
2224
.php-cs-fixer.php
2325
.php-cs-fixer.cache
26+
.gitattributes
27+
.gitignore
28+
.php-cs-fixer.php
29+
.phpstaorm.meta.php
30+
.prettierrc.json
31+
AGENTS.md
32+
codecov.yml
33+
CONTRIBUTING.md
34+
Dockerfile
35+
eslint.config.js
36+
Makefile
37+
osv-scanner.toml
38+
phpstan-baseline.neon
2439
phpstan.neon
40+
phpunit.ci.xml
2541
phpunit.xml
2642
.phpunit.result.cache
43+
rector.php
44+
sonar-project.properties
2745
phpstan/*
2846
scripts/*
2947
vite/*
48+
# Local testing @ildyria
49+
public/uploads-bck/*
3050

3151
# Node
3252
node_modules/
3353
npm-debug.log
3454

35-
# Lychee
36-
/public/uploads/*
55+
# Mapping for database and config used by docker compose
3756
lychee/*
3857

3958
# Laravel
@@ -46,6 +65,8 @@ lychee/*
4665
!.env.example
4766

4867
# IDE
68+
.ai/
69+
.claude/
4970
.vscode/
5071
.idea/
5172
*.swp

.editorconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ indent_size = 4
3131

3232
[docker-compose.yaml]
3333
indent_style = space
34-
indent_size = 2
34+
indent_size = 2
35+
36+
[Dockerfile]
37+
indent_style = space
38+
indent_size = 4

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ DEBUGBAR_ENABLED=false
2020
# enable or disable log viewer. By default it is enabled.
2121
LOG_VIEWER_ENABLED=true
2222

23+
# disable logging 404 errors
24+
# LOG_404_ERRORS=false
25+
2326
# enable or disable clockwork. By default it is disabled (and not provided on non-dev build).
2427
CLOCKWORK_ENABLE=false
28+
CLOCKWORK_DRIVER=laravel
29+
CLOCKWORK_STORAGE_FILES_PATH=storage/clockwork
2530

2631
# enable or disable latency debug: adds a specific amount of time in milliseconds to wait before processing requests.
2732
# Always disabled on production environment.
@@ -113,6 +118,7 @@ REDIS_PORT=6379
113118
# to disable it for your Log Viewer.
114119
# Should redis crash, you will no longer be able to access your logs.
115120
LOG_VIEWER_CACHE_DRIVER=file
121+
LOG_STDOUT=false
116122

117123
# Session configuration
118124
SESSION_DRIVER=file

Dockerfile

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@ WORKDIR /app
1313
COPY composer.json composer.lock ./
1414

1515
# Install dependencies (no dev packages for production)
16+
# Remove markdown and test directories to slim down the image
1617
RUN composer install \
1718
--no-dev \
1819
--no-interaction \
1920
--no-progress \
2021
--no-scripts \
2122
--prefer-dist \
2223
--optimize-autoloader \
23-
--ignore-platform-reqs
24+
--ignore-platform-reqs \
25+
&& find vendor \
26+
\( -iname "*.md" -o -iname "test" -o -iname "tests" \) \
27+
-exec rm -rf {} +
2428

2529
# ============================================================================
2630
# Stage 2: Node.js Build for Frontend Assets
@@ -63,32 +67,30 @@ LABEL org.opencontainers.image.source="https://github.com/LycheeOrg/Lychee"
6367
# hadolint ignore=DL3018
6468
RUN apk add --no-cache \
6569
exiftool \
66-
shadow \
70+
shadow \
6771
ffmpeg \
6872
gd \
6973
grep \
7074
imagemagick \
7175
jpegoptim \
72-
netcat-openbsd \
73-
unzip \
76+
netcat-openbsd \
77+
unzip \
7478
curl \
7579
&& install-php-extensions \
7680
pdo_mysql \
7781
pdo_pgsql \
7882
gd \
7983
zip \
80-
dom \
8184
bcmath \
8285
sodium \
8386
opcache \
8487
pcntl \
85-
exif \
86-
imagick \
87-
intl \
88-
redis \
89-
tokenizer \
90-
&& rm -rf /var/cache/apk/* \
91-
&& apk del shadow
88+
exif \
89+
imagick \
90+
intl \
91+
redis \
92+
tokenizer \
93+
&& rm -rf /var/cache/apk/*
9294

9395
WORKDIR /app
9496

@@ -111,18 +113,18 @@ RUN mkdir -p storage/framework/cache \
111113
&& chown -R www-data:www-data storage bootstrap/cache public/dist \
112114
&& chmod -R 750 storage bootstrap/cache \
113115
&& chmod -R 755 public/dist \
114-
&& touch /app/frankenphp_target \
115-
&& touch /app/public/dist/user.css \
116-
&& touch /app/public/dist/custom.js \
117-
&& chown www-data:www-data /app/public/dist/user.css /app/public/dist/custom.js \
118-
&& chmod 644 /app/public/dist/user.css /app/public/dist/custom.js \
119-
&& cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini \
116+
&& touch /app/frankenphp_target \
117+
&& touch /app/public/dist/user.css \
118+
&& touch /app/public/dist/custom.js \
119+
&& chown www-data:www-data /app/public/dist/user.css /app/public/dist/custom.js \
120+
&& chmod 644 /app/public/dist/user.css /app/public/dist/custom.js \
121+
&& cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini \
120122
&& echo "upload_max_filesize=110M" > $PHP_INI_DIR/conf.d/custom.ini \
121123
&& echo "post_max_size=110M" >> $PHP_INI_DIR/conf.d/custom.ini \
122-
&& echo "max_execution_time=3000" >> $PHP_INI_DIR/conf.d/custom.ini \
123-
&& echo "expose_php=Off" >> $PHP_INI_DIR/conf.d/custom.ini \
124-
&& echo "display_errors=Off" >> $PHP_INI_DIR/conf.d/custom.ini \
125-
&& echo "log_errors=On" >> $PHP_INI_DIR/conf.d/custom.ini
124+
&& echo "max_execution_time=3000" >> $PHP_INI_DIR/conf.d/custom.ini \
125+
&& echo "expose_php=Off" >> $PHP_INI_DIR/conf.d/custom.ini \
126+
&& echo "display_errors=Off" >> $PHP_INI_DIR/conf.d/custom.ini \
127+
&& echo "log_errors=On" >> $PHP_INI_DIR/conf.d/custom.ini
126128

127129
# Copy entrypoint and validation scripts
128130
COPY docker/scripts/entrypoint.sh /usr/local/bin/entrypoint.sh

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,14 @@ gen_typescript_types:
160160
class-leak:
161161
vendor/bin/class-leak check app database/migrations config --skip-type Illuminate\\View\\Component
162162

163-
docker-build-base-image:
164-
docker build -t lychee-base:latest ./docker/base
163+
docker-build:
164+
docker build -t lychee-frankenphp .
165165

166-
docker-build-dev-image:
167-
docker build ./docker/dev -t lychee-dev:latest
166+
docker-build-no-cache:
167+
docker build -t lychee-frankenphp . --no-cache
168168

169-
docker-build-dev: docker-build-base-image docker-build-dev-image
169+
docker-run:
170+
docker compose up
170171

171172
test_pgsql_v2:
172173
docker compose -f docker-compose-pgsql.yaml up -d

app/Assets/ArrayToTextTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ protected function setWidth(string $key, ?string $value): void
355355
*/
356356
protected static function valueToLines(?string $value): array
357357
{
358-
return explode("\n", $value);
358+
return explode("\n", $value ?? '');
359359
}
360360

361361
protected static function mb_str_pad(

app/Exceptions/Handler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
3434
use Symfony\Component\HttpKernel\Exception\HttpException;
3535
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
36+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
3637

3738
/**
3839
* Lychee's custom exception handler.
@@ -135,6 +136,10 @@ public function __construct(Container $container)
135136
// Cache the application path to avoid multiple function calls
136137
// and potential exceptions in `report()`
137138
$this->appPath = app_path();
139+
140+
if (config('features.log_404_errors') === false) {
141+
$this->dontReport[] = NotFoundHttpException::class;
142+
}
138143
}
139144

140145
/**

app/Http/Resources/Models/AlbumResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct(Album $album)
7979
$this->track_url = $album->track_url;
8080
$this->license = $album->license->localization();
8181
// TODO: Investigate later why this string is 24 characters long.
82-
$this->header_id = trim($album->header_id);
82+
$this->header_id = $album->header_id !== null ? trim($album->header_id) : null;
8383

8484
// children
8585
$this->parent_id = $album->parent_id;

app/Http/Resources/Models/ThumbAlbumResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function __construct(AbstractAlbum $data)
7676
$this->created_at_carbon = $data->created_at;
7777
$this->created_at = $this->created_at_carbon->format($date_format);
7878
$policy = AlbumProtectionPolicy::ofBaseAlbum($data);
79-
$this->description = Str::limit($data->description, 100);
79+
$this->description = $data->description === null ? null : Str::limit($data->description, 100);
8080
$this->owner = $data->owner->username;
8181
}
8282

app/Models/Album.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ protected function setAlbumThumbAspectRatioAttribute(?AspectRatioType $aspect_ra
386386
*/
387387
protected function getAlbumTimelineAttribute(): ?TimelineAlbumGranularity
388388
{
389-
return TimelineAlbumGranularity::tryFrom($this->attributes['album_timeline']);
389+
return TimelineAlbumGranularity::tryFrom($this->attributes['album_timeline'] ?? '');
390390
}
391391

392392
/**

0 commit comments

Comments
 (0)