Skip to content

Commit

Permalink
feat: 新版挂件-兼容Windows构建,修复博客园API报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Jul 27, 2023
1 parent d231f73 commit d1ba9e7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"serve": "bash scripts/serve.sh",
"serveWin": "scripts\\serve.cmd",
"dev": "BUILD_TYPE=siyuan vite build --watch",
"devWin":"cmd /C \"set BUILD_TYPE=siyuan && vite build --watch\"",
"build": "BUILD_TYPE=siyuan vite build",
Expand Down
11 changes: 11 additions & 0 deletions scripts/serve.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off

set URL=http://127.0.0.1:6806
set /p COOKIE=<cookie.txt
set /p TOKEN=<token.txt
set IS_SERVE=true
set VITE_SIYUAN_API_URL=%URL%
set VITE_SIYUAN_AUTH_TOKEN=%TOKEN%
set VITE_SIYUAN_COOKIE=%COOKIE%

vite
2 changes: 2 additions & 0 deletions src/adaptors/api/cnblogs/adaptor/cnblogsApiAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import { CnblogsConstants } from "~/src/adaptors/api/cnblogs/cnblogsConstants.ts
/**
* 博客园 API 适配器
*
* @see [博客园 API 文档](https://rpc.cnblogs.com/metaweblog/tangyouwei)
*
* @author terwer
* @version 0.9.0
* @since 0.9.0
Expand Down
4 changes: 3 additions & 1 deletion src/adaptors/api/cnblogs/cnblogsConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
* @since 0.9.0
*/
class CnblogsConstants {
public static METHOD_GET_USERS_BLOGS = "metaWeblog.getUsersBlogs"
// 博客园不支持 metaWeblog.getUsersBlogs
// 博客园只支持 blogger.getUsersBlogs
public static METHOD_GET_USERS_BLOGS = "blogger.getUsersBlogs"
}

export { CnblogsConstants }
2 changes: 1 addition & 1 deletion src/components/set/publish/platform/yamlConvertAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import { PostForm } from "~/src/models/postForm.ts"
import { YamlFormatObj } from "~/src/models/yamlFormatObj.ts"
import { GithubConfig } from "~/src/adaptors/base/github/config/GithubConfig.ts"
import { GithubConfig } from "~/src/adaptors/api/base/github/config/GithubConfig.ts"

export interface IYamlConvertAdaptor {
convertToYaml(postForm: PostForm, githubCfg?: GithubConfig): YamlFormatObj
Expand Down
7 changes: 4 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ const isWatch = args.watch || args.w || false
const isDev = isWatch || debugMode
let devDistDir
if (os.platform() === "win32") {
devDistDir = path.join(os.homedir(), "Documents", "SiYuan", "data", "widgets", "sy-post-publisher")
// devDistDir = path.join(os.homedir(), "Documents", "SiYuan", "data", "widgets", "sy-post-publisher")
devDistDir = path.join(os.homedir(), "Documents", "testdoc", "data", "widgets", "sy-post-publisher")
} else {
devDistDir = "/Users/terwer/Documents/mydocs/SiYuanWorkspace/public/data/widgets/sy-post-publisher"
// devDistDir = "/Users/terwer/Documents/mydocs/SiYuanWorkspace/test/data/widgets/sy-post-publisher"
// devDistDir = "/Users/terwer/Documents/mydocs/SiYuanWorkspace/public/data/widgets/sy-post-publisher"
devDistDir = "/Users/terwer/Documents/mydocs/SiYuanWorkspace/test/data/widgets/sy-post-publisher"
}
const distDir = isWatch ? devDistDir : "./dist"
const isSiyuanBuild = process.env.BUILD_TYPE === "siyuan"
Expand Down

0 comments on commit d1ba9e7

Please sign in to comment.