Compare commits

...

2 Commits

Author SHA1 Message Date
rhiannon morris 1e7a58359d make default cw less cryptic 2022-12-26 20:09:25 +01:00
rhiannon morris 3c04976d1a large previews for some sites
unless they need oembed (glares at mastodon), which requires
the ability to resize images on the fly. lol. lmao
2022-12-26 20:07:38 +01:00
1 changed files with 17 additions and 6 deletions

View File

@ -9,7 +9,7 @@ import qualified NsfwWarning
import Control.Exception
import Control.Monad
import Data.List (sort, intersperse)
import Data.Maybe (fromMaybe)
import Data.Maybe (fromMaybe, isNothing)
import qualified Data.Text as Strict
import qualified Data.Text.Lazy as Lazy
import System.FilePath (joinPath, splitPath)
@ -71,8 +71,10 @@ make' root siteName prefix nsfw _dataDir dir
</figcaption>
|]
let defWarning = "oops i forgot to put one, sorry!<br>\
\if you can let me know i'd appreciate it" :: Text
let defWarning = [b|
i forgot to add a cw, sorry! <br>
if you can let me know i'd appreciate it
|]
let warning'
| Just w <- #warning image0 = makeWarning w
| #nsfw image0 = makeWarning defWarning
@ -97,6 +99,16 @@ make' root siteName prefix nsfw _dataDir dir
let nsfwScript = NsfwWarning.script nsfw'
let nsfwDialog = NsfwWarning.dialog nsfw'
let imageMeta =
if #sfw image0 && isNothing (#warning image0) then [b|@0
<meta property=og:image content="$url/$path0'">
<meta name=twitter:card content=summary_large_image>
<meta name=twitter:image content="$url/$path0'">
|] else [b|@0
<meta property=og:image content="$url/$thumb">
<meta name=twitter:card content=summary>
|]
pure [b|@0
<!DOCTYPE html>
<html lang=en>
@ -105,14 +117,13 @@ make' root siteName prefix nsfw _dataDir dir
<link rel=stylesheet href=/style/shiny/single.css>
<link rel=icon href=/style/niss.svg>
<meta property=og:type content=og:website>
<meta property=og:type content=article>
<meta property=og:title content="$title">
<meta property=og:site_name content="$siteName">
<meta property=og:description content="$desc">
<meta property=og:image content="$url/$thumb">
<meta property=og:url content="$url">
<meta name=twitter:site content=@2_gecs>
<meta name=twitter:card content=summary>
$imageMeta
<meta name=robots content='noai,noimageai'>