From 21ae0ea376387273363a2a2c432d81156d7f650e Mon Sep 17 00:00:00 2001 From: Bram Date: Tue, 4 Jun 2024 15:50:08 +0200 Subject: [PATCH 1/3] Default to original server name if no well-known found --- src/Internal/Api/Task.elm | 18 ++++++++++++++++-- src/Internal/Config/Text.elm | 7 +++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Internal/Api/Task.elm b/src/Internal/Api/Task.elm index 744b1d2..06bb7a3 100644 --- a/src/Internal/Api/Task.elm +++ b/src/Internal/Api/Task.elm @@ -35,9 +35,10 @@ import Internal.Api.Request as Request import Internal.Api.SendMessageEvent.Api import Internal.Api.Versions.Api import Internal.Config.Log exposing (Log, log) +import Internal.Config.Text as Text import Internal.Tools.Json as Json import Internal.Values.Context as Context exposing (APIContext) -import Internal.Values.Envelope exposing (EnvelopeUpdate(..)) +import Internal.Values.Envelope as E exposing (EnvelopeUpdate(..)) import Internal.Values.Room exposing (RoomUpdate(..)) import Internal.Values.Vault exposing (VaultUpdate(..)) import Task @@ -111,7 +112,20 @@ getBaseUrl c = Nothing -> Internal.Api.BaseUrl.Api.baseUrl { url = Context.fromApiFormat c |> .serverName } - c + |> C.catchWith + (\_ -> + let + url : String + url = + Context.fromApiFormat c + |> .serverName + in + { contextChange = Context.setBaseUrl url + , logs = [ log.warn (Text.logs.baseUrlFailed url) ] + , messages = [ E.SetBaseUrl url ] + } + ) + |> (|>) c {-| Get the current timestamp diff --git a/src/Internal/Config/Text.elm b/src/Internal/Config/Text.elm index a63e936..806ac16 100644 --- a/src/Internal/Config/Text.elm +++ b/src/Internal/Config/Text.elm @@ -609,7 +609,8 @@ happened. Most of these unexpected results, are taken account of by the Elm SDK, but logged so that the programmer can do something about it. -} logs : - { baseUrlFound : String -> String -> String + { baseUrlFailed : String -> String + , baseUrlFound : String -> String -> String , getEventId : String -> String , getNow : Int -> String , httpRequest : String -> String -> String @@ -621,7 +622,9 @@ logs : , serverReturnedUnknownJSON : String -> String } logs = - { baseUrlFound = + { baseUrlFailed = + (++) "Failed to find .well-known, using default server address: " + , baseUrlFound = \url baseUrl -> String.concat [ "Found baseURL of ", url, " at address ", baseUrl ] , getEventId = (++) "Received event with id = " From 76cc6d46b90820b81d06892d822a867c32e54d66 Mon Sep 17 00:00:00 2001 From: Bram Date: Wed, 5 Jun 2024 17:41:11 +0200 Subject: [PATCH 2/3] Prepare develop for master No elm-test for this patch update. The update does not concern written Elm tests, and it has been tested on the Elm SDK demo code --- elm.json | 2 +- src/Internal/Config/Default.elm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/elm.json b/elm.json index 41e703c..aad9344 100644 --- a/elm.json +++ b/elm.json @@ -3,7 +3,7 @@ "name": "noordstar/elm-matrix-sdk-beta", "summary": "Matrix SDK for instant communication. Unstable beta version for testing only.", "license": "EUPL-1.1", - "version": "3.3.0", + "version": "3.3.1", "exposed-modules": [ "Matrix", "Matrix.Event", diff --git a/src/Internal/Config/Default.elm b/src/Internal/Config/Default.elm index cfca825..4b56824 100644 --- a/src/Internal/Config/Default.elm +++ b/src/Internal/Config/Default.elm @@ -29,7 +29,7 @@ will assume until overriden by the user. -} currentVersion : String currentVersion = - "beta 3.3.0" + "beta 3.3.1" {-| The default device name that is being communicated with the Matrix API. From 61dad6c5e863eab61633559ea27d31c14754eed5 Mon Sep 17 00:00:00 2001 From: Bram van den Heuvel Date: Mon, 10 Jun 2024 10:07:44 +0200 Subject: [PATCH 3/3] Add Matrix Room to README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5913ad2..0ab88f5 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,9 @@ supported for which spec versions. - ✅ **One way to do things** instead of having multiple functions that are considered deprecated. -Follow us on [Mastodon](https://social.noordstar.me/@elm_matrix_sdk) at -@elm_matrix_sdk@social.noordstar.me to stay up-to-date on the latest changes. +Follow us on [Mastodon](https://social.noordstar.me/@elm_matrix_sdk) or join the +conversation on [Matrix](https://matrix.to/#/#elm-sdk:matrix.org) to stay +up-to-date on the latest changes. ## How to install