webapp: Encryption can be disabled when setting up remotes.
This commit is contained in:
parent
cf999689f7
commit
c9fd389fbf
7 changed files with 31 additions and 9 deletions
|
@ -52,6 +52,7 @@ data AWSInput = AWSInput
|
|||
-- Only used for S3, not Glacier.
|
||||
, storageClass :: StorageClass
|
||||
, repoName :: Text
|
||||
, enableEncryption :: EnableEncryption
|
||||
}
|
||||
|
||||
data AWSCreds = AWSCreds Text Text
|
||||
|
@ -66,6 +67,7 @@ s3InputAForm = AWSInput
|
|||
<*> datacenterField AWS.S3
|
||||
<*> areq (selectFieldList storageclasses) "Storage class" (Just StandardRedundancy)
|
||||
<*> areq textField "Repository name" (Just "S3")
|
||||
<*> enableEncryptionField
|
||||
where
|
||||
storageclasses :: [(Text, StorageClass)]
|
||||
storageclasses =
|
||||
|
@ -80,6 +82,7 @@ glacierInputAForm = AWSInput
|
|||
<*> datacenterField AWS.Glacier
|
||||
<*> pure StandardRedundancy
|
||||
<*> areq textField "Repository name" (Just "glacier")
|
||||
<*> enableEncryptionField
|
||||
|
||||
awsCredsAForm :: AForm WebApp WebApp AWSCreds
|
||||
awsCredsAForm = AWSCreds
|
||||
|
@ -112,7 +115,7 @@ getAddS3R = awsConfigurator $ do
|
|||
FormSuccess input -> lift $ do
|
||||
let name = T.unpack $ repoName input
|
||||
makeAWSRemote S3.remote (extractCreds input) name setgroup $ M.fromList
|
||||
[ ("encryption", "shared")
|
||||
[ configureEncryption $ enableEncryption input
|
||||
, ("type", "S3")
|
||||
, ("datacenter", T.unpack $ datacenter input)
|
||||
, ("storageclass", show $ storageClass input)
|
||||
|
@ -133,7 +136,7 @@ getAddGlacierR = glacierConfigurator $ do
|
|||
FormSuccess input -> lift $ do
|
||||
let name = T.unpack $ repoName input
|
||||
makeAWSRemote Glacier.remote (extractCreds input) name setgroup $ M.fromList
|
||||
[ ("encryption", "shared")
|
||||
[ configureEncryption $ enableEncryption input
|
||||
, ("type", "glacier")
|
||||
, ("datacenter", T.unpack $ datacenter input)
|
||||
]
|
||||
|
|
|
@ -36,6 +36,7 @@ data WebDAVInput = WebDAVInput
|
|||
, password :: Text
|
||||
, embedCreds :: Bool
|
||||
, directory :: Text
|
||||
, enableEncryption :: EnableEncryption
|
||||
}
|
||||
|
||||
toCredPair :: WebDAVInput -> CredPair
|
||||
|
@ -47,6 +48,7 @@ boxComAForm = WebDAVInput
|
|||
<*> areq passwordField "Box.com Password" Nothing
|
||||
<*> areq checkBoxField "Share this account with friends?" (Just True)
|
||||
<*> areq textField "Directory" (Just "annex")
|
||||
<*> enableEncryptionField
|
||||
|
||||
webDAVCredsAForm :: AForm WebApp WebApp WebDAVInput
|
||||
webDAVCredsAForm = WebDAVInput
|
||||
|
@ -54,6 +56,7 @@ webDAVCredsAForm = WebDAVInput
|
|||
<*> areq passwordField "Password" Nothing
|
||||
<*> pure False
|
||||
<*> pure T.empty
|
||||
<*> pure NoEncryption -- not used!
|
||||
|
||||
getAddBoxComR :: Handler RepHtml
|
||||
#ifdef WITH_WEBDAV
|
||||
|
@ -63,7 +66,7 @@ getAddBoxComR = boxConfigurator $ do
|
|||
case result of
|
||||
FormSuccess input -> lift $
|
||||
makeWebDavRemote "box.com" (toCredPair input) setgroup $ M.fromList
|
||||
[ ("encryption", "shared")
|
||||
[ configureEncryption $ enableEncryption input
|
||||
, ("embedcreds", if embedCreds input then "yes" else "no")
|
||||
, ("type", "webdav")
|
||||
, ("url", "https://www.box.com/dav/" ++ T.unpack (directory input))
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
module Assistant.WebApp.Form where
|
||||
|
||||
import Types.Remote (RemoteConfigKey)
|
||||
|
||||
import Yesod hiding (textField, passwordField)
|
||||
import Yesod.Form.Fields as F
|
||||
import Data.Text (Text)
|
||||
|
@ -42,3 +44,22 @@ withNote field note = field { fieldView = newview }
|
|||
newview theId name attrs val isReq =
|
||||
let fieldwidget = (fieldView field) theId name attrs val isReq
|
||||
in [whamlet|^{fieldwidget} <span>^{note}</span>|]
|
||||
|
||||
|
||||
data EnableEncryption = SharedEncryption | NoEncryption
|
||||
deriving (Eq)
|
||||
|
||||
{- Adds a check box to an AForm to control encryption. -}
|
||||
enableEncryptionField :: RenderMessage master FormMessage => AForm sub master EnableEncryption
|
||||
enableEncryptionField = areq (selectFieldList choices) "Encryption" (Just SharedEncryption)
|
||||
where
|
||||
choices :: [(Text, EnableEncryption)]
|
||||
choices =
|
||||
[ ("Encrypt all data", SharedEncryption)
|
||||
, ("Disable encryption", NoEncryption)
|
||||
]
|
||||
|
||||
{- Generates Remote configuration for encryption. -}
|
||||
configureEncryption :: EnableEncryption -> (RemoteConfigKey, String)
|
||||
configureEncryption SharedEncryption = ("encryption", "shared")
|
||||
configureEncryption NoEncryption = ("encryption", "none")
|
||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -19,6 +19,7 @@ git-annex (3.20121128) UNRELEASED; urgency=low
|
|||
* webapp: Fix bad interaction between required fields and modals.
|
||||
* webapp: Added help buttons and links next to fields that require
|
||||
explanations.
|
||||
* webapp: Encryption can be disabled when setting up remotes.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Wed, 28 Nov 2012 13:31:07 -0400
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
<p>
|
||||
Even a small amount of free storage is useful, as a transfer point #
|
||||
between your repositories.
|
||||
<p>
|
||||
All data will be encrypted before being sent to Box.com.
|
||||
<p>
|
||||
<form .form-horizontal enctype=#{enctype}>
|
||||
<fieldset>
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
monthly fee for data storage. #
|
||||
<a href="http://aws.amazon.com/glacier/pricing/">
|
||||
Pricing details
|
||||
<p>
|
||||
All data will be encrypted before being sent to Amazon Glacier.
|
||||
<p>
|
||||
<form .form-horizontal enctype=#{enctype}>
|
||||
<fieldset>
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
for data storage. #
|
||||
<a href="http://aws.amazon.com/s3/pricing/">
|
||||
Pricing details, including one year Free Usage Tier promotion
|
||||
<p>
|
||||
All data will be encrypted before being sent to Amazon S3.
|
||||
<p>
|
||||
<form .form-horizontal enctype=#{enctype}>
|
||||
<fieldset>
|
||||
|
|
Loading…
Reference in a new issue