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) => {
|
||||
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 => {
|
||||
|
||||
@ -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": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user