···7777@elm:
7878 echo "> Compiling Elm application"
7979 elm make {{SRC_DIR}}/Applications/Brain.elm --output {{BUILD_DIR}}/brain.elm.js
8080- elm make {{SRC_DIR}}/Applications/UI.elm --output {{BUILD_DIR}}/ui.elm.js
8080+ elm make {{SRC_DIR}}/Applications/UI.elm --output {{BUILD_DIR}}/ui.elm.js --debug
818182828383@elm-prod:
+2-7
src/Applications/UI/Adjunct.elm
···66import Return.Ext as Return
77import UI.Alfred.State as Alfred
88import UI.Audio.State as Audio
99-import UI.Authentication.Types as Authentication
99+import UI.Authentication.Common as Authentication
1010import UI.Common.State as Common
1111import UI.Interface.State exposing (hideOverlay)
1212import UI.Page as Page
···3232 Return.singleton m
33333434 authenticated =
3535- case model.authentication of
3636- Authentication.Authenticated _ ->
3737- True
3838-3939- _ ->
4040- False
3535+ Authentication.isAuthenticated model.authentication
4136 in
4237 if not authenticated || (m.focusedOnInput && Maybe.isNothing model.alfred) then
4338 case m.pressedKeys of
+10
src/Applications/UI/Authentication/Common.elm
···88-- 🛠
9910101111+isAuthenticated : State -> Bool
1212+isAuthenticated state =
1313+ case state of
1414+ Authenticated _ ->
1515+ True
1616+1717+ _ ->
1818+ False
1919+2020+1121extractMethod : State -> Maybe Method
1222extractMethod state =
1323 case state of
+22-14
src/Applications/UI/Authentication/State.elm
···2929import UI.Backdrop as Backdrop
3030import UI.Common.State as Common exposing (showNotification, showNotificationWithModel)
3131import UI.Ports as Ports
3232+import UI.Sources.Query
3233import UI.Sources.State as Sources
3334import UI.Types as UI exposing (..)
3435import UI.User.State.Import as User
···283284notAuthenticated model =
284285 -- This is the message we get when the app initially
285286 -- finds out we're not authenticated.
286286- andThen
287287- Backdrop.setDefault
288288- (if model.isUpgrading then
289289- """
290290- Thank you for using Diffuse V1!
291291- If you want to import your old data,
292292- please pick the storage method you used before and
293293- go to the [import page](#/settings/import-export).
294294- """
295295- |> Notifications.stickySuccess
296296- |> showNotificationWithModel { model | isUpgrading = False }
287287+ (if model.isUpgrading then
288288+ """
289289+ Thank you for using Diffuse V1!
290290+ If you want to import your old data,
291291+ please pick the storage method you used before and
292292+ go to the [import page](#/settings/import-export).
293293+ """
294294+ |> Notifications.stickySuccess
295295+ |> showNotificationWithModel { model | isUpgrading = False }
296296+297297+ else
298298+ Return.singleton model
299299+ )
300300+ |> andThen Backdrop.setDefault
301301+ -- When the user wants to create a source (by passing the info through the url)
302302+ -- and the user isn't signed in yet, sign in using the "Local" method.
303303+ |> (if UI.Sources.Query.requestedAddition model.url then
304304+ andThen (signIn Local)
297305298298- else
299299- Return.singleton model
300300- )
306306+ else
307307+ identity
308308+ )
301309302310303311remoteStorageWebfinger : RemoteStorage.Attributes -> Result Http.Error String -> Manager
+68
src/Applications/UI/Sources/Query.elm
···11+module UI.Sources.Query exposing (..)
22+33+import Dict
44+import Json.Decode as Decode
55+import Sources exposing (Source)
66+import Url exposing (Url)
77+import Url.Parser as Url
88+import Url.Parser.Query as Query
99+1010+1111+requestedAddition : Url -> Bool
1212+requestedAddition url =
1313+ case Url.parse (urlParser identity) url of
1414+ Nothing ->
1515+ False
1616+1717+ Just [] ->
1818+ False
1919+2020+ Just (_ :: _) ->
2121+ True
2222+2323+2424+sourcesFromUrl : Url -> List Source
2525+sourcesFromUrl url =
2626+ url
2727+ |> Url.parse (urlParser <| List.filterMap fromUrl)
2828+ |> Maybe.withDefault []
2929+3030+3131+3232+-- 🔬
3333+3434+3535+fromUrl : String -> Maybe Source
3636+fromUrl json =
3737+ json
3838+ |> Decode.decodeString sourceParser
3939+ |> Result.toMaybe
4040+4141+4242+urlParser individualParser =
4343+ individualParser
4444+ |> Query.custom "source"
4545+ |> Url.query
4646+4747+4848+sourceParser : Decode.Decoder Source
4949+sourceParser =
5050+ Decode.andThen
5151+ (\{ service, data } ->
5252+ if Dict.member "name" data then
5353+ Decode.succeed
5454+ { id = "FILL_IN_LATER"
5555+ , data = data
5656+ , directoryPlaylists = True
5757+ , enabled = True
5858+ , service = service
5959+ }
6060+6161+ else
6262+ Decode.fail "Missing `name` in `data` dictionary"
6363+ )
6464+ <|
6565+ Decode.map2
6666+ (\s d -> { service = s, data = d })
6767+ (Decode.field "kind" Sources.serviceDecoder)
6868+ (Decode.field "data" <| Decode.dict Decode.string)
+19
src/Applications/UI/Sources/State.elm
···2626import UI.Sources.ContextMenu as Sources
2727import UI.Sources.Form as Form
2828import UI.Sources.Page as Sources
2929+import UI.Sources.Query
2930import UI.Sources.Types exposing (..)
3031import UI.Tracks.State as Tracks
3132import UI.Types as UI exposing (Manager, Model)
···148149149150150151-- 🔱
152152+153153+154154+addSourcesFromUrl : Manager
155155+addSourcesFromUrl model =
156156+ case UI.Sources.Query.sourcesFromUrl model.url of
157157+ [] ->
158158+ Return.singleton model
159159+160160+ sources ->
161161+ sources
162162+ |> List.foldl
163163+ (\s -> andThen <| addToCollection s)
164164+ (Return.singleton model)
165165+ |> Return.command
166166+ (Nav.replaceUrl
167167+ model.navKey
168168+ (model.url.path ++ Page.toString model.page)
169169+ )
151170152171153172finishedProcessing : Manager
+2
src/Applications/UI/User/State/Import.elm
···126126 Return.singleton m
127127 )
128128 |> andThen
129129+ Sources.addSourcesFromUrl
130130+ |> andThen
129131 (\m ->
130132 if m.processAutomatically then
131133 Sources.process m