File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ Environment variables (will overwrite other server configs)
128128| HMD_TWITTER_CONSUMERSECRET | no example | Twitter API consumer secret |
129129| HMD_GITHUB_CLIENTID | no example | GitHub API client id |
130130| HMD_GITHUB_CLIENTSECRET | no example | GitHub API client secret |
131+ | HMD_GITLAB_SCOPE | ` read_user ` or ` api ` | GitLab API requested scope (default is ` api ` ) (gitlab snippet import/export need ` api ` scope) |
131132| HMD_GITLAB_BASEURL | no example | GitLab authentication endpoint, set to use other endpoint than GitLab.com (optional) |
132133| HMD_GITLAB_CLIENTID | no example | GitLab API client id |
133134| HMD_GITLAB_CLIENTSECRET | no example | GitLab API client secret |
Original file line number Diff line number Diff line change @@ -335,8 +335,10 @@ if (config.github) {
335335 successReturnToOrRedirect : config . serverurl + '/' ,
336336 failureRedirect : config . serverurl + '/'
337337 } ) )
338- // github callback actions
339- app . get ( '/auth/github/callback/:noteId/:action' , response . githubActions )
338+ if ( ! config . gitlab . scope || config . gitlab . scope === 'api' ) {
339+ // gitlab callback actions
340+ app . get ( '/auth/gitlab/callback/:noteId/:action' , response . gitlabActions )
341+ }
340342}
341343// gitlab auth
342344if ( config . gitlab ) {
Original file line number Diff line number Diff line change 8989 "description" : " GitLab API client secret" ,
9090 "required" : false
9191 },
92+ "HMD_GITLAB_SCOPE" : {
93+ "description" : " GitLab API client scope (optional)" ,
94+ "required" : false
95+ },
9296 "HMD_DROPBOX_CLIENTID" : {
9397 "description" : " Dropbox API client id" ,
9498 "required" : false
Original file line number Diff line number Diff line change 3636 "gitlab" : {
3737 "baseURL" : " change this" ,
3838 "clientID" : " change this" ,
39- "clientSecret" : " change this"
39+ "clientSecret" : " change this" ,
40+ "scope" : " use 'read_user' scope for auth user only or remove this property if you need gitlab snippet import/export support (will result to be default scope 'api')"
4041 },
4142 "dropbox" : {
4243 "clientID" : " change this" ,
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ function registerAuthMethod () {
9191 baseURL : config . gitlab . baseURL ,
9292 clientID : config . gitlab . clientID ,
9393 clientSecret : config . gitlab . clientSecret ,
94+ scope : config . gitlab . scope ,
9495 callbackURL : config . serverurl + '/auth/gitlab/callback'
9596 } , callback ) )
9697 }
Original file line number Diff line number Diff line change @@ -102,8 +102,9 @@ var github = ((process.env.HMD_GITHUB_CLIENTID && process.env.HMD_GITHUB_CLIENTS
102102var gitlab = ( ( process . env . HMD_GITLAB_CLIENTID && process . env . HMD_GITLAB_CLIENTSECRET ) || ( fs . existsSync ( '/run/secrets/gitlab_clientID' ) && fs . existsSync ( '/run/secrets/gitlab_clientSecret' ) ) ) ? {
103103 baseURL : process . env . HMD_GITLAB_BASEURL ,
104104 clientID : handleDockerSecret ( 'gitlab_clientID' ) || process . env . HMD_GITLAB_CLIENTID ,
105- clientSecret : handleDockerSecret ( 'gitlab_clientSecret' ) || process . env . HMD_GITLAB_CLIENTSECRET
106- } : config . gitlab || false
105+ clientSecret : handleDockerSecret ( 'gitlab_clientSecret' ) || process . env . HMD_GITLAB_CLIENTSECRET ,
106+ scope : process . env . HMD_GITLAB_SCOPE
107+ } : ( config . gitlab && config . gitlab . clientID && config . gitlab . clientSecret && config . gitlab ) || false
107108var dropbox = ( ( process . env . HMD_DROPBOX_CLIENTID && process . env . HMD_DROPBOX_CLIENTSECRET ) || ( fs . existsSync ( '/run/secrets/dropbox_clientID' ) && fs . existsSync ( '/run/secrets/dropbox_clientSecret' ) ) ) ? {
108109 clientID : handleDockerSecret ( 'dropbox_clientID' ) || process . env . HMD_DROPBOX_CLIENTID ,
109110 clientSecret : handleDockerSecret ( 'dropbox_clientSecret' ) || process . env . HMD_DROPBOX_CLIENTSECRET
Original file line number Diff line number Diff line change 4242 < li role= " presentation" >< a role= " menuitem" class = " ui-save-gist" tabindex= " -1" href= " #" target= " _blank" >< i class = " fa fa-github fa-fw" >< / i> Gist< / a>
4343 < / li>
4444 < % } %>
45- <% if (typeof gitlab !== ' undefined' && gitlab) { % >
45+ <% if (typeof gitlab !== ' undefined' && gitlab && ( ! gitlab . scope || gitlab . scope === ' api ' ) ) { % >
4646 < li role= " presentation" >< a role= " menuitem" class = " ui-save-snippet" href= " #" >< i class = " fa fa-gitlab fa-fw" >< / i> Snippet< / a>
4747 < / li>
4848 < % } %>
5454 </li >
5555 <li role =" presentation" ><a role =" menuitem" class =" ui-import-gist" href =" #" data-toggle =" modal" data-target =" #gistImportModal" ><i class =" fa fa-github fa-fw" ></i > Gist</a >
5656 </li >
57- <% if (typeof gitlab !== ' undefined' && gitlab) { % >
57+ <% if (typeof gitlab !== ' undefined' && gitlab && ( ! gitlab . scope || gitlab . scope === ' api ' ) ) { % >
5858 < li role= " presentation" >< a role= " menuitem" class = " ui-import-snippet" href= " #" >< i class = " fa fa-gitlab fa-fw" >< / i> Snippet< / a>
5959 < / li>
6060 < % } %>
139139 < li role= " presentation" >< a role= " menuitem" class = " ui-save-gist" tabindex= " -1" href= " #" target= " _blank" >< i class = " fa fa-github fa-fw" >< / i> Gist< / a>
140140 < / li>
141141 < % } %>
142- <% if (typeof gitlab !== ' undefined' && gitlab) { % >
142+ <% if (typeof gitlab !== ' undefined' && gitlab && ( ! gitlab . scope || gitlab . scope === ' api ' ) ) { % >
143143 < li role= " presentation" >< a role= " menuitem" class = " ui-save-snippet" href= " #" >< i class = " fa fa-gitlab fa-fw" >< / i> Snippet< / a>
144144 < / li>
145145 < % } %>
151151 </li >
152152 <li role =" presentation" ><a role =" menuitem" class =" ui-import-gist" href =" #" data-toggle =" modal" data-target =" #gistImportModal" ><i class =" fa fa-github fa-fw" ></i > Gist</a >
153153 </li >
154- <% if (typeof gitlab !== ' undefined' && gitlab) { % >
154+ <% if (typeof gitlab !== ' undefined' && gitlab && ( ! gitlab . scope || gitlab . scope === ' api ' ) ) { % >
155155 < li role= " presentation" >< a role= " menuitem" class = " ui-import-snippet" href= " #" >< i class = " fa fa-gitlab fa-fw" >< / i> Snippet< / a>
156156 < / li>
157157 < % } %>
You can’t perform that action at this time.
0 commit comments