mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 08:44:49 +00:00
Merge pull request #4405 from pixelfed/staging
Update ApiV1Controller, add idempotency-key support to /api/v1/status…
This commit is contained in:
commit
ce8470562f
2 changed files with 8 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
- Added `only_media` support to /api/v1/timelines/tag/:id api endpoint ([b5fe956a](https://github.com/pixelfed/pixelfed/commit/b5fe956a))
|
||||
- Added /api/v2/instance api endpoint ([167dbcdd](https://github.com/pixelfed/pixelfed/commit/167dbcdd))
|
||||
- Removed api endpoint cloud ip block logic ([6a2daf1f](https://github.com/pixelfed/pixelfed/commit/6a2daf1f))
|
||||
- Added idempotency-key support to /api/v1/statuses endpoint ([c54cdd3e](https://github.com/pixelfed/pixelfed/commit/c54cdd3e))
|
||||
|
||||
### Added
|
||||
- Added store remote media on S3 config setting, disabled by default ([51768083](https://github.com/pixelfed/pixelfed/commit/51768083))
|
||||
|
|
|
@ -2786,6 +2786,13 @@ class ApiV1Controller extends Controller
|
|||
'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) {
|
||||
$blockedKeywords = config('costar.keyword.block');
|
||||
if($blockedKeywords !== null && $request->status) {
|
||||
|
|
Loading…
Reference in a new issue