mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-09-14 10:52:34 +00:00
Convert backend to ESM
- About 5 years overdue - Remove eslint, use bomejs instead
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
const express = require('express');
|
||||
const jwtdecode = require('../lib/express/jwt-decode');
|
||||
const apiValidator = require('../lib/validator/api');
|
||||
const internalToken = require('../internal/token');
|
||||
const schema = require('../schema');
|
||||
import express from "express";
|
||||
import internalToken from "../internal/token.js";
|
||||
import jwtdecode from "../lib/express/jwt-decode.js";
|
||||
import apiValidator from "../lib/validator/api.js";
|
||||
import { getValidationSchema } from "../schema/index.js";
|
||||
|
||||
let router = express.Router({
|
||||
const router = express.Router({
|
||||
caseSensitive: true,
|
||||
strict: true,
|
||||
mergeParams: true
|
||||
strict: true,
|
||||
mergeParams: true,
|
||||
});
|
||||
|
||||
router
|
||||
.route('/')
|
||||
.route("/")
|
||||
.options((_, res) => {
|
||||
res.sendStatus(204);
|
||||
})
|
||||
@@ -24,13 +24,13 @@ router
|
||||
* for services like Job board and Worker.
|
||||
*/
|
||||
.get(jwtdecode(), (req, res, next) => {
|
||||
internalToken.getFreshToken(res.locals.access, {
|
||||
expiry: (typeof req.query.expiry !== 'undefined' ? req.query.expiry : null),
|
||||
scope: (typeof req.query.scope !== 'undefined' ? req.query.scope : null)
|
||||
})
|
||||
internalToken
|
||||
.getFreshToken(res.locals.access, {
|
||||
expiry: typeof req.query.expiry !== "undefined" ? req.query.expiry : null,
|
||||
scope: typeof req.query.scope !== "undefined" ? req.query.scope : null,
|
||||
})
|
||||
.then((data) => {
|
||||
res.status(200)
|
||||
.send(data);
|
||||
res.status(200).send(data);
|
||||
})
|
||||
.catch(next);
|
||||
})
|
||||
@@ -41,13 +41,12 @@ router
|
||||
* Create a new Token
|
||||
*/
|
||||
.post(async (req, res, next) => {
|
||||
apiValidator(schema.getValidationSchema('/tokens', 'post'), req.body)
|
||||
apiValidator(getValidationSchema("/tokens", "post"), req.body)
|
||||
.then(internalToken.getTokenFromEmail)
|
||||
.then((data) => {
|
||||
res.status(200)
|
||||
.send(data);
|
||||
res.status(200).send(data);
|
||||
})
|
||||
.catch(next);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
Reference in New Issue
Block a user