summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Croft2016-05-11 17:06:18 -0400
committerJason Croft2016-05-11 17:06:18 -0400
commitad79b581bda79ef2be0d6ad1a192fc7d0afef2f0 (patch)
tree386c7bb01db5d4a875ddda10c6c4dd8f4aac1a65
parente545de72a6daab8f51d4b39ec9e33563eb16ee68 (diff)
End-point to get GitLab data.
Diffstat (limited to '')
-rw-r--r--app.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/app.js b/app.js
index a6eded98..964a3a81 100644
--- a/app.js
+++ b/app.js
@@ -16,6 +16,7 @@ var formidable = require('formidable');
var morgan = require('morgan');
var passportSocketIo = require("passport.socketio");
var helmet = require('helmet');
+var request = require('request');
//core
var config = require("./lib/config.js");
@@ -82,6 +83,9 @@ var sessionStore = new SequelizeStore({
//compression
app.use(compression());
+//cookies
+app.use(cookieParser());
+
// use hsts to tell https users stick to this
app.use(helmet.hsts({
maxAge: 31536000 * 1000, // 365 days
@@ -438,6 +442,18 @@ app.post('/uploadimage', function (req, res) {
}
});
});
+//get gitlab parameters
+app.get('/gitlab', function (req, res) {
+ var ret = { baseURL: config.gitlab.baseURL };
+ models.User.findById(req.cookies.userid)
+ .then(function(user) {
+ ret.accesstoken = user.accessToken;
+ return res.send(ret);
+ }).catch(function(err) {
+ logger.error('user search failed: ' + err);
+ return done(err, null);
+ });
+});
//get new note
app.get("/new", response.newNote);
//get publish note