Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #1461 support picgo for halo2 #1465

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@
"cross-fetch": "^3.1.8",
"crypto-js": "^4.2.0",
"element-plus": "^2.8.7",
"gray-matter": "^4.0.3",
"iframe-resizer": "^5.3.2",
"js-base64": "^3.7.7",
"js-yaml": "^4.1.0",
"katex": "^0.16.11",
"lodash-es": "^4.17.21",
"pinia": "^2.2.6",
Expand All @@ -92,7 +90,7 @@
"zhi-lib-base": "^0.8.0",
"zhi-notion-markdown": "^0.1.4",
"zhi-siyuan-api": "^2.23.0",
"zhi-siyuan-picgo": "1.11.5",
"zhi-siyuan-picgo": "1.11.6",
"zhi-xmlrpc-middleware": "^0.6.21"
},
"packageManager": "[email protected]"
Expand Down
65 changes: 13 additions & 52 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions src/adaptors/api/halo/haloUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
* questions.
*/

import * as yaml from "js-yaml"
import * as matter from "gray-matter"

/**
* Halo 平台工具类
*
Expand All @@ -34,27 +31,6 @@ import * as matter from "gray-matter"
* @since 1.15.0
*/
class HaloUtils {
private static options = {
engines: {
yaml: {
parse: (input: string) => yaml.load(input) as object,
stringify: (data: object) => {
return yaml.dump(data, {
styles: { "!!null": "empty" },
})
},
},
},
}

public static readMatter(content: string) {
return matter(content, this.options)
}

public static mergeMatter(content: string, data: object) {
return matter.stringify(content, data, this.options)
}

/**
* 将正文 h1-h6的标签加上 id,例如 <h1 xxx>标题1</h1> 转换成 <h1 id="标题1">标题1</h1>
*
Expand Down
3 changes: 2 additions & 1 deletion src/adaptors/web/haloweb/useHalowebWeb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ const useHalowebWeb = async (key?: string, newCfg?: HalowebConfig) => {
const middlewareUrl = Utils.emptyOrDefault(process.env.VITE_MIDDLEWARE_URL, LEGENCY_SHARED_PROXT_MIDDLEWARE)
const url = new URL(dynCfg.authUrl)
cfg = new HalowebConfig(url.origin, middlewareUrl)
cfg.picbedService = PicbedServiceTypeEnum.Bundled
logger.debug("Configuration is empty, using default environment variables.")
} else {
logger.info("Using configuration from settings...")
}
// 下面是强制设置的配置
const middlewareUrl = Utils.emptyOrDefault(process.env.VITE_MIDDLEWARE_URL, LEGENCY_SHARED_PROXT_MIDDLEWARE)
if (StrUtil.isEmptyString(cfg.middlewareUrl)) {
cfg.middlewareUrl = middlewareUrl
Expand All @@ -95,7 +97,6 @@ const useHalowebWeb = async (key?: string, newCfg?: HalowebConfig) => {
// picbed service
cfg.picgoPicbedSupported = true
cfg.bundledPicbedSupported = true
cfg.picbedService = PicbedServiceTypeEnum.Bundled
const webApi = new HalowebWebAdaptor(appInstance, cfg)

return {
Expand Down
Loading