Added remote.name.annex-web-options config

Which is a per-remote version of the annex.web-options config.

Had to plumb RemoteGitConfig through to getUrlOptions. In cases where a
special remote does not use curl, there was no need to do that and I used
Nothing instead.

In the case of the addurl and importfeed commands, it seemed best to say
that running these commands is not using the web special remote per se,
so the config is not used for those commands.
This commit is contained in:
Joey Hess 2025-04-01 10:17:38 -04:00
parent 932fac7772
commit e81fd72018
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
19 changed files with 152 additions and 99 deletions

View file

@ -404,6 +404,7 @@ data RemoteGitConfig = RemoteGitConfig
, remoteAnnexBwLimitUpload :: Maybe BwRate
, remoteAnnexBwLimitDownload :: Maybe BwRate
, remoteAnnexAllowUnverifiedDownloads :: Bool
, remoteAnnexWebOptions :: [String]
, remoteAnnexUUID :: Maybe UUID
, remoteAnnexConfigUUID :: Maybe UUID
, remoteAnnexMaxGitBundles :: Int
@ -492,6 +493,7 @@ extractRemoteGitConfig r remotename = do
readBwRatePerSecond =<< getmaybe BWLimitDownloadField
, remoteAnnexAllowUnverifiedDownloads = (== Just "ACKTHPPT") $
getmaybe SecurityAllowUnverifiedDownloadsField
, remoteAnnexWebOptions = getwords WebOptionsField
, remoteAnnexUUID = toUUID <$> getmaybe UUIDField
, remoteAnnexConfigUUID = toUUID <$> getmaybe ConfigUUIDField
, remoteAnnexMaxGitBundles =
@ -556,6 +558,7 @@ extractRemoteGitConfig r remotename = do
| B.null b -> Nothing
| otherwise -> Just (decodeBS b)
_ -> Nothing
getwords k = fromMaybe [] $ words <$> getmaybe k
data RemoteGitConfigField
= CostField
@ -588,6 +591,7 @@ data RemoteGitConfigField
| UUIDField
| ConfigUUIDField
| SecurityAllowUnverifiedDownloadsField
| WebOptionsField
| MaxGitBundlesField
| AllowEncryptedGitRepoField
| ProxyField
@ -656,6 +660,7 @@ remoteGitConfigField = \case
UUIDField -> uninherited True "uuid"
ConfigUUIDField -> uninherited True "config-uuid"
SecurityAllowUnverifiedDownloadsField -> inherited True "security-allow-unverified-downloads"
WebOptionsField -> inherited True "web-options"
MaxGitBundlesField -> inherited True "max-git-bundles"
AllowEncryptedGitRepoField -> inherited True "allow-encrypted-gitrepo"
-- Allow proxy chains.