mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
fix: 修復 github-issues 最新評論 獲取的url格式bug
This commit is contained in:
parent
65d89334b2
commit
4b381350a1
@ -15,15 +15,13 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
const findTrueUrl = (array) => {
|
const findTrueUrl = (array) => {
|
||||||
let url = ''
|
|
||||||
Promise.all(array.map(item =>
|
Promise.all(array.map(item =>
|
||||||
fetch(item.url).then(resp => resp.json()).then(data => {
|
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') {
|
if (data.user.login === 'utterances-bot') {
|
||||||
url = data.body.match(/https?\:\/\/[^\" ]+/ig).slice(-1)
|
return urlArray.pop()
|
||||||
return url[0]
|
|
||||||
} else {
|
} else {
|
||||||
url = data.body.match(/https?\:\/\/[^\" ]+/i)
|
return urlArray.shift()
|
||||||
return url[0]
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)).then(res => {
|
)).then(res => {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "3.7.0",
|
"version": "3.7.1-b1",
|
||||||
"description": "A Simple and Card UI Design theme for Hexo",
|
"description": "A Simple and Card UI Design theme for Hexo",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user