mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-06-05 21:02:14 +08:00
- Adds request logging in debug mode for some endpoints - Moves certbot version determination to the startup scripts and removes bash script encapsulation when installing plugins - Revert loose domain validation, which was there for a specific reason addressing CVE's - Fix Cypress suite for cert generation - Adds Cypress test that iterates over the entire certbot plugins list and installs each one, ensuring at the very least that the install works - Fixed some plugins based on this - (!) Still some work to do on this, hostinger is still broken at least - Improved cypress tests for custom certs; they will generate on each run instead of being baked in. The baked ones were due to expire soon
79 lines
2.3 KiB
JavaScript
79 lines
2.3 KiB
JavaScript
import express from "express";
|
|
import { isCI } from "../lib/config.js";
|
|
import errs from "../lib/error.js";
|
|
import logRequest from "../lib/express/log-request.js";
|
|
import pjson from "../package.json" with { type: "json" };
|
|
import { isSetup } from "../setup.js";
|
|
import auditLogRoutes from "./audit-log.js";
|
|
import ciRoutes from "./ci.js";
|
|
import accessListsRoutes from "./nginx/access_lists.js";
|
|
import certificatesHostsRoutes from "./nginx/certificates.js";
|
|
import deadHostsRoutes from "./nginx/dead_hosts.js";
|
|
import proxyHostsRoutes from "./nginx/proxy_hosts.js";
|
|
import redirectionHostsRoutes from "./nginx/redirection_hosts.js";
|
|
import streamsRoutes from "./nginx/streams.js";
|
|
import reportsRoutes from "./reports.js";
|
|
import schemaRoutes from "./schema.js";
|
|
import settingsRoutes from "./settings.js";
|
|
import tokensRoutes from "./tokens.js";
|
|
import usersRoutes from "./users.js";
|
|
import versionRoutes from "./version.js";
|
|
|
|
const router = express.Router({
|
|
caseSensitive: true,
|
|
strict: true,
|
|
mergeParams: true,
|
|
});
|
|
|
|
router.use(logRequest);
|
|
|
|
/**
|
|
* Health Check
|
|
* GET /api
|
|
*/
|
|
router.get("/", async (_, res /*, next*/) => {
|
|
const version = pjson.version.split("-").shift().split(".");
|
|
const setup = await isSetup();
|
|
|
|
res.status(200).send({
|
|
status: "OK",
|
|
setup,
|
|
version: {
|
|
major: Number.parseInt(version.shift(), 10),
|
|
minor: Number.parseInt(version.shift(), 10),
|
|
revision: Number.parseInt(version.shift(), 10),
|
|
},
|
|
});
|
|
});
|
|
|
|
router.use("/schema", schemaRoutes);
|
|
router.use("/tokens", tokensRoutes);
|
|
router.use("/users", usersRoutes);
|
|
router.use("/audit-log", auditLogRoutes);
|
|
router.use("/reports", reportsRoutes);
|
|
router.use("/settings", settingsRoutes);
|
|
router.use("/version", versionRoutes);
|
|
router.use("/nginx/proxy-hosts", proxyHostsRoutes);
|
|
router.use("/nginx/redirection-hosts", redirectionHostsRoutes);
|
|
router.use("/nginx/dead-hosts", deadHostsRoutes);
|
|
router.use("/nginx/streams", streamsRoutes);
|
|
router.use("/nginx/access-lists", accessListsRoutes);
|
|
router.use("/nginx/certificates", certificatesHostsRoutes);
|
|
|
|
// Only include CI routes if we're in a CI environment
|
|
if (isCI()) {
|
|
router.use("/ci", ciRoutes);
|
|
}
|
|
|
|
/**
|
|
* API 404 for all other routes
|
|
*
|
|
* ALL /api/*
|
|
*/
|
|
router.all(/(.+)/, (req, _, next) => {
|
|
req.params.page = req.params["0"];
|
|
next(new errs.ItemNotFoundError(req.params.page));
|
|
});
|
|
|
|
export default router;
|