Skip to content

Commit

Permalink
fix: dev link fail on first run
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Apr 22, 2024
1 parent 11ad8e3 commit fcf60f4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ nginx

# test
coverage
testdata
testdata
.typora
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [1.21.2](https://github.com/terwer/siyuan-plugin-publisher/compare/siyuan-plugin-publisher-v1.21.1...siyuan-plugin-publisher-v1.21.2) (2024-04-13)
### Bug Fixes

* notion publish error ([cfc974e](https://github.com/terwer/siyuan-plugin-publisher/commit/cfc974e8b4beb56795d4b6442ff467870a7efe2f))
* wechat publish error ([e080cff](https://github.com/terwer/siyuan-plugin-publisher/commit/e080cff78a3122cb1cf58631d04a9115044a9817))
### Miscellaneous
Expand Down
5 changes: 4 additions & 1 deletion docs/插件开发.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

先要确定插件所属的大类,这个是发布工具内置的,需要发布工具内部添加维护,不支持用户自定义。
目前可用的有

- Common
- Metaweblog
- Wordpress
Expand All @@ -11,6 +12,7 @@
- System

## 新增大类的时候需要维护(内部维护)

- DynamicJsonCfg
- getSubtypeList
- setDynamicJsonCfg
Expand Down Expand Up @@ -47,6 +49,7 @@
- src/platforms/pre.ts
4. 新增适配器
网页授权需要再 src/adaptors/web 新建文件。例如

- csdnWebAdaptor 需要继承 BaseWebApi
- csdnConfig 需要继承 CommonWebConfig
- csdnPlaceholder 需要继承 CommonWebPlaceholder
Expand Down Expand Up @@ -79,7 +82,7 @@
// 注意:最后一个参数必须是 true
const resJson = await this.webFormFetch(url, [header], formData, true)
```

11.2 网页端使用 proxy,PC 端使用 node-fetch-cjs,例如:CSDN

```js
Expand Down
11 changes: 11 additions & 0 deletions scripts/make_dev_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
devOutDir = 'dist'
# ******************************************************************************************


# 如果不存在cookie.txt创建一个空的 cookie.txt
# 检查并创建空的 cookie.txt 和 token.txt
if not os.path.exists('cookie.txt'):
with open('cookie.txt', 'w', encoding='utf-8'):
pass
# 如果不存在token.txt创建一个空的 如果不存在token.txt
if not os.path.exists('token.txt'):
with open('token.txt', 'w', encoding='utf-8'):
pass

with open('cookie.txt', 'r', encoding='utf-8') as cookie_file, open('token.txt', 'r', encoding='utf-8') as token_file:
cookie = cookie_file.read().strip()
token = token_file.read().strip()
Expand Down
2 changes: 1 addition & 1 deletion siyuan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default class PublisherPlugin extends Plugin {
this.logger.error("获取发布菜单失败")
return
}
this.logger.info("当前上下文 =>", context)
this.logger.debug("当前上下文 =>", context)

const pageId = detail?.protyle?.block.rootID
if (!pageId) {
Expand Down

0 comments on commit fcf60f4

Please sign in to comment.