mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update ApiV1Controller, fix instance endpoint
This commit is contained in:
parent
c0ae0e9267
commit
c383f1008d
2 changed files with 30 additions and 3 deletions
|
@ -1236,11 +1236,13 @@ class ApiV1Controller extends Controller
|
|||
'description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms',
|
||||
'email' => config('instance.email'),
|
||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') .')',
|
||||
'urls' => [],
|
||||
'urls' => [
|
||||
'streaming_api' => 'wss://' . config('pixelfed.domain.app')
|
||||
],
|
||||
'stats' => $stats,
|
||||
'thumbnail' => url('headers/default.jpg'),
|
||||
'thumbnail' => url('img/pixelfed-icon-color.png'),
|
||||
'languages' => ['en'],
|
||||
'registrations' => (bool) config('pixelfed.open_registration'),
|
||||
'registrations' => (bool) config_cache('pixelfed.open_registration'),
|
||||
'approval_required' => false,
|
||||
'contact_account' => $contact,
|
||||
'rules' => $rules
|
||||
|
@ -1434,6 +1436,30 @@ class ApiV1Controller extends Controller
|
|||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/media/{id}
|
||||
*
|
||||
* @param integer $id
|
||||
*
|
||||
* @return MediaTransformer
|
||||
*/
|
||||
public function mediaGet(Request $request, $id)
|
||||
{
|
||||
abort_if(!$request->user(), 403);
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
$media = Media::whereUserId($user->id)
|
||||
->whereNull('status_id')
|
||||
->findOrFail($id);
|
||||
|
||||
$resource = new Fractal\Resource\Item($media, new MediaTransformer());
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
$res['preview_url'] = url('/storage/no-preview.png');
|
||||
$res['url'] = url('/storage/no-preview.png');
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/mutes
|
||||
*
|
||||
|
|
|
@ -24,6 +24,7 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
'username' => $username,
|
||||
'acct' => $acct,
|
||||
'display_name' => $profile->name,
|
||||
'discoverable' => true,
|
||||
'locked' => (bool) $profile->is_private,
|
||||
'followers_count' => (int) $profile->followerCount(),
|
||||
'following_count' => (int) $profile->followingCount(),
|
||||
|
|
Loading…
Reference in a new issue