Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_fileUploadData.call(multerOptions, file, data);
}
} else {
multerOptions.onFileUploadData = function(file, data) {
file.contentLength += data.length;
file.size += data.length; // backwards compatibility
}
}
var multerMiddleware = multer(multerOptions);
var restRouter = RESTful(options, files.restFiles || []);
var middleware = [
Connect.cookieParser(options.connect.session.secret),
Connect.session(options.connect.session),
// Handle cross site access exceptions
function(req, res, next) {
var crossSiteAccess = appOptions.safeGet('connect.crossSiteAccess');
if (crossSiteAccess.enabled) {
var authorizedRoutes = crossSiteAccess.authorizedOrigins[req.headers.origin];
_.find(authorizedRoutes, function(routeRegex){
var pattern = new RegExp(routeRegex);
if (req.url.match(pattern)){
res.setHeader("Access-Control-Allow-Origin", req.headers.origin);
res.setHeader("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Authorization, Cookie");
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
res.setHeader("Access-Control-Allow-Credentials", true);
return true;
}
var express = require('express'),
connect = require('connect'),
config = require("../../config/config.js"),
riak = require('riak-js').getClient(config),
sessionStore = require("../session_store.js"),
mrFunctions = require("../map_reduce.js");
// Setup server
// bodyParser - To parse form data
// cookieParser - To support session support
// session - To enable session support using Riak
var app = express.createServer(
express.static(__dirname + '/public'),
express.bodyParser(),
connect.cookieParser(),
connect.session({
secret: 'aos;fop;qe13hpoaneruhwphfepaf',
store: new sessionStore({
bucket: "syslog-web-sessions",
client: riak
})
})
);
app.set('views', __dirname + '/views');
// Dumps the given object as a JSON string
var json = function(object) {
return JSON.stringify(object);
}
// Builds a query for Riak Search
var buildQuery = function(params) {
return arr || [];
} else {
this.session.flash = {};
return msgs;
}
};
// Expire after two minutes
var redisStore = new RedisStore({ maxAge: 60000 * 2 });
connect.createServer(
// session requires cookieDecoder
connect.cookieDecoder(),
// Pass custom session store
connect.session({ store: redisStore }),
// Ignore favicon
function(req, res, next){
if (req.url === '/favicon.ico') {
res.writeHead(404, {});
res.end();
} else {
next();
}
},
// Increment views
function(req, res){
req.session.count = req.session.count || 0
++req.session.count;
//test unicode compatibility
var http = require("http");
var fs = require("fs");
var querystring = require("querystring");
express = require('express'),
connect = require('connect'),
sys = require('sys'),
app = express.createServer(
connect.bodyParser(),
connect.cookieParser(),
connect.session({secret : "locker"}));
var stdin = process.openStdin();
stdin.setEncoding('utf8');
stdin.on('data', function (chunk) {
var processInfo = JSON.parse(chunk);
process.chdir(processInfo.workingDirectory);
app.listen(processInfo.port, function() {
var returnedInfo = {port: processInfo.port};
console.log(JSON.stringify(returnedInfo));
});
});
app.get('/test',
function(req, res) {
exports.webserver = function (assert) {
var port = Math.floor(Math.random() * 40000 + 10000);
var server = connect.createServer();
server.use(connect.cookieDecoder());
server.use(connect.bodyDecoder());
server.use(connect.session({
store : new Cart({ dbFile : '/tmp/cart-' + port + '.db' }),
secret : 'salty-' + Math.floor(Math.random() * 1e16)
}));
server.use(connect.router(function (app) {
app.get('/', function (req, res) {
res.writeHead(200, { 'Content-Type' : 'text/html' });
res.write(req.session.name || 'nobody');
res.end();
});
app.get('/login', function (req, res) {
req.session.regenerate(function (err) {
if (err) throw err;
req.session.name = 'substack';
res.writeHead(200, { 'Content-Type' : 'text/html' });
var app = connect(),
server = http.createServer(app),
io;
var session = {
store: new connect.session.MemoryStore(),
secret: "secret",
key: "mykey.sid",
cookieParser: connect.cookieParser("secret")
};
io = require("socket.io")(server);
//configure connect session
app.use(session.cookieParser);
app.use(connect.session(session));
//configure socket session
io.use(socketSession(session));
//static server to serve the client
app.use(connect.static(__dirname));
io.on("connection", function(socket){
socket.on("whoAreYou", function(callback){
console.log(socket.session);
//read from session
callback(socket.session.name);
});
app.configure(function(){
app.use(connect.cookieDecoder());
app.use(connect.session({ store: new MongoStore() }));
app.use(app.router);
});
module.exports = function startup(options, imports, register) {
assert(options.key, "option 'key' is required");
assert(options.secret, "option 'secret' is required");
var connect = imports.connect;
var sessionStore = imports["session-store"];
connect.useSession(Session({
store: sessionStore,
key: options.key,
secret: options.secret
}));
register(null, {
session: {
getKey: function() {
return options.key;
},
get: sessionStore.get
}
});
};
* Please see the LICENSE file for more information.
*
*/
/**
* Module dependencies.
*/
var fs = require('fs');
var express = require('express'),
connect = require('connect'),
url = require('url'),
sys = require('sys'),
app = express.createServer(
connect.bodyParser(),
connect.cookieParser(),
connect.session({secret : 'locker'})
),
http = require('http'),
https = require('https'),
request = require('request'),
oauthclient = require('oauth').OAuth2,
xml2js = require('xml2js'),
locker = require('../../Common/node/locker.js'),
lfs = require('../../Common/node/lfs.js');
var lockerInfo;
var me;
var accessData;
var oAuth;
var state;
function setupOAuthClient(clientId, clientSecret) {
/**
* web server/service to wrap interactions w/ FB open graph
*/
var _debug = false;
var fs = require('fs'),
http = require('http'),
url = require('url'),
express = require('express'),
connect = require('connect'),
sys = require('sys'),
app = express.createServer(
connect.bodyParser(),
connect.cookieParser(),
connect.session({secret : "locker"})),
locker = require('../../Common/node/locker.js'),
lfs = require('../../Common/node/lfs.js');
var wwwdude = require('wwwdude'),
wwwdude_client = wwwdude.createClient({ encoding: 'binary' });
var me, auth, latests, userInfo;
var facebookClient = require('facebook-js')();
function displayHTML(content) {
return ""
+ ""
+ "<title>Facebook Connector - Locker</title>"
+ "<style type="text/css">"
+ ".header{background:rgb(125,174,92);width: 100%;color: white;border-radius:50px;} .goback{position:absolute;left:90%;top:3%;} .body{background:rgb(125,174,92);border-radius:14px;color: white;} .content{margin-left:1%;} h3{margin-left:1%;margin-bottom:0.5%;} a{color:white;} a:hover{color:rgb(199,199,199);}"</style>