mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-11-13 05:45:15 +00:00
- Added frontend translation for english - Moved frontend api logic to hook and backend api space - Added swagger schema for the new api endpoint - Moved backend logic to its own internal file - Added user agent header to github api check - Added cypress integration test for version check api - Added a memory cache item from github check to avoid hitting it too much
41 lines
867 B
JavaScript
41 lines
867 B
JavaScript
import express from "express";
|
|
import internalRemoteVersion from "../internal/remote-version.js";
|
|
import { debug, express as logger } from "../logger.js";
|
|
|
|
const router = express.Router({
|
|
caseSensitive: true,
|
|
strict: true,
|
|
mergeParams: true,
|
|
});
|
|
|
|
/**
|
|
* /api/version/check
|
|
*/
|
|
router
|
|
.route("/check")
|
|
.options((_, res) => {
|
|
res.sendStatus(204);
|
|
})
|
|
|
|
/**
|
|
* GET /api/version/check
|
|
*
|
|
* Check for available updates
|
|
*/
|
|
.get(async (req, res, _next) => {
|
|
try {
|
|
const data = await internalRemoteVersion.get();
|
|
res.status(200).send(data);
|
|
} catch (error) {
|
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${error}`);
|
|
// Send 200 even though there's an error to avoid triggering update checks repeatedly
|
|
res.status(200).send({
|
|
current: null,
|
|
latest: null,
|
|
update_available: false,
|
|
});
|
|
}
|
|
});
|
|
|
|
export default router;
|