mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 01:05:36 +00:00
Update ApiController
This commit is contained in:
parent
7e0f9ac3d4
commit
10cb2d4004
2 changed files with 16 additions and 4 deletions
|
@ -1469,7 +1469,7 @@ class ApiV1Controller extends Controller
|
||||||
*
|
*
|
||||||
* @return StatusTransformer
|
* @return StatusTransformer
|
||||||
*/
|
*/
|
||||||
public function createStatus(Request $request)
|
public function statusCreate(Request $request)
|
||||||
{
|
{
|
||||||
abort_if(!$request->user(), 403);
|
abort_if(!$request->user(), 403);
|
||||||
|
|
||||||
|
@ -1510,7 +1510,7 @@ class ApiV1Controller extends Controller
|
||||||
$status->scope = $request->input('visibility');
|
$status->scope = $request->input('visibility');
|
||||||
$status->visibility = $request->input('visibility');
|
$status->visibility = $request->input('visibility');
|
||||||
$status->profile_id = $user->profile_id;
|
$status->profile_id = $user->profile_id;
|
||||||
$status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive');
|
$status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive', false);
|
||||||
$status->in_reply_to_id = $parent->id;
|
$status->in_reply_to_id = $parent->id;
|
||||||
$status->in_reply_to_profile_id = $parent->profile_id;
|
$status->in_reply_to_profile_id = $parent->profile_id;
|
||||||
$status->save();
|
$status->save();
|
||||||
|
@ -1519,7 +1519,7 @@ class ApiV1Controller extends Controller
|
||||||
$status->caption = strip_tags($request->input('status'));
|
$status->caption = strip_tags($request->input('status'));
|
||||||
$status->profile_id = $user->profile_id;
|
$status->profile_id = $user->profile_id;
|
||||||
$status->scope = 'draft';
|
$status->scope = 'draft';
|
||||||
$status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive');
|
$status->is_nsfw = $user->profile->cw == true ? true : $request->input('sensitive', false);
|
||||||
$status->save();
|
$status->save();
|
||||||
|
|
||||||
$mimes = [];
|
$mimes = [];
|
||||||
|
@ -1562,4 +1562,16 @@ class ApiV1Controller extends Controller
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE /api/v1/statuses
|
||||||
|
*
|
||||||
|
* @param integer $id
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function statusDelete(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!$request->user(), 403);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -125,7 +125,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::get('timelines/home', 'Api\ApiV1Controller@timelineHome')->middleware('auth:api');
|
Route::get('timelines/home', 'Api\ApiV1Controller@timelineHome')->middleware('auth:api');
|
||||||
Route::get('conversations', 'Api\ApiV1Controller@conversations')->middleware('auth:api');
|
Route::get('conversations', 'Api\ApiV1Controller@conversations')->middleware('auth:api');
|
||||||
Route::get('timelines/public', 'Api\ApiV1Controller@timelinePublic');
|
Route::get('timelines/public', 'Api\ApiV1Controller@timelinePublic');
|
||||||
Route::post('statuses', 'Api\ApiV1Controller@createStatus')->middleware('auth:api');
|
Route::post('statuses', 'Api\ApiV1Controller@statusCreate')->middleware('auth:api');
|
||||||
|
|
||||||
// Route::get('likes', 'ApiController@hydrateLikes');
|
// Route::get('likes', 'ApiController@hydrateLikes');
|
||||||
// Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');
|
// Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');
|
||||||
|
|
Loading…
Reference in a new issue