mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Support importing native TeamSpeak .ini identity files
The connector now parses --identity either as our own JSON blob or as a
raw TS3 identity string ("<counter>V<base64-key>", the format inside a
native client's exported .ini and in teamspeak:// URLs) via tsproto's
Identity::new_from_str, which already handles both.
The web client's "Identitäten" > Importieren now recognizes a native
.ini file (looks for a [Identity] section), unescapes its \xHH-escaped
name field, and pulls out id/identity/nickname/phonetic_nickname directly
- no conversion needed, the raw identity string is stored as-is and self-
migrates to our JSON format after the first successful connect (same as
any other imported/created identity).
Verified with a real exported .ini file: parsing extracts the right
name/nickname/blob, and connecting the connector directly against the
real server with that exact identity string succeeds and is recognized
as the already-known account (its own channel/server group, not the
default guest group) - not just a fresh/anonymous identity.
This commit is contained in:
1 parent
17899ae137
commit
53ccb22189
2 files changed
+41
-2
No files matched your search
@@ -588,10 +588,14 @@ async fn run(args: Args) -> Result<()> {
|
||||
tracing_subscriber::fmt().with_env_filter("warn").with_writer(std::io::stderr).init();
|
||||
|
||||
let address = args.address.clone();
|
||||
// Accepts either our own persisted JSON blob (serialized below) or a raw
|
||||
// TS3 identity string ("<counter>V<base64-key>", the format used by the
|
||||
// native client's exported .ini files and teamspeak:// URLs) - the web
|
||||
// client's "Identitäten importieren" can hand in either.
|
||||
let identity = args
|
||||
.identity
|
||||
.as_deref()
|
||||
.and_then(|s| serde_json::from_str::<Identity>(s).ok())
|
||||
.and_then(|s| serde_json::from_str::<Identity>(s).ok().or_else(|| Identity::new_from_str(s).ok()))
|
||||
.unwrap_or_else(Identity::create);
|
||||
let identity_str = serde_json::to_string(&identity).unwrap();
|
||||
let mut con_config = Connection::build(args.address).name(args.nickname).identity(identity);
|
||||
|
||||
Reference in new issue
Block a user