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 /

Browse.hs

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

-- | Browse page controller.

module Hpaste.Controller.Browse
  (handle)
  where

import Hpaste.Types
import Hpaste.Model.Channel  (getChannels)
import Hpaste.Model.Language (getLanguages)
import Hpaste.Model.Paste    (getPaginatedPastes,countPublicPastes)
import Hpaste.View.Browse    (page)

import Control.Monad.IO
import Data.Time
import Text.Blaze.Pagination
import Snap.App

-- | Browse all pastes.
handle :: HPCtrl ()
handle = do
  pn <- getPagination "pastes"
  author <- getStringMaybe "author"
  (pn',pastes) <- model $ getPaginatedPastes author (pnPn pn)
  chans <- model getChannels
  langs <- model getLanguages
  now <- io getCurrentTime
  output $ page now pn { pnPn = pn' } chans langs pastes author
[See repo JSON]