{-# LANGUAGE OverloadedStrings #-}
module Main where

import           Control.Monad.IO.Class (liftIO)
import           Web.Scotty

import qualified Template
import qualified Storage

main :: IO ()
main = scotty 3000 $ do
  get "/" $ do
    page <- liftIO (Template.paneList `fmap` Storage.getPanes)
    html page
  get "/chunk/:n" $ do
    n <- param "n"
    let offset = 0x100000 + (n * 0xff)
    html (Template.charList offset n)
