diff --git a/assets/css/common.less b/assets/css/common.less index 0227084..5c3cb0c 100644 --- a/assets/css/common.less +++ b/assets/css/common.less @@ -10,13 +10,13 @@ font-family: 'Droid Sans'; font-style: normal; font-weight: 400; - src: local('Droid Sans'), local('DroidSans'), url(http://themes.googleusercontent.com/static/fonts/droidsans/v3/s-BiyweUPV0v-yRb-cjciBsxEYwM7FgeyaSgU71cLG0.woff) format('woff'); + src: local('Droid Sans'), local('DroidSans'), url(//themes.googleusercontent.com/static/fonts/droidsans/v3/s-BiyweUPV0v-yRb-cjciBsxEYwM7FgeyaSgU71cLG0.woff) format('woff'); } @font-face { font-family: 'Droid Sans'; font-style: normal; font-weight: 700; - src: local('Droid Sans Bold'), local('DroidSans-Bold'), url(http://themes.googleusercontent.com/static/fonts/droidsans/v3/EFpQQyG9GqCrobXxL-KRMQFhaRv2pGgT5Kf0An0s4MM.woff) format('woff'); + src: local('Droid Sans Bold'), local('DroidSans-Bold'), url(//themes.googleusercontent.com/static/fonts/droidsans/v3/EFpQQyG9GqCrobXxL-KRMQFhaRv2pGgT5Kf0An0s4MM.woff) format('woff'); } * { @@ -455,4 +455,4 @@ footer { opacity: 0.5; } 66% {} -} \ No newline at end of file +} diff --git a/assets/js/modules/socketconnection.coffee b/assets/js/modules/socketconnection.coffee index 1e26df5..8fbe352 100644 --- a/assets/js/modules/socketconnection.coffee +++ b/assets/js/modules/socketconnection.coffee @@ -10,7 +10,8 @@ socketConnection = (pasteboard) -> getID: () -> return ID init: () -> return unless @isSupported() - connection = new WebSocket("ws://#{window.location.hostname}:#{SOCKET_PORT}") + protocol = if window.location.protocol == "http:" then "ws:" else "wss:" + connection = new WebSocket(protocol + "//#{window.location.hostname}:#{SOCKET_PORT}") connection.onmessage = (e) -> try data = JSON.parse(e.data) diff --git a/config/environments.coffee b/config/environments.coffee index 458065b..cf466a1 100644 --- a/config/environments.coffee +++ b/config/environments.coffee @@ -2,6 +2,7 @@ # Environment Configuration ### auth = require "../auth" +url = require "url" exports.init = (app, express) -> # General @@ -18,8 +19,15 @@ exports.init = (app, express) -> # Set app.set "localrun", process.env.LOCAL or false + # The port where the server listens app.set "port", process.env.PORT or 3000 - app.set "domain", "http://pasteboard.co" + + if process.env.ORIGIN + app.set "domain", process.env.ORIGIN + app.set "externalPort", url.parse(process.env.ORIGIN).port or 443 + else + app.set "domain", "http://pasteboard.co" + app.set "externalPort", app.get "port" # Amazon S3 connection settings (using knox) if auth.amazon diff --git a/controllers/main.coffee b/controllers/main.coffee index 219da31..4bb1ab7 100644 --- a/controllers/main.coffee +++ b/controllers/main.coffee @@ -17,7 +17,7 @@ post = {} # The index page get.index = (req, res) -> viewData = - port: req.app.get "port" + port: req.app.get "externalPort" redirected: false useAnalytics: false trackingCode: "" diff --git a/helpers/common.coffee b/helpers/common.coffee index 6a70db9..e627d53 100644 --- a/helpers/common.coffee +++ b/helpers/common.coffee @@ -40,7 +40,7 @@ exports.imageURL = (req, image) -> base = auth.amazon.CDN_URL or "http://#{auth.amazon.S3_BUCKET}.s3.amazonaws.com" return "#{base}#{req.app.get "amazonFilePath"}#{image}" else - "http://#{req.headers.host}#{req.app.get "localStorageURL"}#{image}" + return "#{req.app.get "domain"}#{req.app.get "localStorageURL"}#{image}" # Generate the image owner key imageOwnerKey = (image) -> diff --git a/views/image.ejs b/views/image.ejs index 285a8c1..690efd9 100644 --- a/views/image.ejs +++ b/views/image.ejs @@ -6,7 +6,7 @@ - + @@ -46,8 +46,8 @@ Embed URL: - - + + Download image <% if (isImageOwner) { %>