From abdb3423fca14f745462c32549e004de40fb279d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Thu, 11 Jun 2015 14:56:57 +0200 Subject: [PATCH] trying to fix https issue --- server/server.js | 18 +++++++++++++++--- static/js/nochan.js | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/server/server.js b/server/server.js index b89be95e..b7af1b68 100755 --- a/server/server.js +++ b/server/server.js @@ -1,8 +1,20 @@ +var fs = require('fs'); +var http = require('http'); +var https = require('https'); +var privateKey = fs.readFileSync('/etc/apache2/ssl/private.key', 'utf8'); +var certificate = fs.readFileSync('/etc/apache2/ssl/ssl.crt', 'utf8'); + +var credentials = {key: privateKey, cert: certificate}; +// your express configuration here + +//var httpServer = http.createServer(app); +var httpsServer = https.createServer(credentials, app); + var express = require('express'); var app = express(); -var server = require('http').createServer(app); -var io = require('socket.io')(server); +//var server = require('http').createServer(app); +var io = require('socket.io')(httpsServer); //db var mongojs = require('mongojs'); @@ -14,7 +26,7 @@ var crypto = require('crypto'); var port = 3000; var lists = []; -server.listen(port, function () { +httpsServer.listen(port, function () { console.log('Server listening at port %d', port); }); diff --git a/static/js/nochan.js b/static/js/nochan.js index 0bc2424c..54884f26 100755 --- a/static/js/nochan.js +++ b/static/js/nochan.js @@ -82,7 +82,7 @@ $(document).ready(function (){ list_html = $("#channels").html(); $("#channels").empty(); - var socket = io.connect('//'+window.location.hostname+':3000'); + var socket = io.connect('https://'+window.location.hostname+':3000'); var playlists = []; socket.emit('frontpage_lists'); socket.on('playlists', function(msg){