From 0a400a801c029aeb9401e082e2835714a9f5d960 Mon Sep 17 00:00:00 2001
From: outfoxxed <outfoxxed@outfoxxed.me>
Date: Mon, 10 Feb 2025 23:17:45 -0800
Subject: [PATCH] don't parse plausible tokens as utf8

They'll always be ascii
---
 blog-proxy.cabal      | 1 -
 src/PlausibleQuery.hs | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/blog-proxy.cabal b/blog-proxy.cabal
index dc1a7e4..5980c28 100644
--- a/blog-proxy.cabal
+++ b/blog-proxy.cabal
@@ -17,7 +17,6 @@ executable blog-proxy
   build-depends:
     base ^>= 4.18.2.0,
     bytestring ^>= 0.11.5.0,
-    utf8-string ^>= 1.0.0,
     text ^>= 2.0.0,
     split ^>= 0.2.5,
     containers ^>= 0.6.7,
diff --git a/src/PlausibleQuery.hs b/src/PlausibleQuery.hs
index c698ffc..de1dfc4 100644
--- a/src/PlausibleQuery.hs
+++ b/src/PlausibleQuery.hs
@@ -5,7 +5,7 @@ module PlausibleQuery (queryPageviewsLoop) where
 
 import GHC.Generics (Generic)
 import Data.Map (Map)
-import qualified Data.ByteString.UTF8 as BS.UTF8
+import qualified Data.ByteString.Char8 as BS.Char8
 import qualified Data.Map as Map
 import qualified Data.Aeson as JSON
 import Data.Aeson (FromJSON, (.=))
@@ -34,7 +34,7 @@ queryPageviews :: C.Config -> IO (Either String (Map String Int))
 queryPageviews config = do
   request' <- H.parseRequest $ "POST " ++ C.queryUrl (C.plausible config)
   let request
-        = H.addRequestHeader H.hAuthorization (BS.UTF8.fromString $ "Bearer " ++ C.token (C.plausible config))
+        = H.addRequestHeader H.hAuthorization (BS.Char8.pack $ "Bearer " ++ C.token (C.plausible config))
         $ H.setRequestBodyJSON
             (JSON.object [
               "site_id" .= C.siteId (C.plausible config),