Implement creator studio and upload updates
This commit is contained in:
@@ -61,6 +61,36 @@ final class UploadFinishRequest extends FormRequest
|
||||
$this->denyAsNotFound();
|
||||
}
|
||||
|
||||
$archiveSessionId = (string) $this->input('archive_session_id');
|
||||
if ($archiveSessionId !== '') {
|
||||
$archiveSession = $sessions->get($archiveSessionId);
|
||||
if (! $archiveSession || $archiveSession->userId !== $user->id) {
|
||||
$this->logUnauthorized('archive_session_not_owned_or_missing');
|
||||
$this->denyAsNotFound();
|
||||
}
|
||||
}
|
||||
|
||||
$additionalScreenshotSessions = $this->input('additional_screenshot_sessions', []);
|
||||
if (is_array($additionalScreenshotSessions)) {
|
||||
foreach ($additionalScreenshotSessions as $index => $payload) {
|
||||
$screenshotSessionId = (string) data_get($payload, 'session_id', '');
|
||||
if ($screenshotSessionId === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$screenshotSession = $sessions->get($screenshotSessionId);
|
||||
if (! $screenshotSession || $screenshotSession->userId !== $user->id) {
|
||||
$this->logUnauthorized('additional_screenshot_session_not_owned_or_missing');
|
||||
logger()->warning('Upload finish additional screenshot session rejected', [
|
||||
'index' => $index,
|
||||
'session_id' => $screenshotSessionId,
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
$this->denyAsNotFound();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$artwork = Artwork::query()->find($artworkId);
|
||||
if (! $artwork || (int) $artwork->user_id !== (int) $user->id) {
|
||||
$this->logUnauthorized('artwork_not_owned_or_missing');
|
||||
@@ -79,6 +109,11 @@ final class UploadFinishRequest extends FormRequest
|
||||
'artwork_id' => 'required|integer',
|
||||
'upload_token' => 'nullable|string|min:40|max:200',
|
||||
'file_name' => 'nullable|string|max:255',
|
||||
'archive_session_id' => 'nullable|uuid|different:session_id',
|
||||
'archive_file_name' => 'nullable|string|max:255',
|
||||
'additional_screenshot_sessions' => 'nullable|array|max:4',
|
||||
'additional_screenshot_sessions.*.session_id' => 'required|uuid|distinct|different:session_id|different:archive_session_id',
|
||||
'additional_screenshot_sessions.*.file_name' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user