Something went wrong. Try again.
📰 A single-page application to manage standard.site publication on the AT Protocol cuducos.tngl.io/std-pub
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197module Types exposing ( BasicTheme , BlobRef , Config , Document , ExamplePhase(..) , Flags , Model , Page(..) , PendingOAuth , Preferences , Publication , RgbColor , Session )
import Browser.Navigation as Navimport Dict exposing (Dict)import Fileimport Json.Decode as Decode
-- Config (from flags, 12-factor)
type alias Config = { clientName : String , appUrl : String , basePath : String , plcDirectoryUrl : String , dohUrl : String , bskyAppviewUrl : String }
-- Flags from JS bootstrap
{-| Raw flags from JS. `session` and `pendingOAuth` are kept as opaque JSONvalues so that schema mismatches in stored data don't crash the app at boot —they're decoded leniently in `init` and dropped on failure.-}type alias Flags = { clientName : String , appUrl : String , plcDirectoryUrl : String , dohUrl : String , bskyAppviewUrl : String , jkt : String , now : Int , session : Decode.Value , pendingOAuth : Decode.Value }
-- Session (persisted across reloads)
type alias Session = { did : String , handle : String , pdsEndpoint : String , tokenEndpoint : String , accessToken : String , refreshToken : Maybe String }
-- Pending OAuth (persisted between authorize redirect and callback)
type alias PendingOAuth = { state : String , codeVerifier : String , tokenEndpoint : String , pdsEndpoint : String , did : String , handle : String }
-- Page
type Page = LoginView | Dashboard Session
type ExamplePhase = Idle | FadingOut | FadingIn
-- Model
type alias Model = { config : Config , jkt : String , page : Page , navKey : Nav.Key , clientId : String , redirectUri : String , handleInput : String , error : Maybe String , notification : Maybe String , isLoading : Bool , pendingRequests : Int
-- Login animation , exampleIndex : Int , examplePhase : ExamplePhase
-- Lexicon state , publications : List Publication , selectedPubRkey : Maybe String , draftPublication : Maybe Publication , documents : List Document , publicationsCursor : Maybe String , documentsCursor : Maybe String , pendingIconFile : Maybe File.File , pendingActionId : Maybe String
-- OAuth flow (transient, cleared on success) , oauthCode : String , oauthCodeVerifier : String , oauthCodeChallenge : String , oauthState : String , oauthDid : String , oauthHandle : String , oauthPdsEndpoint : String , oauthAuthorizationEndpoint : String , oauthTokenEndpoint : String , oauthParEndpoint : String , oauthIssuer : String
-- DPoP nonces per origin , nonces : Dict String String }
-- Lexicon types
type alias Publication = { rkey : String , url : String , name : String , description : Maybe String , icon : Maybe BlobRef , basicTheme : Maybe BasicTheme , preferences : Maybe Preferences , createdAt : Maybe String }
type alias BasicTheme = { background : RgbColor , foreground : RgbColor , accent : RgbColor , accentForeground : RgbColor }
type alias RgbColor = { r : Int, g : Int, b : Int }
type alias BlobRef = { link : String , mimeType : String , size : Int }
type alias Preferences = { showInDiscover : Maybe Bool }
type alias Document = { title : String , path : Maybe String , site : String , publishedAt : String , url : Maybe String , description : Maybe String }