Skip to content

Commit

Permalink
fix: #857 修复查看最新文章路径错误
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Nov 4, 2023
1 parent 1d86ab9 commit c5dda53
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/adaptors/api/base/github/commonGithubApiAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class CommonGithubApiAdaptor extends BaseBlogApi {
.replace("[branch]", cfg.githubBranch)
.replace("[docpath]", postid)
// 路径组合
previewUrl = StrUtil.pathJoin(this.cfg.home, previewUrl)
// previewUrl = StrUtil.pathJoin(this.cfg.home, previewUrl)
return previewUrl
}

Expand Down
2 changes: 1 addition & 1 deletion src/adaptors/api/base/gitlab/commonGitlabApiAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class CommonGitlabApiAdaptor extends BaseBlogApi {
.replace("[branch]", cfg.githubBranch)
.replace("[docpath]", postid)
// 路径组合
previewUrl = StrUtil.pathJoin(this.cfg.home, previewUrl)
// previewUrl = StrUtil.pathJoin(this.cfg.home, previewUrl)
return previewUrl
}

Expand Down
3 changes: 2 additions & 1 deletion src/adaptors/api/base/metaweblog/metaweblogBlogApiAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ class MetaweblogBlogApiAdaptor extends BaseBlogApi {

public async getPreviewUrl(postid: string): Promise<string> {
const previewUrl = this.cfg.previewUrl.replace(/\[postid\]/g, postid)
return StrUtil.pathJoin(this.cfg.home ?? "", previewUrl)
// return StrUtil.pathJoin(this.cfg.home ?? "", previewUrl)
return previewUrl
}

public async getCategories(): Promise<CategoryInfo[]> {
Expand Down
3 changes: 2 additions & 1 deletion src/adaptors/api/halo/HaloApiAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ class HaloApiAdaptor extends BaseBlogApi {
.replace("{year}", haloPostKey.year)
.replace("{month}", haloPostKey.month)
.replace("{day}", haloPostKey.day)
return StrUtil.pathJoin(this.cfg.home ?? "", postUrl)
return postUrl
// return StrUtil.pathJoin(this.cfg.home ?? "", postUrl)
}

public async deletePost(postid: string): Promise<boolean> {
Expand Down
3 changes: 2 additions & 1 deletion src/adaptors/web/csdn/csdnWebAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ class CsdnWebAdaptor extends BaseWebApi {
const token = this.cfg.password
const userid = WebUtils.readCookie("UserName", token)
const previewUrl = this.cfg.previewUrl.replace(/\[userid\]/g, userid).replace(/\[postid\]/g, postid)
return StrUtil.pathJoin(this.cfg.home ?? "", previewUrl)
return previewUrl
// return StrUtil.pathJoin(this.cfg.home ?? "", previewUrl)
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/adaptors/web/jianshu/jianshuWebAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class JianshuWebAdaptor extends BaseWebApi {
// const pageId = jianshuPostKey.pageId
const endUrl = jianshuPostKey.endUrl
const postUrl = purl.replace("[postid]", endUrl)
return StrUtil.pathJoin(this.cfg.home ?? "", postUrl)
return postUrl
// return StrUtil.pathJoin(this.cfg.home ?? "", postUrl)
}

public async deletePost(postid: string): Promise<boolean> {
Expand Down
3 changes: 2 additions & 1 deletion src/adaptors/web/juejin/juejinWebAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ class JuejinWebAdaptor extends BaseWebApi {
const juejinPostKey = this.getJuejinPostidKey(postid)
const pageId = juejinPostKey.pageId
const postUrl = this.cfg.previewUrl.replace("[postid]", pageId)
return StrUtil.pathJoin(this.cfg.home ?? "", postUrl)
return postUrl
// return StrUtil.pathJoin(this.cfg.home ?? "", postUrl)
}

public async deletePost(postid: string): Promise<boolean> {
Expand Down
3 changes: 2 additions & 1 deletion src/composables/usePublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ const usePublish = () => {
const postMeta = ObjectUtil.getProperty(setting, id, {})
const newPostid = postMeta[posidKey]
const previewUrl = await api.getPreviewUrl(newPostid)
return StrUtil.pathJoin(cfg?.home ?? "", previewUrl)
const isAbsoluteUrl = /^http/.test(previewUrl)
return isAbsoluteUrl ? previewUrl : `${cfg?.home ?? ""}${previewUrl}`
}

/**
Expand Down

0 comments on commit c5dda53

Please sign in to comment.