mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-18 20:41:27 +00:00
commit
705f30b865
4 changed files with 40 additions and 6 deletions
|
@ -20,7 +20,8 @@
|
|||
- Update Status model, improve thumb logic ([d969a973](https://github.com/pixelfed/pixelfed/commit/d969a973))
|
||||
- Update Status model, allow unlisted thumbnails ([1f0a45b7](https://github.com/pixelfed/pixelfed/commit/1f0a45b7))
|
||||
- Update StatusTagsPipeline, fix object tags and slug normalization ([d295e605](https://github.com/pixelfed/pixelfed/commit/d295e605))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
- Update Note and CreateNote transformers, include attachment blurhash, width and height ([ce1afe27](https://github.com/pixelfed/pixelfed/commit/ce1afe27))
|
||||
- Update ap helpers, store media attachment width and height if present ([8c969191](https://github.com/pixelfed/pixelfed/commit/8c969191))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
|
||||
## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9)
|
||||
|
|
|
@ -81,7 +81,8 @@ class CreateNote extends Fractal\TransformerAbstract
|
|||
'@type' => '@id'
|
||||
],
|
||||
'toot' => 'http://joinmastodon.org/ns#',
|
||||
'Emoji' => 'toot:Emoji'
|
||||
'Emoji' => 'toot:Emoji',
|
||||
'blurhash' => 'toot:blurhash',
|
||||
]
|
||||
],
|
||||
'id' => $status->permalink(),
|
||||
|
@ -103,12 +104,22 @@ class CreateNote extends Fractal\TransformerAbstract
|
|||
'cc' => $status->scopeToAudience('cc'),
|
||||
'sensitive' => (bool) $status->is_nsfw,
|
||||
'attachment' => $status->media()->orderBy('order')->get()->map(function ($media) {
|
||||
return [
|
||||
$res = [
|
||||
'type' => $media->activityVerb(),
|
||||
'mediaType' => $media->mime,
|
||||
'url' => $media->url(),
|
||||
'name' => $media->caption,
|
||||
];
|
||||
if($media->blurhash) {
|
||||
$res['blurhash'] = $media->blurhash;
|
||||
}
|
||||
if($media->width) {
|
||||
$res['width'] = $media->width;
|
||||
}
|
||||
if($media->height) {
|
||||
$res['height'] = $media->height;
|
||||
}
|
||||
return $res;
|
||||
})->toArray(),
|
||||
'tag' => $tags,
|
||||
'commentsEnabled' => (bool) !$status->comments_disabled,
|
||||
|
|
|
@ -82,7 +82,8 @@ class Note extends Fractal\TransformerAbstract
|
|||
'@type' => '@id'
|
||||
],
|
||||
'toot' => 'http://joinmastodon.org/ns#',
|
||||
'Emoji' => 'toot:Emoji'
|
||||
'Emoji' => 'toot:Emoji',
|
||||
'blurhash' => 'toot:blurhash',
|
||||
]
|
||||
],
|
||||
'id' => $status->url(),
|
||||
|
@ -97,12 +98,22 @@ class Note extends Fractal\TransformerAbstract
|
|||
'cc' => $status->scopeToAudience('cc'),
|
||||
'sensitive' => (bool) $status->is_nsfw,
|
||||
'attachment' => $status->media()->orderBy('order')->get()->map(function ($media) {
|
||||
return [
|
||||
$res = [
|
||||
'type' => $media->activityVerb(),
|
||||
'mediaType' => $media->mime,
|
||||
'url' => $media->url(),
|
||||
'name' => $media->caption,
|
||||
];
|
||||
if($media->blurhash) {
|
||||
$res['blurhash'] = $media->blurhash;
|
||||
}
|
||||
if($media->width) {
|
||||
$res['width'] = $media->width;
|
||||
}
|
||||
if($media->height) {
|
||||
$res['height'] = $media->height;
|
||||
}
|
||||
return $res;
|
||||
})->toArray(),
|
||||
'tag' => $tags,
|
||||
'commentsEnabled' => (bool) !$status->comments_disabled,
|
||||
|
|
|
@ -108,7 +108,10 @@ class Helpers {
|
|||
'string',
|
||||
Rule::in($mimeTypes)
|
||||
],
|
||||
'*.name' => 'sometimes|nullable|string'
|
||||
'*.name' => 'sometimes|nullable|string',
|
||||
'*.blurhash' => 'sometimes|nullable|string|min:6|max:164',
|
||||
'*.width' => 'sometimes|nullable|integer|min:1|max:5000',
|
||||
'*.height' => 'sometimes|nullable|integer|min:1|max:5000',
|
||||
])->passes();
|
||||
|
||||
return $valid;
|
||||
|
@ -684,6 +687,8 @@ class Helpers {
|
|||
$blurhash = isset($media['blurhash']) ? $media['blurhash'] : null;
|
||||
$license = isset($media['license']) ? License::nameToId($media['license']) : null;
|
||||
$caption = isset($media['name']) ? Purify::clean($media['name']) : null;
|
||||
$width = isset($media['width']) ? $media['width'] : false;
|
||||
$height = isset($media['height']) ? $media['height'] : false;
|
||||
|
||||
$media = new Media();
|
||||
$media->blurhash = $blurhash;
|
||||
|
@ -695,6 +700,12 @@ class Helpers {
|
|||
$media->remote_url = $url;
|
||||
$media->caption = $caption;
|
||||
$media->order = $key + 1;
|
||||
if($width) {
|
||||
$media->width = $width;
|
||||
}
|
||||
if($height) {
|
||||
$media->height = $height;
|
||||
}
|
||||
if($license) {
|
||||
$media->license = $license;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue