Skip to content

Commit cd4d9cb

Browse files
authored
Completely new front-end & version 5.0.0! (#2035)
1 parent 8019e1d commit cd4d9cb

File tree

451 files changed

+25458
-215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

451 files changed

+25458
-215
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ APP_FORCE_HTTPS=false
99
# Do note that this disable CSP!!
1010
DEBUGBAR_ENABLED=false
1111

12+
# enable or disable the v5 layout.
13+
LIVEWIRE_ENABLED=true
14+
1215
# enable or disable log viewer. By default it is enabled.
1316
LOG_VIEWER_ENABLED=true
1417

@@ -101,3 +104,6 @@ TRUSTED_PROXIES=null
101104

102105
# Comma-separated list of class names of diagnostics checks that should be skipped.
103106
#SKIP_DIAGNOSTICS_CHECKS=
107+
108+
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
109+
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.github/workflows/.env.mariadb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ APP_URL=https://localhost
33
APP_ENV=dev
44
APP_KEY=SomeRandomString
55
APP_DEBUG=true
6+
LIVEWIRE_ENABLED=false
67

78
DB_CONNECTION=mysql
89
DB_HOST=localhost

.github/workflows/.env.postgresql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ APP_URL=https://localhost
33
APP_ENV=dev
44
APP_KEY=SomeRandomString
55
APP_DEBUG=true
6+
LIVEWIRE_ENABLED=false
67

78
DB_CONNECTION=pgsql
89
DB_HOST=localhost

.github/workflows/.env.sqlite

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ APP_URL=https://localhost
33
APP_ENV=dev
44
APP_KEY=SomeRandomString
55
APP_DEBUG=true
6+
LIVEWIRE_ENABLED=false
67

78
DB_CONNECTION=sqlite
89
DB_LIST_FOREIGN_KEYS=true

.github/workflows/CICD.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,35 @@ jobs:
6969
- name: Check source code for code style errors
7070
run: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --verbose --diff --dry-run
7171

72+
check_js:
73+
name: 2️⃣ JS Node ${{ matrix.node-version }} - Code Style errors & Compilation
74+
runs-on: ubuntu-latest
75+
needs:
76+
- php_syntax_errors
77+
strategy:
78+
matrix:
79+
node-version: [16, 18, 20]
80+
steps:
81+
- name: Checkout code
82+
uses: actions/checkout@v3
83+
84+
- name: Use Node.js ${{ matrix.node-version }}
85+
uses: actions/setup-node@v3
86+
with:
87+
node-version: ${{ matrix.node-version }}
88+
89+
- name: Install
90+
run: npm install -D
91+
92+
- name: Check Style
93+
run: npm run check-formatting
94+
95+
- name: Check TypeScript
96+
run: npm run check
97+
98+
- name: Compile Front-end
99+
run: npm run build
100+
72101
phpstan:
73102
name: 2️⃣ PHP 8.2 - PHPStan
74103
runs-on: ubuntu-latest
@@ -106,6 +135,7 @@ jobs:
106135
- sqlite
107136
test-suite:
108137
- Feature
138+
- Livewire
109139
# Service containers to run with `container-job`
110140
services:
111141
# Label used to access the service container
@@ -282,6 +312,17 @@ jobs:
282312
with:
283313
composer-options: --no-dev
284314

315+
- name: Use Node.js 20
316+
uses: actions/setup-node@v3
317+
with:
318+
node-version: 20
319+
320+
- name: Install
321+
run: npm install
322+
323+
- name: Compile Front-end
324+
run: npm run build
325+
285326
- name: Build Dist
286327
run: |
287328
make clean dist

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ build/*
55
# Those are personal
66
public/dist/user.css
77
public/dist/custom.js
8+
public/build/*
89

910
# Pictures we do not commit
1011
public/uploads/**
12+
public/uploads-*/**
1113

1214
# Storage stuff: useless
1315
/storage/*.key

.prettierrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"printWidth": 150
3+
}

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ composer:
55
composer install --prefer-dist --no-dev
66
php artisan vendor:publish --tag=log-viewer-asset
77

8-
dist-gen: clean composer
8+
npm-build:
9+
rm -r public/build 2> /dev/null || true
10+
rm -r node_modules 2> /dev/null || true
11+
npm install
12+
npm run build
13+
14+
dist-gen: clean composer npm-build
915
@echo "packaging..."
1016
@mkdir Lychee
1117
@mkdir Lychee/public
@@ -19,6 +25,7 @@ dist-gen: clean composer
1925
@cp -r config Lychee
2026
@cp -r composer-cache Lychee
2127
@cp -r database Lychee
28+
@cp -r public/build Lychee/public
2229
@cp -r public/dist Lychee/public
2330
@cp -r public/vendor Lychee/public
2431
@cp -r public/installer Lychee/public
@@ -46,6 +53,7 @@ dist-gen: clean composer
4653
@cp -r version.md Lychee
4754
@touch Lychee/storage/logs/laravel.log
4855
@touch Lychee/public/dist/user.css
56+
@touch Lychee/public/dist/custom.js
4957
@touch Lychee/public/uploads/import/index.html
5058
@touch Lychee/public/sym/index.html
5159

@@ -63,6 +71,12 @@ dist: dist-clean
6371
clean:
6472
@rm build/* 2> /dev/null || true
6573
@rm -r Lychee 2> /dev/null || true
74+
@rm -r public/build 2> /dev/null || true
75+
@rm -r node_modules 2> /dev/null || true
76+
@rm -r vendor 2> /dev/null || true
77+
78+
install: composer npm-build
79+
php artisan migrate
6680

6781
test:
6882
@if [ -x "vendor/bin/phpunit" ]; then \
@@ -90,6 +104,7 @@ formatting:
90104
phpstan:
91105
vendor/bin/phpstan analyze
92106

107+
# Generating new versions
93108
gen_minor:
94109
php scripts/gen_release.php
95110
git add database
@@ -106,6 +121,8 @@ gen_major:
106121
release_major: gen_major
107122
git commit -m "bump to version $(shell cat version.md)"
108123

124+
# Building tests 1 by 1
125+
109126
TESTS_PHP := $(shell find tests/Feature -name "*Test.php" -printf "%f\n")
110127
TEST_DONE := $(addprefix build/,$(TESTS_PHP:.php=.done))
111128

app/Actions/Diagnostics/Pipes/Infos/SystemInfo.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use App\Actions\Diagnostics\Diagnostics;
66
use App\Contracts\DiagnosticPipe;
7+
use App\Facades\Helpers;
8+
use App\Livewire\Components\Forms\Add\Upload;
79
use Carbon\CarbonTimeZone;
810
use Illuminate\Database\QueryException;
911
use Illuminate\Support\Facades\DB;
@@ -53,10 +55,18 @@ public function handle(array &$data, \Closure $next): array
5355
$data[] = Diagnostics::line('Timezone:', ($timeZone !== false ? $timeZone : null)?->getName());
5456
$data[] = Diagnostics::line('Max uploaded file size:', ini_get('upload_max_filesize'));
5557
$data[] = Diagnostics::line('Max post size:', ini_get('post_max_size'));
58+
$this->getUploadLimit($data);
5659
$data[] = Diagnostics::line('Max execution time: ', ini_get('max_execution_time'));
5760
$data[] = Diagnostics::line($dbtype . ' Version:', $dbver);
5861
$data[] = '';
5962

6063
return $next($data);
6164
}
65+
66+
private function getUploadLimit(array &$data): void
67+
{
68+
$size = Upload::getUploadLimit();
69+
70+
$data[] = Diagnostics::line('Livewire chunk size:', Helpers::getSymbolByQuantity($size));
71+
}
6272
}

app/Actions/Search/PhotoSearch.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\Models\Extensions\SortingDecorator;
99
use App\Models\Photo;
1010
use App\Policies\PhotoQueryPolicy;
11+
use Illuminate\Database\Eloquent\Builder;
1112
use Illuminate\Database\Eloquent\Collection;
1213

1314
class PhotoSearch
@@ -20,9 +21,27 @@ public function __construct(PhotoQueryPolicy $photoQueryPolicy)
2021
}
2122

2223
/**
24+
* Apply search directly.
25+
*
2326
* @throws InternalLycheeException
2427
*/
2528
public function query(array $terms): Collection
29+
{
30+
$query = $this->sqlQuery($terms);
31+
$sorting = PhotoSortingCriterion::createDefault();
32+
33+
return (new SortingDecorator($query))
34+
->orderBy($sorting->column, $sorting->order)->get();
35+
}
36+
37+
/**
38+
* Create the query manually.
39+
*
40+
* @param array $terms
41+
*
42+
* @return Builder
43+
*/
44+
public function sqlQuery(array $terms): Builder
2645
{
2746
$query = $this->photoQueryPolicy->applySearchabilityFilter(
2847
Photo::query()->with(['album', 'size_variants', 'size_variants.sym_links'])
@@ -40,10 +59,6 @@ public function query(array $terms): Collection
4059
);
4160
}
4261

43-
$sorting = PhotoSortingCriterion::createDefault();
44-
45-
return (new SortingDecorator($query))
46-
->orderBy($sorting->column, $sorting->order)
47-
->get();
62+
return $query;
4863
}
4964
}

0 commit comments

Comments
 (0)