mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-20 19:17:01 +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:
@@ -10,30 +10,34 @@ import Route
|
||||
import WebSocket
|
||||
|
||||
|
||||
-- MODEL --
|
||||
-- MODEL
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ messages : List MessageHeader }
|
||||
{ wsUrl : String
|
||||
, messages : List MessageHeader
|
||||
}
|
||||
|
||||
|
||||
init : Model
|
||||
init =
|
||||
{ messages = [] }
|
||||
init : String -> Model
|
||||
init host =
|
||||
{ wsUrl = "ws://" ++ host ++ "/api/v1/monitor/messages"
|
||||
, messages = []
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- SUBSCRIPTIONS --
|
||||
-- SUBSCRIPTIONS
|
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
WebSocket.listen "ws://192.168.1.10:3000/api/v1/monitor/messages"
|
||||
WebSocket.listen model.wsUrl
|
||||
(decodeString MessageHeader.decoder >> NewMessage)
|
||||
|
||||
|
||||
|
||||
-- UPDATE --
|
||||
-- UPDATE
|
||||
|
||||
|
||||
type Msg
|
||||
@@ -58,7 +62,7 @@ update session msg model =
|
||||
|
||||
|
||||
|
||||
-- VIEW --
|
||||
-- VIEW
|
||||
|
||||
|
||||
view : Session -> Model -> Html Msg
|
||||
|
||||
Reference in New Issue
Block a user