Skip to content

Commit

Permalink
fix: Metaweblog平台增加友好提示
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Jan 11, 2023
1 parent 6b1c95d commit 9699356
Show file tree
Hide file tree
Showing 20 changed files with 352 additions and 29 deletions.
62 changes: 59 additions & 3 deletions components/publish/tab/PlatformSetting.vue
@@ -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
Expand Down Expand Up @@ -162,6 +162,9 @@ import YuqueSetting from "~/components/publish/tab/setting/common/YuqueSetting.v
import KmsSetting from "~/components/publish/tab/setting/common/KmsSetting.vue"
import GithubSetting from "~/components/publish/tab/setting/GithubSetting.vue"
import MetaweblogSetting from "~/components/publish/tab/setting/MetaweblogSetting.vue"
import { PRE_DEFINED_PLATFORM_KEY_CONSTANTS } from "~/utils/import/PRE_DEFINED_PLATFORM_CONSTANTS"
import { MetaweblogPlaceholder } from "~/utils/platform/metaweblog/metaweblogPlaceholder"
import { useI18n } from "vue-i18n"
const logger = LogFactory.getLogger(
"components/publish/tab/PlatformSetting.vue"
Expand Down Expand Up @@ -191,14 +194,67 @@ const formData = reactive({
wordpressArray: [],
})
const { t } = useI18n()
const createGCfg = ref((gcfg) => {
return new DynamicGCfg(gcfg)
})
const createMCfg = ref((mcfg) => {
return new DynamicMCfg(getDynPostidKey(mcfg.platformKey))
const dynMcfg = new DynamicMCfg(getDynPostidKey(mcfg.platformKey))
// 预定义平台处理
const dynTypechoPlaceholder = new MetaweblogPlaceholder()
const dynOschinaPlaceholder = new MetaweblogPlaceholder()
switch (mcfg.platformKey) {
case PRE_DEFINED_PLATFORM_KEY_CONSTANTS.PRE_DEFINED_TYPECHO_KEY:
dynTypechoPlaceholder.homePlaceholder = t("setting.typecho.home.tip")
dynTypechoPlaceholder.usernamePlaceholder = t(
"setting.typecho.username.tip"
)
dynTypechoPlaceholder.passwordPlaceholder = t(
"setting.typecho.password.tip"
)
dynTypechoPlaceholder.apiUrlPlaceholder = t("setting.typecho.apiUrl.tip")
dynTypechoPlaceholder.previewUrlPlaceholder = t(
"setting.typecho.previewUrl.tip"
)
dynMcfg.placeholder = dynTypechoPlaceholder
break
case PRE_DEFINED_PLATFORM_KEY_CONSTANTS.PRE_DEFINED_OSCHINA_KEY:
dynOschinaPlaceholder.homePlaceholder = t("setting.oschina.home.tip")
dynOschinaPlaceholder.usernamePlaceholder = t(
"setting.oschina.username.tip"
)
dynOschinaPlaceholder.passwordPlaceholder = t(
"setting.oschina.password.tip"
)
dynOschinaPlaceholder.apiUrlPlaceholder = t("setting.oschina.apiUrl.tip")
dynOschinaPlaceholder.previewUrlPlaceholder = t(
"setting.oschina.previewUrl.tip"
)
dynMcfg.placeholder = dynOschinaPlaceholder
break
default:
break
}
return dynMcfg
})
const createWCfg = ref((wcfg) => {
return new DynamicWCfg(getDynPostidKey(wcfg.platformKey))
const dynWcfg = new DynamicWCfg(getDynPostidKey(wcfg.platformKey))
// 预定义平台处理
switch (wcfg.platformKey) {
case PRE_DEFINED_PLATFORM_KEY_CONSTANTS.PRE_DEFINED_TYPECHO_KEY:
break
case PRE_DEFINED_PLATFORM_KEY_CONSTANTS.PRE_DEFINED_OSCHINA_KEY:
break
default:
break
}
return dynWcfg
})
const initDynCfg = (dynCfg: any[]) => {
const newCfg = []
Expand Down
5 changes: 2 additions & 3 deletions components/publish/tab/ServiceSwitch.vue
@@ -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
Expand Down Expand Up @@ -47,7 +47,7 @@
<el-switch v-model="jvueEnabled" @change="jvueOnChange" />
</el-form-item>

<el-form-item :label="$t('service.switch.conf')">
<el-form-item :label="$t('service.switch.conf')" v-if="false">
<el-switch v-model="confEnabled" @change="confOnChange" />
</el-form-item>

Expand Down Expand Up @@ -109,7 +109,6 @@ import {
getDynSwitchInactive,
getSwitchItem,
} from "~/utils/platform/dynamicConfig"
import { LogFactory } from "~/utils/logUtil"
// use
const {
Expand Down
29 changes: 23 additions & 6 deletions components/publish/tab/setting/MetaweblogSetting.vue
@@ -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
Expand Down Expand Up @@ -32,23 +32,40 @@
:closable="false"
/>
<el-form-item :label="$t('setting.blog.url')">
<el-input v-model="home" />
<el-input
v-model="home"
:placeholder="props.cfg.placeholder.homePlaceholder"
/>
</el-form-item>

<el-form-item :label="$t('setting.blog.username')">
<el-input v-model="username" />
<el-input
v-model="username"
:placeholder="props.cfg.placeholder.usernamePlaceholder"
/>
</el-form-item>

<el-form-item :label="$t('setting.blog.password')">
<el-input type="password" v-model="password" show-password />
<el-input
type="password"
v-model="password"
show-password
:placeholder="props.cfg.placeholder.passwordPlaceholder"
/>
</el-form-item>

<el-form-item :label="$t('setting.blog.apiurl')">
<el-input v-model="apiUrl" />
<el-input
v-model="apiUrl"
:placeholder="props.cfg.placeholder.apiUrlPlaceholder"
/>
</el-form-item>

<el-form-item :label="$t('setting.blog.previewUrl')">
<el-input v-model="previewUrl" />
<el-input
v-model="previewUrl"
:placeholder="props.cfg.placeholder.previewUrlPlaceholder"
/>
</el-form-item>

<el-form-item :label="$t('setting.blog.pageType')">
Expand Down
13 changes: 12 additions & 1 deletion components/publish/tab/setting/metaweblog/CnblogsSetting.vue
@@ -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
Expand Down Expand Up @@ -32,8 +32,19 @@ import { API_TYPE_CONSTANTS } from "~/utils/constants/apiTypeConstants"
import { ref } from "vue"
import { CnblogsCfg } from "~/utils/platform/metaweblog/cnblogs/cnblogsCfg"
import MetaweblogSetting from "~/components/publish/tab/setting/MetaweblogSetting.vue"
import { MetaweblogPlaceholder } from "~/utils/platform/metaweblog/metaweblogPlaceholder"
import { useI18n } from "vue-i18n"
const apiType = ref(API_TYPE_CONSTANTS.API_TYPE_CNBLOGS)
const { t } = useI18n()
const cnblogsCfg = new CnblogsCfg()
const cnblogsPlaceholder = new MetaweblogPlaceholder()
cnblogsPlaceholder.homePlaceholder = t("setting.cnblogs.home.tip")
cnblogsPlaceholder.usernamePlaceholder = t("setting.cnblogs.username.tip")
cnblogsPlaceholder.passwordPlaceholder = t("setting.cnblogs.password.tip")
cnblogsPlaceholder.apiUrlPlaceholder = t("setting.cnblogs.apiUrl.tip")
cnblogsPlaceholder.previewUrlPlaceholder = t("setting.cnblogs.previewUrl.tip")
cnblogsCfg.placeholder = cnblogsPlaceholder
const cfg = ref(cnblogsCfg)
</script>
16 changes: 14 additions & 2 deletions components/publish/tab/setting/metaweblog/ConfluenceSetting.vue
@@ -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
Expand Down Expand Up @@ -32,7 +32,19 @@ import { API_TYPE_CONSTANTS } from "~/utils/constants/apiTypeConstants"
import { ref } from "vue"
import MetaweblogSetting from "../MetaweblogSetting.vue"
import { ConfCfg } from "~/utils/platform/metaweblog/conf/confCfg"
import { useI18n } from "vue-i18n"
import { MetaweblogPlaceholder } from "~/utils/platform/metaweblog/metaweblogPlaceholder"
const apiType = ref(API_TYPE_CONSTANTS.API_TYPE_CONFLUENCE)
const cfg = ref(new ConfCfg())
const { t } = useI18n()
const confCfg = new ConfCfg()
const confPlaceholder = new MetaweblogPlaceholder()
confPlaceholder.homePlaceholder = t("setting.conf.home.tip")
confPlaceholder.usernamePlaceholder = t("setting.conf.username.tip")
confPlaceholder.passwordPlaceholder = t("setting.conf.password.tip")
confPlaceholder.apiUrlPlaceholder = t("setting.conf.apiUrl.tip")
confPlaceholder.previewUrlPlaceholder = t("setting.conf.previewUrl.tip")
confCfg.placeholder = confPlaceholder
const cfg = ref(confCfg)
</script>
16 changes: 14 additions & 2 deletions components/publish/tab/setting/metaweblog/JVueSetting.vue
@@ -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
Expand Down Expand Up @@ -33,7 +33,19 @@ import { ref } from "vue"
import { JVueCfg } from "~/utils/platform/metaweblog/jvue/jvueCfg"
import MetaweblogSetting from "../MetaweblogSetting.vue"
import { MetaweblogPlaceholder } from "~/utils/platform/metaweblog/metaweblogPlaceholder"
import { useI18n } from "vue-i18n"
const apiType = ref(API_TYPE_CONSTANTS.API_TYPE_JVUE)
const cfg = ref(new JVueCfg())
const { t } = useI18n()
const jvueCfg = new JVueCfg()
const jvuePlaceholder = new MetaweblogPlaceholder()
jvuePlaceholder.homePlaceholder = t("setting.jvue.home.tip")
jvuePlaceholder.usernamePlaceholder = t("setting.jvue.username.tip")
jvuePlaceholder.passwordPlaceholder = t("setting.jvue.password.tip")
jvuePlaceholder.apiUrlPlaceholder = t("setting.jvue.apiUrl.tip")
jvuePlaceholder.previewUrlPlaceholder = t("setting.jvue.previewUrl.tip")
jvueCfg.placeholder = jvuePlaceholder
const cfg = ref(jvueCfg)
</script>
16 changes: 14 additions & 2 deletions components/publish/tab/setting/metaweblog/WordpressSetting.vue
@@ -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
Expand Down Expand Up @@ -33,6 +33,8 @@ import { ref } from "vue"
import { WordpressCfg } from "~/utils/platform/wordpress/wordpressCfg"
import MetaweblogSetting from "../MetaweblogSetting.vue"
import { MetaweblogPlaceholder } from "~/utils/platform/metaweblog/metaweblogPlaceholder"
import { useI18n } from "vue-i18n"
// const props = defineProps({
// isReload: {
Expand All @@ -50,5 +52,15 @@ import MetaweblogSetting from "../MetaweblogSetting.vue"
// })
const apiType = ref(API_TYPE_CONSTANTS.API_TYPE_WORDPRESS)
const cfg = ref(new WordpressCfg())
const { t } = useI18n()
const wpCfg = new WordpressCfg()
const wpPlaceholder = new MetaweblogPlaceholder()
wpPlaceholder.homePlaceholder = t("setting.wordpress.home.tip")
wpPlaceholder.usernamePlaceholder = t("setting.wordpress.username.tip")
wpPlaceholder.passwordPlaceholder = t("setting.wordpress.password.tip")
wpPlaceholder.apiUrlPlaceholder = t("setting.wordpress.apiUrl.tip")
wpPlaceholder.previewUrlPlaceholder = t("setting.wordpress.previewUrl.tip")
wpCfg.placeholder = wpPlaceholder
const cfg = ref(wpCfg)
</script>
56 changes: 56 additions & 0 deletions locales/en_US.ts
Expand Up @@ -371,4 +371,60 @@ export default {
"The API address of the KMS platform, for example: http:// localhost: 9564/kms16_release/API/KMS-Multidoc/KMSMultidOWRESTSERVICE",
"siyuan.local.share.tip":
"Reminder: If you find that the sharing link or the browser can be displayed or the network connection is rejected, please check according to the following operation. 1: Siyuan Note-> Settings-> About-> Open the network servo; 2: After the browser is opened, click the bottom Siyuan address at the bottom to modify the corresponding address to the local area network IP address.",
"setting.cnblogs.home.tip":
"The homepage of your blog park is usually: https://www.cnblogs.com/ <your username>",
"setting.cnblogs.username.tip":
"Your blog garden MetaWeblog login name, you can go to your blog garden background-> Settings, note: login name, not a user nickname (*^▽^*)",
"setting.cnblogs.password.tip":
"Your blog garden Metaweblog access token, you can go to your blog garden backstage-> Settings",
"setting.cnblogs.apiUrl.tip":
"Your blog garden Metaweblog access address, you can go to your blog park background-> settings, usually: https://rpc.cnblogs.com/metaweblog/ <Your username>",
"setting.cnblogs.previewUrl.tip":
"Preview rules for your blog garden article",

"setting.wordpress.home.tip": "Wordpress homepage",
"setting.wordpress.username.tip":
"WordPress login name, note: it is login name, not a user nickname (*^▽^*)",
"setting.wordpress.password.tip": "Wordpress login password",
"setting.wordpress.apiUrl.tip":
"WordPress's XMLRPC remote release address, usually: https:// <WordPress blog address> /xmlrpc.php",
"setting.wordpress.previewUrl.tip":
"The preview rules of the WordPress platform are usually :? P = [Postid]",

"setting.oschina.home.tip":
"Homepage of open source China, usually: https://my.oschina.net/ <Your username>",
"setting.oschina.username.tip":
"Open source China login name, you can enter the login mailbox",
"setting.oschina.password.tip": "Open source China login password",
"setting.oschina.apiUrl.tip":
"Open source China XMLRPC remote publishing address, usually fixed: https://www.oschina.net/ACTION/xmlrpc",
"setting.oschina.previewUrl.tip":
"The preview rules of the open source China platform are usually:/blog/[postid]",

"setting.typecho.home.tip": "Homepage of the Typecho platform",
"setting.typecho.username.tip": "Typecho platform login name",
"setting.typecho.password.tip": "Typecho platform password",
"setting.typecho.apiUrl.tip":
"The XMLRPC remote publishing address of the Typecho platform is usually fixed: https: // <platform address> /index.php/xmlrpc",
"setting.typecho.previewUrl.tip":
"The preview rules of the Typecho platform are usually: /index.php/archives/ [Postid]",

"setting.jvue.home.tip": "Homepage of the Jvue platform",
"setting.jvue.username.tip": "Jvue platform login name",
"setting.jvue.password.tip": "Jvue platform password",
"setting.jvue.apiUrl.tip":
"The XMLRPC remote release address of the JVUE platform is usually fixed: https: // <platform address>/xmlrpc",
"setting.jvue.previewUrl.tip":
"The preview rules of the Jvue platform are usually:/post/[postid] .html",

"setting.conf.home.tip":
"Confluence Cloud, homepage, usually: https: // <your user name> .atlassian.net/wiki/spaces/<Space name>",
"setting.conf.username.tip":
"CONFLUENCE login name, you can go to your Atlassian account to get",
"setting.conf.password.tip":
"Confluence access token, you can go to your Atlassian account to get",
"setting.conf.apiUrl.tip":
"You can go to https://developper.atlassian.com/Cloud/confluence/rest/v1/1/1/",
"setting.conf.previewUrl.tip":
"CONFLUENCE platform articles preview rules, usually:/pages/[postid]",
}
54 changes: 54 additions & 0 deletions locales/zh_CN.ts
Expand Up @@ -375,4 +375,58 @@ export default {
"KMS平台的API地址,例如:http://localhost:9564/kms16_release/api/kms-multidoc/kmsMultidocKnowledgeRestService",
"siyuan.local.share.tip":
"温馨提示:如果发现分享链接或者浏览器打开无法显示或者网络连接被拒绝,请按照下面操作排查。1:思源笔记->设置->关于->打开网络伺服;2:在浏览器打开之后,点击底部思源地址,修改对应地址为局域网ip地址。",
"setting.cnblogs.home.tip":
"您的博客园首页,通常是:https://www.cnblogs.com/<您的用户名>",
"setting.cnblogs.username.tip":
"您的博客园MetaWeblog登录名,可前往您的博客园后台->设置查看,注意:是登录名,不是用户昵称哦(*^▽^*)",
"setting.cnblogs.password.tip":
"您的博客园MetaWeblog访问令牌,可前往您的博客园后台->设置查看",
"setting.cnblogs.apiUrl.tip":
"您的博客园MetaWeblog访问地址,可前往您的博客园后台->设置查看,通常是:https://rpc.cnblogs.com/metaweblog/<您的用户名>",
"setting.cnblogs.previewUrl.tip":
"博客园平台的文章预览规则,通常是:/p/[postid].html",

"setting.wordpress.home.tip": "WordPress首页",
"setting.wordpress.username.tip":
"WordPress登录名,注意:是登录名,不是用户昵称哦(*^▽^*)",
"setting.wordpress.password.tip": "WordPress登录密码",
"setting.wordpress.apiUrl.tip":
"WordPress的xmlrpc远程发布地址,通常是:https://<WordPress博客地址>/xmlrpc.php",
"setting.wordpress.previewUrl.tip":
"WordPress平台的文章预览规则,通常是:?p=[postid]",

"setting.oschina.home.tip":
"开源中国首页,通常是:https://my.oschina.net/<您的用户名>",
"setting.oschina.username.tip": "开源中国登录名,可以输入登录邮箱",
"setting.oschina.password.tip": "开源中国登录密码",
"setting.oschina.apiUrl.tip":
"开源中国的xmlrpc远程发布地址,通常固定是:https://www.oschina.net/action/xmlrpc",
"setting.oschina.previewUrl.tip":
"开源中国平台的文章预览规则,通常是:/blog/[postid]",

"setting.typecho.home.tip": "Typecho平台的首页",
"setting.typecho.username.tip": "Typecho平台登录名",
"setting.typecho.password.tip": "Typecho平台密码",
"setting.typecho.apiUrl.tip":
"Typecho平台的xmlrpc远程发布地址,通常固定是:https://<平台地址>/index.php/action/xmlrpc",
"setting.typecho.previewUrl.tip":
"Typecho平台的文章预览规则,通常是:/index.php/archives/[postid]",

"setting.jvue.home.tip": "JVue平台的首页",
"setting.jvue.username.tip": "JVue平台登录名",
"setting.jvue.password.tip": "JVue平台密码",
"setting.jvue.apiUrl.tip":
"JVue平台的xmlrpc远程发布地址,通常固定是:https://<平台地址>/xmlrpc",
"setting.jvue.previewUrl.tip":
"JVue平台的文章预览规则,通常是:/post/[postid].html",

"setting.conf.home.tip":
"Confluence Cloud,首页,通常是:https://<您的用户名>.atlassian.net/wiki/spaces/<空间名>",
"setting.conf.username.tip": "Confluence登录名,可前往您的atlassian账户获取",
"setting.conf.password.tip":
"Confluence访问令牌,可前往您的atlassian账户获取",
"setting.conf.apiUrl.tip":
"可前往 https://developer.atlassian.com/cloud/confluence/rest/v1/#api-wiki-rest-api-content-get 查看文档",
"setting.conf.previewUrl.tip":
"Confluence平台文章预览规则,通常是:/pages/[postid]",
}

0 comments on commit 9699356

Please sign in to comment.