diff --git a/Assistant/WebApp/Configurators/Pairing.hs b/Assistant/WebApp/Configurators/Pairing.hs index 6ac48f3f16..964b28ab90 100644 --- a/Assistant/WebApp/Configurators/Pairing.hs +++ b/Assistant/WebApp/Configurators/Pairing.hs @@ -55,34 +55,29 @@ import Control.Concurrent import qualified Data.Set as S #endif -{- Starts either kind of pairing. -} -getStartPairR :: Handler RepHtml +getStartXMPPPairR :: Handler RepHtml #ifdef WITH_XMPP -getStartPairR = do - xmppconfigured <- isJust <$> runAnnex Nothing getXMPPCreds -#ifdef WITH_PAIRING - let localsupported = True +getStartXMPPPairR = ifM (isJust <$> runAnnex Nothing getXMPPCreds) + ( do + {- Ask buddies to send presence info, to get + - the buddy list populated. -} + liftAssistant $ sendNetMessage QueryPresence + pairPage $ + $(widgetFile "configurators/pairing/xmpp/prompt") + , redirect XMPPForPairingR -- go get XMPP configured, then come back + ) #else - let localsupported = False -#endif - {- Ask buddies to send presence info, to get the buddy list - - populated. -} - liftAssistant $ sendNetMessage QueryPresence - pairPage $ - $(widgetFile "configurators/pairing/start") -#else -#ifdef WITH_PAIRING -getStartPairR = redirect StartLocalPairR -#else -getStartPairR = noPairing "local or jabber" -#endif +getStartXMPPPairR = noXMPPPairing + +noXMPPPairing :: Handler RepHtml +noXMPPPairing = noPairing "XMPP" #endif -{- Starts pairing with an XMPP buddy, or with other clients sharing an +{- Does pairing with an XMPP buddy, or with other clients sharing an - XMPP account. -} -getStartXMPPPairR :: BuddyKey -> Handler RepHtml +getRunningXMPPPairR :: BuddyKey -> Handler RepHtml #ifdef WITH_XMPP -getStartXMPPPairR bid = do +getRunningXMPPPairR bid = do buddy <- liftAssistant $ getBuddy bid <<~ buddyList go $ S.toList . buddyAssistants <$> buddy where @@ -97,12 +92,9 @@ getStartXMPPPairR bid = do xmppPairEnd True $ if samejid then Nothing else Just exemplar -- A buddy could have logged out, or the XMPP client restarted, -- and there be no clients to message; handle unforseen by going back. - go _ = redirect StartPairR + go _ = redirect StartXMPPPairR #else -getStartXMPPPairR _ = noXMPPPairing - -noXMPPPairing :: Handler RepHtml -noXMPPPairing = noPairing "XMPP" +getRunningXMPPPairR _ = noXMPPPairing #endif {- Starts local pairing. -} diff --git a/Assistant/WebApp/Configurators/XMPP.hs b/Assistant/WebApp/Configurators/XMPP.hs index 9d26f58e16..8cef1f9db9 100644 --- a/Assistant/WebApp/Configurators/XMPP.hs +++ b/Assistant/WebApp/Configurators/XMPP.hs @@ -57,7 +57,7 @@ getXMPPR = xmppPage $ getXMPPForPairingR :: Handler RepHtml #ifdef WITH_XMPP -getXMPPForPairingR = getXMPPR' StartPairR +getXMPPForPairingR = getXMPPR' StartXMPPPairR #else getXMPPForPairingR = xmppPage $ $(widgetFile "configurators/xmpp/disabled") diff --git a/Assistant/WebApp/routes b/Assistant/WebApp/routes index d802154d79..1af4eb8708 100644 --- a/Assistant/WebApp/routes +++ b/Assistant/WebApp/routes @@ -26,11 +26,11 @@ /config/repository/add/cloud/rsync.net AddRsyncNetR GET /config/repository/add/cloud/S3 AddS3R GET -/config/repository/pair/start StartPairR GET /config/repository/pair/local/start StartLocalPairR GET /config/repository/pair/local/running/#SecretReminder RunningLocalPairR GET /config/repository/pair/local/finish/#PairMsg FinishLocalPairR GET -/config/repository/pair/xmpp/start/#BuddyKey StartXMPPPairR GET +/config/repository/pair/xmpp/start StartXMPPPairR GET +/config/repository/pair/xmpp/running/#BuddyKey RunningXMPPPairR GET /config/repository/pair/xmpp/finish/#PairKey FinishXMPPPairR GET /config/repository/enable/rsync/#UUID EnableRsyncR GET diff --git a/templates/configurators/pairing/start.hamlet b/templates/configurators/pairing/start.hamlet deleted file mode 100644 index 9f2930b973..0000000000 --- a/templates/configurators/pairing/start.hamlet +++ /dev/null @@ -1,24 +0,0 @@ -
-

- Pairing with another computer -

- Pairing with a another computer combines both git-annex repositories # - into a single shared repository, with changes kept in sync. - $if localsupported -

- Is the computer you want to pair with located nearby, on the same # - local network? (Or sharing a VPN?) -
- If so, the best choice is local pairing. # - - Start local pairing -

- Or, you can pair with any of your friends using jabber, or with another # - computer that shares your jabber account. -

- $if xmppconfigured - ^{buddyListDisplay} - $else - First, you need to # - - configure a jabber account diff --git a/templates/configurators/pairing/xmpp/prompt.hamlet b/templates/configurators/pairing/xmpp/prompt.hamlet new file mode 100644 index 0000000000..9f52d6b15d --- /dev/null +++ b/templates/configurators/pairing/xmpp/prompt.hamlet @@ -0,0 +1,11 @@ +

+

+ Pairing with another computer +

+ Pairing with a another computer combines both git-annex repositories # + into a single shared repository, with changes kept in sync. +

+ You can pair with any of your friends using jabber, or with another # + computer that shares your own jabber account. +

+ ^{buddyListDisplay} diff --git a/templates/configurators/repositories/misc.hamlet b/templates/configurators/repositories/misc.hamlet index dfcd6cb2e2..4b75105986 100644 --- a/templates/configurators/repositories/misc.hamlet +++ b/templates/configurators/repositories/misc.hamlet @@ -10,11 +10,26 @@ between computers.

- - Pair with another computer + + Local computer

- Connect with another computer used by you, or by a friend, - that is also running git-annex. + Pair with a computer to automatically keep files in sync + over your local network. + +

+ + For easy sharing with friends and devices in the same location. + +

+ + Share with a friend +

+ Pair with a friend's computer, to combine your repositories and # + share files. + +

+ + For easy sharing with friends and devices, over the internet.

Phone diff --git a/templates/configurators/xmpp/buddylist.hamlet b/templates/configurators/xmpp/buddylist.hamlet index d978eb004a..348b5299f5 100644 --- a/templates/configurators/xmpp/buddylist.hamlet +++ b/templates/configurators/xmpp/buddylist.hamlet @@ -25,7 +25,7 @@ paired $else $if canpair - + Start pairing $else not using git-annex