The product is Voelin (app id io.github.faumaray.Voelin), everywhere: - crates tsc-* -> voelin-* (and voelin-fuzz), the desktop binary tsc-desktop -> voelin, the development CLI tsctl -> voelinctl; - the Android app: applicationId, Kotlin package io.github.faumaray.voelin, VoelinApp, libvoelin_android.so (JNI class names follow); - TSC_* environment variables -> VOELIN_*, Gradle properties tsc.* -> voelin.*, signing secrets VOELIN_SIGNING_*; - the data/config/cache/state folder tsc -> voelin, the keyring service, thread names, the dev compose project; - desktop file, metainfo, icon, Flatpak manifest, NSIS installer, docs. The gateway keeps its name: bin tsgw (crate voelin-gateway), TSGW_* env vars, the tsgw.v1+json protocol, the tsgw image. The window title and the About page show "Voelin <version>" from voelin_platform::APP_NAME. Packages (scripts/package.sh): the app only (voelin, voelin.exe, APKs, Flatpak). voelinctl is a development tool and in no package. tsgw is for servers and now its own Linux package, tsgw_<v>_amd64.deb and tsgw-<v>-linux-x86_64.tar.gz, with a sandboxed systemd unit (packaging/linux/tsgw.service; /etc/tsgw config, /var/lib/tsgw state) and dependencies of its own (no GUI libraries). docs/gateway-admin.md has an Install section. Fixes: - package-windows: makensis on Windows found no file through "D:/a/..." paths; pass Windows paths (cygpath -w). - StartupWMClass is the app id, which the app sets as its X11 WM_CLASS (it was the binary name, so desktops could not match the window). - Gradle wrapper download timeout 10 s -> 60 s (slow proxies). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
139 lines
4.2 KiB
Rust
139 lines
4.2 KiB
Rust
//! 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 }
|
|
}
|
|
ServerFlavor::Ts6(_) => {
|
|
Capabilities { streams: true, raw_query: false, ssh_query: true, http_query: true }
|
|
}
|
|
ServerFlavor::Unknown(_) => Capabilities::default(),
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 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,
|
|
}
|
|
|
|
#[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);
|
|
}
|
|
}
|