diff options
author | Minteck <contact@minteck.org> | 2021-12-04 10:58:59 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2021-12-04 10:58:59 +0100 |
commit | e618c3f52c1c4ae161650679cda24eecbba579bb (patch) | |
tree | a160a9f18847be1be73fb1c2ac2bc25b1e756e27 /server/http.js | |
parent | bce13ee94deb2a4914784bb4268dc1d7bc0f11ed (diff) | |
download | wolfeye-js-e618c3f52c1c4ae161650679cda24eecbba579bb.tar.gz wolfeye-js-e618c3f52c1c4ae161650679cda24eecbba579bb.tar.bz2 wolfeye-js-e618c3f52c1c4ae161650679cda24eecbba579bb.zip |
Code is now more cute!
Diffstat (limited to 'server/http.js')
-rw-r--r-- | server/http.js | 9 |
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(); |