viddl/src/Templates/Error.hs

27 lines
686 B
Haskell

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module Templates.Error (errorPage) where
import qualified Data.Text.Lazy as TL
import Text.RawString.QQ
import Text.HTML.SanitizeXSS
errorPage :: TL.Text -> TL.Text
errorPage msg = [r|
<!DOCTYPE html>
<head>
<meta cherset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>viddl</title>
</head>
<body>
<center>
<h1>viddl</h1>
<p>|] <> (TL.fromStrict (sanitize (TL.toStrict msg))) <> [r|</p>
<hr>
<p>viddl is free <a href="https://githug.xyz/depsterr/viddl">open source</a> software and is powered by <a href="https://yt-dl.org/">youtube-dl</a>.</p>
</center>
</body>
|]