Permalink
Browse files

Removes heist dependancy.

  • Loading branch information...
1 parent 2d418e2 commit 73f170197932c8d6a0efccc27628a5513f2a1afb @clanehin committed Oct 5, 2012
Showing with 12 additions and 15 deletions.
  1. +11 −11 Roguestar/Server/Main.hs
  2. +1 −4 roguestar.cabal
View
22 Roguestar/Server/Main.hs
@@ -3,13 +3,12 @@
import Prelude
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
+import qualified Data.ByteString.Lazy as LBS
+import qualified Data.ByteString.Lazy.Char8 as LBS8
import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
import Data.Text.Read
import Data.Text.Encoding
-import qualified Text.XHtmlCombinators.Escape as XH
-import qualified Text.XmlHtml as X
-import Text.Templating.Heist
import Control.Exception (SomeException)
import qualified Control.Monad.CatchIO as CatchIO
import Control.Monad.Trans
@@ -50,6 +49,7 @@ import qualified System.UUID.V4 as V4
import GHC.Stats
import Data.Aeson as Aeson
import qualified Data.HashMap.Strict as HashMap
+import Text.Hastache
data App = App {
_app_game_state :: GameState,
@@ -89,13 +89,13 @@ makeGlobals =
handle500 :: MonadSnap m => m a -> m ()
handle500 m = (m >> return ()) `CatchIO.catch` \(e::SomeException) -> do
- let t = T.pack $ show e
+ let t = LBS8.pack $ show e
putResponse r
writeBS "<html><head><title>Internal Server Error</title></head>"
writeBS "<body><h1>Internal Server Error</h1>"
writeBS "<p>A web handler threw an exception. Details:</p>"
writeBS "<pre>\n"
- writeText $ XH.escape t
+ writeLBS $ htmlEscape t
writeBS "\n</pre></body></html>"
where
r = setContentType "text/html" $
@@ -351,12 +351,12 @@ oops action =
return $ error "oops: Unreachable code."
Left (DBError bad) ->
do putResponse r
- writeText "<html><head><title>Gameplay Error</title></head>"
- writeText "<body><h1>Gameplay Error</h1>"
- writeText "<p>Roguestar returned an error condition. Details:</p>"
- writeText "<pre>\n"
- writeText $ XH.escape $ T.pack bad
- writeText "\n</pre></body></html>"
+ writeBS "<html><head><title>Gameplay Error</title></head>"
+ writeBS "<body><h1>Gameplay Error</h1>"
+ writeBS "<p>Roguestar returned an error condition. Details:</p>"
+ writeBS "<pre>\n"
+ writeLBS $ htmlEscape $ LBS8.pack bad
+ writeBS "\n</pre></body></html>"
finishWith =<< getResponse
where
r = setContentType "text/html" $
View
5 roguestar.cabal
@@ -1,5 +1,5 @@
name: roguestar
-version: 0.8.0.0
+version: 0.10.0.0
cabal-version: >=1.2
build-type: Simple
license: OtherLicense
@@ -20,13 +20,10 @@ executable roguestar-server
snap-core >=0.8,
snap-server >= 0.8,
text >=0.11,
- xmlhtml,
- xhtml-combinators == 0.2.2,
MonadCatchIO-transformers >= 0.2,
data-lens-template,
containers >=0.3.0.0,
base >=4.4,
- heist >=0.8.0,
system-uuid >= 1.2.7,
binary >= 0.5.1
ghc-prof-options: -prof -auto-all

0 comments on commit 73f1701

Please sign in to comment.