From b1691e0d4fb7aa7ba77ae3729da7dadf68b8220a Mon Sep 17 00:00:00 2001 From: "xiaoqi.cxq" Date: Thu, 23 Feb 2023 15:33:55 +0800 Subject: [PATCH] =?UTF-8?q?Gitlab=E6=94=AF=E6=8C=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++ chart/values.yaml | 2 + config/dev.env.js | 2 + package.json | 2 +- server/conf.js | 4 ++ .../modals/providers/GiteaAccountModal.vue | 4 ++ .../modals/providers/GitlabAccountModal.vue | 62 ++++++++++++++----- .../providers/gitlabWorkspaceProvider.js | 27 +++++++- .../providers/helpers/gitlabHelper.js | 26 ++++++-- src/services/utils.js | 2 +- 10 files changed, 109 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index a29f974f..2d6b9689 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ StackEdit中文版 - 支持图片直接存储到当前文档空间(2022-10-29) - 支持MD文档之间链接跳转(2022-11-20) - 支持预览区域选择主题样式(2022-12-04) +- Gitlab的支持优化(2023-02-23) ## 国外开源版本弊端: - 作者已经不维护了 @@ -151,6 +152,9 @@ docker run -itd --name stackedit \ - Gitea可选择性配置环境变量(未配置则在关联时前端指定,有配置则仅允许配置的应用信息):GITEA_CLIENT_ID、GITEA_CLIENT_SECRET、GITEA_URL,**[如何创建Gitea应用](./docs/部署之Gitea应用创建.md)** +- Gitlab可选择性配置环境变量(未配置则在关联时前端指定,有配置则仅允许配置的应用信息):GITLAB_CLIENT_ID、GITEA_URL **如何创建Gitlab应用(待补充文档)** + +(特别说明:自建的Gitea、Gitlab要能接入stackedit必须支持跨域) ## 编译与运行 > 编译运行的nodejs版本选择11.15.0版本 diff --git a/chart/values.yaml b/chart/values.yaml index ce054d9f..414aaa21 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -18,6 +18,8 @@ awsSecretAccessKey: "" giteaClientId: "" giteaClientSecret: "" giteaUrl: "" +gitlabClientId: "" +gitlabUrl: "" replicaCount: 1 diff --git a/config/dev.env.js b/config/dev.env.js index 363113d9..9df17460 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -12,4 +12,6 @@ module.exports = merge(prodEnv, { // GITEA_CLIENT_ID: '"fe30f8f9-b1e8-4531-8f72-c1a5d3912805"', // GITEA_CLIENT_SECRET: '"lus7oMnb3H6M1hsChndphArE20Txr7erwJLf7SDBQWTw"', // GITEA_URL: '"https://gitea.test.com"', + // GITLAB_CLIENT_ID: '"33e01128c27fe75df3e5b35218d710c7df280e6ee9c90b6ca27ac9d9fdfb92f7"', + // GITLAB_URL: '"http://gitlab.qicoder.com"', }) \ No newline at end of file diff --git a/package.json b/package.json index 8eed8149..c2a2b4cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stackedit", - "version": "5.15.17", + "version": "5.15.18", "description": "免费, 开源, 功能齐全的 Markdown 编辑器", "author": "Benoit Schweblin, 豆萁", "license": "Apache-2.0", diff --git a/server/conf.js b/server/conf.js index 2c02071a..e0492325 100644 --- a/server/conf.js +++ b/server/conf.js @@ -14,6 +14,8 @@ const wordpressClientId = process.env.WORDPRESS_CLIENT_ID; const giteaClientId = process.env.GITEA_CLIENT_ID; const giteaClientSecret = process.env.GITEA_CLIENT_SECRET; const giteaUrl = process.env.GITEA_URL; +const gitlabClientId = process.env.GITLAB_CLIENT_ID; +const gitlabUrl = process.env.GITLAB_URL; exports.values = { pandocPath, @@ -43,4 +45,6 @@ exports.publicValues = { allowSponsorship: !!paypalReceiverEmail, giteaClientId, giteaUrl, + gitlabClientId, + gitlabUrl, }; diff --git a/src/components/modals/providers/GiteaAccountModal.vue b/src/components/modals/providers/GiteaAccountModal.vue index f22d7b38..1d4e04e7 100644 --- a/src/components/modals/providers/GiteaAccountModal.vue +++ b/src/components/modals/providers/GiteaAccountModal.vue @@ -41,6 +41,7 @@ import modalTemplate from '../common/modalTemplate'; import constants from '../../../data/constants'; import store from '../../../store'; +import networkSvc from '../../../services/networkSvc'; export default modalTemplate({ data: () => ({ @@ -65,6 +66,9 @@ export default modalTemplate({ return !!confClientId && !!confServerUrl; }, }, + mounted() { + networkSvc.getServerConf(); + }, methods: { resolve() { if (this.useServerConf) { diff --git a/src/components/modals/providers/GitlabAccountModal.vue b/src/components/modals/providers/GitlabAccountModal.vue index 29a3839f..abe48dd2 100644 --- a/src/components/modals/providers/GitlabAccountModal.vue +++ b/src/components/modals/providers/GitlabAccountModal.vue @@ -5,22 +5,27 @@

将您的GitLab链接到StackEdit中文版

- - - - - - - - -
- 更多信息 -
-
+