added special camera repository to start screen for android
This commit is contained in:
parent
82b57b65cd
commit
33334bfe2e
5 changed files with 33 additions and 24 deletions
|
@ -138,13 +138,22 @@ getFirstRepositoryR :: Handler RepHtml
|
|||
getFirstRepositoryR = postFirstRepositoryR
|
||||
postFirstRepositoryR :: Handler RepHtml
|
||||
postFirstRepositoryR = page "Getting started" (Just Configuration) $ do
|
||||
#ifdef __ANDROID__
|
||||
androidspecial <- liftIO $ doesDirectoryExist "/sdcard/DCIM"
|
||||
let path = "/sdcard/annex"
|
||||
#else
|
||||
let androidspecial = False
|
||||
path <- liftIO . defaultRepositoryPath =<< lift inFirstRun
|
||||
#endif
|
||||
((res, form), enctype) <- lift $ runFormPost $ newRepositoryForm path
|
||||
case res of
|
||||
FormSuccess (RepositoryPath p) -> lift $
|
||||
startFullAssistant $ T.unpack p
|
||||
startFullAssistant (T.unpack p) ClientGroup
|
||||
_ -> $(widgetFile "configurators/newrepository/first")
|
||||
|
||||
getAndroidCameraRepositoryR :: Handler ()
|
||||
getAndroidCameraRepositoryR = startFullAssistant "/sdcard/DCIM" SourceGroup
|
||||
|
||||
{- Adding a new local repository, which may be entirely separate, or may
|
||||
- be connected to the current repository. -}
|
||||
getNewRepositoryR :: Handler RepHtml
|
||||
|
@ -299,14 +308,13 @@ driveList = return []
|
|||
{- Bootstraps from first run mode to a fully running assistant in a
|
||||
- repository, by running the postFirstRun callback, which returns the
|
||||
- url to the new webapp. -}
|
||||
startFullAssistant :: FilePath -> Handler ()
|
||||
startFullAssistant path = do
|
||||
startFullAssistant :: FilePath -> StandardGroup -> Handler ()
|
||||
startFullAssistant path group = do
|
||||
webapp <- getYesod
|
||||
url <- liftIO $ do
|
||||
isnew <- makeRepo path False
|
||||
u <- initRepo isnew True path Nothing
|
||||
inDir path $
|
||||
setStandardGroup u ClientGroup
|
||||
inDir path $ setStandardGroup u group
|
||||
addAutoStartFile path
|
||||
changeWorkingDirectory path
|
||||
fromJust $ postFirstRun webapp
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
/config/xmpp/needcloudrepo/#UUID NeedCloudRepoR GET
|
||||
|
||||
/config/addrepository AddRepositoryR GET
|
||||
/config/repository/new/first FirstRepositoryR GET POST
|
||||
/config/repository/new NewRepositoryR GET POST
|
||||
/config/repository/new/first FirstRepositoryR GET POST
|
||||
/config/repository/new/androidcamera AndroidCameraRepositoryR GET
|
||||
/config/repository/switcher RepositorySwitcherR GET
|
||||
/config/repository/switchto/#FilePath SwitchToRepositoryR GET
|
||||
/config/repository/combine/#FilePathAndUUID CombineRepositoryR GET
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue