feat(users/Profpatsch/whatcd-resolver): use stylize CSS
Gets rid of the giant bootstrap dependency and replaces it with a little CSS file that formats our table nicely. Change-Id: I3e0bb552481503679e7b229c4feaa4e9805f5eae Reviewed-on: https://cl.tvl.fyi/c/depot/+/13269 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
parent
18f565567a
commit
10c8f3386b
2 changed files with 21 additions and 17 deletions
|
|
@ -26,6 +26,14 @@ caseE2 m e2 = do
|
|||
E21 a -> f1 $ getField @l1 a
|
||||
E22 b -> f2 $ getField @l2 b
|
||||
|
||||
e21 :: forall l1 t1 l2 t2. LabelPrx l1 -> t1 -> E2 l1 t1 l2 t2
|
||||
{-# INLINE e21 #-}
|
||||
e21 LabelPrx a = E21 (label @l1 a)
|
||||
|
||||
e22 :: forall l1 t1 l2 t2. LabelPrx l2 -> t2 -> E2 l1 t1 l2 t2
|
||||
{-# INLINE e22 #-}
|
||||
e22 LabelPrx b = E22 (label @l2 b)
|
||||
|
||||
t2 :: forall l1 t1 l2 t2. LabelPrx l1 -> t1 -> LabelPrx l2 -> t2 -> T2 l1 t1 l2 t2
|
||||
{-# INLINE t2 #-}
|
||||
t2 LabelPrx a LabelPrx b = T2 (label @l1 a) (label @l2 b)
|
||||
|
|
|
|||
|
|
@ -515,20 +515,13 @@ prefetchHtmlIntegrities :: (MonadOtel m, MonadThrow m) => m (OurHtmlIntegrities
|
|||
prefetchHtmlIntegrities = do
|
||||
let resources =
|
||||
[ HtmlIntegrity
|
||||
{ integrityName = "Bootstrap CSS",
|
||||
integrityUrl = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css",
|
||||
integrityHash = "sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM",
|
||||
localPath = "resources/bootstrap.min.css",
|
||||
provideSourceMap = True,
|
||||
isTag = E21 (label @"link" ())
|
||||
},
|
||||
HtmlIntegrity
|
||||
{ integrityName = "Bootstrap JS",
|
||||
integrityUrl = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js",
|
||||
integrityHash = "sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz",
|
||||
localPath = "resources/bootstrap.bundle.min.js",
|
||||
provideSourceMap = True,
|
||||
isTag = E22 (label @"script" ())
|
||||
{ integrityName = "Stylize CSS",
|
||||
integrityUrl = "https://raw.githubusercontent.com/vasanthv/stylize.css/master/stylize.css",
|
||||
integrityHash = "sha384-EsaVGfq7QMIquv7LCLomD9pQFZbPh2fOY3gcgN9MW/AlV2aQk/miZ1/EbrcwMr67",
|
||||
localPath = "resources/stylize.css",
|
||||
provideSourceMap = False,
|
||||
isTag = e21 #link (),
|
||||
ignoreUpstreamContentType = True
|
||||
},
|
||||
HtmlIntegrity
|
||||
{ integrityName = "htmx",
|
||||
|
|
@ -536,7 +529,8 @@ prefetchHtmlIntegrities = do
|
|||
integrityHash = "sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h",
|
||||
localPath = "resources/htmx.js",
|
||||
provideSourceMap = False,
|
||||
isTag = E22 (label @"script" ())
|
||||
isTag = e22 #script (),
|
||||
ignoreUpstreamContentType = False
|
||||
}
|
||||
]
|
||||
resources
|
||||
|
|
@ -1425,7 +1419,9 @@ data HtmlIntegrity = HtmlIntegrity
|
|||
-- | Whether there is a resource map at the URL + `.map`
|
||||
provideSourceMap :: Bool,
|
||||
-- | is @<link>@ or @<script>@ tag?
|
||||
isTag :: E2 "link" () "script" ()
|
||||
isTag :: E2 "link" () "script" (),
|
||||
-- | ignore upstream content type
|
||||
ignoreUpstreamContentType :: Bool
|
||||
}
|
||||
|
||||
-- | Fetch a resource, calculate its integrity hash, and return a html @<link>@ snippet and a handler to return the resource.
|
||||
|
|
@ -1504,7 +1500,7 @@ prefetchResourceIntegrity dat = inSpan' [fmt|prefetching resource {dat.integrity
|
|||
Wai.responseLBS
|
||||
Http.ok200
|
||||
[ ( "Content-Type",
|
||||
mContentType
|
||||
(if dat.ignoreUpstreamContentType then mempty else mContentType)
|
||||
& fromMaybe
|
||||
( tagMatch
|
||||
#script
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue