Skip to content

Commit

Permalink
all connections are ssl, still need http redirect to https
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewxhill committed Oct 11, 2011
1 parent 9ae9781 commit 1cf9623
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ key
cert
key.key
cert.crt
gd.crt
2 changes: 1 addition & 1 deletion app/lib/neemo/dirtsock.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports.start = function(io, cartodb, store) {
//console.log('\n== CartoDB result for NEEMO get "' + query + '" ==');
//console.log(result + '\n');
var default_region = 0,
default_track = Math.floor(Math.random()*5);
default_track = Math.floor(Math.random()*30);
result = JSON.parse(result);
if (result.total_rows == 0){
user_profile = {
Expand Down
21 changes: 17 additions & 4 deletions app/lib/neemo/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var express = require('express')
, sys = require('sys')
, fs = require("fs")
, path = require("path")
//, https = require("https")
, querystring = require('querystring')
, crypto = require('crypto')
, CAS = require('cas')
Expand Down Expand Up @@ -87,10 +88,14 @@ module.exports = function(){

};

var privateKey, certificate, ca;
// initialize express server
privateKey = fs.readFileSync('../key.key').toString();
certificate = fs.readFileSync('../cert.crt').toString();
ca = fs.readFileSync('../gd.crt').toString();

var app = express.createServer(
{key: fs.readFileSync('../key').toString(),
cert: fs.readFileSync('../cert').toString() }
{key:privateKey,cert:certificate,ca:ca},
express.cookieParser(),
express.session({
secret: "string", //TODO use a real secret
Expand All @@ -100,6 +105,7 @@ module.exports = function(){
}
})
);

app.use('/js', express.static(global.settings.app_root + '/public/js'));
app.use('/images', express.static(global.settings.app_root + '/public/images'));
app.use('/css', express.static(global.settings.app_root + '/public/css'));
Expand All @@ -111,10 +117,17 @@ module.exports = function(){
app.use(express.logger({buffer:true, format:'[:remote-addr :date] \033[90m:method\033[0m \033[36m:url\033[0m \033[90m:status :response-time ms -> :res[Content-Type]\033[0m'}));

cartodb.start(function(){
require('./dirtsock').start(io.listen(app, {secure: true}), this, store);
/*
if (global.settings.name != 'aproduction'){
//require('./dirtsock').start(io.listen(app), this, store);
} else {
require('./dirtsock').start(io.listen(app), this, store);
}
*/
require('./dirtsock').start(io.listen(app, {key:privateKey,cert:certificate,ca:ca}), this, store);

/*
eval(fs.readFileSync('./config/uploadtracks.js', encoding="ascii"));
eval(fs.readFileSync('./config/newtracks.js', encoding="ascii"));
doc = {};
var track = 1;
var protected_request = this.api_url;
Expand Down
3 changes: 2 additions & 1 deletion app/public/js/Neemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ Neemo.modules.socket = function(neemo) {
this.intRegion=-1;
this.track = -1;
this._bus = bus;
this.socket = io.connect('https://localhost', {
this.socket = io.connect('https://cartodb.zooniverse.org', {
secure: true,
'reconnect': true,
'reconnection delay': 5,
'max reconnection attempts': 10
Expand Down
2 changes: 1 addition & 1 deletion app/public/regions/tracks.js

Large diffs are not rendered by default.

0 comments on commit 1cf9623

Please sign in to comment.