From 4b381350a19591bb456771bfc22e4b62f16ec66d Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 22 Mar 2021 16:56:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=20github-issues=20?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E8=A9=95=E8=AB=96=20=E7=8D=B2=E5=8F=96?= =?UTF-8?q?=E7=9A=84url=E6=A0=BC=E5=BC=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third-party/newest-comments/github-issues.pug | 8 +++----- package.json | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/layout/includes/third-party/newest-comments/github-issues.pug b/layout/includes/third-party/newest-comments/github-issues.pug index e561f95..4b39308 100644 --- a/layout/includes/third-party/newest-comments/github-issues.pug +++ b/layout/includes/third-party/newest-comments/github-issues.pug @@ -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 => { diff --git a/package.json b/package.json index ac48e90..8260e35 100644 --- a/package.json +++ b/package.json @@ -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": {