summaryrefslogtreecommitdiff
path: root/Assistant.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-08 19:57:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-08 19:57:15 -0400
commite59b0a1c884b4222162b444d0d306f67f2a6ca30 (patch)
tree78c2b8c0cfe9c6c52e31b0de2b4a730a7f080635 /Assistant.hs
parente6e0877378af85293356b1c7d644a6df6cc40415 (diff)
first pass at alert buttons
They work fine. But I had to go to a lot of trouble to get Yesod to render routes in a pure function. It may instead make more sense to have each alert have an assocated IO action, and a single route that runs the IO action of a given alert id. I just wish I'd realized that before the past several hours of struggling with something Yesod really doesn't want to allow.
Diffstat (limited to 'Assistant.hs')
-rw-r--r--Assistant.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Assistant.hs b/Assistant.hs
index 0141f5f56..96eca166c 100644
--- a/Assistant.hs
+++ b/Assistant.hs
@@ -97,6 +97,10 @@
- ScanRemotes (STM TMVar)
- Remotes that have been disconnected, and should be scanned
- are indicated by writing to this TMVar.
+ - UrlRenderer (MVar)
+ - A Yesod route rendering function is stored here. This allows
+ - things that need to render Yesod routes to block until the webapp
+ - has started up and such rendering is possible.
-}
{-# LANGUAGE CPP #-}
@@ -125,6 +129,7 @@ import Assistant.Threads.NetWatcher
import Assistant.Threads.TransferScanner
import Assistant.Threads.TransferPoller
#ifdef WITH_WEBAPP
+import Assistant.WebApp
import Assistant.Threads.WebApp
#ifdef WITH_PAIRING
import Assistant.Threads.PairListener
@@ -170,12 +175,13 @@ startAssistant assistant daemonize webappwaiter = do
transferqueue <- newTransferQueue
transferslots <- newTransferSlots
scanremotes <- newScanRemoteMap
+ urlrenderer <- newUrlRenderer
mapM_ (startthread dstatus)
[ watch $ commitThread st changechan commitchan transferqueue dstatus
#ifdef WITH_WEBAPP
- , assist $ webAppThread (Just st) dstatus scanremotes transferqueue transferslots Nothing webappwaiter
+ , assist $ webAppThread (Just st) dstatus scanremotes transferqueue transferslots urlrenderer Nothing webappwaiter
#ifdef WITH_PAIRING
- , assist $ pairListenerThread st dstatus
+ , assist $ pairListenerThread st dstatus urlrenderer
#endif
#endif
, assist $ pushThread st dstatus commitchan pushmap