subdomain svg correction

This commit is contained in:
Levi Neuwirth 2026-04-13 10:26:25 -04:00
parent 93d909893d
commit e005380362
4 changed files with 11 additions and 8 deletions

View File

@ -76,18 +76,21 @@ isInternalPage url
| "https://" `T.isPrefixOf` url = False | "https://" `T.isPrefixOf` url = False
| otherwise = True | otherwise = True
-- | True if the URL points outside the site's domain. -- | True if the URL points outside the site's content host.
-- --
-- Uses a strict hostname comparison rather than substring matching, so -- Only @levineuwirth.org@ and @www.levineuwirth.org@ count as the content
-- that a hostile lookalike like @evil-levineuwirth.org.attacker.com@ is -- site itself. Sibling subdomains like @git.levineuwirth.org@ (Forgejo) are
-- correctly classified as external (and gets @rel=noopener noreferrer@ -- distinct services and are classified as external so they receive their
-- plus @target=_blank@ applied). -- brand icon, @target=_blank@, and @rel=noopener noreferrer@.
--
-- Uses strict hostname comparison rather than substring matching, so a
-- hostile lookalike like @evil-levineuwirth.org.attacker.com@ is also
-- correctly classified as external.
isExternal :: Text -> Bool isExternal :: Text -> Bool
isExternal url = isExternal url =
case extractHost url of case extractHost url of
Nothing -> False Nothing -> False
Just host -> Just host -> host /= siteHost && host /= "www." <> siteHost
not (host == siteHost || ("." <> siteHost) `T.isSuffixOf` host)
where where
siteHost = "levineuwirth.org" siteHost = "levineuwirth.org"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB