Merge pull request #10461 from annando/ap-preview

Transmit preview link
2022.09-rc
Hypolite Petovan 2021-07-04 09:07:56 -04:00 zatwierdzone przez GitHub
commit 4a1bcb13d5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 43 dodań i 19 usunięć

Wyświetl plik

@ -126,6 +126,7 @@ class Processor
$data['url'] = $attachment['url'];
$data['mimetype'] = $attachment['mediaType'];
$data['height'] = $attachment['height'] ?? null;
$data['width'] = $attachment['width'] ?? null;
$data['size'] = $attachment['size'] ?? null;
$data['preview'] = $attachment['image'] ?? null;
$data['description'] = $attachment['name'] ?? null;

Wyświetl plik

@ -1112,14 +1112,6 @@ class Receiver
'image' => $pageImage,
];
break;
case 'as:Link':
$attachlist[] = [
'type' => str_replace('as:', '', JsonLD::fetchElement($attachment, '@type')),
'mediaType' => JsonLD::fetchElement($attachment, 'as:mediaType', '@value'),
'name' => JsonLD::fetchElement($attachment, 'as:name', '@value'),
'url' => JsonLD::fetchElement($attachment, 'as:href', '@id')
];
break;
case 'as:Image':
$mediaType = JsonLD::fetchElement($attachment, 'as:mediaType', '@value');
$imageFullUrl = JsonLD::fetchElement($attachment, 'as:url', '@id');
@ -1181,7 +1173,10 @@ class Receiver
'type' => str_replace('as:', '', JsonLD::fetchElement($attachment, '@type')),
'mediaType' => JsonLD::fetchElement($attachment, 'as:mediaType', '@value'),
'name' => JsonLD::fetchElement($attachment, 'as:name', '@value'),
'url' => JsonLD::fetchElement($attachment, 'as:url', '@id')
'url' => JsonLD::fetchElement($attachment, 'as:url', '@id'),
'height' => JsonLD::fetchElement($attachment, 'as:height', '@value'),
'width' => JsonLD::fetchElement($attachment, 'as:width', '@value'),
'image' => JsonLD::fetchElement($attachment, 'as:image', '@id')
];
}
}

Wyświetl plik

@ -1298,10 +1298,24 @@ class Transmitter
}
$urls[] = $attachment['url'];
$attachments[] = ['type' => 'Document',
$attach = ['type' => 'Document',
'mediaType' => $attachment['mimetype'],
'url' => $attachment['url'],
'name' => $attachment['description']];
if (!empty($attachment['height'])) {
$attach['height'] = $attachment['height'];
}
if (!empty($attachment['width'])) {
$attach['width'] = $attachment['width'];
}
if (!empty($attachment['preview'])) {
$attach['image'] = $attachment['preview'];
}
$attachments[] = $attach;
}
}
@ -1316,10 +1330,24 @@ class Transmitter
}
$urls[] = $attachment['url'];
$attachments[] = ['type' => 'Document',
$attach = ['type' => 'Document',
'mediaType' => $attachment['mimetype'],
'url' => $attachment['url'],
'name' => $attachment['description']];
if (!empty($attachment['height'])) {
$attach['height'] = $attachment['height'];
}
if (!empty($attachment['width'])) {
$attach['width'] = $attachment['width'];
}
if (!empty($attachment['preview'])) {
$attach['image'] = $attachment['preview'];
}
$attachments[] = $attach;
}
// Currently deactivated, since it creates side effects on Mastodon and Pleroma.
// It will be activated, once this cleared.