From 3d1d03fa87c8ab788760fa74bae01f9dd917f019 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Thu, 4 Oct 2018 20:43:39 +0200 Subject: [PATCH 1/5] Make oauth2 provider name accessible Right now the feature exists but is almost not usable since the only way to configure it is to know that it exists from reading the source code and add it to config.json. This patch provides all needed changes so it can be used by everyone including documentation. Signed-off-by: Sheogorath --- README.md | 1 + lib/config/default.js | 1 + lib/config/environment.js | 1 + 3 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 25388ec..b2be7dd 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ There are some config settings you need to change in the files below. | `CMD_OAUTH2_AUTHORIZATION_URL` | `https://example.com` | authorization URL of your provider, please refer to the documentation of your OAuth2 provider (no default value) | | `CMD_OAUTH2_CLIENT_ID` | `afae02fckafd...` | you will get this from your OAuth2 provider when you register CodiMD as OAuth2-client, (no default value) | | `CMD_OAUTH2_CLIENT_SECRET` | `afae02fckafd...` | you will get this from your OAuth2 provider when you register CodiMD as OAuth2-client, (no default value) | +| `CMD_OAUTH2_PROVIDERNAME` | `My institution` | Optional name to be displayed at login form indicating the oAuth2 provider | | `CMD_IMGUR_CLIENTID` | no example | Imgur API client id | | `CMD_EMAIL` | `true` or `false` | set to allow email signin | | `CMD_ALLOW_PDF_EXPORT` | `true` or `false` | Enable or disable PDF exports | diff --git a/lib/config/default.js b/lib/config/default.js index c34279b..d4d26db 100644 --- a/lib/config/default.js +++ b/lib/config/default.js @@ -83,6 +83,7 @@ module.exports = { }, // authentication oauth2: { + providerName: undefined, authorizationURL: undefined, tokenURL: undefined, clientID: undefined, diff --git a/lib/config/environment.js b/lib/config/environment.js index 6c4ce92..c345abd 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -75,6 +75,7 @@ module.exports = { clientSecret: process.env.CMD_MATTERMOST_CLIENTSECRET }, oauth2: { + providerName: process.env.CMD_OAUTH2_PROVIDERNAME, baseURL: process.env.CMD_OAUTH2_BASEURL, userProfileURL: process.env.CMD_OAUTH2_USER_PROFILE_URL, userProfileUsernameAttr: process.env.CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR, From 5212bbf9c4bb14d0ee5f009512df0bb6f7a475d0 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Fri, 5 Oct 2018 21:51:54 +0200 Subject: [PATCH 2/5] Replace font-awesome with fork-awesome This patch replaces font-awesome with its fork called fork-awesome. Besides the fact that the newer versions of font-awesome can't be shipped with distros like debian due to license issues, fork-awesome also provides more FOSS related icons and builds on top of version 4.7.x of font-awesome, which we used until this patch. Signed-off-by: Sheogorath --- package.json | 2 +- public/views/codimd/head.ejs | 2 +- public/views/html.hbs | 2 +- public/views/index/head.ejs | 2 +- public/views/pretty.ejs | 2 +- public/views/slide.ejs | 2 +- webpackBaseConfig.js | 8 ++++---- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 1217263..0d11df6 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "express-session": "^1.14.2", "file-saver": "^1.3.3", "flowchart.js": "^1.6.4", - "font-awesome": "^4.7.0", + "fork-awesome": "^1.1.3", "formidable": "^1.0.17", "gist-embed": "~2.6.0", "graceful-fs": "^4.1.11", diff --git a/public/views/codimd/head.ejs b/public/views/codimd/head.ejs index 1f44625..b76eb70 100644 --- a/public/views/codimd/head.ejs +++ b/public/views/codimd/head.ejs @@ -9,7 +9,7 @@ <% if(useCDN) { %> - + diff --git a/public/views/html.hbs b/public/views/html.hbs index a87bf81..cc08b6f 100644 --- a/public/views/html.hbs +++ b/public/views/html.hbs @@ -16,7 +16,7 @@ - + diff --git a/public/views/index/head.ejs b/public/views/index/head.ejs index f826d9e..fc10dfa 100644 --- a/public/views/index/head.ejs +++ b/public/views/index/head.ejs @@ -11,7 +11,7 @@ <% if(useCDN) { %> - + diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs index 4c2fc0a..a20f229 100644 --- a/public/views/pretty.ejs +++ b/public/views/pretty.ejs @@ -19,7 +19,7 @@ <% if(useCDN) { %> - + diff --git a/public/views/slide.ejs b/public/views/slide.ejs index c11d298..2b069f2 100644 --- a/public/views/slide.ejs +++ b/public/views/slide.ejs @@ -16,7 +16,7 @@ <% if(useCDN) { %> - + diff --git a/webpackBaseConfig.js b/webpackBaseConfig.js index 19d021d..8df19b7 100644 --- a/webpackBaseConfig.js +++ b/webpackBaseConfig.js @@ -184,7 +184,7 @@ module.exports = { ], 'cover-styles-pack': [ path.join(__dirname, 'node_modules/bootstrap/dist/css/bootstrap.min.css'), - path.join(__dirname, 'node_modules/font-awesome/css/font-awesome.min.css'), + path.join(__dirname, 'node_modules/fork-awesome/css/fork-awesome.min.css'), path.join(__dirname, 'public/css/bootstrap-social.css'), path.join(__dirname, 'node_modules/select2/select2.css'), path.join(__dirname, 'node_modules/select2/select2-bootstrap.css') @@ -236,7 +236,7 @@ module.exports = { ], 'index-styles-pack': [ path.join(__dirname, 'node_modules/bootstrap/dist/css/bootstrap.min.css'), - path.join(__dirname, 'node_modules/font-awesome/css/font-awesome.min.css'), + path.join(__dirname, 'node_modules/fork-awesome/css/fork-awesome.min.css'), path.join(__dirname, 'public/css/bootstrap-social.css'), path.join(__dirname, 'node_modules/ionicons/css/ionicons.min.css'), path.join(__dirname, 'node_modules/octicons/build/octicons.css') @@ -287,7 +287,7 @@ module.exports = { ], 'pretty-styles-pack': [ path.join(__dirname, 'node_modules/bootstrap/dist/css/bootstrap.min.css'), - path.join(__dirname, 'node_modules/font-awesome/css/font-awesome.min.css'), + path.join(__dirname, 'node_modules/fork-awesome/css/fork-awesome.min.css'), path.join(__dirname, 'node_modules/ionicons/css/ionicons.min.css'), path.join(__dirname, 'node_modules/octicons/build/octicons.css') ], @@ -324,7 +324,7 @@ module.exports = { path.join(__dirname, 'public/css/markdown.css') ], 'slide-styles-pack': [ - path.join(__dirname, 'node_modules/font-awesome/css/font-awesome.min.css'), + path.join(__dirname, 'node_modules/fork-awesome/css/fork-awesome.min.css'), path.join(__dirname, 'node_modules/ionicons/css/ionicons.min.css'), path.join(__dirname, 'node_modules/octicons/build/octicons.css') ], From 702f52f07c026adf07fc18d7a563763cde52f814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Couralet?= Date: Tue, 9 Oct 2018 06:46:25 +0000 Subject: [PATCH 3/5] Fix #986 : Visibility is now transmitted with gitlab V4 api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédric Couralet --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index 1330dea..3dd25fa 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1479,7 +1479,7 @@ $('#snippetExportModalConfirm').click(function () { file_name: $('#snippetExportModalFileName').val(), code: editor.getValue(), visibility_level: $('#snippetExportModalVisibility').val(), - visibility: $('#snippetExportModalVisibility').val() === 0 ? 'private' : ($('#snippetExportModalVisibility').val() === 10 ? 'internal' : '') + visibility: $('#snippetExportModalVisibility').val() === '0' ? 'private' : ($('#snippetExportModalVisibility').val() === '10' ? 'internal' : 'private') } if (!data.title || !data.file_name || !data.code || !data.visibility_level || !$('#snippetExportModalProjects').val()) return From d7987def7f8f83b6ded8af32cff8416bfa9552bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Couralet?= Date: Tue, 9 Oct 2018 07:04:04 +0000 Subject: [PATCH 4/5] Fix #1001: get only project user is member of (and return max of results) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédric Couralet --- lib/response.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/response.js b/lib/response.js index 9f1740c..4f572e4 100644 --- a/lib/response.js +++ b/lib/response.js @@ -591,7 +591,7 @@ function gitlabActionProjects (req, res, note) { ret.accesstoken = user.accessToken ret.profileid = user.profileid request( - config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?access_token=' + user.accessToken, + config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?membership=yes&per_page=100&access_token=' + user.accessToken, function (error, httpResponse, body) { if (!error && httpResponse.statusCode === 200) { ret.projects = JSON.parse(body) From c7478c1694be2b3b880b8d52f9c15d60832a06f8 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Tue, 9 Oct 2018 23:08:36 +0200 Subject: [PATCH 5/5] Update yarn.lock Signed-off-by: Sheogorath --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5d92bbc..ef1be26 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4150,11 +4150,6 @@ flush-write-stream@^1.0.0: inherits "^2.0.1" readable-stream "^2.0.4" -font-awesome@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133" - integrity sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM= - for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -4179,6 +4174,11 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +fork-awesome@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/fork-awesome/-/fork-awesome-1.1.3.tgz#820403b860a8f8bb90c3e0d8509c81b42ae2dcf8" + integrity sha512-pjeV0OWPbl/EiZJ64nsxB0ATGyG+e0/mnOI/BFlwT+171P2/2eI96KaRHy8ySZTdXG/lCCdffs7dODGm0hDBXg== + form-data@1.0.0-rc3: version "1.0.0-rc3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-1.0.0-rc3.tgz#d35bc62e7fbc2937ae78f948aaa0d38d90607577"