forked from mirror/pixelfed
Update ApiV1Controller, add idempotency-key support to /api/v1/statuses endpoint
This commit is contained in:
parent
f452509e17
commit
c54cdd3eb4
1 changed files with 7 additions and 0 deletions
|
@ -2786,6 +2786,13 @@ class ApiV1Controller extends Controller
|
||||||
'comments_disabled' => 'sometimes|boolean',
|
'comments_disabled' => 'sometimes|boolean',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
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);
|
||||||
|
abort_if($exists, 400, 'Duplicate idempotency key.');
|
||||||
|
Cache::put($key, 1, 3600);
|
||||||
|
}
|
||||||
|
|
||||||
if(config('costar.enabled') == true) {
|
if(config('costar.enabled') == true) {
|
||||||
$blockedKeywords = config('costar.keyword.block');
|
$blockedKeywords = config('costar.keyword.block');
|
||||||
if($blockedKeywords !== null && $request->status) {
|
if($blockedKeywords !== null && $request->status) {
|
||||||
|
|
Loading…
Reference in a new issue