Skip to content

Commit

Permalink
fix: 掘金平台摘要控制在50-100
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Nov 8, 2023
1 parent 8ad9b31 commit db620b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
12 changes: 11 additions & 1 deletion src/adaptors/web/juejin/juejinWebAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

// 保存草稿
Expand Down
23 changes: 1 addition & 22 deletions testdata/siyuan/siyuan.http
Original file line number Diff line number Diff line change
@@ -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}}

0 comments on commit db620b7

Please sign in to comment.