diff --git a/server/conf.js b/server/conf.js index 7aa256a3b..73e13bd25 100644 --- a/server/conf.js +++ b/server/conf.js @@ -8,6 +8,9 @@ const dropboxAppKey = process.env.DROPBOX_APP_KEY; const dropboxAppKeyFull = process.env.DROPBOX_APP_KEY_FULL; const githubClientId = process.env.GITHUB_CLIENT_ID; const githubClientSecret = process.env.GITHUB_CLIENT_SECRET; +const githubAuthUrl = process.env.GITHUB_AUTH_URL || 'https://github.com/login/oauth/authorize'; +const githubTokenUrl = process.env.GITHUB_TOKEN_URL || 'https://github.com/login/oauth/access_token'; +const githubUserProfileUrl = process.env.GITHUB_USER_PROFILE_URL || 'https://api.github.com/user'; const googleClientId = process.env.GOOGLE_CLIENT_ID; const googleApiKey = process.env.GOOGLE_API_KEY; const wordpressClientId = process.env.WORDPRESS_CLIENT_ID; @@ -22,6 +25,9 @@ exports.values = { dropboxAppKeyFull, githubClientId, githubClientSecret, + githubAuthUrl, + githubTokenUrl, + githubUserProfileUrl, googleClientId, googleApiKey, wordpressClientId, @@ -31,6 +37,9 @@ exports.publicValues = { dropboxAppKey, dropboxAppKeyFull, githubClientId, + githubAuthUrl, + githubTokenUrl, + githubUserProfileUrl, googleClientId, googleApiKey, wordpressClientId, diff --git a/server/github.js b/server/github.js index 83aff9e31..f3d0fa5da 100644 --- a/server/github.js +++ b/server/github.js @@ -6,7 +6,7 @@ function githubToken(clientId, code) { return new Promise((resolve, reject) => { request({ method: 'POST', - url: 'https://github.com/login/oauth/access_token', + url: conf.values.githubTokenUrl, qs: { client_id: clientId, client_secret: conf.values.githubClientSecret, diff --git a/src/data/defaults/defaultSettings.yml b/src/data/defaults/defaultSettings.yml index bcb4a508f..741d47352 100644 --- a/src/data/defaults/defaultSettings.yml +++ b/src/data/defaults/defaultSettings.yml @@ -79,17 +79,13 @@ turndown: # GitHub/GitLab commit messages git: - createFileMessage: '{{path}} created from https://stackedit.io/' - updateFileMessage: '{{path}} updated from https://stackedit.io/' - deleteFileMessage: '{{path}} deleted from https://stackedit.io/' + createFileMessage: '{{path}} created' + updateFileMessage: '{{path}} updated' + deleteFileMessage: '{{path}} deleted' # Default content for new files newFileContent: | - - - > Written with [StackEdit](https://stackedit.io/). - # Default properties for new files newFileProperties: | # extensions: diff --git a/src/services/providers/helpers/githubHelper.js b/src/services/providers/helpers/githubHelper.js index 2f10a5bc1..35ca2f4ab 100644 --- a/src/services/providers/helpers/githubHelper.js +++ b/src/services/providers/helpers/githubHelper.js @@ -63,11 +63,13 @@ export default { * https://developer.github.com/apps/building-oauth-apps/authorization-options-for-oauth-apps/ */ async startOauth2(scopes, sub = null, silent = false) { + const githubAuthUrl = store.getters['data/serverConf'].githubAuthUrl; + const githubUserProfileUrl = store.getters['data/serverConf'].githubUserProfileUrl; const clientId = store.getters['data/serverConf'].githubClientId; // Get an OAuth2 code const { code } = await networkSvc.startOauth2( - 'https://github.com/login/oauth/authorize', + githubAuthUrl, { client_id: clientId, scope: scopes.join(' '), @@ -88,7 +90,7 @@ export default { // Call the user info endpoint const user = (await networkSvc.request({ method: 'GET', - url: 'https://api.github.com/user', + url: githubUserProfileUrl, params: { access_token: accessToken, }, diff --git a/src/store/workspace.js b/src/store/workspace.js index 2c31fc0f4..b6aa29302 100644 --- a/src/store/workspace.js +++ b/src/store/workspace.js @@ -22,7 +22,7 @@ export default { Object.entries(rootGetters['data/workspaces']).forEach(([id, workspace]) => { const sanitizedWorkspace = { id, - providerId: 'googleDriveAppData', + providerId: 'githubWorkspace', sub: mainWorkspaceToken && mainWorkspaceToken.sub, ...workspace, };