about summary refs log blame commit diff stats
path: root/src/loader/about.nim
blob: 1bbe962596c7c02e2d8008c3709b943231479697 (plain) (tree)
1
2
3
4
5
6
7
8
9

             



                          

                
                                          
                     


                             



                                                         
                                     


                                                 
                                        



                                                 
       
                                                   
import tables

import loader/connecterror
import loader/headers
import loader/loaderhandle
import loader/request
import types/url

const chawan = staticRead"res/chawan.html"
const HeaderTable = {
  "Content-Type": "text/html"
}.toTable()

proc loadAbout*(handle: LoaderHandle, request: Request) =
  template t(body: untyped) =
    if not body:
      return
  if request.url.pathname == "blank":
    t handle.sendResult(0)
    t handle.sendStatus(200) # ok
    t handle.sendHeaders(newHeaders(HeaderTable))
  elif request.url.pathname == "chawan":
    t handle.sendResult(0)
    t handle.sendStatus(200) # ok
    t handle.sendHeaders(newHeaders(HeaderTable))
    t handle.sendData(chawan)
  else:
    t handle.sendResult(ERROR_ABOUT_PAGE_NOT_FOUND)