mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02: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',
|
'description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms',
|
||||||
'email' => config('instance.email'),
|
'email' => config('instance.email'),
|
||||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') .')',
|
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') .')',
|
||||||
'urls' => [],
|
'urls' => [
|
||||||
|
'streaming_api' => 'wss://' . config('pixelfed.domain.app')
|
||||||
|
],
|
||||||
'stats' => $stats,
|
'stats' => $stats,
|
||||||
'thumbnail' => url('headers/default.jpg'),
|
'thumbnail' => url('img/pixelfed-icon-color.png'),
|
||||||
'languages' => ['en'],
|
'languages' => ['en'],
|
||||||
'registrations' => (bool) config('pixelfed.open_registration'),
|
'registrations' => (bool) config_cache('pixelfed.open_registration'),
|
||||||
'approval_required' => false,
|
'approval_required' => false,
|
||||||
'contact_account' => $contact,
|
'contact_account' => $contact,
|
||||||
'rules' => $rules
|
'rules' => $rules
|
||||||
|
@ -1434,6 +1436,30 @@ class ApiV1Controller extends Controller
|
||||||
return response()->json($res);
|
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
|
* GET /api/v1/mutes
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,6 +24,7 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'acct' => $acct,
|
'acct' => $acct,
|
||||||
'display_name' => $profile->name,
|
'display_name' => $profile->name,
|
||||||
|
'discoverable' => true,
|
||||||
'locked' => (bool) $profile->is_private,
|
'locked' => (bool) $profile->is_private,
|
||||||
'followers_count' => (int) $profile->followerCount(),
|
'followers_count' => (int) $profile->followerCount(),
|
||||||
'following_count' => (int) $profile->followingCount(),
|
'following_count' => (int) $profile->followingCount(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue