Skip to content

Commit

Permalink
Merge pull request #91 from terwer/dev
Browse files Browse the repository at this point in the history
feat:#85 Google插件扩展-同时兼容Google扩展与思源挂件构建
  • Loading branch information
terwer committed Sep 22, 2022
2 parents fe61087 + 5399e94 commit 31a894b
Show file tree
Hide file tree
Showing 29 changed files with 544 additions and 249 deletions.
88 changes: 56 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

Publish siyuan article to supported open platforms

At present, it supports vuepress and two open API standard blog platforms, <code>metaweblog api</code> and <code>xmlrpc</code> remote call API based on <code>wordpress</code>
At present, it supports vuepress and two open API standard blog platforms, <code>metaweblog api</code> and <code>
xmlrpc</code> remote call API based on <code>wordpress</code>

ALso provide a [common API adaptor](https://github.com/terwer/src-sy-post-publisher/blob/main/src/lib/api.ts) , make every plantform posiable.
ALso provide a [common API adaptor](https://github.com/terwer/src-sy-post-publisher/blob/main/src/lib/api.ts) , make
every plantform posiable.

<a href="https://img1.terwergreen.com/api/public/20220729233245.gif" target="_blank" >Click me</a>

Expand All @@ -31,58 +33,65 @@ ALso provide a [common API adaptor](https://github.com/terwer/src-sy-post-publis
[Click here to view development progress](https://github.com/users/terwer/projects/1/views/1)

### v0.0.2
- [X] [#15](https://github.com/terwer/src-sy-post-publisher/issues/15) Published to other platforms-blog parks, WordPress, chain drop community, etc.

- [x] [#18](https://github.com/terwer/src-sy-post-publisher/issues/18) Implement MetaWeblog-API client
- [X] [#15](https://github.com/terwer/src-sy-post-publisher/issues/15) Published to other platforms-blog parks,
WordPress, chain drop community, etc.

- [x] [#24](https://github.com/terwer/src-sy-post-publisher/issues/24) Non-pendant server version, you need to pass the document ID. It is recommended to cooperate with my other work [node-siyuan](https://github.com/terwer/node-siyuan) use
- [x] [#18](https://github.com/terwer/src-sy-post-publisher/issues/18) Implement MetaWeblog-API client

- [x] [#25](https://github.com/terwer/src-sy-post-publisher/issues/25) Vercel deploy
- [x] [#24](https://github.com/terwer/src-sy-post-publisher/issues/24) Non-pendant server version, you need to pass
the document ID. It is recommended to cooperate with my other
work [node-siyuan](https://github.com/terwer/node-siyuan) use

- [X] [#38](https://github.com/terwer/src-sy-post-publisher/issues/38) Some platforms support cancel the release
- [x] [#25](https://github.com/terwer/src-sy-post-publisher/issues/25) Vercel deploy

- [X] [#39](https://github.com/terwer/src-sy-post-publisher/issues/39) Support ELETRON interface
- [X] [#38](https://github.com/terwer/src-sy-post-publisher/issues/38) Some platforms support cancel the release

- [X] [#40](https://github.com/terwer/src-sy-post-publisher/issues/40) Published to Confluence, you need to cooperate with my project [node-metaweblog-api-adaptor](https://github.com/terwer/node-metaweblog-api-adaptor)
- [X] [#39](https://github.com/terwer/src-sy-post-publisher/issues/39) Support ELETRON interface

- [x] [#41](https://github.com/terwer/src-sy-post-publisher/issues/41) Send to Wordpess
- [X] [#40](https://github.com/terwer/src-sy-post-publisher/issues/40) Published to Confluence, you need to
cooperate with my project [node-metaweblog-api-adaptor](https://github.com/terwer/node-metaweblog-api-adaptor)

- [x] [#42](https://github.com/terwer/src-sy-post-publisher/issues/42) Sendto Liandi
- [x] [#41](https://github.com/terwer/src-sy-post-publisher/issues/41) Send to Wordpess

- [x] [#43](https://github.com/terwer/src-sy-post-publisher/issues/43) Send to Yuque
- [x] [#42](https://github.com/terwer/src-sy-post-publisher/issues/42) Sendto Liandi

- [x] [#44](https://github.com/terwer/src-sy-post-publisher/issues/44) Send to KMS

- [#19](https://github.com/terwer/src-sy-post-publisher/issues/19) 增强Vuepress支持,如果设置了Github参数,使用Github API实现自动发布,否则自行复制文本
- [x] [#43](https://github.com/terwer/src-sy-post-publisher/issues/43) Send to Yuque

- [x] [#44](https://github.com/terwer/src-sy-post-publisher/issues/44) Send to KMS

- [#19](https://github.com/terwer/src-sy-post-publisher/issues/19) 增强Vuepress支持,如果设置了Github参数,使用Github
API实现自动发布,否则自行复制文本

- 1、add aupport for Github rest api

- 2、TS generic implementation Vuepress release parameter configuration

- 3、Fix Octokit to build an error in vite, replace `node-fetch` as `isomorphic-fetch`

- 4、Add config valifation

- 5、Time-consuming button operation add `loading`

- 6、If the GitHub parameter is set, the GitHub API is set to be automatically published, otherwise the text will be copied by yourself


- 6、If the GitHub parameter is set, the GitHub API is set to be automatically published, otherwise the text will be
copied by yourself

- 7、Support selection of custom release directory

- 8、Support modified file name

- 9、Vuepress's slug add hash to avoid the conflict of repeated articles

- 10、Support simple and complex mode

- 11、New API status to ensure the availability of the API

- 12、Configuration switch automatically takes effect

- 13、Default directory switch

- 14、Page initialization is also additional content

- 15、Support article cancellation and release

### v0.0.1
Expand All @@ -91,17 +100,24 @@ ALso provide a [common API adaptor](https://github.com/terwer/src-sy-post-publis

## Vue 3 + TypeScript + Vite

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue
3 `<script setup>` SFCs, check out
the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

## Recommended IDE Setup

* [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)

## Type Support For `.vue` Imports in TS

Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type
by default. In most cases this is fine if you don't really care about component prop types outside of templates.
However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using
manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:

1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look
for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default,
Take Over mode will enable itself if the default TypeScript extension is disabled.

2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.

Expand Down Expand Up @@ -129,11 +145,19 @@ yarn create vite

## Deploy

### Build for siyuan widget

```bash
yarn w
```

### Build for chrome extension

```bash
yarn deploy
yarn e
```

## Vercel CLI
## ~~Vercel CLI~~

```
npm i -g vercel
Expand Down
10 changes: 0 additions & 10 deletions deploy.ps1

This file was deleted.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"build-siyuan": "vue-tsc --noEmit && BUILD_TYPE=siyuan vite build",
"preview": "vite preview",
"test": "vitest --watch",
"coverage": "vitest run --coverage",
"webstorm-integration": "vitest --watch --reporter=dot --reporter=json --outputFile=.vitest-result.json",
"deploy": "bash deploy.sh",
"d": "yarn deploy",
"deploy-win": "pwsh deploy.ps1",
"wd": "yarn deploy-win",
"vdev": "vercel dev --listen 5005",
"vbuild": "vercel build",
"ext": "bash ext.sh"
"deploy-siyuan": "bash deploy.sh",
"ext": "bash ext.sh",
"widget": "bash widget.sh",
"e": "yarn ext",
"w": "yarn widget"
},
"dependencies": {
"@element-plus/icons-vue": "^2.0.9",
Expand Down
6 changes: 3 additions & 3 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"web_accessible_resources": [
{
"resources": [
"index/index.html",
"service/index.html"
"blog/index.html",
"index.html"
],
"matches": [
"<all_urls>"
]
}
],
"action": {
"default_popup": "index/index.html"
"default_popup": "blog/index.html"
}
}
4 changes: 2 additions & 2 deletions public/widget.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sy-post-publisher",
"author": "terwer",
"url": "https://github.com/terwer/sy-post-publisher",
"version": "0.0.2"
"url": "https://github.com/terwer/src-sy-post-publisher",
"version": "0.0.3"
}
31 changes: 30 additions & 1 deletion src/components/blog/themes/default/DefaultFooter.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
<template>
<div class="footer"> &copy;2011-2022 sy-post-publisher v0.0.3</div>
<div>
<div class="footer">
<div>
<span class="text"> &copy;2011-2022 </span>
<span class="s-dark" @click="goGithub()"> sy-post-publisher </span>
<span class="text"> v0.0.3. </span>
<span class="text s-dark" @click="toggleDark()">{{ isDark ? $t('theme.mode.light') : $t('theme.mode.dark') }}</span>
</div>
</div>
</div>
</template>

<script lang="ts" setup>
import {useDark, useToggle} from "@vueuse/core";
const isDark = useDark()
const toggleDark = useToggle(isDark)
const goGithub = () => {
window.open("https://github.com/terwer/src-sy-post-publisher")
}
</script>

<script lang="ts">
export default {
name: "DefaultFooter"
Expand All @@ -14,4 +34,13 @@ export default {
color: #bbb;
text-align: center;
}
.footer .text{
vertical-align: middle;
}
.s-dark {
color: var(--el-color-primary);
cursor: pointer;
}
</style>
93 changes: 3 additions & 90 deletions src/components/blog/themes/default/DefaultHeader.vue
Original file line number Diff line number Diff line change
@@ -1,78 +1,10 @@
<template>
<div>
<el-autocomplete
v-model="state"
:fetch-suggestions="querySearch"
popper-class="my-autocomplete"
placeholder="Please input"
@select="handleSelect"
>
<template #suffix>
<el-icon class="el-input__icon" @click="handleIconClick">
<edit/>
</el-icon>
</template>
<template #default="{ item }">
<div class="value">{{ item.value }}</div>
<span class="link">{{ item.link }}</span>
</template>
</el-autocomplete>
<el-button class="s-btn" type="primary" @click="handleBtnSearch">搜索</el-button>
<h1 style="text-align: center;margin-top: 0;">思源笔记发布工具</h1>
</div>
</template>

<script lang="ts" setup>
import {onMounted, ref} from 'vue'
import {Edit} from '@element-plus/icons-vue'
interface LinkItem {
value: string
link: string
}
const state = ref('')
const links = ref<LinkItem[]>([])
const querySearch = (queryString: string, cb: any) => {
const results = queryString
? links.value.filter(createFilter(queryString))
: links.value
// call callback function to return suggestion objects
cb(results)
}
const createFilter = (queryString: any) => {
return (restaurant: any) => {
return (
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
)
}
}
const loadAll = () => {
return [
{value: 'vue', link: 'https://github.com/vuejs/vue'},
{value: 'element', link: 'https://github.com/ElemeFE/element'},
{value: 'cooking', link: 'https://github.com/ElemeFE/cooking'},
{value: 'mint-ui', link: 'https://github.com/ElemeFE/mint-ui'},
{value: 'vuex', link: 'https://github.com/vuejs/vuex'},
{value: 'vue-router', link: 'https://github.com/vuejs/vue-router'},
{value: 'babel', link: 'https://github.com/babel/babel'},
]
}
const handleSelect = (item: LinkItem) => {
console.log(item)
}
const handleIconClick = (ev: Event) => {
console.log(ev)
}
const handleBtnSearch = () => {
console.log("handleBtnSearch")
}
onMounted(() => {
links.value = loadAll()
})
</script>

<script lang="ts">
Expand All @@ -82,26 +14,7 @@ export default {
</script>

<style scoped>
.my-autocomplete li {
line-height: normal;
padding: 7px;
}
.my-autocomplete li .name {
text-overflow: ellipsis;
overflow: hidden;
}
.my-autocomplete li .addr {
font-size: 12px;
color: #b4b4b4;
}
.my-autocomplete li .highlighted .addr {
color: #ddd;
}
.s-btn{
margin-left: 20px;
h1{
color: var(--el-table-text-color);
}
</style>
Loading

1 comment on commit 31a894b

@vercel
Copy link

@vercel vercel bot commented on 31a894b Sep 22, 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.