Take voelin-model from VoelinProtocol and add voelin-proto
voelin-identity, voelin-proto and voelin-model now come from one revision of the protocol repository (main c8e0e5a: the session seam voelin_proto::link with its account types, and the replica in voelin-model). The client's own crates/voelin-model is removed: the protocol's crate is a superset, identical in presence, server, chat and percent, and differs in badges.rs, link.rs and tree.rs only by a doc comment and two equivalent expressions, and adds the perms and replica modules. Every crate that used it takes voelin-model.workspace = true. voelin-core depends on voelin-proto (and, in its dev-dependencies, on the test-util fakes), which the engine will consume in the next commits. Manifests, the lock file and docs only: no source change. THIRD_PARTY_NOTICES.md is unchanged (scripts/notices.sh --check: up to date). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
38473b761d
commit
fb8e6b63dd
23 files changed
+42
-1996
No files matched your search
Generated
+6
-3
@@ -9522,6 +9522,7 @@ dependencies = [
|
||||
"voelin-model",
|
||||
"voelin-observer",
|
||||
"voelin-platform",
|
||||
"voelin-proto",
|
||||
"voelin-query",
|
||||
"voelin-store",
|
||||
"voelin-stream",
|
||||
@@ -9576,7 +9577,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "voelin-identity"
|
||||
version = "0.2.0"
|
||||
source = "git+ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git?rev=64808ccbb1e3aa10213392724f2f436bc25fd36f#64808ccbb1e3aa10213392724f2f436bc25fd36f"
|
||||
source = "git+ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git?rev=c8e0e5a17c1ff5dfaefa087f49b395d2918af650#c8e0e5a17c1ff5dfaefa087f49b395d2918af650"
|
||||
dependencies = [
|
||||
"aws-lc-rs",
|
||||
"base64 0.23.1",
|
||||
@@ -9635,9 +9636,11 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "voelin-model"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git?rev=c8e0e5a17c1ff5dfaefa087f49b395d2918af650#c8e0e5a17c1ff5dfaefa087f49b395d2918af650"
|
||||
dependencies = [
|
||||
"prost",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"voelin-proto",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9672,7 +9675,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "voelin-proto"
|
||||
version = "0.2.0"
|
||||
source = "git+ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git?rev=64808ccbb1e3aa10213392724f2f436bc25fd36f#64808ccbb1e3aa10213392724f2f436bc25fd36f"
|
||||
source = "git+ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git?rev=c8e0e5a17c1ff5dfaefa087f49b395d2918af650#c8e0e5a17c1ff5dfaefa087f49b395d2918af650"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"prost",
|
||||
|
||||
+8
-5
@@ -16,7 +16,6 @@ members = [
|
||||
"crates/voelin-gateway",
|
||||
"crates/voelin-gateway-proto",
|
||||
"crates/voelin-media",
|
||||
"crates/voelin-model",
|
||||
"crates/voelin-observer",
|
||||
"crates/voelin-platform",
|
||||
"crates/voelin-query",
|
||||
@@ -36,7 +35,6 @@ default-members = [
|
||||
"crates/voelin-core",
|
||||
"crates/voelin-gateway",
|
||||
"crates/voelin-gateway-proto",
|
||||
"crates/voelin-model",
|
||||
"crates/voelin-observer",
|
||||
"crates/voelin-platform",
|
||||
"crates/voelin-query",
|
||||
@@ -57,9 +55,14 @@ publish = false
|
||||
# The protocol repository is private (VoelinProtocol). This is the SSH URL its
|
||||
# docs/development.md names, so that a per-developer .cargo/config.toml [patch]
|
||||
# can point it at a sibling checkout (docs/building.md, "Working with a sibling
|
||||
# VoelinProtocol checkout"). Pinned by commit until the protocol tags a release
|
||||
# that has the account-bound KeyStore (its Phase 2 task 28).
|
||||
voelin-identity = { git = "ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git", rev = "64808ccbb1e3aa10213392724f2f436bc25fd36f" }
|
||||
# VoelinProtocol checkout"). Pinned by commit until the protocol tags a release:
|
||||
# the three crates below are at one revision (main c8e0e5a: the account-bound
|
||||
# KeyStore of Phase 2 task 28, the account types of the session seam).
|
||||
voelin-identity = { git = "ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git", rev = "c8e0e5a17c1ff5dfaefa087f49b395d2918af650" }
|
||||
# The backend-neutral session seam (`voelin_proto::link`) and the v1 messages.
|
||||
voelin-proto = { git = "ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git", rev = "c8e0e5a17c1ff5dfaefa087f49b395d2918af650" }
|
||||
# The UI-facing domain model and the client's replica of v1 entities.
|
||||
voelin-model = { git = "ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git", rev = "c8e0e5a17c1ff5dfaefa087f49b395d2918af650" }
|
||||
|
||||
[workspace.lints.rust]
|
||||
# deny, not forbid: generated code (Slint) needs a local allow.
|
||||
|
||||
@@ -28,7 +28,7 @@ Done so far (milestones M0–M4 and the first part of M5 of [the plan](docs/arch
|
||||
- `crates/proto/`: vendored tsclientlib, modernised (TS6 fields and stream
|
||||
messages, faster off-thread Init1 puzzle, `curve25519-dalek` 4, fuzzing fixes;
|
||||
see [UPSTREAM.md](crates/proto/UPSTREAM.md))
|
||||
- `crates/voelin-model`: server flavor detection (TS3 / TS6) and capabilities
|
||||
- `voelin-model` (from VoelinProtocol, a git dependency): domain model, server flavor detection (TS3 / TS6) and capabilities
|
||||
- `crates/voelin-audio`: Opus voice encoding, framing, resampling, WAV, jitter buffer/mixer, cpal devices
|
||||
- `crates/voelin-store`: SQLite store for identities, bookmarks, settings and chat history; keyring secrets
|
||||
- `crates/voelin-query`: ServerQuery client over raw TCP, SSH and HTTP WebQuery (events, rate limiting, keepalive)
|
||||
|
||||
@@ -19,7 +19,7 @@ tokio = { version = "1.53.1", features = ["rt-multi-thread", "macros", "sync", "
|
||||
tracing = "0.1.44"
|
||||
voelin-core = { path = "../voelin-core" }
|
||||
# Channels and people for the voice notification.
|
||||
voelin-model = { path = "../voelin-model" }
|
||||
voelin-model = { workspace = true }
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
anyhow = "1.0.104"
|
||||
|
||||
@@ -51,10 +51,13 @@ tracing = "0.1"
|
||||
voelin-audio = { path = "../voelin-audio", default-features = false }
|
||||
voelin-gateway-proto = { path = "../voelin-gateway-proto", features = ["client"] }
|
||||
voelin-media = { path = "../voelin-media", default-features = false }
|
||||
voelin-model = { path = "../voelin-model" }
|
||||
voelin-model = { workspace = true }
|
||||
voelin-observer = { path = "../voelin-observer" }
|
||||
# Paths only (the cache directory).
|
||||
voelin-platform = { path = "../voelin-platform", default-features = false }
|
||||
# The backend-neutral session seam the engine consumes (`voelin_proto::link`)
|
||||
# and the v1 messages it speaks.
|
||||
voelin-proto = { workspace = true }
|
||||
voelin-query = { path = "../voelin-query" }
|
||||
voelin-store = { path = "../voelin-store" }
|
||||
voelin-stream = { path = "../voelin-stream" }
|
||||
@@ -72,6 +75,9 @@ http = "1"
|
||||
rustls = { version = "0.23", default-features = false }
|
||||
# `process`: the browser interop test drives Chromium through Node.js.
|
||||
tokio = { version = "1", features = ["macros", "net", "process", "rt-multi-thread", "test-util"] }
|
||||
# The fakes of the session seam (`FakeHost`, `FakeSession`, the conformance
|
||||
# suite).
|
||||
voelin-proto = { workspace = true, features = ["test-util"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -24,7 +24,7 @@ tokio = { version = "1", features = ["macros", "net", "rt", "sync"], optional =
|
||||
# TLS (`wss://`, as gateways run behind a proxy) with the system's
|
||||
# certificates; rustls and its crates are in the tree already (reqwest).
|
||||
tokio-tungstenite = { version = "0.30", optional = true, features = ["rustls-tls-native-roots"] }
|
||||
voelin-model = { path = "../voelin-model" }
|
||||
voelin-model = { workspace = true }
|
||||
tsproto-types = { path = "../proto/tsproto-types" }
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -29,7 +29,7 @@ toml = "1.1.6"
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
voelin-gateway-proto = { path = "../voelin-gateway-proto" }
|
||||
voelin-model = { path = "../voelin-model" }
|
||||
voelin-model = { workspace = true }
|
||||
voelin-observer = { path = "../voelin-observer" }
|
||||
voelin-query = { path = "../voelin-query" }
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "voelin-model"
|
||||
version = "0.1.0"
|
||||
description = "UI-facing domain model shared by the client engine, gateway and UI (no IO)."
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -1,94 +0,0 @@
|
||||
uid,name,description,filename,codes
|
||||
4b27be5a-b92a-4b30-8b2d-14b59653f427,20th Anniversary,Celebrating 20 Years of TeamSpeak,20_years,
|
||||
f81ad44d-e931-47d1-a3ef-5fd160217cf8,4Netplayers,4Netplayers customer,4netplayers,
|
||||
b78a0f3e-8758-4572-b102-42a79b4a0342,????,Reads between the line,hat,
|
||||
2bf80270-8efe-46dc-a472-3280a0479145,Alpha Tester,Helped to test our software. THANK YOU!,Alpha,
|
||||
05114019-6b46-4b13-b5a1-e5179ef69fb5,April Fools!,"Roses are red, gaming is fun, you are carrying too much to be able to run :(",rpg,
|
||||
1a518885-520c-4f54-9f49-8b1acb674771,Braindance,I’m chippin’ in,Braindance,P4TEKZ80PZ
|
||||
cbf5aafd-2554-4053-80bb-0cf82ec0a430,Bright Idea,TeamSpeak took my idea on board,FeatureBadge_Lightbulb,
|
||||
d6062d9c-42a3-49c9-91dd-8c43a5a46805,Bug Catcher,I found a bug!,BugBadge_Splat,
|
||||
dfc70674-0fd0-431e-b3a1-edc32d7b09b2,Challenge Accepted,"Unlocked at SCILL Play — Challenges, tournaments and more!",scill,
|
||||
afed63f4-82f1-4479-ab02-0ef053f55723,Communities Early Adopter,Thank you for your Support!,communities_early_adopter,
|
||||
54be472d-3163-4076-9059-7f46128d937e,Communities Purchase,Purchased a TeamSpeak Community,communities_purchase,
|
||||
f85f7e21-753a-4566-b26a-4e3e9155d2ef,Cyberpunk,We have a city to burn,Cyberpunk,
|
||||
c028298c-84ff-4e22-be4e-b8c17552b4bb,Digi,Digi joined your channel #DIGWIN,digi,
|
||||
56df5ce2-6c5a-4a24-90e2-29e497e26170,Drone Champions League,I follow the Drone Champions League,DCL_Badge,DRONECHAMP
|
||||
935e5a2a-954a-44ca-aa7a-55c79285b601,E3 2018 - Winner,Discovered at E3 2018,E3-2018,
|
||||
61723e54-3da2-4f19-a33f-fcdc8ef5eaa0,Father's Day 2022,Not all heroes wear capes,fathersday2022,
|
||||
b9c7d6ad-5b99-40fb-988c-1d02ab6cc130,Found Tim Speak,Found Tim Speak at Gamescom 2018,met_tim,XJN4WJZEJN
|
||||
809bdd5a-2601-4152-82ff-a21d23d8fd46,G2 Esports,Aged 20 years being a G2 fan,G2_Esports,
|
||||
62444179-0d99-42ba-a45c-c6b1557d079a,Gamescom 2014,Registered at Gamescom 2014,gamescom_2014,
|
||||
50bbdbc8-0f2a-46eb-9808-602225b49627,Gamescom 2016,Registered during Gamescom 2016,gamescom_2016,
|
||||
534c9582-ab02-4267-aec6-2d94361daa2a,Gamescom 2017,Visited TeamSpeak at Gamescom 2017,gamescom_2017,DK9JGRJH1Q
|
||||
4eef1ecf-a0ea-423d-bfd0-496543a00305,Gamescom 2018,Visited TeamSpeak at Gamescom 2018,gamescom_2018,8CXB49KPJ4
|
||||
b82a45a5-b235-4926-be77-de102222e5eb,Gamescom 2019,Visited TeamSpeak at Gamescom 2019,Gamescom19,PNKCB76VZ8
|
||||
34dbfa8f-bd27-494c-aa08-a312fc0bb240,Gamescom Hero 2017,Gaming Hero at Gamescom 2017,hero_2017,
|
||||
24512806-f886-4440-b579-9e26e4219ef6,Gamescom Hero 2018,Gamescom Exclusive Gaming Hero 2018,gamescom_2018_played,BJCFQBU53C
|
||||
d49fd07e-99fb-41de-8d7b-c98064713171,GommeHD.net,Your #1 Minecraft Network for over 10 years,GMHD,
|
||||
c565972a-3912-457b-826f-84820c1ba6ca,Halloween 2021,Happy Halloween 2021,halloween21,
|
||||
133595e7-950f-4ef2-b113-f91a68b5770d,Halloween 2021 Special,Earned by participating in our Halloween 2021 special stream,halloween21_special,
|
||||
fb154277-5fe7-428a-85a4-43c0bdcdda3d,Halloween 2022,Spooky_Scary_Skeletons.mp4,halloween22,
|
||||
e6679ce2-d458-493c-8ffb-5660e47ac99f,Happy Hanami,Enjoy the view,hanami2023,
|
||||
de7bd960-eb02-47e1-9ce2-a44f6e255d8f,Happy Holidays 2019,Happy holidays from everyone at TeamSpeak!,Happy_Holidays,
|
||||
d4ea0251-ba46-4c1a-83b7-59db3f89e52c,Happy New Year 2021,Survived the great toilet paper crisis of 2020,firework_2020,
|
||||
1519e001-06a0-458c-9195-a8a6d0ec87fc,Happy New Year 2023,"Aw man, here we go again",2023_NewYear,
|
||||
834d4cc1-cd80-48d6-96c4-23d131d78649,Happy Summer 2023,heat death of the universe,happy_summer_2023,
|
||||
c68bcc52-7aeb-4868-b4d2-e7b20716f9ba,Heatwave 2022,I'm melting... help,summer_icecream,
|
||||
94242c4e-6742-4540-8b66-ce951ed57159,Helping Hand,\ pushed some buttons *beep* *bop* ~ thanks!,homebase,
|
||||
288a56c6-4da3-48de-9c9f-bd9eede5d832,Immortal Roleplay,This is your life.,Immortal_Roleplay,
|
||||
69bfffc8-e9c0-4f70-8a37-47cb8c73fb1d,International Peace Day,"United we stand, divided we fall",peaceday2022,
|
||||
9ea23c77-8755-4d82-b30c-92f4aac109ef,International Women's Day 2021,"To all the mums, sisters, aunties, nieces and beyond, Happy Women's Day!",wft,
|
||||
7d9fa2b1-b6fa-47ad-9838-c239a4ddd116,MIFCOM,MIFCOM | Entered Performance,mifcom,
|
||||
ed85bdff-2a2b-4bea-a1a5-4d06fcc0d776,Merry Christmas 2019,It’s the most wonderful ‘Tim’ of the Year,Christmas,
|
||||
c6480fe2-ee25-4ee8-9853-243652c8ec54,Merry Christmas 2020,"Let it snow, let it snow, let it snow!",Christmas2020,
|
||||
0581aa0f-8c2d-4681-bb9f-8492fec49977,Merry Christmas 2021,Look what Santa's left under the server tree!,christmas2021,
|
||||
d4875b30-9908-43cb-a1eb-1a958e226078,Merry Christmas 2022,There's snow place like home,christmas2022,
|
||||
87ccf9ea-67c9-45e5-adbc-77e210e6128a,Met Tim,Met Tim Speak IRL,tim_irl,
|
||||
0d98391c-ecdf-4f26-931a-49bfd669cda7,Mind Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_MindEgg,
|
||||
2fdda3c6-20e0-48f1-9c12-f39239a2ed02,Mother's Day 2022,Thanks for bearing with us,rose,
|
||||
c3f823eb-5d5c-40f9-9dbd-3437d59a539d,Official TeamSpeak Gamer,New myTeamSpeak member,TS-2018,
|
||||
8dfa37ac-b40d-4466-b393-ff2184a9adf3,Overwatch League,I follow the Overwatch League,OWL_Badge,
|
||||
4ce435d1-6ac5-4530-b81d-6d14ddaaa1ac,PGL Antwerp 2022,Watched the PGL CS:GO Major,PGLant,
|
||||
fa3ece28-64df-431f-b1b3-90844bfdd2d9,Paris Games Week 2014,Registered at Paris Games Week 2014,paris_gamesweek_2014,
|
||||
d95f9901-c42d-4bac-8849-7164fd9e2310,Paris Games Week 2016,Registered during Paris Games Week 2016,paris_gamesweek_2016,
|
||||
0005232e-538e-4cb2-93b6-d7d83e873829,PietSmiet,Werde Snob auf PietSmiet.de ;),PietSmiet,
|
||||
be932556-dfa9-4dc6-afd0-98de0ab25777,PolTeamgeist,WooOOHoohOOHooo,PolTeamgeist,
|
||||
5f6d49e4-35c8-4809-8c81-6e71f7f749e9,Power Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_PowerEgg,
|
||||
ceee2445-4fbf-4f06-9421-286f0f4e875a,Pride,Never be afraid to show your colors.,pride,
|
||||
1aa375e8-7207-45bf-8b80-556bafafc834,Reality Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_RealityEgg,
|
||||
f22c22f1-8e2d-4d99-8de9-f352dc26ac5b,Rocket Beans TV,Rocket Beans TV Community,rbtv,RWGE2NURJZ
|
||||
2c9698c1-1fec-4baa-a28f-4845f045f42f,Soul Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_SoulEgg,
|
||||
641a4d85-2351-482c-97a1-02fc3b6abbb5,Space Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_SpaceEgg,
|
||||
63261116-4359-4842-873e-56820afbe068,SpartaTheOriginal,Olaf Toast @ twitch.tv/SpartaTheOriginal,Toast,
|
||||
ef567ec5-f46e-4520-be07-6021023cf6bd,Sponsorship License,Sponsored by TeamSpeak,Sponsorship,
|
||||
7a627d47-5496-4d68-83b5-2c4eafff9b30,"Stay Home, Stay Safe","Playing Apart, Staying Connected",StaySafeStayHome,
|
||||
7262a528-c7df-4369-bc2c-d34bf5853d7b,TS Chat Alpha Tester,"Helped us test our new mobile app, thanks!",slim_golden,
|
||||
6eee759e-b1e9-4937-b023-07fc778532a2,TS Gameday Participant,At least i tried...,silvered,
|
||||
e1447b99-53b0-448a-98b7-ee7bad8bd268,TS Gameday Winner,As shiny as the golden frying pan,goldenjoystick,
|
||||
1cb07348-34a4-4741-b50f-c41e584370f7,TeamSpeak Addon Author,Creator of TeamSpeak Addons,addon_author,
|
||||
450f81c1-ab41-4211-a338-222fa94ed157,TeamSpeak Addon Developer (Bronze),Creator of at least 1 TeamSpeak Addon,addon_author_bronze,
|
||||
94ec66de-5940-4e38-b002-970df0cf6c94,TeamSpeak Addon Developer (Gold),Creator of at least 5 TeamSpeak Addons,addon_author_gold,
|
||||
c9e97536-5a2d-4c8e-a135-af404587a472,TeamSpeak Addon Developer (Silver),Creator of at least 3 TeamSpeak Addons,addon_author_silver,
|
||||
9cd152a7-bf65-4ece-aeba-62d27678f79a,TeamSpeak Competition Winner Badge,TeamSpeak Competition Winner,CompWinnerBadge,
|
||||
64221fd1-706c-4bb2-ba55-996c39effa79,TeamSpeak Jedi,myTeamSpeak early adopter,TS-OG,
|
||||
6b187e83-873b-46b0-b2c2-a31af15e76a4,TeamSpeak Merch Badge,TeamSpeak Merch Owner - 1st Edition,cap_red,
|
||||
22b9ec39-7694-453e-864c-dfc7b1b0d7c7,TeamSpeak Merch Badge 2.0,TeamSpeak Merch Owner - 2nd Edition,topper,
|
||||
205916f3-a953-4754-8905-bc15069b1f91,TeamSpeak Merch Badge 3.0,TeamSpeak Merch Owner — 3rd Edition,Merch3,
|
||||
8d843dfa-c51a-407f-87b3-94cfc8f03e96,TeamSpeak Staff,Official Staff Member,teamspeak_staff,
|
||||
c2368518-3728-4260-bcd1-8b85e9f8984c,Test,"Testing, Testing.",Testing,
|
||||
4086a249-a503-4f31-9e83-8a0a8e3089bd,Tim-o'-Lantern,Mwuhaahaahaahaahaa,Tim-O-Lantern,JQGCTAQWHT
|
||||
089c7295-3aa2-48b0-b2f1-2dd1bec12caf,Time Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_TimeEgg,
|
||||
904e232c-f369-44db-87f7-5142e15620cc,Time Machine,Worked like a machine to update addons in super-quick time.,time_machine,
|
||||
4c61af66-22ef-4897-b0bb-25fcef2acf60,Undead Nightmare,I'm the last of my kind,undead_nightmare,
|
||||
b0a36aea-3e46-4e83-a455-6e92ae1b9d94,Undead Nightmare,I'm the last of my kind,undead_nightmare,
|
||||
0cd924ed-c5ea-459e-b60a-4f1bc0b65f07,"Up, Up and Away!",Find me on Mount Chiliad,"up,_up_and_away!",
|
||||
4b0fd4f5-d456-4294-973d-853a1db5c7d8,Valentim's Day 2019,Valentim's Day 2019,Valentines_Badge,
|
||||
92801833-e721-4b7e-84d4-6c02dbb332b9,Valentim's Day 2020,Valentim's Day 2020,Valentim2020,
|
||||
958f904b-8260-48a4-a961-f786cbd39411,Valentine's Day 2023,Love you like my Tamagotchi,ValentinesDay23,
|
||||
a676c708-da67-4784-ba7f-3fb7e8d2e865,Valentines Day 2021,"Roses are red, TS is blue, Servers are Sweet and so are you.",valentine21,
|
||||
c54a9f92-07f7-4214-90f3-eafeea8005da,World Backup Day,Don't be an April Fool. Back up your data!,backupday_2023,
|
||||
448a6d13-4e08-46a1-aafa-b4ff6d6c2d06,World Bonsai Day,"harmony, balance, patience",bonsai_day,
|
||||
0f976a27-ddf5-447c-b79c-0644a8e8a297,Year of the Dragon 2024,"Arise, Shenron!",year_of_the_dragon_2024,
|
||||
8c22fe26-30ac-4231-8b31-67d8a75c808a,Year of the Ox 2021,Only listen to the fortune cookie; disregard all other fortune telling units.,ox21,
|
||||
970c70e6-00a1-41c1-ac5c-81c89a06c7a6,Year of the Rabbit 2023,Do a barrel roll!,chineseNY2023,
|
||||
92356386-0451-4a97-87d9-10ff4f43260c,Year of the Tiger 2022,Rocky sends his regards,tiger,
|
||||
|
@@ -1,144 +0,0 @@
|
||||
//! myTeamSpeak badges: what the GUIDs a client shows (`client_badges`)
|
||||
//! stand for, and where TeamSpeak keeps their pictures.
|
||||
//!
|
||||
//! The table is `data/badges.csv`: tsclientlib's list (2023, also in
|
||||
//! `proto/tsproto-structs/declarations`) and the newer badges of
|
||||
//! TeamSpeak's own list (`https://badges-content.teamspeak.com/list`, a
|
||||
//! protobuf) as of October 2026. Badges added since are unknown here.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
/// How many badges a client shows at most (TeamSpeak lets one pick three).
|
||||
pub const SHOWN: usize = 3;
|
||||
|
||||
/// TeamSpeak's server for the badges' pictures.
|
||||
const CONTENT: &str = "https://badges-content.teamspeak.com";
|
||||
|
||||
/// One badge of the table.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct BadgeInfo {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
/// Its picture's name on TeamSpeak's server, without `.svg`.
|
||||
pub filename: String,
|
||||
}
|
||||
|
||||
/// The table by GUID (lower case), read once.
|
||||
static BADGES: LazyLock<HashMap<String, BadgeInfo>> = LazyLock::new(|| {
|
||||
// Columns: uid, name, description, filename, codes.
|
||||
records(include_str!("../data/badges.csv"))
|
||||
.into_iter()
|
||||
.skip(1)
|
||||
.filter_map(|mut fields| {
|
||||
fields.truncate(4);
|
||||
let [uid, name, description, filename] = <[String; 4]>::try_from(fields).ok()?;
|
||||
Some((uid.to_ascii_lowercase(), BadgeInfo { name, description, filename }))
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
|
||||
/// What a badge GUID stands for; none for one the table does not know.
|
||||
pub fn info(guid: &str) -> Option<&'static BadgeInfo> {
|
||||
BADGES.get(&guid.to_ascii_lowercase())
|
||||
}
|
||||
|
||||
/// The address of a badge's picture (an SVG); none for an unknown badge.
|
||||
pub fn icon_url(guid: &str) -> Option<String> {
|
||||
let info = info(guid)?;
|
||||
Some(format!("{CONTENT}/{}/{}.svg", guid.to_ascii_lowercase(), info.filename))
|
||||
}
|
||||
|
||||
/// The records of a CSV text (RFC 4180): fields split at commas; a quoted
|
||||
/// field may hold commas and line breaks, and `""` for a quote.
|
||||
fn records(text: &str) -> Vec<Vec<String>> {
|
||||
let mut records = Vec::new();
|
||||
let mut record = Vec::new();
|
||||
let mut field = String::new();
|
||||
let mut quoted = false;
|
||||
let mut chars = text.chars().peekable();
|
||||
while let Some(c) = chars.next() {
|
||||
match c {
|
||||
'"' if quoted => {
|
||||
if chars.next_if_eq(&'"').is_some() {
|
||||
field.push('"');
|
||||
} else {
|
||||
quoted = false;
|
||||
}
|
||||
}
|
||||
'"' if field.is_empty() => quoted = true,
|
||||
',' if !quoted => record.push(std::mem::take(&mut field)),
|
||||
'\r' if !quoted => {}
|
||||
'\n' if !quoted => {
|
||||
record.push(std::mem::take(&mut field));
|
||||
records.push(std::mem::take(&mut record));
|
||||
}
|
||||
c => field.push(c),
|
||||
}
|
||||
}
|
||||
if !field.is_empty() || !record.is_empty() {
|
||||
record.push(field);
|
||||
records.push(record);
|
||||
}
|
||||
records
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn known_badges() {
|
||||
let info = info("4b27be5a-b92a-4b30-8b2d-14b59653f427").unwrap();
|
||||
assert_eq!(info.name, "20th Anniversary");
|
||||
assert_eq!(info.description, "Celebrating 20 Years of TeamSpeak");
|
||||
assert_eq!(info.filename, "20_years");
|
||||
// Upper case on the wire finds it too.
|
||||
assert_eq!(super::info("4B27BE5A-B92A-4B30-8B2D-14B59653F427"), Some(info));
|
||||
assert_eq!(
|
||||
icon_url("4b27be5a-b92a-4b30-8b2d-14b59653f427").as_deref(),
|
||||
Some(
|
||||
"https://badges-content.teamspeak.com/4b27be5a-b92a-4b30-8b2d-14b59653f427/20_years.svg"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn quoted_fields_keep_their_commas() {
|
||||
let fools = info("05114019-6b46-4b13-b5a1-e5179ef69fb5").unwrap();
|
||||
assert_eq!(fools.name, "April Fools!");
|
||||
assert_eq!(
|
||||
fools.description,
|
||||
"Roses are red, gaming is fun, you are carrying too much to be able to run :("
|
||||
);
|
||||
assert_eq!(fools.filename, "rpg");
|
||||
let stay = info("7a627d47-5496-4d68-83b5-2c4eafff9b30").unwrap();
|
||||
assert_eq!(stay.name, "Stay Home, Stay Safe");
|
||||
assert_eq!(stay.description, "Playing Apart, Staying Connected");
|
||||
let up = info("0cd924ed-c5ea-459e-b60a-4f1bc0b65f07").unwrap();
|
||||
assert_eq!(up.filename, "up,_up_and_away!");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_badges() {
|
||||
assert_eq!(info("00000000-0000-0000-0000-000000000000"), None);
|
||||
assert_eq!(info(""), None);
|
||||
assert_eq!(icon_url("00000000-0000-0000-0000-000000000000"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_row_is_read() {
|
||||
let rows = include_str!("../data/badges.csv").lines().count() - 1;
|
||||
assert_eq!(BADGES.len(), rows);
|
||||
assert!(BADGES.values().all(|b| !b.name.is_empty() && !b.filename.is_empty()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn csv_records() {
|
||||
assert_eq!(
|
||||
records("a,\"b, \"\"c\"\"\",\r\n\"multi\nline\",d"),
|
||||
[vec!["a", "b, \"c\"", ""], vec!["multi\nline", "d"]]
|
||||
);
|
||||
assert!(records("").is_empty());
|
||||
}
|
||||
}
|
||||
@@ -1,283 +0,0 @@
|
||||
//! Chat messages, from any source.
|
||||
//!
|
||||
//! Messages can link files in a channel's file browser: TeamSpeak clients
|
||||
//! post them as `[URL=ts3file://…]name[/URL]`; [`ChatMessage::file_refs`]
|
||||
//! finds them as [`FileRef`]s (for file cards) and [`FileRef::to_bbcode`]
|
||||
//! writes one.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::percent;
|
||||
use crate::presence::{ChannelId, ClientId};
|
||||
|
||||
fn is_false(b: &bool) -> bool {
|
||||
!*b
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(tag = "kind", content = "id", rename_all = "snake_case")]
|
||||
pub enum ChatTarget {
|
||||
/// Everyone on the server.
|
||||
Server,
|
||||
Channel(ChannelId),
|
||||
/// Private chat, by the other side's unique id when known.
|
||||
Private(String),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct ChatMessage {
|
||||
pub target: ChatTarget,
|
||||
pub author_name: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub author_uid: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub author_id: Option<ClientId>,
|
||||
pub text: String,
|
||||
/// Unix time in milliseconds.
|
||||
pub ts_ms: i64,
|
||||
/// Carried by a gateway or query relay rather than our own connection.
|
||||
#[serde(default)]
|
||||
pub via_relay: bool,
|
||||
/// The author is blocked in our contacts (set by the engine when it
|
||||
/// reports the message; never sent over the wire).
|
||||
#[serde(default, skip_serializing_if = "is_false")]
|
||||
pub blocked: bool,
|
||||
}
|
||||
|
||||
impl ChatMessage {
|
||||
/// The file links in the text, in order of appearance, each once.
|
||||
pub fn file_refs(&self) -> Vec<FileRef> {
|
||||
parse_file_links(&self.text)
|
||||
}
|
||||
}
|
||||
|
||||
/// A file in a channel's file browser, as a chat message links it.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct FileRef {
|
||||
/// The server's unique id (`serverUID`), when the link tells it: a link
|
||||
/// from another server cannot be downloaded here.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub server_uid: Option<String>,
|
||||
pub channel: ChannelId,
|
||||
/// The directory, `/` for the channel's root.
|
||||
pub path: String,
|
||||
pub name: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub size: Option<u64>,
|
||||
#[serde(default, skip_serializing_if = "is_false")]
|
||||
pub is_dir: bool,
|
||||
/// Unix seconds of the last change, when the link tells it.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub modified_s: Option<i64>,
|
||||
/// The link as it appeared.
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
/// URL schemes of file links (`ts3file`; later clients may use others of
|
||||
/// the same form).
|
||||
const FILE_SCHEMES: &[&str] = &["ts3file://", "tsfile://", "ts5file://", "ts6file://"];
|
||||
|
||||
impl FileRef {
|
||||
/// The file's path in the channel: [`Self::path`] joined with [`Self::name`].
|
||||
pub fn full_path(&self) -> String {
|
||||
let dir = self.path.trim_end_matches('/');
|
||||
format!("{dir}/{}", self.name)
|
||||
}
|
||||
|
||||
/// Parse one link (`ts3file://name?serverUID=…&channel=…&path=…&filename=…&isDir=…&size=…&fileDateTime=…`).
|
||||
pub fn parse(url: &str) -> Option<Self> {
|
||||
let lower = url.get(..12).unwrap_or(url).to_ascii_lowercase();
|
||||
let scheme = FILE_SCHEMES.iter().find(|s| lower.starts_with(**s))?;
|
||||
let rest = &url[scheme.len()..];
|
||||
let (host, query) = rest.split_once('?').unwrap_or((rest, ""));
|
||||
let mut file = FileRef { url: url.to_owned(), path: "/".into(), ..Default::default() };
|
||||
let mut channel = None;
|
||||
for pair in query.split('&') {
|
||||
let (key, value) = pair.split_once('=').unwrap_or((pair, ""));
|
||||
let value = percent::decode(value);
|
||||
match key.to_ascii_lowercase().as_str() {
|
||||
"serveruid" => file.server_uid = Some(value).filter(|v| !v.is_empty()),
|
||||
"channel" | "cid" => channel = value.parse().ok(),
|
||||
"path" => file.path = if value.is_empty() { "/".into() } else { value },
|
||||
"filename" | "name" => file.name = value,
|
||||
"isdir" => file.is_dir = matches!(value.as_str(), "1" | "true"),
|
||||
"size" => file.size = value.parse().ok(),
|
||||
"filedatetime" => file.modified_s = value.parse().ok(),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if file.name.is_empty() {
|
||||
file.name = percent::decode(host.trim_end_matches('/'));
|
||||
}
|
||||
file.channel = channel?;
|
||||
(!file.name.is_empty()).then_some(file)
|
||||
}
|
||||
|
||||
/// The link as TeamSpeak clients post it: `[URL=ts3file://…]name[/URL]`.
|
||||
pub fn to_bbcode(&self) -> String {
|
||||
let mut url = format!("ts3file://{}?", percent::encode(&self.name));
|
||||
if let Some(uid) = &self.server_uid {
|
||||
url.push_str(&format!("serverUID={}&", percent::encode(uid)));
|
||||
}
|
||||
url.push_str(&format!(
|
||||
"channel={}&path={}&filename={}&isDir={}",
|
||||
self.channel,
|
||||
percent::encode(&self.path),
|
||||
percent::encode(&self.name),
|
||||
u8::from(self.is_dir)
|
||||
));
|
||||
if let Some(size) = self.size {
|
||||
url.push_str(&format!("&size={size}"));
|
||||
}
|
||||
if let Some(t) = self.modified_s {
|
||||
url.push_str(&format!("&fileDateTime={t}"));
|
||||
}
|
||||
format!("[URL={url}]{}[/URL]", self.name)
|
||||
}
|
||||
}
|
||||
|
||||
/// The file links in `text` (BBCode `[URL=…]`, `[URL]…[/URL]`, Markdown
|
||||
/// `[name](…)` or bare), in order, each once.
|
||||
pub fn parse_file_links(text: &str) -> Vec<FileRef> {
|
||||
let lower = text.to_ascii_lowercase();
|
||||
let mut found: Vec<FileRef> = Vec::new();
|
||||
let mut at = 0;
|
||||
while at < text.len() {
|
||||
let next = FILE_SCHEMES.iter().filter_map(|s| lower[at..].find(s).map(|i| at + i)).min();
|
||||
let Some(start) = next else { break };
|
||||
let end = text[start..]
|
||||
.find(|c: char| c.is_whitespace() || matches!(c, ']' | '[' | ')' | '"' | '<' | '>'))
|
||||
.map_or(text.len(), |i| start + i);
|
||||
if let Some(file) = FileRef::parse(&text[start..end])
|
||||
&& !found.iter().any(|f| f.url == file.url)
|
||||
{
|
||||
found.push(file);
|
||||
}
|
||||
at = end.max(start + 1);
|
||||
}
|
||||
found
|
||||
}
|
||||
|
||||
/// Format of messages a relay posts on behalf of a user.
|
||||
pub fn relay_text(format: &str, nick: &str, text: &str) -> String {
|
||||
format.replace("{nick}", nick).replace("{text}", text)
|
||||
}
|
||||
|
||||
/// Split text so each part fits TeamSpeak's message limit (1024 bytes of
|
||||
/// text), breaking at character boundaries.
|
||||
pub fn split_message(text: &str, max_bytes: usize) -> Vec<String> {
|
||||
let mut parts = Vec::new();
|
||||
let mut current = String::new();
|
||||
for c in text.chars() {
|
||||
if current.len() + c.len_utf8() > max_bytes {
|
||||
parts.push(std::mem::take(&mut current));
|
||||
}
|
||||
current.push(c);
|
||||
}
|
||||
if !current.is_empty() || parts.is_empty() {
|
||||
parts.push(current);
|
||||
}
|
||||
parts
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn relay_format() {
|
||||
assert_eq!(relay_text("[{nick}] {text}", "Alice", "hi"), "[Alice] hi");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn splits_on_char_boundaries() {
|
||||
assert_eq!(split_message("abcdef", 4), vec!["abcd", "ef"]);
|
||||
assert_eq!(split_message("", 4), vec![""]);
|
||||
let parts = split_message("ääää", 3);
|
||||
assert!(parts.iter().all(|p| p.len() <= 3));
|
||||
assert_eq!(parts.concat(), "ääää");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_ts3_file_links() {
|
||||
let text = "look: [URL=ts3file://Report%20Q3.pdf?serverUID=l%2FHvD5zXg5r4%2F%2FC6Ht7J9Ts3Wmc%3D&channel=5&path=%2Fdocs&filename=Report%20Q3.pdf&isDir=0&size=12345&fileDateTime=1454598011]Report Q3.pdf[/URL] and [URL]ts3file://a.txt?channel=1&path=%2F&filename=a+b.txt[/URL]";
|
||||
let files = parse_file_links(text);
|
||||
assert_eq!(files.len(), 2);
|
||||
let f = &files[0];
|
||||
assert_eq!(f.server_uid.as_deref(), Some("l/HvD5zXg5r4//C6Ht7J9Ts3Wmc="));
|
||||
assert_eq!((f.channel, f.path.as_str(), f.name.as_str()), (5, "/docs", "Report Q3.pdf"));
|
||||
assert_eq!((f.size, f.modified_s, f.is_dir), (Some(12345), Some(1_454_598_011), false));
|
||||
assert_eq!(f.full_path(), "/docs/Report Q3.pdf");
|
||||
assert_eq!(files[1].name, "a+b.txt");
|
||||
assert_eq!(files[1].full_path(), "/a+b.txt");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn file_links_in_other_forms() {
|
||||
// Markdown, bare, a repeated link, a link without a channel.
|
||||
let text = "[x](ts3file://x?channel=2&filename=x&isDir=true) ts3file://y?channel=3&path=/d/ \
|
||||
ts3file://y?channel=3&path=/d/ ts3file://z?filename=z";
|
||||
let files = parse_file_links(text);
|
||||
assert_eq!(files.len(), 2);
|
||||
assert!(files[0].is_dir);
|
||||
assert_eq!((files[1].name.as_str(), files[1].full_path().as_str()), ("y", "/d/y"));
|
||||
let msg = ChatMessage {
|
||||
target: ChatTarget::Channel(1),
|
||||
author_name: "a".into(),
|
||||
author_uid: None,
|
||||
author_id: None,
|
||||
text: text.into(),
|
||||
ts_ms: 0,
|
||||
via_relay: false,
|
||||
blocked: false,
|
||||
};
|
||||
assert_eq!(msg.file_refs(), files);
|
||||
assert!(parse_file_links("no links, ts3file:// alone").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn file_link_round_trip() {
|
||||
let file = FileRef {
|
||||
server_uid: Some("uid+/=".into()),
|
||||
channel: 7,
|
||||
path: "/a dir".into(),
|
||||
name: "ä b&c.png".into(),
|
||||
size: Some(10),
|
||||
is_dir: false,
|
||||
modified_s: Some(99),
|
||||
url: String::new(),
|
||||
};
|
||||
let text = file.to_bbcode();
|
||||
let parsed = parse_file_links(&text);
|
||||
assert_eq!(parsed.len(), 1);
|
||||
assert_eq!(FileRef { url: String::new(), ..parsed[0].clone() }, file);
|
||||
assert!(text.ends_with("]ä b&c.png[/URL]"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blocked_flag_stays_off_the_wire() {
|
||||
let msg = ChatMessage {
|
||||
target: ChatTarget::Server,
|
||||
author_name: "a".into(),
|
||||
author_uid: None,
|
||||
author_id: None,
|
||||
text: "t".into(),
|
||||
ts_ms: 1,
|
||||
via_relay: false,
|
||||
blocked: false,
|
||||
};
|
||||
let json = serde_json::to_string(&msg).unwrap();
|
||||
assert!(!json.contains("blocked"));
|
||||
let back: ChatMessage = serde_json::from_str(&json).unwrap();
|
||||
assert_eq!(back, msg);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn target_json() {
|
||||
assert_eq!(
|
||||
serde_json::to_string(&ChatTarget::Channel(5)).unwrap(),
|
||||
r#"{"kind":"channel","id":5}"#
|
||||
);
|
||||
assert_eq!(serde_json::to_string(&ChatTarget::Server).unwrap(), r#"{"kind":"server"}"#);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
//! Domain model shared by the client engine, the gateway and the UI.
|
||||
//!
|
||||
//! Nothing in here does IO; the types describe what a server offers and what
|
||||
//! the user sees.
|
||||
|
||||
pub mod badges;
|
||||
mod chat;
|
||||
mod link;
|
||||
mod percent;
|
||||
mod presence;
|
||||
mod server;
|
||||
mod tree;
|
||||
|
||||
pub use chat::{ChatMessage, ChatTarget, FileRef, parse_file_links, relay_text, split_message};
|
||||
pub use link::{Link, ServerLink, channel_path_id, join_channel_path, split_channel_path};
|
||||
pub use presence::{
|
||||
ChannelId, ChannelInfo, ClientId, ClientInfo, GroupId, GroupInfo, GroupNamingMode, GroupType,
|
||||
Presence, PresenceDelta, PresenceSnapshot, myts_avatar_url, parse_badges, shown_badges,
|
||||
};
|
||||
pub use server::{
|
||||
BannerMode, Capabilities, HostMessageMode, ServerDetails, ServerFlavor, ServerVersion,
|
||||
};
|
||||
pub use tree::{Spacer, TreeRow, channel_title, order_siblings, parse_spacer, tree_rows};
|
||||
@@ -1,420 +0,0 @@
|
||||
//! Server links: `ts3server://` (TeamSpeak 3 and 5), `teamspeak://`
|
||||
//! (TeamSpeak 6) and TeamSpeak's short links on `tmspk.gg`, whose page sends
|
||||
//! the browser on to a `teamspeak://` link.
|
||||
|
||||
use crate::percent;
|
||||
use crate::presence::ChannelId;
|
||||
|
||||
/// What a link opens ([`Link::parse`]).
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Link {
|
||||
/// A server, and maybe a channel on it.
|
||||
Server(ServerLink),
|
||||
/// A TeamSpeak 6 invite code (`tmspk.gg/<code>`,
|
||||
/// `teamspeak://invite=<code>`): only a TeamSpeak service knows the
|
||||
/// server it stands for.
|
||||
Invite(String),
|
||||
}
|
||||
|
||||
/// A server link: the server, and what to join it with (none of it empty).
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct ServerLink {
|
||||
/// A host name, an IP address (IPv6 without brackets) or a server
|
||||
/// nickname.
|
||||
pub host: String,
|
||||
pub port: Option<u16>,
|
||||
pub nickname: Option<String>,
|
||||
/// The server's password.
|
||||
pub password: Option<String>,
|
||||
/// The channel to join: its names from the top, separated by `/` (a `/`
|
||||
/// in a name as `\/`, [`split_channel_path`]), or `/<id>` (`cid=`).
|
||||
pub channel: Option<String>,
|
||||
pub channel_password: Option<String>,
|
||||
/// A privilege key: it puts its user in a server or channel group.
|
||||
pub token: Option<String>,
|
||||
}
|
||||
|
||||
const SCHEMES: [&str; 2] = ["ts3server://", "teamspeak://"];
|
||||
const WEB: [&str; 2] = ["https://", "http://"];
|
||||
const SHORT_HOSTS: [&str; 2] = ["tmspk.gg", "www.tmspk.gg"];
|
||||
|
||||
impl Link {
|
||||
/// Read a link: `ts3server://<host>?<query>` with the keys `port`,
|
||||
/// `nickname`, `password`, `channel` (`A/B`), `cid`, `channelpassword`
|
||||
/// and `token` (`teamspeak://` alike; the scheme and the keys in any
|
||||
/// case, other keys ignored, a `+` kept as it is),
|
||||
/// `https://tmspk.gg/s/<host>?<query>` (also `/s=<host>`), and the
|
||||
/// invite codes `tmspk.gg/<code>` and `teamspeak://invite=<code>`. None
|
||||
/// for anything else.
|
||||
pub fn parse(text: &str) -> Option<Link> {
|
||||
let text = text.trim();
|
||||
// The same length in bytes: an index of one is one of the other.
|
||||
let lower = text.to_ascii_lowercase();
|
||||
match SCHEMES.iter().find(|s| lower.starts_with(**s)) {
|
||||
Some(scheme) => parse_server(&text[scheme.len()..]),
|
||||
None => parse_short(text, &lower),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ServerLink {
|
||||
/// A link to the server at `address` (`host`, `host:port`, `[v6]`,
|
||||
/// `[v6]:port` or a bare IPv6 address), joining nothing.
|
||||
pub fn new(address: &str) -> Self {
|
||||
let (host, port) = split_address(address.trim());
|
||||
ServerLink { host: host.to_owned(), port, ..Default::default() }
|
||||
}
|
||||
|
||||
/// The server's address as a bookmark keeps it: `host`, `host:port` or
|
||||
/// `[v6]:port`.
|
||||
pub fn address(&self) -> String {
|
||||
match self.port {
|
||||
Some(port) if self.host.contains(':') => format!("[{}]:{port}", self.host),
|
||||
Some(port) => format!("{}:{port}", self.host),
|
||||
None => self.host.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
/// The link as TeamSpeak clients open it: `ts3server://<host>?port=…`,
|
||||
/// then what is set of nickname, password, channel (or `cid` for
|
||||
/// `/<id>`), channel password and privilege key.
|
||||
pub fn to_url(&self) -> String {
|
||||
let mut url = match self.port {
|
||||
Some(_) if self.host.contains(':') => format!("ts3server://[{}]", self.host),
|
||||
_ => format!("ts3server://{}", self.host),
|
||||
};
|
||||
let pair = |key: &str, value: &Option<String>| {
|
||||
let value = value.as_deref().filter(|v| !v.is_empty())?;
|
||||
Some(format!("{key}={}", percent::encode(value)))
|
||||
};
|
||||
let channel = self.channel.as_deref().filter(|c| !c.is_empty()).map(|path| {
|
||||
match channel_path_id(path) {
|
||||
Some(id) => format!("cid={id}"),
|
||||
// A `/` between names, `%2F` in one.
|
||||
None => {
|
||||
let names: Vec<String> =
|
||||
split_channel_path(path).iter().map(|n| percent::encode(n)).collect();
|
||||
format!("channel={}", names.join("/"))
|
||||
}
|
||||
}
|
||||
});
|
||||
let query: Vec<String> = [
|
||||
self.port.map(|port| format!("port={port}")),
|
||||
pair("nickname", &self.nickname),
|
||||
pair("password", &self.password),
|
||||
channel,
|
||||
pair("channelpassword", &self.channel_password),
|
||||
pair("token", &self.token),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect();
|
||||
if !query.is_empty() {
|
||||
url.push('?');
|
||||
url.push_str(&query.join("&"));
|
||||
}
|
||||
url
|
||||
}
|
||||
}
|
||||
|
||||
/// A channel path's names from the top: `Gaming/Raid Night` →
|
||||
/// `["Gaming", "Raid Night"]`, `AC\/DC` → `["AC/DC"]`.
|
||||
pub fn split_channel_path(path: &str) -> Vec<String> {
|
||||
let mut names = Vec::new();
|
||||
let mut name = String::new();
|
||||
let mut chars = path.chars().peekable();
|
||||
while let Some(c) = chars.next() {
|
||||
match c {
|
||||
'\\' if chars.peek() == Some(&'/') => {
|
||||
name.push('/');
|
||||
chars.next();
|
||||
}
|
||||
'/' => names.push(std::mem::take(&mut name)),
|
||||
c => name.push(c),
|
||||
}
|
||||
}
|
||||
names.push(name);
|
||||
names
|
||||
}
|
||||
|
||||
/// A channel path from its names from the top, a `/` in a name as `\/`:
|
||||
/// the reverse of [`split_channel_path`].
|
||||
pub fn join_channel_path(names: &[impl AsRef<str>]) -> String {
|
||||
names.iter().map(|n| n.as_ref().replace('/', "\\/")).collect::<Vec<_>>().join("/")
|
||||
}
|
||||
|
||||
/// The channel id of a path `/<id>` (what `cid=` gives).
|
||||
pub fn channel_path_id(path: &str) -> Option<ChannelId> {
|
||||
let id = path.strip_prefix('/')?;
|
||||
if id.is_empty() || !id.bytes().all(|b| b.is_ascii_digit()) {
|
||||
return None;
|
||||
}
|
||||
id.parse().ok()
|
||||
}
|
||||
|
||||
/// After `ts3server://` or `teamspeak://`: `<host>[:port][/]?<query>`, or
|
||||
/// `invite=<code>`.
|
||||
fn parse_server(rest: &str) -> Option<Link> {
|
||||
let (head, query) = rest.split_once('?').unwrap_or((rest, ""));
|
||||
let authority = head.split('/').next().unwrap_or_default();
|
||||
if let Some(key) = authority.get(..7).filter(|k| k.eq_ignore_ascii_case("invite=")) {
|
||||
let code = percent::decode(&authority[key.len()..]);
|
||||
return (!code.is_empty()).then_some(Link::Invite(code));
|
||||
}
|
||||
let authority = percent::decode(authority);
|
||||
let (host, port) = split_address(&authority);
|
||||
if host.is_empty() || host.chars().any(|c| c.is_whitespace() || c.is_control()) {
|
||||
return None;
|
||||
}
|
||||
let mut link = ServerLink { host: host.to_owned(), port, ..Default::default() };
|
||||
let mut cid = None;
|
||||
for pair in query.split('&') {
|
||||
let (key, raw) = pair.split_once('=').unwrap_or((pair, ""));
|
||||
let value = Some(percent::decode(raw)).filter(|v| !v.is_empty());
|
||||
match key.to_ascii_lowercase().as_str() {
|
||||
// One that is no port is ignored.
|
||||
"port" => link.port = value.as_deref().and_then(parse_port).or(link.port),
|
||||
"nickname" => link.nickname = value,
|
||||
"password" => link.password = value,
|
||||
// A `/` between names, `%2F` in one.
|
||||
"channel" => {
|
||||
let names: Vec<String> = raw.split('/').map(percent::decode).collect();
|
||||
link.channel = Some(join_channel_path(&names)).filter(|_| names.concat() != "");
|
||||
}
|
||||
"cid" => cid = value.and_then(|v| v.parse::<ChannelId>().ok()).filter(|c| *c != 0),
|
||||
"channelpassword" => link.channel_password = value,
|
||||
"token" => link.token = value,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
// The id names one channel for sure.
|
||||
if let Some(cid) = cid {
|
||||
link.channel = Some(format!("/{cid}"));
|
||||
}
|
||||
Some(Link::Server(link))
|
||||
}
|
||||
|
||||
/// `tmspk.gg/s/<host>?…` (or `/s=`), with or without `https://`, goes where
|
||||
/// its page sends the browser: `teamspeak://<host>?…`; any other path is an
|
||||
/// invite code.
|
||||
fn parse_short(text: &str, lower: &str) -> Option<Link> {
|
||||
let start = WEB.iter().find(|s| lower.starts_with(**s)).map_or(0, |s| s.len());
|
||||
let (host, path) = text[start..].split_once('/')?;
|
||||
if !SHORT_HOSTS.contains(&host.to_ascii_lowercase().as_str()) {
|
||||
return None;
|
||||
}
|
||||
if path.get(..2).is_some_and(|s| s.eq_ignore_ascii_case("s/") || s.eq_ignore_ascii_case("s=")) {
|
||||
return parse_server(&path[2..]);
|
||||
}
|
||||
let code = path.split(['?', '#', '/']).next().unwrap_or_default();
|
||||
let valid = |b: u8| b.is_ascii_alphanumeric() || matches!(b, b'-' | b'_');
|
||||
(!code.is_empty() && code.bytes().all(valid)).then(|| Link::Invite(code.to_owned()))
|
||||
}
|
||||
|
||||
/// `host`, `host:port`, `[v6]`, `[v6]:port` or a bare IPv6 address: the
|
||||
/// host (an IPv6 address without its brackets) and the port, if one is
|
||||
/// given that is one.
|
||||
fn split_address(address: &str) -> (&str, Option<u16>) {
|
||||
if let Some((host, after)) = address.strip_prefix('[').and_then(|a| a.split_once(']')) {
|
||||
return (host, after.strip_prefix(':').and_then(parse_port));
|
||||
}
|
||||
match address.rsplit_once(':') {
|
||||
// A port follows the only colon; more colons: an IPv6 address.
|
||||
Some((host, port))
|
||||
if !host.contains(':')
|
||||
&& !port.is_empty()
|
||||
&& port.bytes().all(|b| b.is_ascii_digit()) =>
|
||||
{
|
||||
(host, parse_port(port))
|
||||
}
|
||||
_ => (address, None),
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_port(text: &str) -> Option<u16> {
|
||||
text.parse().ok().filter(|p| *p != 0)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn server(text: &str) -> ServerLink {
|
||||
match Link::parse(text) {
|
||||
Some(Link::Server(link)) => link,
|
||||
other => panic!("{text}: {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn host(host: &str, port: Option<u16>) -> ServerLink {
|
||||
ServerLink { host: host.into(), port, ..Default::default() }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_parameter() {
|
||||
let link = server(
|
||||
"ts3server://ts.example.org?port=9988&nickname=Nova%20X&password=s3cr%3Ft&channel=Gaming/Raid%20Night&channelpassword=raid+1&token=AbC%2Bd&addbookmark=Mine",
|
||||
);
|
||||
assert_eq!(
|
||||
link,
|
||||
ServerLink {
|
||||
host: "ts.example.org".into(),
|
||||
port: Some(9988),
|
||||
nickname: Some("Nova X".into()),
|
||||
password: Some("s3cr?t".into()),
|
||||
channel: Some("Gaming/Raid Night".into()),
|
||||
// A `+` stays.
|
||||
channel_password: Some("raid+1".into()),
|
||||
token: Some("AbC+d".into()),
|
||||
}
|
||||
);
|
||||
assert_eq!(link.address(), "ts.example.org:9988");
|
||||
assert_eq!(
|
||||
link.to_url(),
|
||||
"ts3server://ts.example.org?port=9988&nickname=Nova%20X&password=s3cr%3Ft&channel=Gaming/Raid%20Night&channelpassword=raid%2B1&token=AbC%2Bd"
|
||||
);
|
||||
assert_eq!(Link::parse(&link.to_url()), Some(Link::Server(link)));
|
||||
// A channel id names the channel, also next to a path.
|
||||
assert_eq!(server("ts3server://h?cid=12").channel.as_deref(), Some("/12"));
|
||||
assert_eq!(server("ts3server://h?channel=Lobby&cid=12").channel.as_deref(), Some("/12"));
|
||||
assert_eq!(server("ts3server://h?cid=x&channel=Lobby").channel.as_deref(), Some("Lobby"));
|
||||
assert_eq!(server("ts3server://h?cid=12").to_url(), "ts3server://h?cid=12");
|
||||
// Empty values are none.
|
||||
assert_eq!(server("ts3server://h?nickname=&channel=&password"), host("h", None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn teamspeak_scheme_is_the_same() {
|
||||
let query = "ts.example.org?port=9987&channel=Lobby&nickname=Nova";
|
||||
assert_eq!(
|
||||
Link::parse(&format!("teamspeak://{query}")),
|
||||
Link::parse(&format!("ts3server://{query}"))
|
||||
);
|
||||
// Any case, of the scheme and the keys; the host as written.
|
||||
let link = server("TeamSpeak://TS.Example.org/?PORT=9988&Channel=Lobby&CID=");
|
||||
assert_eq!(
|
||||
link,
|
||||
ServerLink { channel: Some("Lobby".into()), ..host("TS.Example.org", Some(9988)) }
|
||||
);
|
||||
assert_eq!(server("TS3SERVER://h:9988"), host("h", Some(9988)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn short_links() {
|
||||
for text in [
|
||||
"https://tmspk.gg/s/ts.example.org?port=9988&channel=Lobby",
|
||||
"https://tmspk.gg/s=ts.example.org?port=9988&channel=Lobby",
|
||||
"HTTPS://www.TMSPK.gg/S/ts.example.org?port=9988&channel=Lobby",
|
||||
"tmspk.gg/s/ts.example.org/?port=9988&channel=Lobby",
|
||||
"http://tmspk.gg/s/ts.example.org:9988?channel=Lobby",
|
||||
] {
|
||||
assert_eq!(
|
||||
server(text),
|
||||
ServerLink { channel: Some("Lobby".into()), ..host("ts.example.org", Some(9988)) },
|
||||
"{text}"
|
||||
);
|
||||
}
|
||||
let invite = |code: &str| Some(Link::Invite(code.into()));
|
||||
assert_eq!(Link::parse("https://tmspk.gg/AbC12x"), invite("AbC12x"));
|
||||
assert_eq!(Link::parse("tmspk.gg/AbC12x/?ref=1"), invite("AbC12x"));
|
||||
assert_eq!(Link::parse("teamspeak://invite=AbC12x"), invite("AbC12x"));
|
||||
assert_eq!(Link::parse("TEAMSPEAK://Invite=AbC12x/"), invite("AbC12x"));
|
||||
for text in ["https://tmspk.gg/", "https://tmspk.gg", "tmspk.gg/a.b", "teamspeak://invite="]
|
||||
{
|
||||
assert_eq!(Link::parse(text), None, "{text}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ipv6() {
|
||||
let v6 = host("2001:db8::1", Some(9987));
|
||||
assert_eq!(server("ts3server://[2001:db8::1]?port=9987"), v6);
|
||||
assert_eq!(server("ts3server://[2001:db8::1]:9987"), v6);
|
||||
assert_eq!(v6.address(), "[2001:db8::1]:9987");
|
||||
assert_eq!(v6.to_url(), "ts3server://[2001:db8::1]?port=9987");
|
||||
// Without a port, with or without brackets.
|
||||
let bare = host("2001:db8::1", None);
|
||||
assert_eq!(server("ts3server://2001:db8::1"), bare);
|
||||
assert_eq!(server("ts3server://[2001:db8::1]"), bare);
|
||||
assert_eq!(bare.address(), "2001:db8::1");
|
||||
assert_eq!(ServerLink::new(" [2001:db8::1]:9988 "), host("2001:db8::1", Some(9988)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escapes() {
|
||||
let link = server("ts3server://h?channel=%C3%84rger/Caf%C3%A9&nickname=J%C3%BCrgen");
|
||||
assert_eq!(link.channel.as_deref(), Some("Ärger/Café"));
|
||||
assert_eq!(link.nickname.as_deref(), Some("Jürgen"));
|
||||
// `%2F` is a `/` in a name.
|
||||
let link = server("ts3server://h?channel=AC%2FDC/Live");
|
||||
assert_eq!(link.channel.as_deref(), Some("AC\\/DC/Live"));
|
||||
assert_eq!(split_channel_path("AC\\/DC/Live"), ["AC/DC", "Live"]);
|
||||
assert_eq!(join_channel_path(&["AC/DC", "Live"]), "AC\\/DC/Live");
|
||||
assert_eq!(link.to_url(), "ts3server://h?channel=AC%2FDC/Live");
|
||||
assert_eq!(split_channel_path("Lobby"), ["Lobby"]);
|
||||
assert_eq!(channel_path_id("/12"), Some(12));
|
||||
assert_eq!(channel_path_id("12"), None);
|
||||
assert_eq!(channel_path_id("/1a"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_ports_are_ignored() {
|
||||
for text in [
|
||||
"ts3server://h?port=abc",
|
||||
"ts3server://h?port=70000",
|
||||
"ts3server://h?port=0",
|
||||
"ts3server://h?port=",
|
||||
"ts3server://h:70000",
|
||||
] {
|
||||
assert_eq!(server(text), host("h", None), "{text}");
|
||||
}
|
||||
// One in the address stays.
|
||||
assert_eq!(server("ts3server://h:9988?port=x"), host("h", Some(9988)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn other_links_are_none() {
|
||||
for text in [
|
||||
"",
|
||||
"http://example.com",
|
||||
"https://example.com/s/ts.example.org",
|
||||
"ts3file://a.png?serverUID=x&channel=1",
|
||||
"ts3server://",
|
||||
"ts3server://?port=9987",
|
||||
"ts3server://a b",
|
||||
"ts.example.org",
|
||||
"mailto:a@example.org",
|
||||
] {
|
||||
assert_eq!(Link::parse(text), None, "{text:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn round_trip() {
|
||||
// The invite links of voelin-ui (`vm::servers::invite_link`).
|
||||
for (address, names, url) in [
|
||||
(
|
||||
"ts.example.com:9988",
|
||||
&["Gaming", "Raid Night"][..],
|
||||
"ts3server://ts.example.com?port=9988&channel=Gaming/Raid%20Night",
|
||||
),
|
||||
(" ts.example.com ", &[], "ts3server://ts.example.com"),
|
||||
(
|
||||
"[2001:db8::1]:9987",
|
||||
&["Chill & Co"],
|
||||
"ts3server://[2001:db8::1]?port=9987&channel=Chill%20%26%20Co",
|
||||
),
|
||||
("2001:db8::1", &[], "ts3server://2001:db8::1"),
|
||||
("h:x", &["Ä/b"], "ts3server://h:x?channel=%C3%84%2Fb"),
|
||||
] {
|
||||
let mut link = ServerLink::new(address);
|
||||
link.channel = (!names.is_empty()).then(|| join_channel_path(names));
|
||||
assert_eq!(link.to_url(), url);
|
||||
assert_eq!(Link::parse(url), Some(Link::Server(link.clone())), "{url}");
|
||||
assert_eq!(link.address(), address.trim());
|
||||
if let Some(path) = &link.channel {
|
||||
assert_eq!(split_channel_path(path), names);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
//! Percent escapes in links: file links ([`crate::FileRef`]) and server
|
||||
//! links ([`crate::Link`]).
|
||||
|
||||
/// `%XX` escapes to bytes, read as UTF-8 (a `+` stays: file names and
|
||||
/// passwords keep theirs).
|
||||
pub(crate) fn decode(s: &str) -> String {
|
||||
let bytes = s.as_bytes();
|
||||
let hex = |b: u8| (b as char).to_digit(16);
|
||||
let mut out = Vec::with_capacity(bytes.len());
|
||||
let mut i = 0;
|
||||
while i < bytes.len() {
|
||||
if bytes[i] == b'%'
|
||||
&& let (Some(h), Some(l)) =
|
||||
(bytes.get(i + 1).and_then(|b| hex(*b)), bytes.get(i + 2).and_then(|b| hex(*b)))
|
||||
{
|
||||
out.push((h * 16 + l) as u8);
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
out.push(bytes[i]);
|
||||
i += 1;
|
||||
}
|
||||
String::from_utf8_lossy(&out).into_owned()
|
||||
}
|
||||
|
||||
/// Every byte but letters, digits and `-._~` as `%XX`.
|
||||
pub(crate) fn encode(s: &str) -> String {
|
||||
let mut out = String::with_capacity(s.len());
|
||||
for b in s.bytes() {
|
||||
if b.is_ascii_alphanumeric() || matches!(b, b'-' | b'_' | b'.' | b'~') {
|
||||
out.push(b as char);
|
||||
} else {
|
||||
out.push_str(&format!("%{b:02X}"));
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn escapes() {
|
||||
assert_eq!(decode("Raid%20Night"), "Raid Night");
|
||||
assert_eq!(decode("%C3%84b"), "Äb");
|
||||
assert_eq!(decode("a+b"), "a+b");
|
||||
// A broken escape stays as it is.
|
||||
assert_eq!(decode("100%"), "100%");
|
||||
assert_eq!(decode("%zz"), "%zz");
|
||||
assert_eq!(encode("Chill & Co/Ä"), "Chill%20%26%20Co%2F%C3%84");
|
||||
assert_eq!(decode(&encode("a b+c%")), "a b+c%");
|
||||
}
|
||||
}
|
||||
@@ -1,493 +0,0 @@
|
||||
//! Who is where: channels and the clients in them.
|
||||
//!
|
||||
//! The same model is fed from a voice connection, a query session or a
|
||||
//! gateway. Sources send a [`PresenceSnapshot`] followed by
|
||||
//! [`PresenceDelta`]s; sources that can only poll use [`Presence::diff`].
|
||||
//!
|
||||
//! A voice connection also knows the server's details (welcome message,
|
||||
//! host banner, …) and its server and channel groups ([`Presence::server`],
|
||||
//! [`Presence::server_groups`], [`Presence::channel_groups`]); snapshots and
|
||||
//! deltas do not carry them (other sources leave them empty).
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::server::{BannerMode, ServerDetails};
|
||||
|
||||
pub type ChannelId = u64;
|
||||
pub type ClientId = u16;
|
||||
/// A server or channel group id.
|
||||
pub type GroupId = u64;
|
||||
|
||||
fn is_zero_i32(n: &i32) -> bool {
|
||||
*n == 0
|
||||
}
|
||||
|
||||
fn is_zero_u32(n: &u32) -> bool {
|
||||
*n == 0
|
||||
}
|
||||
|
||||
fn is_false(b: &bool) -> bool {
|
||||
!*b
|
||||
}
|
||||
|
||||
fn is_default<T: Default + PartialEq>(v: &T) -> bool {
|
||||
*v == T::default()
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct ChannelInfo {
|
||||
pub id: ChannelId,
|
||||
/// `0` for top-level channels.
|
||||
pub parent: ChannelId,
|
||||
/// Id of the sibling directly above, `0` for the first.
|
||||
pub order: ChannelId,
|
||||
pub name: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub topic: Option<String>,
|
||||
#[serde(default)]
|
||||
pub has_password: bool,
|
||||
/// `None` means unlimited.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub max_clients: Option<i32>,
|
||||
#[serde(default)]
|
||||
pub needed_subscribe_power: i32,
|
||||
#[serde(default)]
|
||||
pub needed_talk_power: i32,
|
||||
#[serde(default)]
|
||||
pub is_default: bool,
|
||||
/// Icon id (`channel_icon_id`); 0: none.
|
||||
#[serde(default, skip_serializing_if = "is_zero_u32")]
|
||||
pub icon: u32,
|
||||
/// The address of the channel's banner picture (TeamSpeak 6,
|
||||
/// `channel_banner_gfx_url`), drawn behind the channel.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub banner_gfx_url: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "is_default")]
|
||||
pub banner_mode: BannerMode,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct ClientInfo {
|
||||
pub id: ClientId,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub uid: Option<String>,
|
||||
pub nickname: String,
|
||||
pub channel: ChannelId,
|
||||
/// ServerQuery clients (bots, our own relays). UIs normally hide them.
|
||||
#[serde(default)]
|
||||
pub is_query: bool,
|
||||
/// Away, with the away message (empty without one); `None`: not away.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub away: Option<String>,
|
||||
#[serde(default)]
|
||||
pub input_muted: bool,
|
||||
#[serde(default)]
|
||||
pub output_muted: bool,
|
||||
/// `None` when the source cannot tell (query sessions see no voice).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub talking: Option<bool>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub streaming: Option<bool>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub server_groups: Vec<GroupId>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub country: Option<String>,
|
||||
/// MD5 hash of the client's avatar (`client_flag_avatar`, hex); `None`:
|
||||
/// no avatar. A new hash means a new avatar.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub avatar: Option<String>,
|
||||
/// The myTeamSpeak avatar's picture (TeamSpeak 6, an HTTPS link from
|
||||
/// `client_myteamspeak_avatar`, [`myts_avatar_url`]): shown where the
|
||||
/// server has no avatar for the client.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub myts_avatar: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "is_zero_i32")]
|
||||
pub talk_power: i32,
|
||||
/// Allowed to talk regardless of talk power (`client_is_talker`).
|
||||
#[serde(default, skip_serializing_if = "is_false")]
|
||||
pub talker: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub channel_group: Option<GroupId>,
|
||||
/// Badge GUIDs, in display order ([`shown_badges`]).
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub badges: Vec<String>,
|
||||
/// Icon id (`client_icon_id`); 0: none.
|
||||
#[serde(default, skip_serializing_if = "is_zero_u32")]
|
||||
pub icon: u32,
|
||||
#[serde(default, skip_serializing_if = "is_false")]
|
||||
pub recording: bool,
|
||||
#[serde(default, skip_serializing_if = "is_false")]
|
||||
pub priority_speaker: bool,
|
||||
#[serde(default, skip_serializing_if = "is_false")]
|
||||
pub channel_commander: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub database_id: Option<u64>,
|
||||
}
|
||||
|
||||
/// Badge GUIDs of a `client_badges` value
|
||||
/// (`Overwolf=0:badges=<guid>,<guid>`).
|
||||
pub fn parse_badges(value: &str) -> Vec<String> {
|
||||
value
|
||||
.split(':')
|
||||
.filter_map(|part| part.strip_prefix("badges="))
|
||||
.flat_map(|list| list.split(','))
|
||||
.map(str::trim)
|
||||
.filter(|g| !g.is_empty())
|
||||
.map(str::to_owned)
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The badges a client shows: those a TeamSpeak 6 server verified
|
||||
/// (`client_signed_badges`, ids joined by `,`) first, then those of its
|
||||
/// `client_badges` ([`parse_badges`]), each once.
|
||||
pub fn shown_badges(badges: &str, signed: &str) -> Vec<String> {
|
||||
let signed = signed.split(',').map(str::trim).filter(|g| !g.is_empty()).map(str::to_owned);
|
||||
let mut shown: Vec<String> = Vec::new();
|
||||
for guid in signed.chain(parse_badges(badges)) {
|
||||
if !shown.iter().any(|g| g.eq_ignore_ascii_case(&guid)) {
|
||||
shown.push(guid);
|
||||
}
|
||||
}
|
||||
shown
|
||||
}
|
||||
|
||||
/// The picture to show of a `client_myteamspeak_avatar` value (TeamSpeak
|
||||
/// 6): `<state>,<url>;<state>,<url>…`, states as myTeamSpeak's
|
||||
/// `AvatarState` (1 do not disturb, 2 online, 3 away, 4 offline). As the
|
||||
/// official client reads it: an entry that is not `<number>,<url>` (an
|
||||
/// empty one too, from a trailing `;`) makes the whole value no avatar;
|
||||
/// the "online" picture is shown whatever the client's state (an unknown
|
||||
/// state counts as online), else away, do not disturb, offline, the first
|
||||
/// of a kind. Only an HTTPS link of at most 4 KiB.
|
||||
pub fn myts_avatar_url(value: &str) -> Option<String> {
|
||||
let mut best: Option<(u8, &str)> = None;
|
||||
for entry in value.split(';') {
|
||||
let mut parts = entry.split(',');
|
||||
let state: u32 = parts.next()?.trim().parse().ok()?;
|
||||
let url = parts.next()?.trim();
|
||||
let rank = match state {
|
||||
3 => 1,
|
||||
1 => 2,
|
||||
4 => 3,
|
||||
_ => 0,
|
||||
};
|
||||
if best.is_none_or(|(r, _)| rank < r) {
|
||||
best = Some((rank, url));
|
||||
}
|
||||
}
|
||||
let url = best?.1;
|
||||
(url.starts_with("https://") && url.len() <= 4096).then(|| url.to_owned())
|
||||
}
|
||||
|
||||
/// How a group's name is shown next to its members.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum GroupNamingMode {
|
||||
#[default]
|
||||
None,
|
||||
/// Before the nickname: `[Admin] Alice`.
|
||||
Before,
|
||||
/// After the nickname: `Alice [Admin]`.
|
||||
After,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum GroupType {
|
||||
/// For new virtual servers; nobody is a member.
|
||||
Template,
|
||||
#[default]
|
||||
Regular,
|
||||
/// ServerQuery clients.
|
||||
Query,
|
||||
}
|
||||
|
||||
/// A server or channel group.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct GroupInfo {
|
||||
pub id: GroupId,
|
||||
pub name: String,
|
||||
/// Icon id; 0: none.
|
||||
#[serde(default, skip_serializing_if = "is_zero_u32")]
|
||||
pub icon: u32,
|
||||
/// Display order: lower first, then by id.
|
||||
#[serde(default)]
|
||||
pub sort_id: i32,
|
||||
#[serde(default)]
|
||||
pub naming_mode: GroupNamingMode,
|
||||
#[serde(default)]
|
||||
pub group_type: GroupType,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PresenceSnapshot {
|
||||
pub server_name: String,
|
||||
pub channels: Vec<ChannelInfo>,
|
||||
pub clients: Vec<ClientInfo>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(tag = "kind", rename_all = "snake_case")]
|
||||
pub enum PresenceDelta {
|
||||
ChannelAdded(ChannelInfo),
|
||||
ChannelChanged(ChannelInfo),
|
||||
ChannelRemoved { id: ChannelId },
|
||||
ClientJoined(ClientInfo),
|
||||
ClientChanged(ClientInfo),
|
||||
ClientMoved { id: ClientId, channel: ChannelId },
|
||||
ClientLeft { id: ClientId },
|
||||
ServerRenamed { name: String },
|
||||
}
|
||||
|
||||
/// Current state; apply deltas as they arrive.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct Presence {
|
||||
pub server_name: String,
|
||||
pub channels: BTreeMap<ChannelId, ChannelInfo>,
|
||||
pub clients: BTreeMap<ClientId, ClientInfo>,
|
||||
/// What the source knows about the server (a voice connection: all of
|
||||
/// it; other sources: nothing).
|
||||
pub server: ServerDetails,
|
||||
pub server_groups: BTreeMap<GroupId, GroupInfo>,
|
||||
pub channel_groups: BTreeMap<GroupId, GroupInfo>,
|
||||
}
|
||||
|
||||
impl Presence {
|
||||
pub fn from_snapshot(s: PresenceSnapshot) -> Self {
|
||||
Self {
|
||||
server_name: s.server_name,
|
||||
channels: s.channels.into_iter().map(|c| (c.id, c)).collect(),
|
||||
clients: s.clients.into_iter().map(|c| (c.id, c)).collect(),
|
||||
..Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// The client with this unique id, if present (the first of several
|
||||
/// connections with the same identity).
|
||||
pub fn client_by_uid(&self, uid: &str) -> Option<&ClientInfo> {
|
||||
self.clients.values().find(|c| c.uid.as_deref() == Some(uid))
|
||||
}
|
||||
|
||||
/// Groups in display order (sort id, then id).
|
||||
pub fn sorted_groups(groups: &BTreeMap<GroupId, GroupInfo>) -> Vec<&GroupInfo> {
|
||||
let mut sorted: Vec<_> = groups.values().collect();
|
||||
sorted.sort_by_key(|g| (g.sort_id, g.id));
|
||||
sorted
|
||||
}
|
||||
|
||||
pub fn snapshot(&self) -> PresenceSnapshot {
|
||||
PresenceSnapshot {
|
||||
server_name: self.server_name.clone(),
|
||||
channels: self.channels.values().cloned().collect(),
|
||||
clients: self.clients.values().cloned().collect(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Apply a delta. Returns `false` if it referred to something unknown
|
||||
/// (the caller may want to resynchronise).
|
||||
pub fn apply(&mut self, delta: &PresenceDelta) -> bool {
|
||||
match delta {
|
||||
PresenceDelta::ChannelAdded(c) | PresenceDelta::ChannelChanged(c) => {
|
||||
self.channels.insert(c.id, c.clone());
|
||||
true
|
||||
}
|
||||
PresenceDelta::ChannelRemoved { id } => self.channels.remove(id).is_some(),
|
||||
PresenceDelta::ClientJoined(c) | PresenceDelta::ClientChanged(c) => {
|
||||
self.clients.insert(c.id, c.clone());
|
||||
true
|
||||
}
|
||||
PresenceDelta::ClientMoved { id, channel } => match self.clients.get_mut(id) {
|
||||
Some(c) => {
|
||||
c.channel = *channel;
|
||||
true
|
||||
}
|
||||
None => false,
|
||||
},
|
||||
PresenceDelta::ClientLeft { id } => self.clients.remove(id).is_some(),
|
||||
PresenceDelta::ServerRenamed { name } => {
|
||||
self.server_name = name.clone();
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Deltas that turn `self` into `new`, for sources that poll.
|
||||
pub fn diff(&self, new: &Presence) -> Vec<PresenceDelta> {
|
||||
let mut out = Vec::new();
|
||||
if self.server_name != new.server_name {
|
||||
out.push(PresenceDelta::ServerRenamed { name: new.server_name.clone() });
|
||||
}
|
||||
for (id, c) in &new.channels {
|
||||
match self.channels.get(id) {
|
||||
None => out.push(PresenceDelta::ChannelAdded(c.clone())),
|
||||
Some(old) if old != c => out.push(PresenceDelta::ChannelChanged(c.clone())),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
for (id, c) in &new.clients {
|
||||
match self.clients.get(id) {
|
||||
None => out.push(PresenceDelta::ClientJoined(c.clone())),
|
||||
Some(old) if old == c => {}
|
||||
Some(old) if ClientInfo { channel: c.channel, ..old.clone() } == *c => {
|
||||
out.push(PresenceDelta::ClientMoved { id: *id, channel: c.channel });
|
||||
}
|
||||
Some(_) => out.push(PresenceDelta::ClientChanged(c.clone())),
|
||||
}
|
||||
}
|
||||
for id in self.clients.keys().filter(|id| !new.clients.contains_key(id)) {
|
||||
out.push(PresenceDelta::ClientLeft { id: *id });
|
||||
}
|
||||
// Channels last, so clients leave a removed channel first.
|
||||
for id in self.channels.keys().filter(|id| !new.channels.contains_key(id)) {
|
||||
out.push(PresenceDelta::ChannelRemoved { id: *id });
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Clients in a channel, excluding query clients.
|
||||
pub fn members(&self, channel: ChannelId) -> impl Iterator<Item = &ClientInfo> {
|
||||
self.clients.values().filter(move |c| c.channel == channel && !c.is_query)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn ch(id: u64, name: &str) -> ChannelInfo {
|
||||
ChannelInfo { id, name: name.into(), ..Default::default() }
|
||||
}
|
||||
|
||||
fn cl(id: u16, name: &str, channel: u64) -> ClientInfo {
|
||||
ClientInfo { id, nickname: name.into(), channel, ..Default::default() }
|
||||
}
|
||||
|
||||
fn presence(channels: Vec<ChannelInfo>, clients: Vec<ClientInfo>) -> Presence {
|
||||
Presence::from_snapshot(PresenceSnapshot { server_name: "s".into(), channels, clients })
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn diff_then_apply_reaches_target() {
|
||||
let old = presence(
|
||||
vec![ch(1, "Lobby"), ch(2, "Games")],
|
||||
vec![cl(1, "Alice", 1), cl(2, "Bob", 1), cl(3, "Carol", 2)],
|
||||
);
|
||||
let mut muted = cl(2, "Bob", 1);
|
||||
muted.input_muted = true;
|
||||
let new = presence(
|
||||
vec![ch(1, "Lobby"), ch(3, "New")],
|
||||
vec![cl(1, "Alice", 3), muted, cl(4, "Dave", 1)],
|
||||
);
|
||||
let deltas = old.diff(&new);
|
||||
assert!(deltas.contains(&PresenceDelta::ClientMoved { id: 1, channel: 3 }));
|
||||
assert!(deltas.contains(&PresenceDelta::ClientLeft { id: 3 }));
|
||||
assert!(deltas.contains(&PresenceDelta::ChannelRemoved { id: 2 }));
|
||||
assert!(deltas.iter().any(|d| matches!(d, PresenceDelta::ClientChanged(c) if c.id == 2)));
|
||||
let mut state = old.clone();
|
||||
for d in &deltas {
|
||||
assert!(state.apply(d));
|
||||
}
|
||||
assert_eq!(state, new);
|
||||
assert!(new.diff(&new).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn myts_avatars_as_the_official_client_reads_them() {
|
||||
let on = "https://a.example.test/on.png";
|
||||
assert_eq!(myts_avatar_url(&format!("3,https://a/away;2,{on}")).as_deref(), Some(on));
|
||||
// Away before do not disturb before offline; the first of a kind.
|
||||
assert_eq!(
|
||||
myts_avatar_url("4,https://a/off;1,https://a/dnd;3,https://a/away;3,https://a/b")
|
||||
.as_deref(),
|
||||
Some("https://a/away")
|
||||
);
|
||||
assert_eq!(
|
||||
myts_avatar_url("1,https://a/dnd;4,https://a/off").as_deref(),
|
||||
Some("https://a/dnd")
|
||||
);
|
||||
// An unknown state counts as online.
|
||||
assert_eq!(
|
||||
myts_avatar_url("3,https://a/away;9,https://a/x").as_deref(),
|
||||
Some("https://a/x")
|
||||
);
|
||||
// One bad entry spoils the value.
|
||||
for bad in ["", "2", "x,https://a/on", "2,https://a/on;", "2,https://a/on;;3,https://a/b"] {
|
||||
assert_eq!(myts_avatar_url(bad), None, "{bad:?}");
|
||||
}
|
||||
// Only HTTPS, and not endless.
|
||||
assert_eq!(myts_avatar_url("2,http://a/on"), None);
|
||||
assert_eq!(myts_avatar_url(&format!("2,https://a/{}", "x".repeat(4096))), None);
|
||||
// Older JSON without the field still loads.
|
||||
let client: ClientInfo =
|
||||
serde_json::from_str(r#"{"id":1,"nickname":"a","channel":1}"#).unwrap();
|
||||
assert_eq!(client.myts_avatar, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn badges_and_groups() {
|
||||
assert_eq!(
|
||||
parse_badges(
|
||||
"Overwolf=0:badges=c9e97536-5a2d-4c8e-a135-af404587a472,450f81c1-ab41-4211-a338-222fa94ed157"
|
||||
),
|
||||
["c9e97536-5a2d-4c8e-a135-af404587a472", "450f81c1-ab41-4211-a338-222fa94ed157"]
|
||||
);
|
||||
assert!(parse_badges("").is_empty());
|
||||
assert!(parse_badges("Overwolf=1").is_empty());
|
||||
// TeamSpeak 6's verified badges first, each once.
|
||||
assert_eq!(
|
||||
shown_badges(
|
||||
"Overwolf=0:badges=c9e97536-5a2d-4c8e-a135-af404587a472,450f81c1-ab41-4211-a338-222fa94ed157",
|
||||
"450F81C1-AB41-4211-A338-222FA94ED157,1cb07348-34a4-4741-b50f-c41e584370f7"
|
||||
),
|
||||
[
|
||||
"450F81C1-AB41-4211-A338-222FA94ED157",
|
||||
"1cb07348-34a4-4741-b50f-c41e584370f7",
|
||||
"c9e97536-5a2d-4c8e-a135-af404587a472"
|
||||
]
|
||||
);
|
||||
assert!(shown_badges("", "").is_empty());
|
||||
let group = |id, sort_id| GroupInfo { id, sort_id, ..Default::default() };
|
||||
let groups = BTreeMap::from([(1, group(1, 20)), (2, group(2, 10)), (3, group(3, 10))]);
|
||||
let order: Vec<_> = Presence::sorted_groups(&groups).iter().map(|g| g.id).collect();
|
||||
assert_eq!(order, [2, 3, 1]);
|
||||
let mut alice = cl(1, "Alice", 1);
|
||||
alice.uid = Some("A=".into());
|
||||
let p = presence(vec![ch(1, "Lobby")], vec![alice, cl(2, "Bob", 1)]);
|
||||
assert_eq!(p.client_by_uid("A=").map(|c| c.id), Some(1));
|
||||
assert!(p.client_by_uid("B=").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn old_json_without_new_fields() {
|
||||
let c: ClientInfo =
|
||||
serde_json::from_str(r#"{"id":1,"nickname":"a","channel":2,"away":""}"#).unwrap();
|
||||
assert_eq!(c.away.as_deref(), Some(""));
|
||||
assert_eq!((c.talk_power, c.avatar.as_ref(), c.badges.len()), (0, None, 0));
|
||||
// Defaults stay off the wire.
|
||||
assert_eq!(
|
||||
serde_json::to_string(&cl(1, "a", 2)).unwrap(),
|
||||
r#"{"id":1,"nickname":"a","channel":2,"is_query":false,"input_muted":false,"output_muted":false}"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn members_skip_query_clients() {
|
||||
let mut bot = cl(9, "bot", 1);
|
||||
bot.is_query = true;
|
||||
let p = presence(vec![ch(1, "Lobby")], vec![cl(1, "Alice", 1), bot]);
|
||||
assert_eq!(p.members(1).count(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn delta_json_is_tagged() {
|
||||
let json =
|
||||
serde_json::to_string(&PresenceDelta::ClientMoved { id: 1, channel: 3 }).unwrap();
|
||||
assert_eq!(json, r#"{"kind":"client_moved","id":1,"channel":3}"#);
|
||||
let back: PresenceDelta = serde_json::from_str(&json).unwrap();
|
||||
assert_eq!(back, PresenceDelta::ClientMoved { id: 1, channel: 3 });
|
||||
}
|
||||
}
|
||||
@@ -1,250 +0,0 @@
|
||||
//! Server software detection and the capabilities that follow from it.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Parsed `virtualserver_version`, e.g. `3.13.8 [Build: 1779874471]` or
|
||||
/// `6.0.0-beta13.1 [Build: 1790080330]`.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
pub struct ServerVersion {
|
||||
pub major: u32,
|
||||
pub minor: u32,
|
||||
pub patch: u32,
|
||||
/// Pre-release tag such as `beta13.1`.
|
||||
pub pre: Option<String>,
|
||||
/// Build timestamp (seconds since the Unix epoch).
|
||||
pub build: Option<u64>,
|
||||
}
|
||||
|
||||
impl ServerVersion {
|
||||
pub fn parse(s: &str) -> Option<Self> {
|
||||
let s = s.trim();
|
||||
let (version, rest) = s.split_once(' ').unwrap_or((s, ""));
|
||||
let build = rest
|
||||
.trim()
|
||||
.strip_prefix("[Build:")
|
||||
.and_then(|b| b.strip_suffix(']'))
|
||||
.and_then(|b| b.trim().parse().ok());
|
||||
let (numbers, pre) = match version.split_once('-') {
|
||||
Some((n, p)) => (n, Some(p.to_string())),
|
||||
None => (version, None),
|
||||
};
|
||||
let mut parts = numbers.split('.').map(|p| p.parse::<u32>());
|
||||
let major = parts.next()?.ok()?;
|
||||
let minor = parts.next().unwrap_or(Ok(0)).ok()?;
|
||||
let patch = parts.next().unwrap_or(Ok(0)).ok()?;
|
||||
Some(Self { major, minor, patch, pre, build })
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ServerVersion {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}.{}.{}", self.major, self.minor, self.patch)?;
|
||||
if let Some(pre) = &self.pre {
|
||||
write!(f, "-{pre}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Which server software we are talking to.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum ServerFlavor {
|
||||
/// TeamSpeak 3 server (3.x).
|
||||
Ts3(ServerVersion),
|
||||
/// TeamSpeak 6 server (6.x; TeamSpeak 5 server betas are treated alike).
|
||||
Ts6(ServerVersion),
|
||||
/// Unparseable or unexpected version string.
|
||||
Unknown(String),
|
||||
}
|
||||
|
||||
impl ServerFlavor {
|
||||
/// Classify a `virtualserver_version` string.
|
||||
pub fn from_version_string(s: &str) -> Self {
|
||||
match ServerVersion::parse(s) {
|
||||
Some(v) if v.major == 3 => ServerFlavor::Ts3(v),
|
||||
Some(v) if v.major >= 5 => ServerFlavor::Ts6(v),
|
||||
_ => ServerFlavor::Unknown(s.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn version(&self) -> Option<&ServerVersion> {
|
||||
match self {
|
||||
ServerFlavor::Ts3(v) | ServerFlavor::Ts6(v) => Some(v),
|
||||
ServerFlavor::Unknown(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn capabilities(&self) -> Capabilities {
|
||||
match self {
|
||||
ServerFlavor::Ts3(_) => Capabilities {
|
||||
streams: false,
|
||||
raw_query: true,
|
||||
ssh_query: true,
|
||||
http_query: false,
|
||||
file_transfer: true,
|
||||
offline_messages: true,
|
||||
},
|
||||
// Verified against 6.0.0-beta13.1: file transfer and offline
|
||||
// messages work as on TeamSpeak 3.
|
||||
ServerFlavor::Ts6(_) => Capabilities {
|
||||
streams: true,
|
||||
raw_query: false,
|
||||
ssh_query: true,
|
||||
http_query: true,
|
||||
file_transfer: true,
|
||||
offline_messages: true,
|
||||
},
|
||||
ServerFlavor::Unknown(_) => Capabilities::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the host message shows.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum HostMessageMode {
|
||||
/// Not shown.
|
||||
#[default]
|
||||
None,
|
||||
/// In the chat log.
|
||||
Log,
|
||||
/// In a dialog.
|
||||
Modal,
|
||||
/// In a dialog; the connection ends when it is closed.
|
||||
ModalQuit,
|
||||
}
|
||||
|
||||
/// How a banner picture (the host banner, a TeamSpeak 6 channel banner) is
|
||||
/// scaled to its area: `0`, `1` and `2` on the wire.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum BannerMode {
|
||||
/// As it is.
|
||||
#[default]
|
||||
NoAdjust,
|
||||
/// Stretched to the banner area.
|
||||
IgnoreAspect,
|
||||
/// Scaled to fit, keeping its aspect ratio.
|
||||
KeepAspect,
|
||||
}
|
||||
|
||||
impl BannerMode {
|
||||
/// From its number on the wire; an unknown one shows the picture as it
|
||||
/// is.
|
||||
pub fn from_wire(value: &str) -> Self {
|
||||
match value.trim() {
|
||||
"1" => Self::IgnoreAspect,
|
||||
"2" => Self::KeepAspect,
|
||||
_ => Self::NoAdjust,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What a server tells its (voice) clients about itself.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct ServerDetails {
|
||||
pub name: String,
|
||||
/// `virtualserver_unique_identifier` (the key of its chat history).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub uid: Option<String>,
|
||||
#[serde(default)]
|
||||
pub welcome_message: String,
|
||||
#[serde(default)]
|
||||
pub host_message: String,
|
||||
#[serde(default)]
|
||||
pub host_message_mode: HostMessageMode,
|
||||
/// Where a click on the banner leads.
|
||||
#[serde(default)]
|
||||
pub banner_url: String,
|
||||
/// The banner image.
|
||||
#[serde(default)]
|
||||
pub banner_gfx_url: String,
|
||||
/// Reload the banner image this often (seconds); 0: never.
|
||||
#[serde(default)]
|
||||
pub banner_gfx_interval_s: u64,
|
||||
#[serde(default)]
|
||||
pub banner_mode: BannerMode,
|
||||
#[serde(default)]
|
||||
pub host_button_tooltip: String,
|
||||
#[serde(default)]
|
||||
pub host_button_url: String,
|
||||
/// The host button's image.
|
||||
#[serde(default)]
|
||||
pub host_button_gfx_url: String,
|
||||
/// Icon id (`virtualserver_icon_id`); 0: none.
|
||||
#[serde(default)]
|
||||
pub icon: u32,
|
||||
/// Server platform, e.g. `Linux`.
|
||||
#[serde(default)]
|
||||
pub platform: String,
|
||||
/// `virtualserver_version`, e.g. `3.13.8 [Build: 1779874471]`.
|
||||
#[serde(default)]
|
||||
pub version: String,
|
||||
#[serde(default)]
|
||||
pub max_clients: u16,
|
||||
/// How much everyone else is dimmed while a priority speaker talks
|
||||
/// (dB, e.g. -18; `virtualserver_priority_speaker_dimm_modificator`,
|
||||
/// rounded).
|
||||
#[serde(default)]
|
||||
pub priority_speaker_dimm_db: i32,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub default_server_group: Option<u64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub default_channel_group: Option<u64>,
|
||||
}
|
||||
|
||||
/// Features that depend on the server software.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct Capabilities {
|
||||
/// Screen sharing / video streams (TeamSpeak 6).
|
||||
pub streams: bool,
|
||||
/// Raw TCP ServerQuery (TeamSpeak 3 only; may still be disabled by the admin).
|
||||
pub raw_query: bool,
|
||||
/// SSH ServerQuery.
|
||||
pub ssh_query: bool,
|
||||
/// HTTP WebQuery (TeamSpeak 6), request/response only, no events.
|
||||
pub http_query: bool,
|
||||
/// Channel file browsers, avatars and icons (`ftinit*` over TCP).
|
||||
#[serde(default)]
|
||||
pub file_transfer: bool,
|
||||
/// Offline messages to a unique id (`messageadd`, `messagelist`, …).
|
||||
#[serde(default)]
|
||||
pub offline_messages: bool,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parses_ts3() {
|
||||
let v = ServerVersion::parse("3.13.8 [Build: 1779874471]").unwrap();
|
||||
assert_eq!((v.major, v.minor, v.patch), (3, 13, 8));
|
||||
assert_eq!(v.pre, None);
|
||||
assert_eq!(v.build, Some(1_779_874_471));
|
||||
let flavor = ServerFlavor::from_version_string("3.13.8 [Build: 1779874471]");
|
||||
assert!(matches!(flavor, ServerFlavor::Ts3(_)));
|
||||
assert!(!flavor.capabilities().streams);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_ts6_beta() {
|
||||
let s = "6.0.0-beta13.1 [Build: 1790080330]";
|
||||
let v = ServerVersion::parse(s).unwrap();
|
||||
assert_eq!(v.pre.as_deref(), Some("beta13.1"));
|
||||
assert_eq!(v.to_string(), "6.0.0-beta13.1");
|
||||
let flavor = ServerFlavor::from_version_string(s);
|
||||
assert!(matches!(flavor, ServerFlavor::Ts6(_)));
|
||||
assert!(flavor.capabilities().streams);
|
||||
assert!(!flavor.capabilities().raw_query);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn handles_garbage() {
|
||||
assert!(matches!(ServerFlavor::from_version_string(""), ServerFlavor::Unknown(_)));
|
||||
assert!(matches!(ServerFlavor::from_version_string("x.y"), ServerFlavor::Unknown(_)));
|
||||
assert_eq!(ServerVersion::parse("3").unwrap().minor, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
//! Flatten presence into display rows in TeamSpeak's channel order, and
|
||||
//! read the names of spacer channels.
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::presence::{ChannelId, ChannelInfo, ClientInfo, Presence};
|
||||
|
||||
/// One line of a channel tree.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum TreeRow<'a> {
|
||||
Channel { depth: usize, channel: &'a ChannelInfo },
|
||||
Client { depth: usize, client: &'a ClientInfo },
|
||||
}
|
||||
|
||||
/// Sort siblings by following the `order` links (each channel names the
|
||||
/// sibling directly above it). Channels whose predecessor is missing are
|
||||
/// appended at the end, sorted by id, so nothing is ever dropped.
|
||||
pub fn order_siblings(mut siblings: Vec<&ChannelInfo>) -> Vec<&ChannelInfo> {
|
||||
siblings.sort_by_key(|c| c.id);
|
||||
let mut by_prev: HashMap<ChannelId, &ChannelInfo> = HashMap::new();
|
||||
for c in &siblings {
|
||||
by_prev.entry(c.order).or_insert(c);
|
||||
}
|
||||
let mut sorted = Vec::with_capacity(siblings.len());
|
||||
let mut prev = 0;
|
||||
while let Some(c) = by_prev.remove(&prev) {
|
||||
sorted.push(c);
|
||||
prev = c.id;
|
||||
}
|
||||
for c in siblings {
|
||||
if !sorted.iter().any(|s| s.id == c.id) {
|
||||
sorted.push(c);
|
||||
}
|
||||
}
|
||||
sorted
|
||||
}
|
||||
|
||||
/// Channels and their (non-query) clients, depth-first. Clients are sorted by
|
||||
/// name; `collapsed` channels hide their sub-channels and clients.
|
||||
pub fn tree_rows<'a>(p: &'a Presence, collapsed: &dyn Fn(ChannelId) -> bool) -> Vec<TreeRow<'a>> {
|
||||
let mut rows = Vec::new();
|
||||
add_level(p, 0, 0, collapsed, &mut rows);
|
||||
rows
|
||||
}
|
||||
|
||||
fn add_level<'a>(
|
||||
p: &'a Presence,
|
||||
parent: ChannelId,
|
||||
depth: usize,
|
||||
collapsed: &dyn Fn(ChannelId) -> bool,
|
||||
rows: &mut Vec<TreeRow<'a>>,
|
||||
) {
|
||||
let siblings = order_siblings(p.channels.values().filter(|c| c.parent == parent).collect());
|
||||
for channel in siblings {
|
||||
rows.push(TreeRow::Channel { depth, channel });
|
||||
if collapsed(channel.id) {
|
||||
continue;
|
||||
}
|
||||
let mut members: Vec<_> = p.members(channel.id).collect();
|
||||
members.sort_by(|a, b| a.nickname.to_lowercase().cmp(&b.nickname.to_lowercase()));
|
||||
for client in members {
|
||||
rows.push(TreeRow::Client { depth: depth + 1, client });
|
||||
}
|
||||
add_level(p, channel.id, depth + 1, collapsed, rows);
|
||||
}
|
||||
}
|
||||
|
||||
/// How a TeamSpeak spacer channel draws its text.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Spacer {
|
||||
Left,
|
||||
Center,
|
||||
Right,
|
||||
/// The text repeated across the row: a line such as `---`.
|
||||
Fill,
|
||||
}
|
||||
|
||||
impl Spacer {
|
||||
/// Whether a spacer with this text only separates the rows around it
|
||||
/// (a line, or no text): nothing to search for or pick.
|
||||
pub fn separates(self, text: &str) -> bool {
|
||||
self == Spacer::Fill || text.trim().is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
/// A spacer name split into its kind and its text: `[cspacer]Games` is a
|
||||
/// centred "Games", `[*spacer1]-=` repeats "-=", plain `[spacer3]` is an
|
||||
/// empty row. The part between `spacer` and `]` only keeps the names
|
||||
/// unique, so anything goes there. Anything else is not a spacer.
|
||||
pub fn parse_spacer(name: &str) -> Option<(Spacer, &str)> {
|
||||
let (inside, text) = name.strip_prefix('[')?.split_once(']')?;
|
||||
let (kind, _suffix) = inside.split_once("spacer")?;
|
||||
let kind = match kind {
|
||||
"" | "l" => Spacer::Left,
|
||||
"c" => Spacer::Center,
|
||||
"r" => Spacer::Right,
|
||||
"*" => Spacer::Fill,
|
||||
_ => return None,
|
||||
};
|
||||
Some((kind, text))
|
||||
}
|
||||
|
||||
/// A channel's name as shown, and its spacer kind. Only top-level channels
|
||||
/// are spacers, as in TeamSpeak: a sub-channel keeps its name as it is.
|
||||
/// Names sent to the server (joining by name, invite links) stay raw.
|
||||
pub fn channel_title(channel: &ChannelInfo) -> (&str, Option<Spacer>) {
|
||||
match parse_spacer(&channel.name).filter(|_| channel.parent == 0) {
|
||||
Some((kind, text)) => (text, Some(kind)),
|
||||
None => (&channel.name, None),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::presence::PresenceSnapshot;
|
||||
|
||||
fn ch(id: u64, parent: u64, order: u64, name: &str) -> ChannelInfo {
|
||||
ChannelInfo { id, parent, order, name: name.into(), ..Default::default() }
|
||||
}
|
||||
|
||||
fn cl(id: u16, name: &str, channel: u64) -> ClientInfo {
|
||||
ClientInfo { id, nickname: name.into(), channel, ..Default::default() }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn follows_order_links() {
|
||||
let channels = [ch(5, 0, 3, "c"), ch(3, 0, 7, "b"), ch(7, 0, 0, "a")];
|
||||
let names: Vec<_> =
|
||||
order_siblings(channels.iter().collect()).iter().map(|c| c.name.as_str()).collect();
|
||||
assert_eq!(names, ["a", "b", "c"]);
|
||||
let broken = [ch(1, 0, 0, "a"), ch(2, 0, 99, "orphan")];
|
||||
assert_eq!(order_siblings(broken.iter().collect())[1].name, "orphan");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rows_depth_first_with_collapse() {
|
||||
let mut bot = cl(9, "bot", 1);
|
||||
bot.is_query = true;
|
||||
let p = Presence::from_snapshot(PresenceSnapshot {
|
||||
server_name: "s".into(),
|
||||
channels: vec![ch(1, 0, 0, "Lobby"), ch(2, 0, 1, "Games"), ch(3, 2, 0, "Squad")],
|
||||
clients: vec![cl(1, "zed", 1), cl(2, "Alice", 1), bot, cl(3, "Bob", 3)],
|
||||
});
|
||||
let describe = |rows: Vec<TreeRow>| -> Vec<String> {
|
||||
rows.iter()
|
||||
.map(|r| match r {
|
||||
TreeRow::Channel { depth, channel } => format!("{depth}#{}", channel.name),
|
||||
TreeRow::Client { depth, client } => format!("{depth}-{}", client.nickname),
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
assert_eq!(
|
||||
describe(tree_rows(&p, &|_| false)),
|
||||
["0#Lobby", "1-Alice", "1-zed", "0#Games", "1#Squad", "2-Bob"]
|
||||
);
|
||||
assert_eq!(
|
||||
describe(tree_rows(&p, &|c| c == 2)),
|
||||
["0#Lobby", "1-Alice", "1-zed", "0#Games"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spacer_names() {
|
||||
use Spacer::*;
|
||||
for (name, spacer) in [
|
||||
("[spacer0]", Some((Left, ""))),
|
||||
("[spacer3]Hi", Some((Left, "Hi"))),
|
||||
("[lspacer]Hi", Some((Left, "Hi"))),
|
||||
("[rspacer9]Hi", Some((Right, "Hi"))),
|
||||
("[cspacer]Hi", Some((Center, "Hi"))),
|
||||
("[cspacerx]Hi", Some((Center, "Hi"))),
|
||||
("[cspacer12]Гамесы [1]", Some((Center, "Гамесы [1]"))),
|
||||
("[*spacer1]-=", Some((Fill, "-="))),
|
||||
("[*spacer]", Some((Fill, ""))),
|
||||
("[cspacer2Games", None),
|
||||
("Games", None),
|
||||
("[Spacer]x", None),
|
||||
("[xspacer]x", None),
|
||||
("[spacr]x", None),
|
||||
("x[spacer]", None),
|
||||
] {
|
||||
assert_eq!(parse_spacer(name), spacer, "{name}");
|
||||
}
|
||||
assert!(Fill.separates("-=") && Left.separates("") && Center.separates(" "));
|
||||
assert!(!Left.separates("Hi"));
|
||||
// Only top-level channels are spacers: a sub-channel keeps its name.
|
||||
assert_eq!(channel_title(&ch(1, 0, 0, "[rspacer]Staff")), ("Staff", Some(Right)));
|
||||
assert_eq!(channel_title(&ch(2, 1, 0, "[rspacer]Staff")), ("[rspacer]Staff", None));
|
||||
assert_eq!(channel_title(&ch(3, 0, 0, "Lobby")), ("Lobby", None));
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ publish.workspace = true
|
||||
thiserror = "2"
|
||||
tokio = { version = "1", features = ["macros", "rt", "sync", "time"] }
|
||||
tracing = "0.1"
|
||||
voelin-model = { path = "../voelin-model" }
|
||||
voelin-model = { workspace = true }
|
||||
voelin-query = { path = "../voelin-query" }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -39,7 +39,7 @@ voelin-audio = { path = "../voelin-audio" }
|
||||
voelin-core = { path = "../voelin-core", default-features = false, features = ["audio-device"] }
|
||||
# Gateway data types (topics, pins, reactions, capability names).
|
||||
voelin-gateway-proto = { path = "../voelin-gateway-proto" }
|
||||
voelin-model = { path = "../voelin-model" }
|
||||
voelin-model = { workspace = true }
|
||||
# Crash reports and notices everywhere; hotkey backends on desktop (below).
|
||||
voelin-platform = { path = "../voelin-platform", default-features = false }
|
||||
voelin-query = { path = "../voelin-query" }
|
||||
|
||||
@@ -65,7 +65,7 @@ fuzz/ cargo-fuzz targets
|
||||
|
||||
| Crate | Responsibility | State |
|
||||
|---|---|---|
|
||||
| `voelin-model` | UI-facing domain model (servers and their details, channels, clients, server and channel groups, chat and its file links, capabilities), no IO | done |
|
||||
| `voelin-model` (VoelinProtocol, a git dependency) | UI-facing domain model (servers and their details, channels, clients, server and channel groups, chat and its file links, capabilities), no IO; with the replica of the protocol's entities and the permission functions | done |
|
||||
| `voelin-query` | ServerQuery codec and transports: raw TCP, SSH (russh), HTTP WebQuery | done |
|
||||
| `voelin-observer` | Presence tracker + chat relay pool over `voelin-query` | done |
|
||||
| `voelin-gateway-proto`, `voelin-gateway` (`tsgw`) | Companion service for server admins: identity-challenge auth, permission-mirroring authorization, presence stream, chat relay, SQLite history, WebSocket + JSON (`tsgw.v1+json`) | done |
|
||||
|
||||
+12
-7
@@ -128,16 +128,21 @@ the proxy is on localhost. If the proxy inspects TLS, set
|
||||
## Depending on VoelinProtocol
|
||||
|
||||
`voelin-store` uses `voelin-identity` (the identity blobs, the account-bound
|
||||
`KeyStore` and the sign-out rules) from the **private** VoelinProtocol
|
||||
repository, as a Cargo git dependency in the workspace `Cargo.toml`:
|
||||
`KeyStore` and the sign-out rules), `voelin-core` uses `voelin-proto` (the
|
||||
session seam `voelin_proto::link` and the v1 messages), and almost every
|
||||
crate uses `voelin-model` (the domain model and the replica of the protocol's
|
||||
entities), all from the **private** VoelinProtocol repository, as Cargo git
|
||||
dependencies in the workspace `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[workspace.dependencies]
|
||||
voelin-identity = { git = "ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git", rev = "…" }
|
||||
voelin-proto = { git = "ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git", rev = "…" }
|
||||
voelin-model = { git = "ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git", rev = "…" }
|
||||
```
|
||||
|
||||
It is pinned by commit until the protocol tags a release that has it; moving
|
||||
to a newer protocol means changing the `rev` (later a `tag`) and committing
|
||||
They are pinned by one commit until the protocol tags a release; moving
|
||||
to a newer protocol means changing the `rev` of all three (later a `tag`) and committing
|
||||
the resulting `Cargo.lock` together with `THIRD_PARTY_NOTICES.md`, which
|
||||
`scripts/notices.sh` regenerates (the CI notices job fails on a stale one).
|
||||
Cargo fetches it over SSH, so the machine needs an SSH key that can read
|
||||
@@ -167,8 +172,8 @@ per-developer `.cargo/config.toml` in the root of this repository:
|
||||
# VoelinClient/.cargo/config.toml (per developer, never committed)
|
||||
[patch."ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git"]
|
||||
voelin-identity = { path = "../VoelinProtocol/crates/voelin-identity" }
|
||||
# voelin-proto is a dependency of voelin-identity from the same repository:
|
||||
voelin-proto = { path = "../VoelinProtocol/crates/voelin-proto" }
|
||||
voelin-model = { path = "../VoelinProtocol/crates/voelin-model" }
|
||||
```
|
||||
|
||||
- Relative paths in a Cargo config file resolve from the directory that
|
||||
@@ -179,5 +184,5 @@ voelin-proto = { path = "../VoelinProtocol/crates/voelin-proto" }
|
||||
- `/.cargo/` is in `.gitignore`: the file is yours and is never committed.
|
||||
- With the patch active Cargo rewrites `Cargo.lock` (the patched crates lose
|
||||
their git `source`). Do not commit that: run `git checkout Cargo.lock` before
|
||||
committing, or remove the file and run `cargo update -p voelin-identity`
|
||||
after changing the `rev`. CI builds with `--locked` and has no patch.
|
||||
committing, or remove the file and run `cargo update -p voelin-identity -p voelin-proto -p voelin-model`
|
||||
after changing the `rev` (for all three crates). CI builds with `--locked` and has no patch.
|
||||
+1
-1
@@ -702,7 +702,7 @@ scaled down (an animation to its first frame). SVG uses Slint's vector
|
||||
loader and the existing vector-cache cost.
|
||||
Avatars and server, channel, client and group icons use the same image cache.
|
||||
|
||||
The focused checks are the `voelin-core`, `voelin-model`, `voelin-observer`,
|
||||
The focused checks are the `voelin-core`, `voelin-observer`,
|
||||
`voelin-store` and `voelin-ui` library tests. They cover offline icon restoration,
|
||||
bookmark compatibility, cache misses and old-address event rejection. The live
|
||||
`ts6_banners` test checks disabled
|
||||
|
||||
@@ -24,7 +24,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
tsclientlib = { path = "../../crates/proto/tsclientlib", features = ["unstable"] }
|
||||
tsproto = { path = "../../crates/proto/tsproto" }
|
||||
tsproto-packets = { path = "../../crates/proto/tsproto-packets" }
|
||||
voelin-model = { path = "../../crates/voelin-model" }
|
||||
voelin-model = { workspace = true }
|
||||
voelin-query = { path = "../../crates/voelin-query" }
|
||||
voelin-observer = { path = "../../crates/voelin-observer" }
|
||||
# The client database (`identity import`/`export`) and where it lives.
|
||||
|
||||
Reference in new issue
Block a user