Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init() {
// Our require setup is still alive in the DOM, so we can get at Filer
fs = new Filer.FileSystem({
provider: new Filer.FileSystem.providers.Fallback()
});
rewireScript();
rewireImage();
rewireXHR();
startWatchers();
cleanEnv();
}
get: function( req, res ) {
var user = req.session.user;
var path = req.params[0];
var info = getFileInfo(path);
var fs = new Filer.FileSystem({provider: new S3Provider({keyPrefix: user.username, name: user.username, bucket: "", key: "", secret: ""})});
fs.readFile("/" + path, info.encoding, function(err, data) {
if(err) {
if(err.code === "ENOENT") {
res.send(404);
return;
} else {
res.send(500, "Unable to read file" + err);
}
}
res.writeHead(200, "OK", {'Content-Type': info.mime});
res.write(data);
res.end()
});
},
healthcheck: function( req, res ) {
clear: function(req, res) {
var user = req.session.user;
var fs = new Filer.FileSystem({flags: "FORMAT", provider: new S3Provider({keyPrefix: "dave", name: "dave", bucket: "", key: "", secret: ""})}, function(err){
if(err) {
res.send(500, {error: e});
return;
}
res.send(200);
});
},
};