mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update BaseApiController
This commit is contained in:
parent
c15cbe3fbb
commit
295ee0d8f7
1 changed files with 4 additions and 18 deletions
|
@ -118,7 +118,7 @@ class BaseApiController extends Controller
|
|||
$since_id = $request->since_id ?? false;
|
||||
$only_media = $request->only_media ?? false;
|
||||
$user = Auth::user();
|
||||
$account = Profile::findOrFail($id);
|
||||
$account = Profile::whereNull('status')->findOrFail($id);
|
||||
$statuses = $account->statuses()->getQuery();
|
||||
if($only_media == true) {
|
||||
$statuses = $statuses
|
||||
|
@ -150,15 +150,6 @@ class BaseApiController extends Controller
|
|||
return response()->json($res);
|
||||
}
|
||||
|
||||
public function followSuggestions(Request $request)
|
||||
{
|
||||
$followers = Auth::user()->profile->recommendFollowers();
|
||||
$resource = new Fractal\Resource\Collection($followers, new AccountTransformer());
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
public function avatarUpdate(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
|
@ -197,14 +188,9 @@ class BaseApiController extends Controller
|
|||
|
||||
public function showTempMedia(Request $request, int $profileId, $mediaId)
|
||||
{
|
||||
if (!$request->hasValidSignature()) {
|
||||
abort(401);
|
||||
}
|
||||
$profile = Auth::user()->profile;
|
||||
if($profile->id !== $profileId) {
|
||||
abort(403);
|
||||
}
|
||||
$media = Media::whereProfileId($profile->id)->findOrFail($mediaId);
|
||||
abort_if(!$request->hasValidSignature(), 404);
|
||||
abort_if(Auth::user()->profile_id !== $profileId, 404);
|
||||
$media = Media::whereProfileId(Auth::user()->profile_id)->findOrFail($mediaId);
|
||||
$path = storage_path('app/'.$media->media_path);
|
||||
return response()->file($path);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue