fix: multi relay connectivity (#8550)

this PR, created together with @adbenitez, improves the connectivity
state passed to UI, which has changed a lot since multi relay:

- change the algorithm for `get_connectivity()`: this is roughly the
"best" connectivity of all relays now, so if one is connected, we're
already fine. this was discussed widely one to one, and that part
already closes #8554

- the PR adds a test for that, previously, that was untested

- additionally, do not regard unpublished relays in
`get_connectivity()`: e.g. unpublished relays are no longer given to
peers - so if only that is connected, the overall state should not be
"connected". therefore, we just ignore unpublished relays there

- in `get_connectivity_html()`, we continue showing unpublished relays,
however, we tune them down visually and flag them as such

- for the docs, remove the "range for some future use" wording. it was
never used like that, and that future will probably not arrive :)

<img width="320"
src="https://github.com/user-attachments/assets/1805c525-72d1-4197-b865-6e2d6fbc8819"
/>

---------

Co-authored-by: Hocuri <hocuri@gmx.de>
This commit is contained in:
biørn
2026-08-09 20:31:16 +00:00
committed by GitHub
co-authored by Hocuri
parent 137ac9a027
commit 805e555a99
7 changed files with 145 additions and 50 deletions
+13 -8
View File
@@ -289,16 +289,21 @@ impl ConfiguredLoginParam {
/// Loads configured login parameters for all transports.
///
/// Returns a vector of all transport IDs
/// paired with the configured parameters for the transports.
pub(crate) async fn load_all(context: &Context) -> Result<Vec<(u32, Self)>> {
/// paired with the configured parameters for the transports and the published state.
pub(crate) async fn load_all(context: &Context) -> Result<Vec<(u32, Self, bool)>> {
context
.sql
.query_map_vec("SELECT id, configured_param FROM transports", (), |row| {
let id: u32 = row.get(0)?;
let json: String = row.get(1)?;
let param = Self::from_json(&json)?;
Ok((id, param))
})
.query_map_vec(
"SELECT id, configured_param, is_published FROM transports",
(),
|row| {
let id: u32 = row.get(0)?;
let json: String = row.get(1)?;
let param = Self::from_json(&json)?;
let is_published: bool = row.get(2)?;
Ok((id, param, is_published))
},
)
.await
}