Skip to content

Commit

Permalink
feat: 适配 Flowus 息流
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Oct 31, 2023
1 parent 76136e5 commit acd5502
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/adaptors/web/flowus/flowusConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FlowusConfig extends CommonWebConfig {
this.previewUrl = "/p/[postid]"
this.pageType = PageTypeEnum.Markdown
this.passwordType = PasswordType.PasswordType_Cookie
this.usernameEnabled = true
this.usernameEnabled = false
this.tagEnabled = false
this.cateEnabled = false
this.knowledgeSpaceEnabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const subtype = getSubPlatformTypeByKey(apiType)
<wechat-setting v-else-if="subtype === SubPlatformType.Custom_Wechat" :api-type="apiType" />
<jianshu-setting v-else-if="subtype === SubPlatformType.Custom_Jianshu" :api-type="apiType" />
<juejin-setting v-else-if="subtype === SubPlatformType.Custom_Juejin" :api-type="apiType" />
<flowus-setting v-else-if="subtype === SubPlatformType.Custom_Flowus" :api-type="apiType" />
<span v-else>
<el-alert :closable="false" :title="t('setting.entry.not.supported')" class="top-tip" type="error" />
</span>
Expand Down
54 changes: 54 additions & 0 deletions src/components/set/publish/singleplatform/web/FlowusSetting.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!--
- Copyright (c) 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
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation. Terwer designates this
- particular file as subject to the "Classpath" exception as provided
- by Terwer in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
- or visit www.terwer.space if you need additional information or have any
- questions.
-->

<script setup lang="ts">
import CustomWebSetting from "~/src/components/set/publish/singleplatform/base/impl/CustomWebSetting.vue"
import { useVueI18n } from "~/src/composables/useVueI18n.ts"
import { useFlowusWeb } from "~/src/adaptors/web/flowus/useFlowusWeb.ts"
import { FlowusConfig } from "~/src/adaptors/web/flowus/flowusConfig.ts"
import { FlowusPlaceholder } from "~/src/adaptors/web/flowus/flowusPlaceholder.ts"
const props = defineProps({
apiType: {
type: String,
default: "",
},
})
const { t } = useVueI18n()
const { cfg } = await useFlowusWeb(props.apiType)
const flowusCfg = cfg as FlowusConfig
const flowusPlaceholder = new FlowusPlaceholder()
flowusPlaceholder.homePlaceholder = t("setting.flowus.home.tip")
flowusPlaceholder.apiUrlPlaceholder = t("setting.flowus.apiUrl.tip")
flowusPlaceholder.passwordPlaceholder = t("setting.flowus.password.tip")
flowusPlaceholder.previewUrlPlaceholder = t("setting.flowus.previewUrl.tip")
flowusCfg.placeholder = flowusPlaceholder
</script>

<template>
<custom-web-setting :api-type="props.apiType" :cfg="flowusCfg" />
</template>
5 changes: 5 additions & 0 deletions src/locales/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ export default {
"setting.halo.apiUrl.tip": "Halo blog API address, typically the same as the Halo homepage",
"setting.halo.previewUrl.tip": "Halo blog article preview rule, default /archives/{slug}, with placeholders {slug} {name} {year} {month} {day}, can be set in [halo-home-url]/console/settings?tab=routeRules",

"setting.flowus.home.tip": "Flowus homepage address, usually fixed",
"setting.flowus.password.tip": "Flowus cookie, do not modify",
"setting.flowus.apiUrl.tip": "Usually fixed, do not modify",
"setting.flowus.previewUrl.tip": "Flowus platform article preview rules",

"setting.picgo.refer.to": "For details, please refer to:",
"setting.picgo.refer.to.online.doc": "Picgo configuration online documentation",
"setting.picgo.picbed": "Picbed setting",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ export default {
"setting.halo.previewUrl.tip":
"Halo博客文章预览规则,默认 /archives/{slug},占位符有 {slug} {name} {year} {month} {day},可在 [halo-home-url]/console/settings?tab=routeRules设置",

"setting.flowus.home.tip": "Flowus首页地址,通常固定",
"setting.flowus.password.tip": "Flowus的Cookie,请勿修改",
"setting.flowus.apiUrl.tip": "通常固定,请勿修改",
"setting.flowus.previewUrl.tip": "Flowus平台文章预览规则",

"setting.picgo.refer.to": "详情请参考:",
"setting.picgo.refer.to.online.doc": "PicGO配置在线文档",
"setting.picgo.picbed": "图床设置",
Expand Down

0 comments on commit acd5502

Please sign in to comment.