Paste server written in Haskell. Fork of Hpaste, fully freedom and privacy respecting and generally improved. At the time of writing there's an instance at <http://paste.rel4tion.org>.

[[ 🗃 ^aoqmo toothpaste ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/aoqmo

SSH: git clone USERNAME@vervis.peers.community:aoqmo

Branches

Tags

hpaste :: src / Hpaste / Controller /

Irclogs.hs

{-# OPTIONS -Wall #-}
{-# LANGUAGE OverloadedStrings #-}

-- | Irclogs page controller.

module Hpaste.Controller.Irclogs
  (handle)
  where

import Hpaste.Controller
import Hpaste.Model.Irclogs
import Hpaste.Types
import Hpaste.View.Irclogs  (page)

import Data.String.ToString
import Data.String
import Snap.Types
import Safe

handle :: Controller ()
handle = do
  channel <- get "channel"
  date <- get "date"
  time <- get "timestamp"
  pasteid <- getMaybe "paste"
  logs <- getNarrowedLogs channel date time
  output $ page channel date time logs pasteid

  where get key = do
          value <- fmap (fmap toString) $ getParam (fromString key)
          case value of
            Nothing -> error $ "Missing parameter: " ++ key
            Just value -> return value
        getMaybe key = fmap ((>>= readMay) . fmap toString) $ getParam (fromString key)
[See repo JSON]