mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-02 03:54:59 +08:00
feature (git): add git support
This commit is contained in:
@ -20,16 +20,20 @@ app.post('/', function(req, res){
|
||||
type: req.body.type,
|
||||
payload: state
|
||||
};
|
||||
res.cookie('auth', crypto.encrypt(persist), { maxAge: 365*24*60*60*1000, httpOnly: true });
|
||||
res.send({status: 'ok', result: 'pong'});
|
||||
const cookie = crypto.encrypt(persist);
|
||||
if(Buffer.byteLength(cookie, 'utf-8') > 4096){
|
||||
res.send({status: 'error', message: 'we can\'t authenticate you', })
|
||||
}else{
|
||||
res.cookie('auth', crypto.encrypt(persist), { maxAge: 365*24*60*60*1000, httpOnly: true });
|
||||
res.send({status: 'ok', result: 'pong'});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
let message = function(err){
|
||||
let t = 'could not establish a connection'
|
||||
let t = err && err.message || 'could not establish a connection';
|
||||
if(err.code){
|
||||
t += ' ('+err.code+')'
|
||||
}
|
||||
t += ' ('+err.code+')';
|
||||
}
|
||||
return t;
|
||||
}
|
||||
res.send({status: 'error', message: message(err), code: err.code});
|
||||
|
||||
Reference in New Issue
Block a user