diff --git a/app.js b/app.js index 7795dd8..622d866 100644 --- a/app.js +++ b/app.js @@ -199,6 +199,11 @@ app.locals.authProviders = { allowEmailRegister: config.allowEmailRegister } +// Export/Import menu items +app.locals.enableDropBoxSave = config.isDropboxEnable +app.locals.enableGitHubGist = config.isGitHubEnable +app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable + app.use(require('./lib/web/baseRouter')) app.use(require('./lib/web/statusRouter')) app.use(require('./lib/web/auth')) diff --git a/lib/config/index.js b/lib/config/index.js index f8b68e3..501fdca 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -110,6 +110,8 @@ if (config.gitlab && config.gitlab.version !== 'v4' && config.gitlab.version !== logger.warn('config.js contains wrong version (' + config.gitlab.version + ') for gitlab api; it should be \'v3\' or \'v4\'. Defaulting to v4') config.gitlab.version = 'v4' } +// If gitlab scope is api, enable snippets Export/import +config.isGitlabSnippetsEnable = (!config.gitlab.scope || config.gitlab.scope === 'api') // Only update i18n files in development setups config.updateI18nFiles = (env === Environment.development) diff --git a/public/views/codimd/header.ejs b/public/views/codimd/header.ejs index d8df33b..b83838e 100644 --- a/public/views/codimd/header.ejs +++ b/public/views/codimd/header.ejs @@ -32,16 +32,16 @@
  • <%= __('Slide Mode') %>
  • - <% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || (typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api'))) { %> + <% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
  • Dropbox
  • - <% if(typeof github !== 'undefined' && github) { %> + <% if(enableGitHubGist) { %>
  • 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,16 +134,16 @@
  • <%= __('Slide Mode') %>
  • - <% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || (typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api'))) { %> + <% if(enableGitHubGist || enableDropBoxSave || enableGitlabSnippets) { %>
  • Dropbox
  • - <% if(typeof github !== 'undefined' && github) { %> + <% if(enableGitHubGist) { %>
  • 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
  • <% } %>