webapp: When setting up a ssh remote, if the user inputs ~/foo, normalize that to foo, since it's in the home directory by default.
This commit is contained in:
parent
dd5ac19b39
commit
a41ddabd73
3 changed files with 19 additions and 7 deletions
|
@ -91,14 +91,16 @@ sshInputAForm :: Field Handler Text -> SshInput -> AForm Handler SshInput
|
|||
#else
|
||||
sshInputAForm :: Field WebApp WebApp Text -> SshInput -> AForm WebApp WebApp SshInput
|
||||
#endif
|
||||
sshInputAForm hostnamefield def = SshInput
|
||||
<$> aopt check_hostname (bfs "Host name") (Just $ inputHostname def)
|
||||
<*> aopt check_username (bfs "User name") (Just $ inputUsername def)
|
||||
<*> areq (selectFieldList authmethods) (bfs "Authenticate with") (Just $ inputAuthMethod def)
|
||||
<*> aopt passwordField (bfs "Password") Nothing
|
||||
<*> aopt textField (bfs "Directory") (Just $ Just $ fromMaybe (T.pack gitAnnexAssistantDefaultDir) $ inputDirectory def)
|
||||
<*> areq intField (bfs "Port") (Just $ inputPort def)
|
||||
sshInputAForm hostnamefield def = normalize <$> gen
|
||||
where
|
||||
gen = SshInput
|
||||
<$> aopt check_hostname (bfs "Host name") (Just $ inputHostname def)
|
||||
<*> aopt check_username (bfs "User name") (Just $ inputUsername def)
|
||||
<*> areq (selectFieldList authmethods) (bfs "Authenticate with") (Just $ inputAuthMethod def)
|
||||
<*> aopt passwordField (bfs "Password") Nothing
|
||||
<*> aopt textField (bfs "Directory") (Just $ Just $ fromMaybe (T.pack gitAnnexAssistantDefaultDir) $ inputDirectory def)
|
||||
<*> areq intField (bfs "Port") (Just $ inputPort def)
|
||||
|
||||
authmethods :: [(Text, AuthMethod)]
|
||||
authmethods =
|
||||
[ ("password", Password)
|
||||
|
@ -129,6 +131,12 @@ sshInputAForm hostnamefield def = SshInput
|
|||
check_hostname = hostnamefield -- unchecked
|
||||
#endif
|
||||
|
||||
-- The directory is implicitly in home, so remove any leading ~/
|
||||
normalize i = i { inputDirectory = normalizedir <$> inputDirectory i }
|
||||
normalizedir d
|
||||
| "~/" `T.isPrefixOf` d = T.drop 2 d
|
||||
| otherwise = d
|
||||
|
||||
data ServerStatus
|
||||
= UntestedServer
|
||||
| UnusableServer Text -- reason why it's not usable
|
||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -17,6 +17,8 @@ git-annex (5.20140518) UNRELEASED; urgency=medium
|
|||
unicode characters to 8 bits. Allow any encoding to be used, as with
|
||||
filenames (but utf8 is the sane choice). Affects metadata and repository
|
||||
descriptions, and preferred content expressions.
|
||||
* webapp: When setting up a ssh remote, if the user inputs ~/foo,
|
||||
normalize that to foo, since it's in the home directory by default.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Mon, 19 May 2014 15:59:25 -0400
|
||||
|
||||
|
|
|
@ -33,3 +33,5 @@ ok external
|
|||
|
||||
# End of transcript or log.
|
||||
"""]]
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
Loading…
Add table
Reference in a new issue