mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 10:07:02 +00:00
ui: Respect monitor visible config option
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
module Data.AppConfig exposing (AppConfig, decoder)
|
||||
module Data.AppConfig exposing (AppConfig, decoder, default)
|
||||
|
||||
import Json.Decode as D
|
||||
import Json.Decode.Pipeline as P
|
||||
@@ -13,3 +13,8 @@ decoder : D.Decoder AppConfig
|
||||
decoder =
|
||||
D.succeed AppConfig
|
||||
|> P.required "monitor-visible" D.bool
|
||||
|
||||
|
||||
default : AppConfig
|
||||
default =
|
||||
AppConfig True
|
||||
|
||||
@@ -13,6 +13,7 @@ module Data.Session exposing
|
||||
)
|
||||
|
||||
import Browser.Navigation as Nav
|
||||
import Data.AppConfig as AppConfig exposing (AppConfig)
|
||||
import Html exposing (Html)
|
||||
import Json.Decode as D
|
||||
import Json.Decode.Pipeline exposing (..)
|
||||
@@ -28,6 +29,7 @@ type alias Session =
|
||||
, flash : Maybe Flash
|
||||
, routing : Bool
|
||||
, zone : Time.Zone
|
||||
, config : AppConfig
|
||||
, persistent : Persistent
|
||||
}
|
||||
|
||||
@@ -43,13 +45,14 @@ type alias Persistent =
|
||||
}
|
||||
|
||||
|
||||
init : Nav.Key -> Url -> Persistent -> Session
|
||||
init key location persistent =
|
||||
init : Nav.Key -> Url -> AppConfig -> Persistent -> Session
|
||||
init key location config persistent =
|
||||
{ key = key
|
||||
, host = location.host
|
||||
, flash = Nothing
|
||||
, routing = True
|
||||
, zone = Time.utc
|
||||
, config = config
|
||||
, persistent = persistent
|
||||
}
|
||||
|
||||
@@ -61,6 +64,7 @@ initError key location error =
|
||||
, flash = Just (Flash "Initialization failed" [ ( "Error", error ) ])
|
||||
, routing = True
|
||||
, zone = Time.utc
|
||||
, config = AppConfig.default
|
||||
, persistent = Persistent []
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user