diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..922f10a --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20.x diff --git a/README.md b/README.md index f7ce0c2..1572e0c 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ OAUTH_CLIENT_ID="" OAUTH_CLIENT_SECRET="" ``` +If you are using GitHub Enterprise Server or a self-hosted instance of GitLab you'll also need to set `GIT_HOSTNAME` to the hostname of your server. + ### Serving locally 1. Install the required packages: `npm install` diff --git a/middleware/index.js b/middleware/index.js index 68da9c1..93b9396 100644 --- a/middleware/index.js +++ b/middleware/index.js @@ -67,7 +67,7 @@ const authMiddleware = () => { ALLOWED_DOMAINS, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, - GIT_HOSTNAME = "github.com", + GIT_HOSTNAME = provider === "github" ? "github.com" : "gitlab.com", } = process.env; // Check if the domain is whitelisted @@ -191,7 +191,7 @@ const callbackMiddleware = () => { const { OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, - GIT_HOSTNAME = "github.com", + GIT_HOSTNAME = provider === "github" ? "github.com" : "gitlab.com", } = process.env; if (!OAUTH_CLIENT_ID || !OAUTH_CLIENT_SECRET) { @@ -245,10 +245,6 @@ const callbackMiddleware = () => { body: JSON.stringify(requestBody), }); } catch { - // - } - - if (!response) { res.set(defaultHeaders); res.send( htmlResponse({ diff --git a/package.json b/package.json index 7e82130..5304df9 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,7 @@ "prepare": "husky", "test": "c8 --all -r clover -r text ava" }, - "keywords": [ - "decap-cms", - "sveltia-cms", - "github", - "gitlab", - "auth" - ], + "keywords": ["decap-cms", "sveltia-cms", "github", "gitlab", "auth"], "author": "OCAD University ", "license": "BSD-3-Clause", "dependencies": { @@ -37,8 +31,6 @@ "supertest": "^7.0.0" }, "lint-staged": { - "*.{js,json}": [ - "biome check --write --no-errors-on-unmatched" - ] + "*.{js,json}": ["biome check --write --no-errors-on-unmatched"] } }