diff --git a/api/bilibili.go b/api/bilibili.go index 00cde31..0624b87 100644 --- a/api/bilibili.go +++ b/api/bilibili.go @@ -200,13 +200,14 @@ func GetVideoData(w http.ResponseWriter, r *http.Request) { http.Error(w, "无法解析视频数据", http.StatusInternalServerError) return } + imageurl := "https://images.weserv.nl/?url=" info := &VideoInfo{ Owner: video.Data.Owner.Name, - Face: video.Data.Owner.Face, + Face: imageurl + video.Data.Owner.Face, Title: video.Data.Title, Desc: video.Data.Desc, Duration: secondsToTimeString(video.Data.Duration), - Pic: video.Data.Pic, + Pic: imageurl + video.Data.Pic, Coin: video.Data.Stat.Coin, Danmaku: video.Data.Stat.Danmaku, Favorite: video.Data.Stat.Favorite, diff --git a/themes/blog/album.html b/themes/blog/album.html index 53a005a..7b9aaab 100644 --- a/themes/blog/album.html +++ b/themes/blog/album.html @@ -249,7 +249,6 @@ html += `
${item.text}` for (const id of item.ids) { await fetch(`/api/bilibili?bvid=${id}`).then(res => res.json()).then(data => { - console.log(data) html += `
diff --git a/themes/blog/talk.html b/themes/blog/talk.html index 4ecd888..8d3a1e5 100644 --- a/themes/blog/talk.html +++ b/themes/blog/talk.html @@ -213,7 +213,9 @@ imgs = content.match(/!\[.*\]\(.*?\)/g), musics = content.match(/{\s*music\s*(.*)\s*}/g), videos = content.match(/{\s*bilibili\s*(.*)\s*}/g); - if (imgs) imgs = imgs.map(item => { return item.replace(/!\[.*\]\((.*?)\)/, '$1') }) + if (imgs) imgs = imgs.map(item => { + return item.replace(/!\[.*\]\((.*?)\)/, '$1') + }) if (item.resourceList.length) { if (!imgs) imgs = [] item.resourceList.forEach(t => { @@ -229,14 +231,18 @@ imgs.forEach(e => content += ``) content += '
' } - if (musics) musics.forEach(item => { content += `` }) + if (musics) musics.forEach(item => { + content += `` + }) if (videos) videos.forEach(item => { content += `
` }) - return { content, date, text } + return {content, date, text} } function getTime(time) { - var nol = function (h) { return h > 9 ? h : '0' + h } + var nol = function (h) { + return h > 9 ? h : '0' + h + } var now = new Date() var yesterday = new Date(now.getTime() - (1000 * 60 * 60 * 24)).toLocaleDateString() var twoDaysAgo = new Date(now.getTime() - 2 * (1000 * 60 * 60 * 24)).toLocaleDateString() @@ -254,15 +260,20 @@ else return ls[0] + '年' + ls[1] + '月' + ls[2] + '日 ' + ls[3] + ':' + ls[4] } } + fetch('{{ .Data.url }}/api/v1/memo?creatorId={{ .Data.user }}&tag={{ .Data.tag }}&limit=30').then(res => res.json()).then(data => { let items = [], html = '' - data.forEach(item => { items.push(Format(item)) }) + data.forEach(item => { + items.push(Format(item)) + }) if (items.length == 30) document.querySelector('.limit').style.display = 'block' items.forEach(item => { html += `
Leonus${item.date}
${item.content}
` }) document.getElementById('talk').innerHTML = html - imgStatus.watch('.talk-img', () => { waterfall('#talk') }) + imgStatus.watch('.talk-img', () => { + waterfall('#talk') + }) })