diff --git a/app.js b/app.js index 2e10b30..23a7de9 100755 --- a/app.js +++ b/app.js @@ -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 diff --git a/package.json b/package.json index 27e8f95..08f0651 100755 --- a/package.json +++ b/package.json @@ -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": { diff --git a/routes.js b/routes.js index 3770272..2fb393f 100644 --- a/routes.js +++ b/routes.js @@ -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"] = "."; \ No newline at end of file