summaryrefslogtreecommitdiff
path: root/Assistant/WebApp.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/WebApp.hs')
-rw-r--r--Assistant/WebApp.hs21
1 files changed, 19 insertions, 2 deletions
diff --git a/Assistant/WebApp.hs b/Assistant/WebApp.hs
index 64dcd48e3..c8eaeecf0 100644
--- a/Assistant/WebApp.hs
+++ b/Assistant/WebApp.hs
@@ -15,6 +15,7 @@ import Assistant.ThreadedMonad
import Assistant.DaemonStatus
import Utility.NotificationBroadcaster
import Utility.Yesod
+import Locations.UserConfig
import Yesod
import Text.Hamlet
@@ -65,8 +66,11 @@ bootstrap navbaritem content = do
navdetails i = (navBarName i, navBarRoute i, Just i == navbaritem)
newWebAppState :: IO (TMVar WebAppState)
-newWebAppState = liftIO $ atomically $
- newTMVar $ WebAppState { showIntro = True }
+newWebAppState = do
+ otherrepos <- listOtherRepos
+ atomically $ newTMVar $ WebAppState
+ { showIntro = True
+ , otherRepos = otherrepos }
getWebAppState :: forall sub. GHandler sub WebApp WebAppState
getWebAppState = liftIO . atomically . readTMVar =<< webAppState <$> getYesod
@@ -139,3 +143,16 @@ redirectBack = do
clearUltDest
setUltDestReferer
redirectUltDest HomeR
+
+{- List of other known repsitories, and link to add a new one. -}
+otherReposWidget :: Widget
+otherReposWidget = do
+ repolist <- lift $ otherRepos <$> getWebAppState
+ $(widgetFile "otherrepos")
+
+listOtherRepos :: IO [(String, String)]
+listOtherRepos = do
+ f <- autoStartFile
+ dirs <- ifM (doesFileExist f) ( lines <$> readFile f, return [])
+ names <- mapM relHome dirs
+ return $ sort $ zip names dirs