mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-12-13 04:59:33 +01:00
comment url & custom emoji on invidious API (#3658)
* comment url & custom emoji on invidious API * Multi-custom emoji fix
This commit is contained in:
parent
3aebdbe655
commit
8281df7b79
@ -129,7 +129,7 @@ export function youtubeImageUrlToInvidious(url, currentInstance = null) {
|
||||
}
|
||||
|
||||
export function invidiousImageUrlToInvidious(url, currentInstance = null) {
|
||||
return url.replace(/^.+(ggpht.+)/, currentInstance)
|
||||
return url.replaceAll(/(\/ggpht\/)/g, `${currentInstance}/ggpht/`)
|
||||
}
|
||||
|
||||
function parseInvidiousCommentData(response) {
|
||||
@ -138,7 +138,7 @@ function parseInvidiousCommentData(response) {
|
||||
comment.authorLink = comment.authorId
|
||||
comment.authorThumb = youtubeImageUrlToInvidious(comment.authorThumbnails[1].url)
|
||||
comment.likes = comment.likeCount
|
||||
comment.text = autolinker.link(stripHTML(comment.content))
|
||||
comment.text = autolinker.link(stripHTML(invidiousImageUrlToInvidious(comment.contentHtml, getCurrentInstance())))
|
||||
comment.dataType = 'invidious'
|
||||
comment.isOwner = comment.authorIsChannelOwner
|
||||
comment.numReplies = comment.replies?.replyCount ?? 0
|
||||
|
@ -406,7 +406,7 @@ export function createWebURL(path) {
|
||||
|
||||
// strip html tags but keep <br>, <b>, </b> <s>, </s>, <i>, </i>
|
||||
export function stripHTML(value) {
|
||||
return value.replaceAll(/(<(?!br|\/?[bis]>)([^>]+)>)/gi, '')
|
||||
return value.replaceAll(/(<(?!br|\/?[bis]|img>)([^>]+)>)/gi, '')
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user