Making url paths relative to enable reverse proxy

pull/107/head^2
alse 5 years ago
parent 352a57b160
commit 516fdeef68

@ -30,6 +30,7 @@ if (BASIC_AUTH_USER && BASIC_AUTH_PWD) {
// include the routes
var routes = require("./routes").routes;
var routes_relative = require("./routes").relative
// set the view engine to ejs
app.set('view engine', 'ejs');
@ -61,7 +62,7 @@ app.get(routes.root, function(req, res) {
// send all the required parameters
crontab.crontabs( function(docs){
res.render('index', {
routes : JSON.stringify(routes),
routes : JSON.stringify(routes_relative),
crontabs : JSON.stringify(docs),
backups : crontab.get_backup_names(),
env : crontab.get_env(),
@ -130,7 +131,7 @@ app.get(routes.restore, function(req, res) {
// get all the crontabs
restore.crontabs(req.query.db, function(docs){
res.render('restore', {
routes : JSON.stringify(routes),
routes : JSON.stringify(routes_relative),
crontabs : JSON.stringify(docs),
backups : crontab.get_backup_names(),
db: req.query.db

@ -1,6 +1,6 @@
{
"name": "crontab-ui",
"version": "0.3.9",
"version": "0.3.10",
"description": "Easy and safe way to manage your crontab file",
"main": "index.js",
"scripts": {

@ -16,3 +16,6 @@ exports.routes = {
"logger": "/logger",
"stdout": "/stdout",
};
exports.relative = Object.keys(exports.routes).reduce((p, c) => ({...p, [c]: exports.routes[c].replace(/^\//, '')}), {});
exports.relative["root"] = ".";
Loading…
Cancel
Save