1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 16:24:29 +00:00

Update mobile apis, add blurhash

This commit is contained in:
Daniel Supernault 2021-01-18 18:25:03 -07:00
parent 4415af1bf0
commit cf40526ef9
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 5 additions and 4 deletions

View file

@ -1087,8 +1087,8 @@ class ApiV1Controller extends Controller
$resource = new Fractal\Resource\Item($media, new MediaTransformer()); $resource = new Fractal\Resource\Item($media, new MediaTransformer());
$res = $this->fractal->createData($resource)->toArray(); $res = $this->fractal->createData($resource)->toArray();
$res['preview_url'] = url('/storage/no-preview.png'); $res['preview_url'] = $media->url(). '?cb=1&_v=' . time();
$res['url'] = url('/storage/no-preview.png'); $res['url'] = $media->url(). '?cb=1&_v=' . time();
return response()->json($res); return response()->json($res);
} }

View file

@ -12,9 +12,9 @@ class MediaTransformer extends Fractal\TransformerAbstract
return [ return [
'id' => (string) $media->id, 'id' => (string) $media->id,
'type' => $media->activityVerb(), 'type' => $media->activityVerb(),
'url' => $media->url(), 'url' => $media->url() . '?cb=1&_v=' . time(),
'remote_url' => null, 'remote_url' => null,
'preview_url' => $media->thumbnailUrl(), 'preview_url' => $media->thumbnailUrl() . '?cb=1&_v=' . time(),
'text_url' => null, 'text_url' => null,
'meta' => null, 'meta' => null,
'description' => $media->caption, 'description' => $media->caption,
@ -24,6 +24,7 @@ class MediaTransformer extends Fractal\TransformerAbstract
'filter_name' => $media->filter_name, 'filter_name' => $media->filter_name,
'filter_class' => $media->version == 1 ? $media->filter_class : null, 'filter_class' => $media->version == 1 ? $media->filter_class : null,
'mime' => $media->mime, 'mime' => $media->mime,
'blurhash' => $media->blurhash
]; ];
} }
} }