mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-05-31 01:59:46 -05: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
60 lines
1.2 KiB
JavaScript
60 lines
1.2 KiB
JavaScript
import express from "express";
|
|
import dnsPlugins from "../certbot/dns-plugins.json" with { type: "json" };
|
|
import { installPlugin } from "../lib/certbot.js";
|
|
import { debug, express as logger } from "../logger.js";
|
|
|
|
const router = express.Router({
|
|
caseSensitive: true,
|
|
strict: true,
|
|
mergeParams: true,
|
|
});
|
|
|
|
/**
|
|
* ONLY AVAILABLE IN CI ENVIRONMENT!
|
|
*/
|
|
|
|
/**
|
|
* /api/ci/certbot-plugins
|
|
*/
|
|
router
|
|
.route("/certbot-plugins")
|
|
.options((_, res) => {
|
|
res.sendStatus(204);
|
|
})
|
|
|
|
// Return all certbot plugins
|
|
.get(async (_req, res, _next) => {
|
|
res.status(200).send(dnsPlugins);
|
|
});
|
|
|
|
/**
|
|
* /api/ci/certbot-plugins/{plugin}
|
|
*/
|
|
router
|
|
.route("/certbot-plugins/:plugin")
|
|
.options((_, res) => {
|
|
res.sendStatus(204);
|
|
})
|
|
|
|
// Install a certbot plugin
|
|
.post(async (req, res, next) => {
|
|
try {
|
|
const pluginName = req.params.plugin;
|
|
// check if plugin exists
|
|
if (!dnsPlugins[pluginName]) {
|
|
return res.status(404).send({
|
|
error: "Plugin not found",
|
|
});
|
|
}
|
|
|
|
await installPlugin(pluginName);
|
|
res.status(200).send(true);
|
|
} catch (err) {
|
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
|
next(err);
|
|
}
|
|
return;
|
|
});
|
|
|
|
export default router;
|