Update ApiV1Controller, add better direct error message. Fixes #4789

pull/5925/head
Daniel Supernault 5 months ago
parent 0a98b7ad20
commit 658fe6898e
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1

@ -3525,13 +3525,19 @@ class ApiV1Controller extends Controller
'in_reply_to_id' => 'nullable',
'media_ids' => 'sometimes|array|max:'.(int) config_cache('pixelfed.max_album_length'),
'sensitive' => 'nullable',
'visibility' => 'string|in:private,unlisted,public',
'visibility' => 'string|in:private,unlisted,public,direct',
'spoiler_text' => 'sometimes|max:140',
'place_id' => 'sometimes|integer|min:1|max:128769',
'collection_ids' => 'sometimes|array|max:3',
'comments_disabled' => 'sometimes|boolean',
]);
if ($request->filled('visibility') && $request->input('visibility') === 'direct') {
return $this->json([
'error' => 'Direct visibility is not available.',
], 400);
}
if ($request->hasHeader('idempotency-key')) {
$key = 'pf:api:v1:status:idempotency-key:'.$request->user()->id.':'.hash('sha1', $request->header('idempotency-key'));
$exists = Cache::has($key);

Loading…
Cancel
Save