comment url & custom emoji on invidious API (#3658)

* comment url & custom emoji on invidious API

* Multi-custom emoji fix
This commit is contained in:
Wesley Appler 2023-06-14 07:26:53 -04:00 committed by GitHub
parent 3aebdbe655
commit 8281df7b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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, '')
}
/**