rsync.net configurator display
Doesn't set up the repo yet.
This commit is contained in:
parent
6a45ca4658
commit
b584d96c13
4 changed files with 69 additions and 4 deletions
|
@ -42,10 +42,10 @@ data SshServer = SshServer
|
||||||
}
|
}
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
sshServerAForm :: Text -> AForm WebApp WebApp SshServer
|
sshServerAForm :: (Maybe Text) -> AForm WebApp WebApp SshServer
|
||||||
sshServerAForm localusername = SshServer
|
sshServerAForm localusername = SshServer
|
||||||
<$> aopt check_hostname "Host name" Nothing
|
<$> aopt check_hostname "Host name" Nothing
|
||||||
<*> aopt check_username "User name" (Just $ Just localusername)
|
<*> aopt check_username "User name" (Just localusername)
|
||||||
<*> aopt textField "Directory" (Just $ Just $ T.pack gitAnnexAssistantDefaultDir)
|
<*> aopt textField "Directory" (Just $ Just $ T.pack gitAnnexAssistantDefaultDir)
|
||||||
where
|
where
|
||||||
check_hostname = checkM (liftIO . checkdns) textField
|
check_hostname = checkM (liftIO . checkdns) textField
|
||||||
|
@ -83,7 +83,7 @@ getAddSshR = sshConfigurator $ do
|
||||||
u <- liftIO $ T.pack . userName
|
u <- liftIO $ T.pack . userName
|
||||||
<$> (getUserEntryForID =<< getEffectiveUserID)
|
<$> (getUserEntryForID =<< getEffectiveUserID)
|
||||||
((result, form), enctype) <- lift $
|
((result, form), enctype) <- lift $
|
||||||
runFormGet $ renderBootstrap $ sshServerAForm u
|
runFormGet $ renderBootstrap $ sshServerAForm (Just u)
|
||||||
case result of
|
case result of
|
||||||
FormSuccess sshserver -> do
|
FormSuccess sshserver -> do
|
||||||
(status, needspubkey) <- liftIO $ testServer sshserver
|
(status, needspubkey) <- liftIO $ testServer sshserver
|
||||||
|
@ -320,3 +320,24 @@ genSshKey sshdata = do
|
||||||
sshpubkeyfile = sshprivkeyfile ++ ".pub"
|
sshpubkeyfile = sshprivkeyfile ++ ".pub"
|
||||||
mangledhost = "git-annex-" ++ T.unpack (sshHostName sshdata) ++ user
|
mangledhost = "git-annex-" ++ T.unpack (sshHostName sshdata) ++ user
|
||||||
user = maybe "" (\u -> "-" ++ T.unpack u) (sshUserName sshdata)
|
user = maybe "" (\u -> "-" ++ T.unpack u) (sshUserName sshdata)
|
||||||
|
|
||||||
|
getAddRsyncNetR :: Handler RepHtml
|
||||||
|
getAddRsyncNetR = bootstrap (Just Config) $ do
|
||||||
|
sideBarDisplay
|
||||||
|
setTitle "Add a Rsync.net repository"
|
||||||
|
((result, form), enctype) <- lift $
|
||||||
|
runFormGet $ renderBootstrap $ sshServerAForm Nothing
|
||||||
|
let showform status = do
|
||||||
|
let authtoken = webAppFormAuthToken
|
||||||
|
$(widgetFile "configurators/addrsync.net")
|
||||||
|
case result of
|
||||||
|
FormSuccess sshserver -> do
|
||||||
|
let host = fromMaybe "" $ hostname sshserver
|
||||||
|
checkhost host showform $ do
|
||||||
|
error "TODO"
|
||||||
|
_ -> showform UntestedServer
|
||||||
|
where
|
||||||
|
checkhost host showform a
|
||||||
|
| ".rsync.net" `T.isSuffixOf` T.toLower host = a
|
||||||
|
| otherwise = showform $ UnusableServer
|
||||||
|
"That is not a rsync.net host name."
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
/config/repository/add/ssh/confirm/#SshData ConfirmSshR GET
|
/config/repository/add/ssh/confirm/#SshData ConfirmSshR GET
|
||||||
/config/repository/add/ssh/make/git/#SshData MakeSshGitR GET
|
/config/repository/add/ssh/make/git/#SshData MakeSshGitR GET
|
||||||
/config/repository/add/ssh/make/rsync/#SshData MakeSshRsyncR GET
|
/config/repository/add/ssh/make/rsync/#SshData MakeSshRsyncR GET
|
||||||
|
/config/repository/add/rsync.net AddRsyncNetR GET
|
||||||
/config/repository/first FirstRepositoryR GET
|
/config/repository/first FirstRepositoryR GET
|
||||||
|
|
||||||
/transfers/#NotificationId TransfersR GET
|
/transfers/#NotificationId TransfersR GET
|
||||||
|
|
43
templates/configurators/addrsync.net.hamlet
Normal file
43
templates/configurators/addrsync.net.hamlet
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<div .span9 .hero-unit>
|
||||||
|
<h2>
|
||||||
|
Adding a Rsync.net repository
|
||||||
|
<p>
|
||||||
|
<a href="http://rsync.net/">
|
||||||
|
Rsync.net #
|
||||||
|
is a well-respected cloud storage provider. Its rsync repositories are #
|
||||||
|
supported very well by git-annex. #
|
||||||
|
<a href="http://www.rsync.net/products/pricing.html">
|
||||||
|
pricing details
|
||||||
|
<p>
|
||||||
|
$case status
|
||||||
|
$of UnusableServer msg
|
||||||
|
<div .alert .alert-error>
|
||||||
|
<i .icon-warning-sign></i> #{msg}
|
||||||
|
$of _
|
||||||
|
<i .icon-warning-sign></i> #
|
||||||
|
All your data will be synced to the Rsync.net repository, so make #
|
||||||
|
sure it has enough available space. Your data will be encrypted before #
|
||||||
|
it is sent to Rsync.net.
|
||||||
|
<p>
|
||||||
|
When you sign up for a Rsync.net account, you receive an #
|
||||||
|
email from them with a host name and a username. Fill that #
|
||||||
|
information in below. You also likely don't want to use your whole #
|
||||||
|
rsync.net repository for git-annex alone, so git-annex will use a #
|
||||||
|
subdirectory of it, as configured below.
|
||||||
|
<p>
|
||||||
|
<form .form-horizontal enctype=#{enctype}>
|
||||||
|
<fieldset>
|
||||||
|
^{form}
|
||||||
|
^{authtoken}
|
||||||
|
<div .form-actions>
|
||||||
|
<button .btn .btn-primary type=submit onclick="$('#testmodal').modal('show');">
|
||||||
|
Use this rsync.net repository
|
||||||
|
<div .modal .fade #testmodal>
|
||||||
|
<div .modal-header>
|
||||||
|
<h3>
|
||||||
|
Making repository ...
|
||||||
|
<div .modal-body>
|
||||||
|
<p>
|
||||||
|
Setting up your rsync.net repository. This could take a minute.
|
||||||
|
<p>
|
||||||
|
You may be prompted for your rsync.net password.
|
|
@ -5,5 +5,5 @@
|
||||||
<a href="@{RepositoriesR}">
|
<a href="@{RepositoriesR}">
|
||||||
Manage repositories
|
Manage repositories
|
||||||
<p>
|
<p>
|
||||||
Distribute the files in this repository to other devices,
|
Distribute the files in this repository to other devices, #
|
||||||
make backups, and more, by adding repositories.
|
make backups, and more, by adding repositories.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue