use hamlet at least for the static html
This commit is contained in:
parent
81b40cf882
commit
805d50c69d
1 changed files with 14 additions and 13 deletions
|
@ -15,7 +15,10 @@ import Assistant.DaemonStatus
|
||||||
import Utility.WebApp
|
import Utility.WebApp
|
||||||
|
|
||||||
import Yesod
|
import Yesod
|
||||||
|
import Text.Hamlet
|
||||||
import Network.Socket (PortNumber)
|
import Network.Socket (PortNumber)
|
||||||
|
import Text.Blaze.Renderer.Utf8
|
||||||
|
import Data.ByteString.Lazy as L
|
||||||
|
|
||||||
data WebApp = WebApp DaemonStatusHandle
|
data WebApp = WebApp DaemonStatusHandle
|
||||||
|
|
||||||
|
@ -45,20 +48,18 @@ webAppThread st dstatus = do
|
||||||
writeHtmlShim :: PortNumber -> Annex ()
|
writeHtmlShim :: PortNumber -> Annex ()
|
||||||
writeHtmlShim port = do
|
writeHtmlShim port = do
|
||||||
htmlshim <- fromRepo gitAnnexHtmlShim
|
htmlshim <- fromRepo gitAnnexHtmlShim
|
||||||
liftIO $ writeFile htmlshim $ genHtmlShim port
|
liftIO $ L.writeFile htmlshim $ genHtmlShim port
|
||||||
|
|
||||||
{- TODO: generate this static file using Yesod. -}
|
{- TODO: generate this static file using Yesod. -}
|
||||||
genHtmlShim :: PortNumber -> String
|
genHtmlShim :: PortNumber -> L.ByteString
|
||||||
genHtmlShim port = unlines
|
genHtmlShim port = renderHtml [shamlet|
|
||||||
[ "<html>"
|
!!!
|
||||||
, "<head>"
|
<html>
|
||||||
, "<meta http-equiv=\"refresh\" content=\"0; URL=" ++ url ++ "\">"
|
<head>
|
||||||
, "</head>"
|
<meta http-equiv="refresh" content="0; URL=#{url}">
|
||||||
, "<body>"
|
<body>
|
||||||
, "<p>"
|
<p>
|
||||||
, "<a href=\"" ++ url ++ "\">Starting webapp...</a>"
|
<a href="#{url}">Starting webapp...
|
||||||
, "</p>"
|
|]
|
||||||
, "</body>"
|
|
||||||
]
|
|
||||||
where
|
where
|
||||||
url = "http://localhost:" ++ show port ++ "/"
|
url = "http://localhost:" ++ show port ++ "/"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue