diff --git a/acts/default.js b/acts/default.js index 5731573..18e7646 100644 --- a/acts/default.js +++ b/acts/default.js @@ -1,7 +1,7 @@ var fs = require('fs'); module.exports = function(qwiki) { qwiki.rule('', '@@CONTENT@@', function(req, res, instance, next) { - var area = req.url; + var area = req.area; if (area == '') { area = 'front'; } @@ -29,7 +29,7 @@ module.exports = function(qwiki) { res.write(area + ': ' + err.code); next(); } else { - qwiki.convertAndSave(area, (req.url in qwiki.wiki_index.pages ? qwiki.wiki_index.pages[req.url].format : qwiki.getDefault('format')), data, function() { + qwiki.convertAndSave(area, (req.area in qwiki.wiki_index.pages ? qwiki.wiki_index.pages[req.area].format : qwiki.getDefault('format')), data, function() { qwiki.readFile(res, wiki_path, function(type, err) { if (type == 'FNF') { res.write('error while creating cache'); @@ -55,19 +55,19 @@ module.exports = function(qwiki) { }); }); qwiki.rule('', '@@TITLE@@', function(req, res, instance, next) { - res.write('qwiki ' + req.url); + res.write('qwiki ' + req.area); next(); }); qwiki.rule('', '@@PAGE@@', function(req, res, instance, next) { - res.write(req.url); + res.write(req.area); next(); }); qwiki.rule('', '@@CONTROLS@@', function(req, res, instance, next) { - res.write('
  • Edit
  • New Page
  • Upload
  • Index
  • '); + res.write('
  • Edit
  • New Page
  • Upload
  • Index
  • '); next(); }); qwiki.rule('', '@@CRUMBS@@', function(req, res, instance, next) { - var parts = req.url.split('/'); + var parts = req.area.split('/'); var path = ''; parts[0] = '>'; for (var i = 0; i < parts.length; i++) { @@ -82,11 +82,11 @@ module.exports = function(qwiki) { next(); }); qwiki.act('', function(req, res) { - var ext = qwiki.getExt(req.url); - var mimetype = qwiki.getMIMEtype(qwiki.getExt(req.url)); + var ext = qwiki.getExt(req.area); + var mimetype = qwiki.getMIMEtype(qwiki.getExt(req.area)); if (mimetype == '') mimetype = 'application/octet-stream'; if (ext != '') { // write file on disk directly - var path = 'wiki/'+req.url; + var path = 'wiki/'+req.area; fs.stat(path, function(err, stat) { if (err == null) { // TODO: etags should actually be based on binary data(CRC32, etc.), not last modified diff --git a/acts/delete.js b/acts/delete.js index 07f205d..0204484 100644 --- a/acts/delete.js +++ b/acts/delete.js @@ -9,7 +9,7 @@ module.exports = function(qwiki) { next() }); qwiki.act('delete', function(req, res) { - var area = (req.url == '' ? 'front' : req.url.substr(1)); + var area = (req.area == '' ? 'front' : req.area); // handle POST if ('submit' in req.fields) { if (req.fields['submit'] == 'Yes') { @@ -17,8 +17,8 @@ module.exports = function(qwiki) { if (err == null) { qwiki.deletePage(area, function() { qwiki.deleteCache(area, function() { - console.log('redirecting to '+req.url); - res.writeHead(302, {'Location': req.url}); + console.log('redirecting to '+req.area); + res.writeHead(302, {'Location': req.area}); res.end(); }); }); @@ -49,7 +49,7 @@ module.exports = function(qwiki) { }); return; } else { - res.writeHead(302, {'Location': req.url+'/edit'}); + res.writeHead(302, {'Location': req.area+'/edit'}); res.end(); } } else { diff --git a/acts/edit.js b/acts/edit.js index ab894eb..1070fae 100644 --- a/acts/edit.js +++ b/acts/edit.js @@ -1,7 +1,7 @@ var fs = require('fs'); module.exports = function(qwiki) { qwiki.rule('edit', '@@CONTENT@@', function(req, res, instance, next) { - var area = (req.url == '' ? 'front' : req.url.substr(1)); + var area = (req.area == '' ? 'front' : req.area); var path = 'wiki/'+area+'.qwk'; res.write('
    '); res.write('
    '); res.write('
    '); next(); diff --git a/acts/revisions.js b/acts/revisions.js index 8a31bf6..7abba85 100644 --- a/acts/revisions.js +++ b/acts/revisions.js @@ -1,8 +1,8 @@ module.exports = function(qwiki) { // **** REVISIONS qwiki.rule('revisions', '@@CONTENT@@', function(req, res, instance, next) { - var path = 'wiki/'+req.url+'.qwk'; - res.write('revisions for ' + req.url.substr(1)); + var path = 'wiki/'+req.area+'.qwk'; + res.write('revisions for ' + req.area); next() }); qwiki.act('revisions', function(req, res) { diff --git a/acts/upload.js b/acts/upload.js index 6b302bb..91e8929 100644 --- a/acts/upload.js +++ b/acts/upload.js @@ -11,7 +11,7 @@ module.exports = function(qwiki) { res.write('

    Upload

    '); var wiki_path = process.cwd() + '/wiki/'; if (typeof req.files.file !== 'undefined') { - var loc_path = (typeof req.fields.location !== 'undefined' ? req.fields.location+'/' : req.url+'/'); + var loc_path = (typeof req.fields.location !== 'undefined' ? req.fields.location+'/' : req.area+'/'); var total = 0; if (req.files.file instanceof Array) { for (var i = 0, len = req.files.file.length; i < len; i++) { @@ -58,7 +58,7 @@ module.exports = function(qwiki) { function end(req, res) { res.write('
    '); res.write('
    '); - res.write('
    '); + res.write('
    '); res.write('
    '); res.write('
    '); res.write('
    '); diff --git a/acts/view.js b/acts/view.js index f1dde50..bff97e2 100644 --- a/acts/view.js +++ b/acts/view.js @@ -1,10 +1,10 @@ module.exports = function(qwiki) { // **** VIEW qwiki.act('view', function(req, res) { - if (req.url == '') { - req.url = 'index'; + if (req.area == '') { + req.area = 'index'; } - var path = 'wiki/'+req.url+'.qwk'; + var path = 'wiki/'+req.area+'.qwk'; qwiki.readFile(res, path, function(type, err) { if (type == 'FNF') {