Skip to content

Commit 00cc766

Browse files
committed
Merge branch 'master' into assisted-vision
2 parents 74ff1de + 2092969 commit 00cc766

491 files changed

Lines changed: 19262 additions & 7058 deletions

File tree

Some content is hidden

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

.github/workflows/CICD.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
runs-on: ubuntu-latest
3535
steps:
3636
- name: Harden Runner
37-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
37+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
3838
with:
3939
egress-policy: audit
4040

@@ -63,7 +63,7 @@ jobs:
6363
- php_syntax_errors
6464
steps:
6565
- name: Harden Runner
66-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
66+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
6767
with:
6868
egress-policy: audit
6969

@@ -88,7 +88,7 @@ jobs:
8888
- php_syntax_errors
8989
steps:
9090
- name: Harden Runner
91-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
91+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
9292
with:
9393
egress-policy: audit
9494

@@ -114,7 +114,7 @@ jobs:
114114
- php_syntax_errors
115115
steps:
116116
- name: Harden Runner
117-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
117+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
118118
with:
119119
egress-policy: audit
120120

@@ -157,7 +157,7 @@ jobs:
157157

158158
steps:
159159
- name: Harden Runner
160-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
160+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
161161
with:
162162
egress-policy: audit
163163

@@ -201,7 +201,7 @@ jobs:
201201

202202
steps:
203203
- name: Harden Runner
204-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
204+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
205205
with:
206206
egress-policy: audit
207207

@@ -246,7 +246,7 @@ jobs:
246246
type=ref,event=tag
247247
248248
- name: Build and push Docker image
249-
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
249+
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
250250
with:
251251
push: true
252252
platforms: linux/amd64,linux/arm64
@@ -266,7 +266,7 @@ jobs:
266266

267267
steps:
268268
- name: Harden Runner
269-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
269+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
270270
with:
271271
egress-policy: audit
272272

@@ -310,7 +310,7 @@ jobs:
310310

311311
steps:
312312
- name: Harden Runner
313-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
313+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
314314
with:
315315
egress-policy: audit
316316

@@ -356,7 +356,7 @@ jobs:
356356
type=ref,event=tag
357357
358358
- name: Build and push Docker image
359-
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
359+
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
360360
with:
361361
push: true
362362
file: Dockerfile-legacy
@@ -386,7 +386,7 @@ jobs:
386386

387387
steps:
388388
- name: Harden Runner
389-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
389+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
390390
with:
391391
egress-policy: audit
392392

@@ -401,7 +401,7 @@ jobs:
401401
coverage: none
402402

403403
- name: Use Node.js 20
404-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
404+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
405405
with:
406406
node-version: 20
407407

@@ -410,7 +410,7 @@ jobs:
410410
make clean dist
411411
412412
- name: Upload build artifact
413-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
413+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
414414
with:
415415
name: Lychee.zip
416416
path: Lychee.zip
@@ -478,7 +478,7 @@ jobs:
478478
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
479479

480480
- name: Create release
481-
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
481+
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
482482
with:
483483
files: |
484484
Lychee.zip.sigstore.json

.github/workflows/build-demo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
steps:
2020
- name: Harden Runner
21-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
21+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2222
with:
2323
egress-policy: audit
2424

@@ -55,7 +55,7 @@ jobs:
5555
type=raw,value=demo
5656
5757
- name: Build and push Docker image
58-
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
58+
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
5959
with:
6060
push: true
6161
file: Dockerfile-demo

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
steps:
4343
- name: Harden Runner
44-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
44+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
4545
with:
4646
egress-policy: audit
4747

.github/workflows/copilot-setup-steps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ jobs:
4141
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
4242

4343
- name: Use Node.js
44-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
44+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
4545
with:
4646
node-version: 22
4747

4848
- name: Install Js dependencies
4949
run: npm ci -D
5050

5151
- name: Set up uv
52-
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
52+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
5353
with:
5454
enable-cache: true
5555

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Harden Runner
20-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
20+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2121
with:
2222
egress-policy: audit
2323

.github/workflows/js_check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717
- 22
1818
steps:
1919
- name: Harden Runner
20-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
20+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2121
with:
2222
egress-policy: audit
2323

2424
- name: Checkout code
2525
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2626

2727
- name: Use Node.js ${{ matrix.node-version }}
28-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
28+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2929
with:
3030
node-version: ${{ matrix.node-version }}
3131

.github/workflows/php_dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
steps:
4444
- name: Harden Runner
45-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
45+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
4646
with:
4747
egress-policy: audit
4848

.github/workflows/php_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868

6969
steps:
7070
- name: Harden Runner
71-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
71+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
7272
with:
7373
egress-policy: audit
7474

.github/workflows/scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: Harden Runner
35-
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
35+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
3636
with:
3737
egress-policy: audit
3838

@@ -64,7 +64,7 @@ jobs:
6464
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6565
# format to the repository Actions tab.
6666
- name: "Upload artifact"
67-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
67+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
6868
with:
6969
name: SARIF file
7070
path: results.sarif
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<?php
2+
3+
/**
4+
* SPDX-License-Identifier: MIT
5+
* Copyright (c) 2017-2018 Tobias Reich
6+
* Copyright (c) 2018-2026 LycheeOrg.
7+
*/
8+
9+
namespace App\Actions\Admin;
10+
11+
use App\Actions\Album\SetProtectionPolicy;
12+
use App\DTO\BulkAlbumPatchData;
13+
use App\Http\Resources\Models\Utils\AlbumProtectionPolicy;
14+
use App\Models\Album;
15+
use App\Models\BaseAlbumImpl;
16+
17+
/**
18+
* Applies a partial set of metadata and/or visibility changes to a batch of albums.
19+
*
20+
* Changes are applied within the caller's DB transaction.
21+
* Fields absent from the payload are left unchanged.
22+
*
23+
* Three groups are processed separately:
24+
* 1. base_albums columns → chunked mass UPDATE via BaseAlbumImpl
25+
* 2. albums columns → chunked mass UPDATE via Album
26+
* 3. Visibility fields → per-album via SetProtectionPolicy::do()
27+
*/
28+
class BulkEditAlbumsAction
29+
{
30+
private SetProtectionPolicy $set_protection_policy;
31+
32+
public function __construct()
33+
{
34+
$this->set_protection_policy = new SetProtectionPolicy();
35+
}
36+
37+
/**
38+
* Apply the partial payload to all specified album IDs.
39+
*
40+
* Only fields that were present in the original request (tracked via
41+
* {@see BulkAlbumPatchData::has()}) are updated; absent fields are left
42+
* unchanged.
43+
*
44+
* @param BulkAlbumPatchData $data validated, typed patch payload
45+
*/
46+
public function do(BulkAlbumPatchData $data): void
47+
{
48+
$album_ids = $data->album_ids;
49+
50+
// ── Group 1: base_albums columns ─────────────────────────────────────
51+
$base_data = [];
52+
53+
if ($data->has('description')) {
54+
$base_data['description'] = $data->description;
55+
}
56+
if ($data->has('copyright')) {
57+
$base_data['copyright'] = $data->copyright;
58+
}
59+
if ($data->has('photo_layout')) {
60+
$base_data['photo_layout'] = $data->photo_layout?->value;
61+
}
62+
if ($data->has('photo_sorting_col')) {
63+
$base_data['sorting_col'] = $data->photo_sorting_col?->value;
64+
}
65+
if ($data->has('photo_sorting_order')) {
66+
$base_data['sorting_order'] = $data->photo_sorting_order?->value;
67+
}
68+
if ($data->has('photo_timeline')) {
69+
$base_data['photo_timeline'] = $data->photo_timeline?->value;
70+
}
71+
if ($data->has('is_nsfw')) {
72+
$base_data['is_nsfw'] = $data->is_nsfw;
73+
}
74+
75+
if ($base_data !== []) {
76+
BaseAlbumImpl::query()
77+
->whereIn('id', $album_ids)
78+
->update($base_data);
79+
}
80+
81+
// ── Group 2: albums columns ───────────────────────────────────────────
82+
$album_data = [];
83+
84+
if ($data->has('license')) {
85+
$album_data['license'] = $data->license?->value;
86+
}
87+
if ($data->has('album_thumb_aspect_ratio')) {
88+
$album_data['album_thumb_aspect_ratio'] = $data->album_thumb_aspect_ratio?->value;
89+
}
90+
if ($data->has('album_timeline')) {
91+
$album_data['album_timeline'] = $data->album_timeline?->value;
92+
}
93+
if ($data->has('album_sorting_col')) {
94+
$album_data['album_sorting_col'] = $data->album_sorting_col?->value;
95+
}
96+
if ($data->has('album_sorting_order')) {
97+
$album_data['album_sorting_order'] = $data->album_sorting_order?->value;
98+
}
99+
100+
if ($album_data !== []) {
101+
Album::query()
102+
->whereIn('id', $album_ids)
103+
->update($album_data);
104+
}
105+
106+
// ── Group 3: Visibility fields ────────────────────────────────────────
107+
$has_visibility = $data->has('is_public') ||
108+
$data->has('is_link_required') ||
109+
$data->has('grants_full_photo_access') ||
110+
$data->has('grants_download') ||
111+
$data->has('grants_upload');
112+
113+
if ($has_visibility) {
114+
/** @var Album[] $albums */
115+
$albums = Album::query()
116+
->with('base_class.access_permissions')
117+
->whereIn('id', $album_ids)
118+
->get()
119+
->all();
120+
121+
foreach ($albums as $album) {
122+
$existing = $album->public_permissions();
123+
124+
// Derive current values as defaults, then overlay payload
125+
$is_public = $data->has('is_public')
126+
? ($data->is_public === true)
127+
: ($existing !== null);
128+
$is_link_required = $data->has('is_link_required')
129+
? ($data->is_link_required === true)
130+
: ($existing?->is_link_required === true);
131+
$grants_full_photo_access = $data->has('grants_full_photo_access')
132+
? ($data->grants_full_photo_access === true)
133+
: ($existing?->grants_full_photo_access === true);
134+
$grants_download = $data->has('grants_download')
135+
? ($data->grants_download === true)
136+
: ($existing?->grants_download === true);
137+
$grants_upload = $data->has('grants_upload')
138+
? ($data->grants_upload === true)
139+
: ($existing?->grants_upload === true);
140+
141+
// is_nsfw may have been updated in group 1 via mass-update;
142+
// use the payload value if present, else the model value.
143+
$is_nsfw = $data->has('is_nsfw')
144+
? ($data->is_nsfw === true)
145+
: ($album->is_nsfw === true);
146+
147+
$protection_policy = new AlbumProtectionPolicy(
148+
is_public: $is_public,
149+
is_link_required: $is_link_required,
150+
is_nsfw: $is_nsfw,
151+
grants_full_photo_access: $grants_full_photo_access,
152+
grants_download: $grants_download,
153+
grants_upload: $grants_upload,
154+
);
155+
156+
$this->set_protection_policy->do($album, $protection_policy, false, null);
157+
}
158+
}
159+
}
160+
}

0 commit comments

Comments
 (0)