diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-08 20:03:06 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-08 20:04:44 -0400 |
commit | 7c70c89ee75a8543fad1cfdb1051c34d4950432a (patch) | |
tree | 2a7b4f68bcf7900f7566746282fbe1691c5a5315 /Assistant | |
parent | e59b0a1c884b4222162b444d0d306f67f2a6ca30 (diff) |
render webapp staitc file url using yesod
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/Threads/WebApp.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Assistant/Threads/WebApp.hs b/Assistant/Threads/WebApp.hs index d7d5c2602..1bab94b0f 100644 --- a/Assistant/Threads/WebApp.hs +++ b/Assistant/Threads/WebApp.hs @@ -83,7 +83,7 @@ webAppThread mst dstatus scanremotes transferqueue transferslots urlrenderer pos =<< runThreadState st (fromRepo repoPath)) go port webapp htmlshim = do writeHtmlShim webapp port htmlshim - maybe noop (\a -> a (myUrl webapp port "/") htmlshim) onstartup + maybe noop (\a -> a (myUrl webapp port HomeR) htmlshim) onstartup {- Creates a html shim file that's used to redirect into the webapp, - to avoid exposing the secretToken when launching the web browser. -} @@ -113,8 +113,9 @@ genHtmlShim webapp port = unlines , "</html>" ] where - url = myUrl webapp port "/" + url = myUrl webapp port HomeR -myUrl :: WebApp -> PortNumber -> FilePath -> Url -myUrl webapp port page = "http://localhost:" ++ show port ++ page ++ - "?auth=" ++ unpack (secretToken webapp) +myUrl :: WebApp -> PortNumber -> Route WebApp -> Url +myUrl webapp port route = unpack $ yesodRender webapp urlbase route [] + where + urlbase = pack $ "http://localhost:" ++ show port |