import Utility.Verifiable
#endif
import Utility.UserInfo
+import Utility.Tor
import qualified Utility.MagicWormhole as Wormhole
import Git
postStartTorPairSelfR = postStartTorPairR PairingWithSelf
postStartTorPairR :: PairingWith -> Handler Html
-postStartTorPairR pairingwith = pairPage $ do
- let Just ourcode = Wormhole.mkCode "11-bannana-bananna" -- XXX tmp
- ((result, form), enctype) <- liftH $
- runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $
- areq wormholeCodeField (bfs codeprompt) Nothing
- case result of
- FormSuccess v -> error "TODO"
- _ -> showform form enctype ourcode
+postStartTorPairR pairingwith = whenTorInstalled $ whenWormholeInstalled $
+ pairPage $ do
+ let Just ourcode = Wormhole.mkCode "11-bannana-bananna" -- XXX tmp
+ ((result, form), enctype) <- liftH $
+ runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $
+ areq wormholeCodeField (bfs codeprompt) Nothing
+ case result of
+ FormSuccess v -> error "TODO"
+ _ -> showform form enctype ourcode
where
showform form enctype ourcode = $(widgetFile "configurators/pairing/tor/prompt")
codeprompt = case pairingwith of
("That does not look like a valid pairing code. Try again..." :: T.Text)
textField
+whenTorInstalled :: Handler Html -> Handler Html
+whenTorInstalled a = ifM (liftIO torIsInstalled)
+ ( a
+ , page "Need Tor" (Just Configuration) $
+ $(widgetFile "configurators/needtor")
+ )
+
+whenWormholeInstalled :: Handler Html -> Handler Html
+whenWormholeInstalled a = ifM (liftIO Wormhole.isInstalled)
+ ( a
+ , page "Need Magic Wormhole" (Just Configuration) $
+ $(widgetFile "configurators/needmagicwormhole")
+ )
+
{- Starts local pairing. -}
getStartLocalPairR :: Handler Html
getStartLocalPairR = postStartLocalPairR
templates/configurators/rsync.net/encrypt.hamlet
templates/configurators/gitlab.com/add.hamlet
templates/configurators/needgcrypt.hamlet
+ templates/configurators/needtor.hamlet
+ templates/configurators/needmagicwormhole.hamlet
templates/configurators/enabledirectory.hamlet
templates/configurators/fsck/status.hamlet
templates/configurators/fsck/form.hamlet