fix: 修復 github-issues 最新評論 獲取的url格式bug

This commit is contained in:
Jerry 2021-03-22 16:56:15 +08:00
parent 65d89334b2
commit 4b381350a1
2 changed files with 4 additions and 6 deletions

View File

@ -15,15 +15,13 @@ script.
}
const findTrueUrl = (array) => {
let url = ''
Promise.all(array.map(item =>
fetch(item.url).then(resp => resp.json()).then(data => {
const urlArray = data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig)
if (data.user.login === 'utterances-bot') {
url = data.body.match(/https?\:\/\/[^\" ]+/ig).slice(-1)
return url[0]
return urlArray.pop()
} else {
url = data.body.match(/https?\:\/\/[^\" ]+/i)
return url[0]
return urlArray.shift()
}
})
)).then(res => {

View File

@ -1,6 +1,6 @@
{
"name": "hexo-theme-butterfly",
"version": "3.7.0",
"version": "3.7.1-b1",
"description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json",
"scripts": {