Skip to content

Commit

Permalink
fix: Typecho默认发布为HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Aug 6, 2023
1 parent 94f77ba commit a952a03
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions src/adaptors/api/base/metaweblog/metaweblogBlogApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,14 @@ class MetaweblogBlogApi extends BlogApi {

/**
* 新建文章
* @param post
* @param publish
*
* @param post - 文章
* @param publish - 可选,不传递默认是发布,传递false才是草稿
*/
public async newPost(post: Post, publish: boolean = true): Promise<string> {
public async newPost(post: Post, publish?: boolean): Promise<string> {
// 不传递默认是发布,传递false才是草稿
publish = publish ?? true

// 草稿
if (!publish) {
post.post_status = PostStatusEnum.PostStatusEnum_Draft
Expand All @@ -144,7 +148,17 @@ class MetaweblogBlogApi extends BlogApi {
return ret
}

public async editPost(postid: string, post: Post, publish: boolean = true): Promise<boolean> {
/**
* 编辑文章
*
* @param postid - 文章ID
* @param post - 文章
* @param publish - 可选,不传递默认是发布,传递false才是草稿
*/
public async editPost(postid: string, post: Post, publish?: boolean): Promise<boolean> {
// 不传递默认是发布,传递false才是草稿
publish = publish ?? true

// 草稿
if (!publish) {
post.post_status = PostStatusEnum.PostStatusEnum_Draft
Expand Down
2 changes: 1 addition & 1 deletion src/adaptors/api/typecho/config/typechoConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TypechoConfig extends MetaweblogConfig {
this.home = home
this.apiUrl = apiUrl
this.previewUrl = "/index.php/archives/[postid]"
this.pageType = PageTypeEnum.Markdown
this.pageType = PageTypeEnum.Html
}
}

Expand Down

0 comments on commit a952a03

Please sign in to comment.