diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2026-06-28 20:03:58 +0200 |
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2026-06-28 20:03:58 +0200 |
| commit | c257e36ab92460b36879f9a8fdef99ff722b2695 (patch) | |
| tree | b1b4b87000425b9914946047dea4a36e6c656f5a /src/Main.hs | |
| parent | c96197768cb830e103764843b1f4f00013e349ab (diff) | |
Diffstat (limited to 'src/Main.hs')
| -rw-r--r-- | src/Main.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Main.hs b/src/Main.hs index cb4e1fb..78098af 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -140,10 +140,11 @@ pageCalendarDay conf index req alias datestr = (Nothing, _) -> sendText404 "Channel not found" (_, Nothing) -> sendText404 "Invalid date" (Just chan, Just day) -> do - let kind = case query req "ef" of - Just "all" -> CKAll - Just "compr" -> CKCompressed - _ -> CKAll + let (kind, kindCookie) = + case query req "ef" <|> cookie req "ef" of -- event filter + Just "all" -> (CKAll, Just "ef=all; Path=/") + Just "compr" -> (CKCompressed, Just "ef=compr; Path=/") + _ -> (CKAll, Nothing) events <- indexGetEventsDay index chan kind day mpagehighlight <- if | Just (TE.decodeASCII' -> Just eventID) <- query req "eid" -> do @@ -155,11 +156,15 @@ pageCalendarDay conf index req alias datestr = _ -> return Nothing | otherwise -> return Nothing - sendHtml200 $ + let headers = [("Content-Type", "text/html")] ++ + maybe [] (\s -> [("Set-Cookie", s)]) kindCookie + return $ responseBS status200 headers $ renderPageCalendarDay CalendarDayData { network = chanNetwork chan , channel = chanChannel chan , alias = alias + , efAll = kind == CKAll + , efCompr = kind == CKCompressed , date = T.pack (ymdToString (dayToYMD day)) , events = [EventData |
