aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-01-02 23:20:19 +0100
committerache <ache@ache.one>2018-01-02 23:20:19 +0100
commit2a35b7d23c47b1ca3d9188e0ec5a48a53de0466d (patch)
tree3a7df46b22f568c48b5671fa9fa73bfe7cd9cef0
parentdecode the URL (diff)
Fix the download raw button
-rw-r--r--app.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/app.js b/app.js
index c64d3cd..f747fca 100644
--- a/app.js
+++ b/app.js
@@ -45,16 +45,24 @@ app.get('/' + path + '/*', function(req, res) {
var query = req.query;
console.log("[" + new Date() + "] > " + "200 - " + url);
+ if( query && query['raw'] == 'true' ) {
+ res.sendFile(url, { root: '.',
+ dotfiles:'deny',
+ headers: {
+ 'x-timestamp': Date.now(),
+ 'x-sent': true} }, function(err) {
+ if( err ) {
+ next(err);
+ } else {
+ console.log("Sent : ", url);
+ }
+ });
+ return;
+ }
fs.readFile(url.substr(1), 'utf8', function(err, data) {
if (err)
return console.log(err);
- if( query && query['raw'] == 'true' ) {
- console.log("PLEASE");
- res.send( data )
- return;
- }
-
// remark()
/* Debbug comment
const a = unified()
@@ -70,10 +78,10 @@ app.get('/' + path + '/*', function(req, res) {
unified()
.use(remark)
- .use(guide)
+// .use(guide)
.use(mermaid)
.use(lineInput)
- .use(textInput)
+// .use(textInput)
.use(math)
.use(kbd)
.use(sb)