mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-01 07:38:33 -04:00
Merge pull request #908 from micedre/gitlabV4
Add possibility to choose between version v3 or v4 for the gitlab api.
This commit is contained in:
commit
881ca88c51
6 changed files with 24 additions and 9 deletions
|
@ -103,6 +103,12 @@ config.isSAMLEnable = config.saml.idpSsoUrl
|
|||
config.isOAuth2Enable = config.oauth2.clientID && config.oauth2.clientSecret
|
||||
config.isPDFExportEnable = config.allowPDFExport
|
||||
|
||||
// Check gitlab api version
|
||||
if (config.gitlab.version !== 'v4' || config.gitlab.version !== 'v3') {
|
||||
logger.warn('config.js contains wrong version (' + config.gitlab.version + ') for gitlab api; it should be \'v3\' or \'v4\'. Defaulting to v3')
|
||||
config.gitlab.version = 'v4'
|
||||
}
|
||||
|
||||
// Only update i18n files in development setups
|
||||
config.updateI18nFiles = (env === Environment.development)
|
||||
|
||||
|
|
|
@ -573,11 +573,11 @@ function gitlabActionProjects (req, res, note) {
|
|||
}
|
||||
}).then(function (user) {
|
||||
if (!user) { return response.errorNotFound(res) }
|
||||
var ret = { baseURL: config.gitlab.baseURL }
|
||||
var ret = { baseURL: config.gitlab.baseURL, version: config.gitlab.version }
|
||||
ret.accesstoken = user.accessToken
|
||||
ret.profileid = user.profileid
|
||||
request(
|
||||
config.gitlab.baseURL + '/api/v3/projects?access_token=' + user.accessToken,
|
||||
config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?access_token=' + user.accessToken,
|
||||
function (error, httpResponse, body) {
|
||||
if (!error && httpResponse.statusCode === 200) {
|
||||
ret.projects = JSON.parse(body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue