Skip to content

Commit

Permalink
fix: fix http code
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Dec 16, 2024
1 parent 57b6266 commit 2c74764
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 14 deletions.
6 changes: 6 additions & 0 deletions libs/zhi-fetch-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# zhi-fetch-middleware

## 0.13.0

### Minor Changes

- fix http code

## 0.12.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-fetch-middleware/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-fetch-middleware",
"version": "0.12.0",
"version": "0.13.0",
"type": "module",
"description": "an intermediate tier prepared for fetch requests",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-fetch-middleware/src/lib/commonFetchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class CommonFetchClient implements ICommonFetchClient {
this.logger.error(`fetch请求错误,code ${statusCode}, body =>`, resBody)
if (statusCode === 400) {
throw new Error("错误请求,服务器不理解请求的语法")
} else if (statusCode === 401) {
} else if (statusCode === 401 || statusCode === 403) {
throw new Error("因权限不足操作已被禁止")
} else if (statusCode > 401) {
if (statusCode === 413) {
Expand Down
11 changes: 11 additions & 0 deletions libs/zhi-gitlab-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# zhi-gitlab-middleware

## 0.11.0

### Minor Changes

- fix http code

### Patch Changes

- Updated dependencies
- zhi-fetch-middleware@0.13.0

## 0.10.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-gitlab-middleware/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-gitlab-middleware",
"version": "0.10.0",
"version": "0.11.0",
"type": "module",
"description": "a middleware for gitlab api ",
"main": "./dist/index.js",
Expand Down
16 changes: 12 additions & 4 deletions libs/zhi-gitlab-middleware/src/lib/commonGitlabClient.spec.ts

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions libs/zhi-siyuan-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# zhi-siyuan-api

## 2.25.0

### Minor Changes

- fix http code

## 2.24.1

### Patch Changes

- feat: fix undfuned

## 2.24.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-siyuan-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-siyuan-api",
"version": "2.24.0",
"version": "2.25.0",
"type": "module",
"description": "a siyuan-note api including both kernel and client",
"main": "./dist/index.js",
Expand Down
12 changes: 6 additions & 6 deletions libs/zhi-siyuan-api/src/lib/adaptor/siYuanApiAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ class SiYuanApiAdaptor extends BlogApi {
html = (await this.siyuanKernelApi.exportPreview(pid)).html

// 移除挂件html
if (this.cfg?.preferenceConfig.removeMdWidgetTag) {
if (this.cfg?.preferenceConfig?.removeMdWidgetTag) {
md = HtmlUtil.removeMdWidgetTag(md)
html = HtmlUtil.removeWidgetTag(html)
this.logger.info("检测到配置,挂件的HTML已移除")
}

// 删除H1
if (this.cfg?.preferenceConfig.removeFirstH1) {
if (this.cfg?.preferenceConfig?.removeFirstH1) {
md = HtmlUtil.removeMdH1(md)
html = HtmlUtil.removeH1(html)
this.logger.info("检测到配置,第一个H1已移除")
Expand All @@ -173,17 +173,17 @@ class SiYuanApiAdaptor extends BlogApi {
// 处理目录
let outline = []
let outlineLevel = 3
if (this.cfg?.preferenceConfig.outlineEnable) {
outlineLevel = this.cfg?.preferenceConfig.outlineLevel ?? 3
if (this.cfg?.preferenceConfig?.outlineEnable) {
outlineLevel = this.cfg?.preferenceConfig?.outlineLevel ?? 3
outline = await this.siyuanKernelApi.getOutline(pid, outlineLevel)
this.logger.info("检测到配置,目录已获取")
}

// 处理文档树
let docTree = []
let docTreeLevel = 3
if (this.cfg?.preferenceConfig.docTreeEnable) {
docTreeLevel = this.cfg?.preferenceConfig.docTreeLevel ?? 3
if (this.cfg?.preferenceConfig?.docTreeEnable) {
docTreeLevel = this.cfg?.preferenceConfig?.docTreeLevel ?? 3
const hpaths = siyuanPost.hpath.replace(".sy", "").split("/")
const paths = siyuanPost.path.replace(".sy", "").split("/")
const parentPathArray = []
Expand Down

0 comments on commit 2c74764

Please sign in to comment.