Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.

24 lines
560 B
TypeScript
Raw Normal View History

2020-10-20 18:05:58 -05:00
import { Router } from "express"
import { version } from "../constants"
import { ensureAuthenticated } from "../http"
import { UpdateProvider } from "../update"
export const router = Router()
const provider = new UpdateProvider()
router.use((req, _, next) => {
ensureAuthenticated(req)
next()
})
router.get("/", async (req, res) => {
const update = await provider.getUpdate(req.query.force === "true")
2020-10-20 18:05:58 -05:00
res.json({
checked: update.checked,
latest: update.version,
current: version,
isLatest: provider.isLatestVersion(update),
})
})