From 2511c52d9452f60c533871ac111ba9473065310c Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 20 Nov 2021 02:30:20 +0100 Subject: make link adjustments configurable this allows for creating custom URI "schemas" in the linter's config, which may be either allowed, prefixed, or translated according to some (domain-based) substitution. --- lib/LintConfig.hs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lib/LintConfig.hs') diff --git a/lib/LintConfig.hs b/lib/LintConfig.hs index d976352..f540ae1 100644 --- a/lib/LintConfig.hs +++ b/lib/LintConfig.hs @@ -21,10 +21,10 @@ import Data.Text (Text) import GHC.Generics (Generic (Rep, from, to), K1 (..), M1 (..), (:*:) (..)) import Types (Level) +import Uris (SchemaSet) import WithCli (Proxy (..)) import WithCli.Pure (Argument (argumentType, parseArgument)) - type family HKD f a where HKD Identity a = a HKD f a = f a @@ -40,12 +40,7 @@ data LintConfig f = LintConfig -- ^ Don't copy map assets (mostly useful for development) , configAllowScripts :: HKD f Bool -- ^ Allow defining custom scripts in maps - , configLinkPrefix :: HKD f Text - -- ^ prefix that will be added to all outgoing weblinks - , configAllowedDomains :: HKD f [Text] - -- ^ domains that are allowed in weblinks and will not be modified - , configBlockedDomains :: HKD f [Text] - -- ^ domains that are blocked; weblinks to these is an error + , configUriSchemas :: HKD f SchemaSet } deriving (Generic) type LintConfig' = LintConfig Identity @@ -57,6 +52,7 @@ deriving instance , Show (HKD a Level) , Show (HKD a [Text]) , Show (HKD a Bool) + , Show (HKD a SchemaSet) ) => Show (LintConfig a) @@ -73,6 +69,7 @@ instance , FromJSON (HKD a Text) , FromJSON (HKD a Level) , FromJSON (HKD a Bool) + , FromJSON (HKD a SchemaSet) ) => FromJSON (LintConfig a) where -- cgit v1.2.3