Module CI_web_utils

module Wm : Webmachine.S with type 'a io = 'a Lwt.t
type role = [
| `Reader
| `LoggedIn
| `Builder
| `Admin
]

Roles are:

module User : sig ... end
module Auth : sig ... end
type server
val server : auth:Auth.t ‑> web_config:CI_web_templates.t ‑> session_backend:[< `Memory | `Redis of Redis_lwt.Client.connection Lwt_pool.t ] ‑> public_address:Uri.t ‑> server
val web_config : server ‑> CI_web_templates.t
module Session_data : sig ... end
class type resource = object ... end
class static : valid:Str.regexp ‑> mime_type:(Uri.t ‑> string option) ‑> string ‑> resource

new static ~valid ~mime_type dir serves up files from the directory dir, taking the leafname from the context. Names must match the RE valid and the MIME type returned will be mime_type uri.

class static_crunch : mime_type:(Uri.t ‑> string option) ‑> (string ‑> string option) ‑> resource

new static_crunch ~mime_type read serves up files using the function read, taking the path from the context. The MIME type returned will be mime_type uri.

class virtual resource_with_session : server ‑> object ... end

resource_with_session ensures there is a session for each request.

class login_page : server ‑> resource

Page to serve at /auth/login.

class auth_intro : server ‑> resource

Page to serve at /auth/intro/:token.

class auth_setup : server ‑> resource

Page to serve at /auth/setup.

class github_callback : server ‑> resource

Page to serve at /auth/github-callback

class virtual protected_page : server ‑> object ... end

The is_authorized method checks that the session has an associated user and asks the user to log in if not. authenticated_user returns the name of the user once is_authorized has completed.

class virtual post_page : server ‑> object ... end

post_page accepts form POST submissions. It overrides forbidden to check that the CSRF token is present and correct.

class logout_page : server ‑> resource

Posting to this page logs the user out and redirects to /.

val serve : mode:Conduit_lwt_unix.server ‑> routes:(string * (unit ‑> Cohttp_lwt.Body.t Wm.resource)) list ‑> unit Lwt.t

serve ~mode ~routes runs a web-server listening on mode that dispatches incoming requests using routes.

class virtual html_page : server ‑> object ... end
class virtual 'a form_page : server ‑> object ... end
class github_auth_settings : server ‑> resource

The GitHub authentication settings page.