mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-19 02:27:03 +00:00
ui: Much elm work, such wow
- ui: Fix favicon - webui: Changes to support serving Elm UI - Static files now served from `/` mount point. - Old UI handlers moved to `/serve` mount point, some will still be needed by the Elm UI; safe HTML and attachments for example. - Update dev-start.sh for new UI, with tip on how to build it. - ui: Detect browser host:port for websocket URL, - webui: Remove unused mailbox handlers, rename routes - Many routes not needed by Elm UI. - `/serve/mailbox/*` becomes `/serve/m/*`. - webui: Impl custom JSON message API for web UI, - ui: Refactor Mailbox view functions, - ui: Add body tabs for safe HTML and plain text, - webui: Format plain text for new UI, - ui: List attachments with view & download links,
This commit is contained in:
@@ -13,13 +13,16 @@ type alias Message =
|
||||
, date : String
|
||||
, size : Int
|
||||
, seen : Bool
|
||||
, body : Body
|
||||
, text : String
|
||||
, html : String
|
||||
, attachments : List Attachment
|
||||
}
|
||||
|
||||
|
||||
type alias Body =
|
||||
{ text : String
|
||||
, html : String
|
||||
type alias Attachment =
|
||||
{ id : String
|
||||
, fileName : String
|
||||
, contentType : String
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +37,14 @@ decoder =
|
||||
|> required "date" string
|
||||
|> required "size" int
|
||||
|> required "seen" bool
|
||||
|> required "body" bodyDecoder
|
||||
|
||||
|
||||
bodyDecoder : Decoder Body
|
||||
bodyDecoder =
|
||||
decode Body
|
||||
|> required "text" string
|
||||
|> required "html" string
|
||||
|> required "attachments" (list attachmentDecoder)
|
||||
|
||||
|
||||
attachmentDecoder : Decoder Attachment
|
||||
attachmentDecoder =
|
||||
decode Attachment
|
||||
|> required "id" string
|
||||
|> required "filename" string
|
||||
|> required "content-type" string
|
||||
|
||||
@@ -12,10 +12,12 @@ module Data.Session
|
||||
|
||||
import Json.Decode as Decode exposing (..)
|
||||
import Json.Decode.Pipeline exposing (..)
|
||||
import Navigation exposing (Location)
|
||||
|
||||
|
||||
type alias Session =
|
||||
{ flash : String
|
||||
{ host : String
|
||||
, flash : String
|
||||
, routing : Bool
|
||||
, persistent : Persistent
|
||||
}
|
||||
@@ -35,9 +37,9 @@ type Msg
|
||||
| AddRecent String
|
||||
|
||||
|
||||
init : Persistent -> Session
|
||||
init persistent =
|
||||
Session "" True persistent
|
||||
init : Location -> Persistent -> Session
|
||||
init location persistent =
|
||||
Session location.host "" True persistent
|
||||
|
||||
|
||||
update : Msg -> Session -> Session
|
||||
|
||||
Reference in New Issue
Block a user