split up xmpp and local pairing UIs
This commit is contained in:
parent
116023e05d
commit
b91f07fe83
7 changed files with 53 additions and 59 deletions
|
@ -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. -}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<div .span9 .hero-unit>
|
||||
<h2>
|
||||
Pairing with another computer
|
||||
<p>
|
||||
Pairing with a another computer combines both git-annex repositories #
|
||||
into a single shared repository, with changes kept in sync.
|
||||
$if localsupported
|
||||
<p>
|
||||
Is the computer you want to pair with located nearby, on the same #
|
||||
local network? (Or sharing a VPN?)
|
||||
<br>
|
||||
If so, the best choice is local pairing. #
|
||||
<a .btn .btn-primary .btn-small href="@{StartLocalPairR}">
|
||||
Start local pairing
|
||||
<p>
|
||||
Or, you can pair with any of your friends using jabber, or with another #
|
||||
computer that shares your jabber account.
|
||||
<p>
|
||||
$if xmppconfigured
|
||||
^{buddyListDisplay}
|
||||
$else
|
||||
First, you need to #
|
||||
<a .btn .btn-primary href="@{XMPPForPairingR}">
|
||||
configure a jabber account
|
11
templates/configurators/pairing/xmpp/prompt.hamlet
Normal file
11
templates/configurators/pairing/xmpp/prompt.hamlet
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div .span9 .hero-unit>
|
||||
<h2>
|
||||
Pairing with another computer
|
||||
<p>
|
||||
Pairing with a another computer combines both git-annex repositories #
|
||||
into a single shared repository, with changes kept in sync.
|
||||
<p>
|
||||
You can pair with any of your friends using jabber, or with another #
|
||||
computer that shares your own jabber account.
|
||||
<p>
|
||||
^{buddyListDisplay}
|
|
@ -10,11 +10,26 @@
|
|||
between computers.
|
||||
|
||||
<h3>
|
||||
<a href="@{StartPairR}">
|
||||
<i .icon-plus-sign></i> Pair with another computer
|
||||
<a href="@{StartLocalPairR}">
|
||||
<i .icon-plus-sign></i> Local computer
|
||||
<p>
|
||||
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.
|
||||
|
||||
<p>
|
||||
|
||||
For easy sharing with friends and devices in the same location.
|
||||
|
||||
<h3>
|
||||
<a href="@{StartXMPPPairR}">
|
||||
<i .icon-plus-sign></i> Share with a friend
|
||||
<p>
|
||||
Pair with a friend's computer, to combine your repositories and #
|
||||
share files.
|
||||
|
||||
<p>
|
||||
|
||||
For easy sharing with friends and devices, over the internet.
|
||||
|
||||
<h3>
|
||||
<i .icon-plus-sign></i> Phone
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
paired
|
||||
$else
|
||||
$if canpair
|
||||
<a .btn .btn-primary .btn-small href="@{StartXMPPPairR buddyid}">
|
||||
<a .btn .btn-primary .btn-small href="@{RunningXMPPPairR buddyid}">
|
||||
Start pairing
|
||||
$else
|
||||
not using git-annex
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue