From 45b92640b2189d3aa01c22ccb9d6c335222c1f22 Mon Sep 17 00:00:00 2001 From: terwer Date: Sat, 7 Jan 2023 19:28:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DGithub=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E5=8F=91=E5=B8=83=E7=8A=B6=E6=80=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- components/publish/tab/main/GithubMain.vue | 26 ++++++++----------- .../publish/tab/main/MetaweblogMain.vue | 2 +- composables/publish/githubPagesCom.ts | 12 +++++++-- composables/publish/initPublishCom.ts | 4 +-- public/lib/siyuanhook.js | 2 +- utils/publishUtil.ts | 2 +- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 55d84c77..7b726596 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ![](https://img.shields.io/badge/license-GPL-blue.svg?style=popout-square) [![](https://img.shields.io/badge/%E9%A1%B9%E7%9B%AE%E6%BA%90%E7%A0%81-code-brightgreen)](https://github.com/terwer/src-sy-post-publisher) -[![](https://img.shields.io/badge/%E5%B8%AE%E5%8A%A9%E6%96%87%E6%A1%A3-doc-blue)](https://www.terwer.space/post/readme-1j4ltp.html) +[![](https://img.shields.io/badge/%E5%B8%AE%E5%8A%A9%E6%96%87%E6%A1%A3-doc-blue)](https://docs.publish.terwer.space) [![](https://img.shields.io/badge/%E6%96%B0%E6%89%8B%E5%B0%8F%E7%99%BD%E7%BA%A7%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B-video-red)](https://www.terwer.space/post/configure-entry-video-brpm9.html) ![](https://img1.terwer.space/api/public/202212181127124.png) diff --git a/components/publish/tab/main/GithubMain.vue b/components/publish/tab/main/GithubMain.vue index d5f97e6e..81f631a1 100644 --- a/components/publish/tab/main/GithubMain.vue +++ b/components/publish/tab/main/GithubMain.vue @@ -1,5 +1,5 @@
- + - - +
@@ -341,9 +336,7 @@ >
@@ -428,7 +421,10 @@
diff --git a/components/publish/tab/main/MetaweblogMain.vue b/components/publish/tab/main/MetaweblogMain.vue index 2cca414d..cef2d05a 100644 --- a/components/publish/tab/main/MetaweblogMain.vue +++ b/components/publish/tab/main/MetaweblogMain.vue @@ -475,7 +475,7 @@ const initPage = async () => { formData.postid = meta[metaweblogCfg.posidKey] // 路径组合 - previewUrl.value = await api.getPreviewUrl(formData.postid.toString()) + previewUrl.value = await api.getPreviewUrl(formData?.postid?.toString()) try { // 如果文章选择了分类,初始化分类 diff --git a/composables/publish/githubPagesCom.ts b/composables/publish/githubPagesCom.ts index d703d678..20d3dff3 100644 --- a/composables/publish/githubPagesCom.ts +++ b/composables/publish/githubPagesCom.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Terwer . All rights reserved. + * Copyright (c) 2022-2023, Terwer . All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ * questions. */ -import { reactive } from "vue" +import { reactive, ref } from "vue" import { LogFactory } from "~/utils/logUtil" import { getJSONConf } from "~/utils/configUtil" import { IGithubCfg } from "~/utils/platform/github/githubCfg" @@ -132,6 +132,14 @@ export const useGithubPages = (props, deps) => { fname: githubPagesData.mdTitle, }) }, + onFilenameChange: () => { + if (githubPagesData.customPath === "") { + return + } + const val = ref(githubPagesData.customPath) + githubPagesMethods.onSelectChange(val) + logger.info("触发文件名修改,同步发布路径.") + }, getGithubPagesData: () => { return githubPagesData diff --git a/composables/publish/initPublishCom.ts b/composables/publish/initPublishCom.ts index 08b428a8..96d91a91 100644 --- a/composables/publish/initPublishCom.ts +++ b/composables/publish/initPublishCom.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Terwer . All rights reserved. + * Copyright (c) 2022-2023, Terwer . All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -337,7 +337,7 @@ export const useInitPublish = (props, deps, otherArgs?) => { initPublishMethods.convertAttrToYAML(true) // 预览链接 - if (initPublishData.isPublished) { + if (initPublishData.apiStatus && initPublishData.isPublished) { // 预览链接 const baseUrl = githubCfg.baseUrl ?? "https://terwer.space/" const home = githubCfg.home ?? "https://terwer.space/" diff --git a/public/lib/siyuanhook.js b/public/lib/siyuanhook.js index fb063314..b692b1e0 100644 --- a/public/lib/siyuanhook.js +++ b/public/lib/siyuanhook.js @@ -280,7 +280,7 @@ window.terwer.renderPublishHelper = (pageId, pageUrl) => { (response) => { window.siyuan.printWin.loadURL(response.data.url) // 打开开发者工具 - window.siyuan.printWin.webContents.openDevTools() + // window.siyuan.printWin.webContents.openDevTools() } ) }) diff --git a/utils/publishUtil.ts b/utils/publishUtil.ts index c48bd4bb..b492f855 100644 --- a/utils/publishUtil.ts +++ b/utils/publishUtil.ts @@ -136,7 +136,7 @@ export const getPublishStatus = (apiType: string, meta: any): boolean => { logger.debug("postidKey的值=>", postId) } - return isEmptyString(postId) + return !isEmptyString(postId) } /**