Files
outline/server/routes/api/installation/installation.ts
Alexandr ZagorskiyandTom Moor 2e1a827157 Feat/installation info endpoint (#7744)
* feat: add installation.info endpoint using DockerHub API

* feat: UI use an server-side API to show version info

* fix: review fixes

* test: installation.info endpoint

* feat: filtering pre-releases in installation.info endpoint

* fix: change fetch to ApiClient usage for getting version info

* Undo translation change

---------

Co-authored-by: Tom Moor <tom.moor@gmail.com>
2024-10-25 06:39:47 -07:00

25 lines
602 B
TypeScript

import Router from "koa-router";
import auth from "@server/middlewares/authentication";
import { APIContext } from "@server/types";
import { getVersion, getVersionInfo } from "@server/utils/getInstallationInfo";
const router = new Router();
router.post("installation.info", auth(), async (ctx: APIContext) => {
const currentVersion = getVersion();
const { latestVersion, versionsBehind } = await getVersionInfo(
currentVersion
);
ctx.body = {
data: {
version: currentVersion,
latestVersion,
versionsBehind,
},
policies: [],
};
});
export default router;