Gib Website-Bilder aus dem Medienmanager frei, ohne sie zu lizenzieren.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
72130d66c5
commit
13530b8171
18 files changed
+940
-2
No files matched your search
@@ -52,6 +52,18 @@ public function forElementUpload(ContentElement $element, string $incoming): voi
|
||||
$this->rememberElement($element, 'eigen');
|
||||
}
|
||||
|
||||
public function forWebsiteImage(ContentElement $element, string $incoming): void
|
||||
{
|
||||
if ($element->output_class !== 'bild' || ! $this->incomingIsSafe($incoming)) {
|
||||
$this->fail($element, 'Das Bild für die Website wurde nicht übernommen.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->still($element, Storage::disk('cms_incoming'), $incoming, 'element-'.$element->id);
|
||||
$this->rememberElement($element, 'eigen');
|
||||
}
|
||||
|
||||
public function forElementFrame(ContentElement $element, ContentElementVersion $version, float $seconds): void
|
||||
{
|
||||
if ($version->content_element_id !== $element->id || $element->output_class !== 'film') {
|
||||
@@ -201,6 +213,14 @@ private function readableDerived(mixed $path, string $prefix): bool
|
||||
return Storage::disk('media_derived')->exists($path);
|
||||
}
|
||||
|
||||
private function incomingIsSafe(string $incoming): bool
|
||||
{
|
||||
return (str_starts_with($incoming, 'cms/') || str_starts_with($incoming, 'vorschau/'))
|
||||
&& ! str_contains($incoming, '..')
|
||||
&& preg_match('#^(cms|vorschau)/[A-Za-z0-9._\-/]+$#', $incoming) === 1
|
||||
&& Storage::disk('cms_incoming')->exists($incoming);
|
||||
}
|
||||
|
||||
private function secondText(float $seconds): string
|
||||
{
|
||||
$seconds = max(0, min(7200, $seconds));
|
||||
|
||||
Reference in new issue
Block a user