From db620b7cb33f362a4d2cc54e5529d8c8239654dc Mon Sep 17 00:00:00 2001 From: terwer Date: Wed, 8 Nov 2023 21:02:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=98=E9=87=91=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=91=98=E8=A6=81=E6=8E=A7=E5=88=B6=E5=9C=A850-100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/adaptors/web/juejin/juejinWebAdaptor.ts | 12 ++++++++++- testdata/siyuan/siyuan.http | 23 +-------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/adaptors/web/juejin/juejinWebAdaptor.ts b/src/adaptors/web/juejin/juejinWebAdaptor.ts index 28ed8554..41a69dd7 100644 --- a/src/adaptors/web/juejin/juejinWebAdaptor.ts +++ b/src/adaptors/web/juejin/juejinWebAdaptor.ts @@ -100,7 +100,17 @@ class JuejinWebAdaptor extends BaseWebApi { "由于掘金平台的摘要有强制字数要求,这里需要给一下默认文字作为摘要。这里是掘金平台的默认摘要,您可以稍后自行修改。" if (StrUtil.isEmptyString(post.shortDesc) || post.shortDesc.length < DEFAULT_DESC.length) { post.shortDesc = DEFAULT_DESC - this.logger.error("掘金平台未设置摘要或者摘要字数不够,将使用默认摘要") + this.logger.error("掘金平台未设置摘要或者摘要字数,将使用默认摘要") + } + + // 摘要控制在 50 - 100 + if (post.shortDesc.length < 50) { + while (post.shortDesc.length < 50) { + post.shortDesc += post.shortDesc + } + post.shortDesc = post.shortDesc.slice(0, 100) + } else if (post.shortDesc.length > 100) { + post.shortDesc = post.shortDesc.slice(0, 100) } // 保存草稿 diff --git a/testdata/siyuan/siyuan.http b/testdata/siyuan/siyuan.http index 7b0a2b7f..a4cdafb3 100644 --- a/testdata/siyuan/siyuan.http +++ b/testdata/siyuan/siyuan.http @@ -1,24 +1,3 @@ -### 代理 -POST http://127.0.0.1:6806/api/network/forwardProxy -Cookie: {{cookie}} -Content-Type: application/json - -{ - "url": "http://127.0.0.1:6806/api/file/putFile", - "headers": [ - { - "Authorization": "Token {{token}}", - "Cookie": "{{cookie}}" - } - ], - "payload": {}, - "method": "POST" -} - - ### 鉴权码 GET http://127.0.0.1:6806/stage/build/desktop -Cookie: {{cookie}} -Authorization: "Token {{token}}", - - +Cookie: {{cookie}} \ No newline at end of file