Skip to content
This repository has been archived by the owner on Apr 27, 2019. It is now read-only.

Commit

Permalink
Add specific websocket host, so we can be hosted by CloudFlare.
Browse files Browse the repository at this point in the history
  • Loading branch information
m242 committed Aug 5, 2015
1 parent 7684c0e commit f2b7774
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion web/app/assets/javascripts/maildrop.coffee
Expand Up @@ -39,7 +39,8 @@ class Index
blocked: ->
el = M.id "blocked"
trash = M.id "trash"
socket = new WebSocket("ws://" + window.location.host + "/ws/blocked")
wshost = window['MailDropWsHost'] || window.location.host
socket = new WebSocket("ws://" + wshost + "/ws/blocked")
socket.onmessage = (msg) ->
if document.all then el.innerText = msg.data else el.textContent = msg.data
el.addClass "add"
Expand Down
2 changes: 1 addition & 1 deletion web/app/controllers/Application.scala
Expand Up @@ -5,7 +5,7 @@ import java.util.{Properties, Date}
import javax.mail.{Multipart, BodyPart}
import javax.mail.internet.MimeMessage
import akka.actor.{PoisonPill, Props}
import com.heluna.maildrop.util.{Redis, Mailbox, Metrics}
import com.heluna.maildrop.util.{Mailbox, Metrics}
import play.api.Play
import play.api.data.Form
import play.api.libs.concurrent.Akka
Expand Down
3 changes: 3 additions & 0 deletions web/app/views/template.scala.html
Expand Up @@ -95,6 +95,9 @@
</div>
</footer>

<script>
window.MailDropWsHost = '@{ play.Play.application().configuration().getString("maildrop.wshost") }';
</script>
<script src="@routes.Assets.versioned("javascripts/maildrop.js")"></script>

@if(gaEnabled) {
Expand Down
1 change: 1 addition & 0 deletions web/conf/application.conf
@@ -1,5 +1,6 @@
maildrop {
hostname = "localhost"
wshost = "localhost"

// This needs to be the same as the smtp module!
data {
Expand Down

0 comments on commit f2b7774

Please sign in to comment.