diff --git a/app/constants/settings.js b/app/constants/settings.js index 78b229522..8e8e9b8c8 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -58,5 +58,8 @@ export default { }, Threads_enabled: { type: null + }, + API_Gitlab_URL: { + type: 'valueAsString' } }; diff --git a/app/views/LoginSignupView.js b/app/views/LoginSignupView.js index a80d8b50b..1b09b994f 100644 --- a/app/views/LoginSignupView.js +++ b/app/views/LoginSignupView.js @@ -91,6 +91,7 @@ const SERVICES_COLLAPSED_HEIGHT = 174; @connect(state => ({ server: state.server.server, Site_Name: state.settings.Site_Name, + Gitlab_URL: state.settings.API_Gitlab_URL, services: state.login.services })) export default class LoginSignupView extends React.Component { @@ -106,7 +107,8 @@ export default class LoginSignupView extends React.Component { navigation: PropTypes.object, server: PropTypes.string, services: PropTypes.object, - Site_Name: PropTypes.string + Site_Name: PropTypes.string, + Gitlab_URL: PropTypes.string } constructor(props) { @@ -175,9 +177,10 @@ export default class LoginSignupView extends React.Component { } onPressGitlab = () => { - const { services, server } = this.props; + const { services, server, Gitlab_URL } = this.props; const { clientId } = services.gitlab; - const endpoint = 'https://gitlab.com/oauth/authorize'; + const baseURL = Gitlab_URL ? Gitlab_URL.trim().replace(/\/*$/, '') : 'https://gitlab.com'; + const endpoint = `${ baseURL }/oauth/authorize`; const redirect_uri = `${ server }/_oauth/gitlab?close`; const scope = 'read_user'; const state = this.getOAuthState();