mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix getCommentMediaInfo
This commit is contained in:
@@ -4,12 +4,7 @@ const getCommentMediaInfo = (comment) => {
|
|||||||
if (!comment?.thumbnailUrl && !comment?.link) {
|
if (!comment?.thumbnailUrl && !comment?.link) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (comment?.thumbnailUrl) {
|
|
||||||
// return {
|
|
||||||
// url: comment.link,
|
|
||||||
// type: 'webpage'
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
if (comment?.link) {
|
if (comment?.link) {
|
||||||
try {
|
try {
|
||||||
new URL(comment.link);
|
new URL(comment.link);
|
||||||
@@ -23,24 +18,31 @@ const getCommentMediaInfo = (comment) => {
|
|||||||
if (mime?.startsWith('image')) {
|
if (mime?.startsWith('image')) {
|
||||||
return {
|
return {
|
||||||
url: comment.link,
|
url: comment.link,
|
||||||
type: 'image'
|
type: 'image',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mime?.startsWith('video')) {
|
if (mime?.startsWith('video')) {
|
||||||
return {
|
return {
|
||||||
url: comment.link,
|
url: comment.link,
|
||||||
type: 'video'
|
type: 'video',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mime?.startsWith('audio')) {
|
if (mime?.startsWith('audio')) {
|
||||||
return {
|
return {
|
||||||
url: comment.link,
|
url: comment.link,
|
||||||
type: 'audio'
|
type: 'audio',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (comment?.thumbnailUrl !== comment?.link) {
|
||||||
|
return {
|
||||||
|
url: comment.link,
|
||||||
|
type: 'webpage',
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default getCommentMediaInfo;
|
export default getCommentMediaInfo;
|
||||||
Reference in New Issue
Block a user