lx-scan
Version:
License eXtension to find 5-tuples of all installed packages: name, version, project home page, license (e. g. Apache v2, BSD) and required notice. It includes a GUI to edit information for each package and to enter information if necessary.
19 lines (18 loc) • 649 B
JavaScript
var fs = require("fs");
var lxu = require("lxutils");
module.exports.get = function(req,res) {
// Right now assumes that license links to external sources will
// begin with http, https, ftp, or ftps
var htmlreg = /^(f|ht)tps?:\/\/.*$/;
var uri = req.query.path||"";
if(htmlreg.test(uri)) {
res.redirect(uri);
} else {
// If the file was ever found on a machine locally, its full text should be present
// in the JSON document
var path = req.app.locals.jfiles[req.query.jfile];
lxu.parseJSON(path,function(err,jfile) {
res.render("textdisplay",{text:lxu.getPackText(jfile,req.query.pack,req.query.index)});
});
}
};