Trying some sssl

This commit is contained in:
Kasper Rynning-Tønnesen
2015-11-27 15:21:52 +01:00
parent d5731121f9
commit 6c5c0af12e
3 changed files with 11 additions and 9 deletions

View File

@@ -1,9 +1,10 @@
var server; var server;
/*try{ try{
var fs = require('fs'); var fs = require('fs');
var privateKey = fs.readFileSync('/etc/apache2/ssl/private.key', 'utf8'); var privateKey = fs.readFileSync('/etc/apache2/ssl/private.key', 'utf8');
var certificate = fs.readFileSync('/etc/apache2/ssl/ssl.crt', 'utf8'); var certificate = fs.readFileSync('/etc/apache2/ssl/ssl.crt', 'utf8');
//var ca = fs.readFileSync('/etc/apache2/ssl/ca.')
var credentials = {key: privateKey, cert: certificate}; var credentials = {key: privateKey, cert: certificate};
var https = require('https'); var https = require('https');
server = https.createServer(credentials, handler); server = https.createServer(credentials, handler);
@@ -17,10 +18,10 @@ var server;
}).listen(8080, function() { }).listen(8080, function() {
console.log('Running CORS Anywhere on :' + 8080); console.log('Running CORS Anywhere on :' + 8080);
}); });
}*/ }
//catch(err){ catch(err){
console.log("Starting without https (probably on localhost)"); console.log("Starting without https (probably on localhost)");
//if(err["errno"] != 34)console.log(err); if(err["errno"] != 34)console.log(err);
var cors_proxy = require('cors-anywhere'); var cors_proxy = require('cors-anywhere');
var request = require('request'); var request = require('request');
@@ -32,7 +33,7 @@ cors_proxy.createServer({
}); });
var http = require('http'); var http = require('http');
server = http.createServer(handler); server = http.createServer(handler);
//} }
var io = require('socket.io')(server, {'pingTimeout': 25000}); var io = require('socket.io')(server, {'pingTimeout': 25000});

File diff suppressed because one or more lines are too long

View File

@@ -40,12 +40,13 @@ var seekTo;
var song_title; var song_title;
var connection_options = { var connection_options = {
'sync disconnect on unload':true 'sync disconnect on unload':true,
'secure': true
}; };
if(window.location.hostname == "zoff.no") add = "dev.zoff.no"; if(window.location.hostname == "zoff.no") add = "dev.zoff.no";
else add = "localhost"; else add = "localhost";
var socket = io.connect('http://'+add+':8880', connection_options); var socket = io.connect('//'+add+':8880', connection_options);
socket.on("get_list", function(){ socket.on("get_list", function(){
socket.emit('list', chan.toLowerCase()); socket.emit('list', chan.toLowerCase());
}); });