diff --git a/package.json b/package.json index 2d17a20..f5ee0e2 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ }, "devDependencies": { "@biomejs/biome": "1.2.2", - "@richex/git-last-commit": "^2.1.1", "@vercel/ncc": "^0.34.0", "chai": "^4.3.6", "copy-webpack-plugin": "^11.0.0", diff --git a/src/api/v3/index.js b/src/api/v3/index.js index 73da0c2..5d30412 100644 --- a/src/api/v3/index.js +++ b/src/api/v3/index.js @@ -37,8 +37,11 @@ const router = express.Router() router.get('/version', async (req, res) => { // TODO Support responding with JSON object when requested - const versionDetails = (app.get('git_branch') && app.get('git_hash')) - ? `+${app.get('git_branch')}.${app.get('git_hash').substring(0, 10)}` + let versionDetails = app.get('git_branch') + ? `+${app.get('git_branch')}` + : '' + versionDetails += (app.get('git_branch') && app.get('git_hash')) + ? `.${app.get('git_hash').substring(0, 10)}` : '' return res.status(200).contentType('text/plain').send(`${app.get('keyoxide_name')}/${app.get('keyoxide_version')}${versionDetails}`) diff --git a/src/index.js b/src/index.js index 8c88dad..e49a099 100644 --- a/src/index.js +++ b/src/index.js @@ -27,7 +27,6 @@ You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . */ -import git from '@richex/git-last-commit' import express from 'express' import * as httpContext from 'express-http-context2' import { nanoid } from 'nanoid' @@ -46,7 +45,6 @@ dotenv.config() const app = express() const packageData = JSON.parse(readFileSync('./package.json')) -const commit = await git.getLastCommitAsync() app.set('env', process.env.NODE_ENV || 'production') app.engine('pug', pug.__express).set('view engine', 'pug') @@ -55,8 +53,8 @@ app.set('domain', process.env.DOMAIN) app.set('scheme', process.env.SCHEME || 'https') app.set('keyoxide_name', 'keyoxide-web') app.set('keyoxide_version', packageData.version) -app.set('git_branch', commit.branch ?? process.env.CI_COMMIT_BRANCH ?? process.env.COMMIT_BRANCH) -app.set('git_hash', commit.hash ?? process.env.CI_COMMIT_SHA ?? process.env.COMMIT_SHA) +app.set('git_branch', process.env.CI_COMMIT_BRANCH ?? process.env.COMMIT_BRANCH) +app.set('git_hash', process.env.CI_COMMIT_SHA ?? process.env.COMMIT_SHA) app.set('onion_url', process.env.ONION_URL) // Middlewares diff --git a/yarn.lock b/yarn.lock index 59cd22c..f84820c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -488,11 +488,6 @@ resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.24.tgz#58601079e11784d20f82d0585865bb42305c4df3" integrity sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ== -"@richex/git-last-commit@^2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@richex/git-last-commit/-/git-last-commit-2.1.1.tgz#b6527ae4223af8143f13e39d8f0cdaeaed7f9ba6" - integrity sha512-rNa0hCMyKTJ+qPwyN54FlwTUhDBNNghiQWt0ES27g11iYzyzpLcFBGLKYhDaEEEUPZ7aawXOCEYAwCg5JZ1FAQ== - "@sindresorhus/is@^4.0.0": version "4.6.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f"