Skip to content

Commit

Permalink
Merge pull request #269 from terwer/dev
Browse files Browse the repository at this point in the history
feat: #133 支持Github系列-大版本完成,预发版
  • Loading branch information
terwer committed Dec 14, 2022
2 parents 844285b + d5f6579 commit c8db9c7
Show file tree
Hide file tree
Showing 39 changed files with 1,318 additions and 194 deletions.
64 changes: 40 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
# sy-post-publisher

![](https://raw.githubusercontent.com/terwer/src-sy-post-publisher/main/assets/favicon/android-chrome-512x512.png)

[思源笔记](https://github.com/siyuan-note/siyuan) 的文章发布到支持的平台的 **思源笔记挂件**

![](https://static-rs-terwer.oss-cn-beijing.aliyuncs.com/project/sy-post-publisher/preview.png)
![version](https://img.shields.io/github/release/terwer/src-sy-post-publisher.svg?style=flat-square)
<a title="Downloads" target="_blank" href="https://github.com/terwer/src-sy-post-publisher/releases"><img src="https://img.shields.io/github/downloads/terwer/src-sy-post-publisher/total.svg?style=flat-square&color=blueviolet"></a>
[![](https://img.shields.io/badge/online-preview-faad14.svg?style=popout-square)](https://publish.terwer.space/blog/index.html)
![](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://hugo.terwer.space/post/readme-1j4ltp.html)
[![](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://hugo.terwer.space/post/configure-entry-video-brpm9.html)

[点击查看项目源码](https://github.com/terwer/src-sy-post-publisher)
![](https://raw.githubusercontent.com/terwer/src-sy-post-publisher/main/public/preview.png)

[点击查看帮助文档](https://mp.terwer.space/post/readme-1j4ltp.html)
## 开发状态

[点击查看新手小白级视频教程](https://mp.terwer.space/post/configure-entry-video-brpm9.html)
[![dev checks](https://img.shields.io/github/checks-status/terwer/src-sy-post-publisher/main?label=main)](https://github.com/terwer/src-sy-post-publisher)
[![dev checks](https://img.shields.io/github/checks-status/terwer/src-sy-post-publisher/dev?label=dev)](https://github.com/terwer/src-sy-post-publisher/tree/dev)
![GitHub last commit](https://img.shields.io/github/last-commit/terwer/src-sy-post-publisher)

## 支持平台

- [x] Hugo
- [x] [Hugo](https://gohugo.io/) <sup>推荐</sup>
- [x] Hexo
- [x] Jekyll(Github pages 默认内置支持的平台)
- [x] Vuepress
- [x] [Jekyll](https://github.com/lorepirri/cayman-blog)(Github pages 默认内置支持的平台)
- [x] [Vuepress](https://github.com/terwer/terwer.github.io)
- [x] Vitepress
- [x] Nuxt
- [x] Next
- [x] 博客园
- [x] [博客园](https://cnblogs.com) <sup>推荐</sup>
- [ ] CSDN <sup>预研</sup>
- [ ] 知乎 <sup>预研</sup>
- [x] 语雀
- [x] 开源中国
- [x] 链滴社区
- [x] WordPress
- [x] Confluence <sup>通过接口适配器支持</sup>
- [x] Metaweblog API
- [x] [语雀](https://yuque.com) <sup>推荐</sup>
- [x] [开源中国](https://my.oschina.net/terwergreen)
- [x] [链滴社区](https://ld246.com)
- [x] [WordPress](https://blog.terwergreen.com)
- [x] [Confluence](https://github.com/terwer/node-metaweblog-api-adaptor) <sup>通过接口适配器支持</sup>
- [x] [Metaweblog API](http://xmlrpc.com/spec.md)
- [ ] 自定义 HTTP 协议 <sup>预研</sup>

## 挂件版快速上手
Expand All @@ -44,7 +55,7 @@

## 浏览器插件快速上手

https://mp.terwer.space/post/start-to-get-started-zi0eyk.html
https://terwer.space/post/start-to-get-started-zi0eyk.html

## 愿景

Expand All @@ -70,11 +81,11 @@ https://mp.terwer.space/post/start-to-get-started-zi0eyk.html

| 商店 | 版本 | 上架状态 |
| :----------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------: |
| ![](https://static-rs-terwer.oss-cn-beijing.aliyuncs.com/icons/browser/edge20.svg) | [v0.0.3](https://microsoftedge.microsoft.com/addons/detail/%E6%80%9D%E6%BA%90%E7%AC%94%E8%AE%B0%E5%8F%91%E5%B8%83%E8%BE%85%E5%8A%A9%E5%B7%A5%E5%85%B7/aejmkigifflimhjlhjkdckclhabbilee) | 已上架 |
| ![](https://static-rs-terwer.oss-cn-beijing.aliyuncs.com/icons/browser/chrome20.svg) | [v0.0.3](https://chrome.google.com/webstore/detail/%E6%80%9D%E6%BA%90%E7%AC%94%E8%AE%B0%E5%8F%91%E5%B8%83%E8%BE%85%E5%8A%A9%E5%B7%A5%E5%85%B7/gemlnnppcphbiimfjnobfgdkohjmgifm) | 已上架 |
| 网页版 | [v0.0.3](https://publish.terwer.space/blog/index.html) | 可使用 |
| 离线 zip | [v0.0.3](https://github.com/terwer/src-sy-post-publisher/releases/download/v0.0.3/sy-post-publisher-chrome-0.0.3.zip) | 可下载 |
| 挂件版 | [v0.0.3](https://github.com/terwer/sy-post-publisher) | 可使用 |
| ![](https://static-rs-terwer.oss-cn-beijing.aliyuncs.com/icons/browser/edge20.svg) | [latest](https://microsoftedge.microsoft.com/addons/detail/%E6%80%9D%E6%BA%90%E7%AC%94%E8%AE%B0%E5%8F%91%E5%B8%83%E8%BE%85%E5%8A%A9%E5%B7%A5%E5%85%B7/aejmkigifflimhjlhjkdckclhabbilee) | 已上架 |
| ![](https://static-rs-terwer.oss-cn-beijing.aliyuncs.com/icons/browser/chrome20.svg) | [latest](https://chrome.google.com/webstore/detail/%E6%80%9D%E6%BA%90%E7%AC%94%E8%AE%B0%E5%8F%91%E5%B8%83%E8%BE%85%E5%8A%A9%E5%B7%A5%E5%85%B7/gemlnnppcphbiimfjnobfgdkohjmgifm) | 已上架 |
| 网页版 | [latest](https://publish.terwer.space/blog/index.html) | 可使用 |
| 离线 zip | [latest](https://github.com/terwer/src-sy-post-publisher/releases/download/v0.0.3/sy-post-publisher-chrome-0.0.3.zip) | 可下载 |
| 挂件版 | [latest](https://github.com/terwer/sy-post-publisher) | 可使用 |

小贴士:

Expand Down Expand Up @@ -116,10 +127,15 @@ https://mp.terwer.space/post/start-to-get-started-zi0eyk.html
- [x] 发布页面支持预览 <sup>0.1.0+</sup>
- [ ] 支持自定义接口协议 <sup>1.0.0+</sup>
- [x] 支持文章标题使用数字编号 <sup>0.0.3+</sup>
- [x] [多平台支持,并且持续适配中](https://github.com/terwer/src-sy-post-publisher#%E6%94%AF%E6%8C%81%E5%B9%B3%E5%8F%B0) <sup>0.0.1+</sup>
- [ ] 支持同步到 Github(Github pages、Hugo、Hexo、Jekyll、Vuepress、Vitepress、Nuxt content、Next.js),0.1.0+ 之后更加通用,支持动态添加管理多个 <sup>0.0.1+</sup> <sup>0.1.0+</sup>
- [ ] 支持自定义图床 <sup>0.1.0+</sup>
- [ ] 支持多种发布视图,简单模式、详细模式和源码模式 <sup>0.1.0+</sup> <sup>0.0.1+</sup>
- [x] [多平台支持,并且持续适配中](https://github.com/terwer/src-sy-post-publisher#%E6%94%AF%E6%8C%81%E5%B9%B3%E5%8F%B0) <sup>
0.0.1+</sup>
- [x] 支持同步到 Github(Github pages、Hugo、Hexo、Jekyll、Vuepress、Vitepress、Nuxt content、Next.js),0.1.0+
之后更加通用,支持动态添加管理多个 <sup>0.0.1+</sup> <sup>0.1.0+</sup>
- [ ] 支持自定义图床 <sup>1.0.0+</sup>
- [x] 支持多种发布视图,简单模式、详细模式和源码模式(Github 系列平台) <sup>0.1.0+</sup> <sup>0.0.1+</sup>
- [x] 支持自定义设置 API 地址,支持本地、局域网、远程 <sup>0.1.0+</sup>
- [x] 支持配置导入导出 <sup>0.2.0+</sup>
- [x] 通用设置支持标题序号开关、正文 H1 开关、新窗口开关、自动标签开关 <sup>0.2.0+</sup>

## 最近更新

Expand Down
30 changes: 4 additions & 26 deletions components/publish/PublishService.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@
<platform-setting :is-reload="isReloadServiceTab" />
</el-tab-pane>
<el-tab-pane name="post-bind" :label="$t('service.tab.post.bind')">
<PostBind :is-reload="isReloadSettingTab" :page-id="props.pageId" />
<PostBind :is-reload="isReloadServiceTab" :page-id="props.pageId" />
</el-tab-pane>
<el-tab-pane
name="service-switch"
:label="$t('service.tab.service.switch')"
>
<service-switch :is-reload="isReloadServiceSwitchTab" />
<service-switch :is-reload="isReloadServiceTab" />
</el-tab-pane>
<el-tab-pane name="dynamic-platform" :label="$t('dynamic.platform.new')">
<dynamic-platform />
</el-tab-pane>
<el-tab-pane :label="$t('service.tab.change.local')" name="general-setting">
<general-setting :is-reload="isReloadCommonSettingTab" />
<general-setting :is-reload="isReloadServiceTab" />
</el-tab-pane>
</el-tabs>
</template>
Expand All @@ -75,10 +75,6 @@ const logger = LogFactory.getLogger("components/publish/PublishService.vue")
const defaultTab = ref("platform-main")
const isReloadServiceTab = ref(false)
const isReloadSettingTab = ref(false)
const isReloadPostBindTab = ref(false)
const isReloadServiceSwitchTab = ref(false)
const isReloadCommonSettingTab = ref(false)
const props = defineProps({
isReload: {
Expand All @@ -94,25 +90,7 @@ const props = defineProps({
const serviceTabChange = (name) => {
const paneName = name.paneName
logger.debug("serviceTabChange=>", paneName)
if (paneName === "platform-main") {
isReloadServiceTab.value = !isReloadServiceTab.value
}
if (paneName === "platform-setting") {
isReloadSettingTab.value = !isReloadSettingTab.value
}
if (paneName === "post-bind") {
isReloadPostBindTab.value = !isReloadPostBindTab.value
}
if (paneName === "service-switch") {
isReloadServiceSwitchTab.value = !isReloadServiceSwitchTab.value
}
if (paneName === "general-setting") {
isReloadCommonSettingTab.value = !isReloadCommonSettingTab.value
}
isReloadServiceTab.value = !isReloadServiceTab.value
}
</script>

Expand Down
13 changes: 12 additions & 1 deletion components/publish/tab/DynamicPlatform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ import {
} from "~/utils/platform/dynamicConfig"
import { LogFactory } from "~/utils/logUtil"
import { checkKeyExists } from "~/utils/configUtil"
import { importPreDefinedPlatform } from "~/utils/import/importUtil"
const logger = LogFactory.getLogger(
"components/publish/tab/DynamicPlatform.vue"
Expand Down Expand Up @@ -301,7 +302,11 @@ const submitForm = async (formEl) => {
formData.dynCfg.platformKey,
formData.dynCfg.platformName
)
newCfg.subPlatformType = formData.subtype
if (formData.ptype === PlatformType.Github) {
newCfg.subPlatformType = formData.subtype
} else {
newCfg.subPlatformType = SubPlatformType.NONE
}
formData.dynamicConfigArray.push(newCfg)
setDynamicJsonCfg(formData.dynamicConfigArray)
Expand Down Expand Up @@ -386,6 +391,12 @@ const initPage = async () => {
}
onMounted(async () => {
// 导入配置
logger.info("开始导入预定义平台...")
importPreDefinedPlatform()
logger.info("导入预定义平台成功.")
// 初始化
await initPage()
})
</script>
Expand Down
20 changes: 13 additions & 7 deletions components/publish/tab/PlatformMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<el-tabs
v-if="tabCountStore.tabCount > 0"
type="border-card"
@tab-click="mainTabChange"
@tab-change="mainTabChange"
>
<!-- Github -->
<el-tab-pane :label="$t('main.publish.to.vuepress')" v-if="vuepressEnabled">
Expand Down Expand Up @@ -124,12 +124,14 @@
:label="gcfg.platformName"
>
<github-main
:is-main-reload="isReloadMainTab"
:is-reload="props.isReload"
:api-type="gcfg.platformKey"
:is-main-reload="isReloadMainTab"
:page-id="props.pageId"
:yaml-converter="gcfg.yamlConverter"
/>
</el-tab-pane>

<el-tab-pane
v-for="mcfg in formData.metaweblogArray"
:key="mcfg.platformKey"
Expand All @@ -142,6 +144,7 @@
:page-id="props.pageId"
/>
</el-tab-pane>

<el-tab-pane
v-for="wcfg in formData.wordpressArray"
:key="wcfg.platformKey"
Expand Down Expand Up @@ -185,6 +188,7 @@ import MetaweblogMain from "~/components/publish/tab/main/MetaweblogMain.vue"
import {
DynamicConfig,
getDynamicJsonCfg,
getDynYamlConverterAdaptor,
} from "~/utils/platform/dynamicConfig"
import { getBooleanConf } from "~/utils/configUtil"
Expand All @@ -210,13 +214,13 @@ const {
const isReloadMainTab = ref(false)
const formData = reactive({
dynamicConfigArray: [],
githubArray: [],
metaweblogArray: [],
wordpressArray: [],
dynamicConfigArray: <DynamicConfig[]>[],
githubArray: <DynamicConfig[]>[],
metaweblogArray: <DynamicConfig[]>[],
wordpressArray: <DynamicConfig[]>[],
})
const initDynCfg = (dynCfg: any[]) => {
const initDynCfg = (dynCfg: DynamicConfig[]) => {
const newCfg = []
dynCfg.forEach((item) => {
Expand All @@ -232,6 +236,8 @@ const initDynCfg = (dynCfg: any[]) => {
if (switchValue) {
newCfg.push(newItem)
}
newItem.yamlConverter = getDynYamlConverterAdaptor(item.platformKey)
})
return newCfg
Expand Down
2 changes: 0 additions & 2 deletions components/publish/tab/ServiceSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ import {
} from "~/utils/platform/dynamicConfig"
import { LogFactory } from "~/utils/logUtil"
const logger = LogFactory.getLogger("components/publish/tab/ServiceSwitch.vue")
// use
const {
tabCountStore,
Expand Down
5 changes: 5 additions & 0 deletions components/publish/tab/main/CommonBlogMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,11 @@ const initPage = async () => {
}
}
// 自动标签
if (publishCfg.autoTag && formData.tag.dynamicTags.length === 0) {
tagSwitch.value = true
}
// 发布状态
isPublished.value = getPublishStatus(props.apiType, siyuanData.meta)
// 只支持新建选择笔记本
Expand Down
43 changes: 32 additions & 11 deletions components/publish/tab/main/GithubMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,19 +355,19 @@
</el-button>
</el-form-item>

<el-form-item>
<el-form-item
v-if="pageModeData.etype !== PageEditMode.EditMode_simple"
>
<!-- 属性转换 -->
<el-button
v-if="pageModeData.etype !== PageEditMode.EditMode_simple"
type="primary"
@click="quickMethods.saveAttrToSiyuan"
<el-button type="primary" @click="quickMethods.saveAttrToSiyuan"
>{{ $t("main.save.attr.to.siyuan") }}
</el-button>
</el-form-item>

<el-form-item>
<el-form-item
v-if="pageModeData.etype !== PageEditMode.EditMode_simple"
>
<el-button
v-if="pageModeData.etype !== PageEditMode.EditMode_simple"
type="primary"
@click="
initPublishMethods.onEditModeChange(
Expand Down Expand Up @@ -412,8 +412,8 @@
class="publish-status"
>
<!-- 文章状态 -->
<el-form-item>
<el-button disabled text type="danger">
<el-form-item class="publish-status-box">
<el-button class="publish-text-btn" disabled text type="danger">
{{
initPublishData.isPublished
? $t("main.publish.status.published")
Expand All @@ -428,9 +428,16 @@
>{{ $t("main.publish.see.md.preview") }}</a
>
</el-form-item>
<el-form-item>
<el-form-item
v-if="initPublishData.isPublished"
class="publish-status-box"
>
<img
:src="initPublishData.mdStatusUrl"
alt="md-build-status"
class="publish-build-status-icon"
/>
<a
v-if="initPublishData.isPublished"
:href="initPublishData.previewUrl"
:title="initPublishData.previewUrl"
target="_blank"
Expand Down Expand Up @@ -644,6 +651,7 @@ const { publishTimeData, publishTimeMethods } = usePublishTime()
const { tagData, tagMethods } = useTag(props)
const { githubPagesData, githubPagesMethods } = useGithubPages(props, {
siyuanPageMethods,
slugMethods,
})
const { yamlData, yamlMethods } = useYaml()
const { quickData, quickMethods } = useQuick(props, {
Expand Down Expand Up @@ -743,4 +751,17 @@ html.dark .source-opt a {
cursor: default;
/*pointer-events: none;*/
}
.publish-status-box {
margin-bottom: 0;
}
.publish-status-box .publish-text-btn {
margin: 0;
padding: 0 12px 0 0;
}
.publish-build-status-icon {
margin-right: 12px;
}
</style>
5 changes: 5 additions & 0 deletions components/publish/tab/main/MetaweblogMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ const initPage = async () => {
}
}
// 自动标签
if (publishCfg.autoTag && formData.tag.dynamicTags.length === 0) {
tagSwitch.value = true
}
// 发布状态
isPublished.value = getPublishStatus(props.apiType, siyuanData.meta)
Expand Down
Loading

1 comment on commit c8db9c7

@vercel
Copy link

@vercel vercel bot commented on c8db9c7 Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.