aboutsummaryrefslogtreecommitdiff
path: root/server/http.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/http.js')
-rw-r--r--server/http.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/http.js b/server/http.js
index c679d95..465b726 100644
--- a/server/http.js
+++ b/server/http.js
@@ -14,6 +14,8 @@ module.exports.start = function () {
http.createServer(function (req, res) {
global.res = res;
req.url_orig = req.url;
+ req.url_arg = req.url.split("?")[1];
+ req.url = req.url.split("?")[0];
if (req.headers["x-forwarded-for"]) {
global.address = req.headers["x-forwarded-for"];
@@ -140,7 +142,12 @@ module.exports.start = function () {
'Set-Cookie': '__mpws_request=' + year + month + day + hour + min + sec
});
try {
- require('ejs').renderFile(wwwdata + req.url, {wwwdata, private, req, res, slang, lang}, (err, str) => {
+ if (typeof req.url_arg === "string") {
+ get = require('querystring').parse(require('url').parse(req.url_orig).query);
+ } else {
+ get = {};
+ }
+ require('ejs').renderFile(wwwdata + req.url, {wwwdata, private, req, res, slang, lang, get, fs: require('fs'), child_process: require('child_process')}, (err, str) => {
if (err) throw err;
res.write(str);
res.end();