diff --git a/app.js b/app.js index 7795dd8..50b6122 100644 --- a/app.js +++ b/app.js @@ -198,6 +198,7 @@ app.locals.authProviders = { email: config.isEmailEnable, allowEmailRegister: config.allowEmailRegister } +app.locals.enableGitlabSnippets = (!config.gitlab.scope || config.gitlab.scope === 'api') app.use(require('./lib/web/baseRouter')) app.use(require('./lib/web/statusRouter')) diff --git a/public/views/codimd/header.ejs b/public/views/codimd/header.ejs index d8df33b..56a42eb 100644 --- a/public/views/codimd/header.ejs +++ b/public/views/codimd/header.ejs @@ -32,7 +32,7 @@
  • <%= __('Slide Mode') %>
  • - <% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || (typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api'))) { %> + <% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || enableGitlabSnippets) { %>
  • Dropbox @@ -41,7 +41,7 @@
  • Gist
  • <% } %> - <% if(typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api')) { %> + <% if(enableGitlabSnippets) { %>
  • Snippet
  • <% } %> @@ -52,7 +52,7 @@
  • Gist
  • - <% if(typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api')) { %> + <% if(enableGitlabSnippets) { %>
  • Snippet
  • <% } %> @@ -134,7 +134,7 @@
  • <%= __('Slide Mode') %>
  • - <% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || (typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api'))) { %> + <% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || enableGitlabSnippets ) { %>
  • Dropbox @@ -143,7 +143,7 @@
  • Gist
  • <% } %> - <% if(typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api')) { %> + <% if(enableGitlabSnippets) { %>
  • Snippet
  • <% } %> @@ -154,7 +154,7 @@
  • Gist
  • - <% if(typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api')) { %> + <% if(enableGitlabSnippets) { %>
  • Snippet
  • <% } %>