Merge the identity defaults: one default, one identities page

The development branch's identity work and this wave's Profiles page
were two models of the same thing: the store's default identity (schema
4: where each identity came from and which one is the default, which the
import on start relies on to replace Voelin's own identity once) next to
this wave's identity.default setting, and a separate Identities section
next to Profiles. They are one now.

- The store's default is the only default: the identity.default setting
  is gone (never released, so nothing to migrate). Choosing an identity
  calls Store::set_default_identity as the user's choice, which no
  import replaces, and says it applies from the next connection.
- One place picks the identity of a connection: the bookmark's own if it
  names one that exists, else the store's default. Connecting, My
  Account and each identity's "Used by" all go through it.
- Profiles has what Identities had: each identity's origin ("Made in
  Voelin", "Imported", "Chosen by you") with its level, the Default
  badge or "Use as default", and the switch for importing the official
  clients' identities on start, next to this wave's rename, export,
  delete, security level, import by hand and identity per server. The
  Identities section, its sidebar entry and the phone's sixth tab are
  gone; VOELIN_OPEN=settings:identities opens Profiles.
- docs/identity.md and docs/ui.md say so; the Identities screenshot gives
  way to the Profiles one, taken from a store with the created identity
  and a synthetic TeamSpeak one.

Checked headless with a fake home and synthetic identities only: the
first start creates Default; the second, with a synthetic TeamSpeak 6
database, makes its identity the default once and says so; the third
changes nothing, and My Account shows the store's default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-04 09:56:25 +03:00
commit 301f472ecf
24 files changed
+541 -137

No files matched your search

+6
View File
@@ -100,3 +100,9 @@ against or offered back to upstream.
(RFC 2782 order). A CNAME among the SRV answers no longer panics. The lookups
are injectable inside the module, and the tests use a fake TSDNS server and
fake names; the upstream tests that need DNS and the internet are `#[ignore]`d.
12. **Private keys with leading zero bytes** (`tsproto-types/src/crypto.rs`,
"Voelin patch"). The TeamSpeak export stores the private scalar as a DER
integer, which drops leading zero bytes, and `EccKeyPrivP256::from_tomcrypt`
handed those fewer than 32 bytes to `from_short`, which refused them: one
identity in 256 (the official client's ones included) could not be imported.
The scalar is padded to 32 bytes now; a test round-trips such keys.
+26 -2
View File
@@ -394,14 +394,23 @@ impl EccKeyPrivP256 {
if (*len != 1 && *len != 2) || content[0] & 0x80 == 0 {
return Err(Error::NoPrivateKey);
}
// Voelin patch: DER drops the leading zero bytes of a scalar
// below 2^248 (one key in 256), which `from_short` refused.
let short = |i: &BigInt| -> Result<Self> {
let bytes = i.to_bytes_be().1;
let mut padded = [0u8; 32];
let start = padded.len().checked_sub(bytes.len()).ok_or(Error::NoShortKey)?;
padded[start..].copy_from_slice(&bytes);
Self::from_short(&padded)
};
if *len == 1 {
if let Some(ASN1Block::Integer(_, i)) = blocks.get(4) {
Self::from_short(&i.to_bytes_be().1)
short(i)
} else {
Err(Error::NoPrivateKey)
}
} else if let Some(ASN1Block::Integer(_, i)) = blocks.get(2) {
Self::from_short(&i.to_bytes_be().1)
short(i)
} else {
Err(Error::NoPrivateKey)
}
@@ -602,6 +611,21 @@ mod tests {
assert_eq!(short, short2);
}
/// Voelin patch: a private key whose first bytes are zero survives the
/// TeamSpeak export (DER stores the scalar without them).
#[test]
fn small_priv_key_round_trips() {
for leading_zeros in [1, 2, 31] {
let mut short = [0x5au8; 32];
short[..leading_zeros].fill(0);
let key = EccKeyPrivP256::from_short(&short).unwrap();
let back = EccKeyPrivP256::from_ts(&key.to_ts()).unwrap();
assert_eq!(back.to_short().as_slice(), short);
let back = EccKeyPrivP256::from_ts_obfuscated(&key.to_ts_obfuscated()).unwrap();
assert_eq!(back.to_short().as_slice(), short);
}
}
#[test]
fn parse_ed25519_pub_key() {
EccKeyPubEd25519::from_base64("zQ3irtRjRVCafjz9j2iz3HVVsp3M7HPNGHUPmTgSQIo=").unwrap();
+116 -22
View File
@@ -32,7 +32,7 @@ use std::{fs, str};
use rusqlite::{Connection, OpenFlags, OptionalExtension};
use tsclientlib::Identity;
use voelin_gateway_proto::UniqueIds;
use voelin_store::Store;
use voelin_store::{IdentityOrigin, Store};
/// Name given to an identity whose source kept none.
pub const DEFAULT_NICKNAME: &str = "imported";
@@ -169,29 +169,65 @@ pub fn import(store: &Store, found: &[Found]) -> Result<Vec<Imported>, IdentityE
if !known.insert(f.uid()) {
return Ok(Imported::Duplicate);
}
Ok(Imported::Added(store.add_identity(&f.nickname, &f.identity)?))
Ok(Imported::Added(store.add_identity(
&f.nickname,
&f.identity,
IdentityOrigin::Imported,
)?))
})
.collect()
}
/// What [`import_new`] did.
#[derive(Debug, Default)]
pub struct LaunchImport {
/// The identities added, the official clients' defaults first.
pub added: Vec<Found>,
/// The identity that became our default.
pub default: Option<Found>,
/// That took the place of the identity the app had created on its own
/// ([`IdentityOrigin::Created`]), which is kept.
pub replaced: bool,
}
/// Store the identities in the official clients' files at `paths` (usually
/// [`discover`]) that the store does not have yet, as the app does when it
/// starts. Files that cannot be read or hold no identity are skipped; none is
/// written. The identities the clients use by default go in first, so on a
/// store without identities the official client's default becomes ours (the
/// first identity) and servers see the same unique id. Returns what was
/// added.
pub fn import_new(store: &Store, paths: &[PathBuf]) -> Result<Vec<Found>, IdentityError> {
/// written.
///
/// Servers should see the user as on the official client: while our
/// default is an identity nobody chose, the one the app created on its own
/// ([`IdentityOrigin::Created`]), or there is none, the identity the official
/// client uses by default becomes ours (the TeamSpeak 6 client's before the
/// TeamSpeak 3 client's), once: an identity the user picked as the default
/// is [`IdentityOrigin::User`] and stays.
pub fn import_new(store: &Store, paths: &[PathBuf]) -> Result<LaunchImport, IdentityError> {
let before = store.default_identity()?;
let mut found: Vec<Found> = paths.iter().filter_map(|path| read(path).ok()).flatten().collect();
// Stable: TeamSpeak 6's default before TeamSpeak 3's, as `locations` lists them.
found.sort_by_key(|f| !f.selected);
let outcomes = import(store, &found)?;
Ok(found
if before.as_ref().is_none_or(|b| b.origin == IdentityOrigin::Created)
&& let Some(official) = found.iter().find(|f| f.selected)
{
let uid = official.uid();
if let Some(entry) = store.identities()?.into_iter().find(|e| e.uid == uid) {
store.set_default_identity(entry.id, false)?;
}
}
let after = store.default_identity()?;
let mut report = LaunchImport::default();
if let Some(after) = after.filter(|a| before.as_ref().is_none_or(|b| b.id != a.id)) {
report.default = found.iter().find(|f| f.uid() == after.uid).cloned();
report.replaced = before.is_some() && report.default.is_some();
}
report.added = found
.into_iter()
.zip(outcomes)
.filter(|(_, outcome)| matches!(outcome, Imported::Added(_)))
.map(|(f, _)| f)
.collect())
.collect();
Ok(report)
}
/// The TeamSpeak 3 `.ini` export of an identity, which the official client
@@ -701,6 +737,14 @@ mod tests {
}
}
fn nicknames(found: &[Found]) -> Vec<&str> {
found.iter().map(|f| f.nickname.as_str()).collect()
}
fn default_uid(store: &Store) -> String {
store.default_identity().unwrap().unwrap().uid
}
#[test]
fn launch_import_makes_the_clients_default_ours_and_adds_only_new_ones() {
let dir = temp_dir("launch");
@@ -712,21 +756,71 @@ mod tests {
let missing = dir.join("missing.db");
let store = Store::open_in_memory().unwrap();
let added = import_new(&store, &[ts6.clone(), missing.clone()]).unwrap();
let nicknames: Vec<_> = added.iter().map(|f| f.nickname.as_str()).collect();
assert_eq!(nicknames, ["Main", "Spare"]);
// The first identity is the app's default: the client's default.
assert_eq!(store.identities().unwrap()[0].uid, main.key().to_pub().get_uid());
let report = import_new(&store, &[ts6.clone(), missing.clone()]).unwrap();
assert_eq!(nicknames(&report.added), ["Main", "Spare"]);
// Without an identity of its own the app takes the client's default.
assert_eq!(report.default.unwrap().nickname, "Main");
assert!(!report.replaced);
assert_eq!(default_uid(&store), main.key().to_pub().get_uid());
// The next start finds only what is new.
// The next start finds only what is new, and an imported default
// stays even when another client has a different one.
client_database(&ts3, &[(&old, "Old", true), (&main, "Main", true)]);
let added = import_new(&store, &[ts6, ts3, missing]).unwrap();
let nicknames: Vec<_> = added.iter().map(|f| f.nickname.as_str()).collect();
assert_eq!(nicknames, ["Old"]);
let stored = store.identities().unwrap();
assert_eq!(stored.len(), 3);
// A store that has identities keeps its default.
assert_eq!(stored[0].uid, main.key().to_pub().get_uid());
let report = import_new(&store, &[ts6, ts3, missing]).unwrap();
assert_eq!(nicknames(&report.added), ["Old"]);
assert!(report.default.is_none() && !report.replaced);
assert_eq!(store.identities().unwrap().len(), 3);
assert_eq!(default_uid(&store), main.key().to_pub().get_uid());
fs::remove_dir_all(dir).unwrap();
}
/// The identity the app made on its first start gives way to the
/// official client's default once; the user's later choice stays.
#[test]
fn the_created_identity_gives_way_once() {
let dir = temp_dir("replace");
let ts6 = dir.join("ts6.db");
let (made, main) = (synthetic(), synthetic());
let store = Store::open_in_memory().unwrap();
let made_id = store.add_identity("Default", &made, IdentityOrigin::Created).unwrap();
// The official client is not there yet: nothing changes.
let report = import_new(&store, std::slice::from_ref(&ts6)).unwrap();
assert!(report.added.is_empty() && report.default.is_none());
assert_eq!(default_uid(&store), made.key().to_pub().get_uid());
client_database(&ts6, &[(&main, "Main", true)]);
let report = import_new(&store, std::slice::from_ref(&ts6)).unwrap();
assert_eq!(report.default.unwrap().nickname, "Main");
assert!(report.replaced);
assert_eq!(default_uid(&store), main.key().to_pub().get_uid());
// The one the app made is kept.
assert_eq!(store.identities().unwrap().len(), 2);
// The user goes back to it: later starts leave that alone.
store.set_default_identity(made_id, true).unwrap();
for _ in 0..2 {
let report = import_new(&store, std::slice::from_ref(&ts6)).unwrap();
assert!(report.added.is_empty() && report.default.is_none() && !report.replaced);
assert_eq!(default_uid(&store), made.key().to_pub().get_uid());
}
fs::remove_dir_all(dir).unwrap();
}
/// An identity imported earlier (by `voelinctl identity import`, which
/// does not choose a default) still takes the created one's place.
#[test]
fn an_earlier_import_still_replaces_the_created_identity() {
let dir = temp_dir("earlier");
let ts6 = dir.join("ts6.db");
let (made, main) = (synthetic(), synthetic());
client_database(&ts6, &[(&main, "Main", true)]);
let store = Store::open_in_memory().unwrap();
store.add_identity("Default", &made, IdentityOrigin::Created).unwrap();
import(&store, &read(&ts6).unwrap()).unwrap();
assert_eq!(default_uid(&store), made.key().to_pub().get_uid());
let report = import_new(&store, &[ts6]).unwrap();
assert!(report.added.is_empty() && report.replaced);
assert_eq!(default_uid(&store), main.key().to_pub().get_uid());
fs::remove_dir_all(dir).unwrap();
}
+1 -2
View File
@@ -274,8 +274,7 @@ mod tests {
db.execute_batch("INSERT INTO settings (key, value) VALUES ('k', '1');").unwrap();
}
let store = Store::open(&path).unwrap();
assert_eq!(store.schema_version().unwrap(), 3);
assert_eq!(Store::SCHEMA_VERSION, 3);
assert_eq!(store.schema_version().unwrap(), Store::SCHEMA_VERSION);
assert_eq!(store.setting::<u32>("k").unwrap(), Some(1));
store.put_contact(&friend("a=")).unwrap();
drop(store);
+1 -1
View File
@@ -21,7 +21,7 @@ pub use contacts::{Contact, ContactSeen, Relation};
#[cfg(feature = "keyring")]
pub use secrets::KeyringSecrets;
pub use secrets::{MemorySecrets, Secrets};
pub use store::{Bookmark, IdentityEntry, QueryConfig, QueryTransport, Store};
pub use store::{Bookmark, IdentityEntry, IdentityOrigin, QueryConfig, QueryTransport, Store};
#[derive(Debug, thiserror::Error)]
pub enum Error {
+163 -9
View File
@@ -22,8 +22,22 @@ const MIGRATIONS: &[Migration] = &[
Migration::Sql(SCHEMA_1),
Migration::Code(crate::chat::migrate_2),
Migration::Sql(crate::contacts::SCHEMA_3),
Migration::Sql(SCHEMA_4),
];
/// Version 4: where each identity came from ([`IdentityOrigin`]) and which
/// one is the default. Until now the app created an identity named
/// `Default` when it had none, and the only other way in was an import;
/// the default was the first identity.
const SCHEMA_4: &str = r#"
ALTER TABLE identities ADD COLUMN origin TEXT NOT NULL DEFAULT 'user';
ALTER TABLE identities ADD COLUMN is_default INTEGER NOT NULL DEFAULT 0;
UPDATE identities SET origin = 'imported';
UPDATE identities SET origin = 'created'
WHERE id = (SELECT MIN(id) FROM identities) AND name = 'Default';
UPDATE identities SET is_default = 1 WHERE id = (SELECT MIN(id) FROM identities);
"#;
/// Version 1: identities, bookmarks, settings and a first chat cache.
pub(crate) const SCHEMA_1: &str = r#"
CREATE TABLE identities (
@@ -62,6 +76,39 @@ pub struct IdentityEntry {
pub name: String,
pub uid: String,
pub level: u8,
pub origin: IdentityOrigin,
/// The identity the app connects with.
pub is_default: bool,
}
/// Where an identity came from.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum IdentityOrigin {
/// Made by the app on its own because it had none; nobody chose it, so
/// the official client's identity may take its place as the default.
Created,
/// From another client (`voelin_core::identity`).
Imported,
/// Made or chosen as the default by the user.
User,
}
impl IdentityOrigin {
fn as_str(self) -> &'static str {
match self {
Self::Created => "created",
Self::Imported => "imported",
Self::User => "user",
}
}
fn parse(text: &str) -> Self {
match text {
"created" => Self::Created,
"imported" => Self::Imported,
_ => Self::User,
}
}
}
/// How to reach a server's ServerQuery for invisible presence and relay chat.
@@ -179,28 +226,71 @@ impl Store {
// Identities
pub fn add_identity(&self, name: &str, identity: &Identity) -> Result<i64> {
/// Store an identity; it is the default when no other one is.
pub fn add_identity(
&self,
name: &str,
identity: &Identity,
origin: IdentityOrigin,
) -> Result<i64> {
let uid = identity.key().to_pub().get_uid();
self.db.execute(
"INSERT INTO identities (name, uid, data) VALUES (?1, ?2, ?3)",
params![name, uid, serde_json::to_string(identity)?],
"INSERT INTO identities (name, uid, data, origin, is_default)
VALUES (?1, ?2, ?3, ?4, NOT EXISTS (SELECT 1 FROM identities WHERE is_default))",
params![name, uid, serde_json::to_string(identity)?, origin.as_str()],
)?;
Ok(self.db.last_insert_rowid())
}
pub fn identities(&self) -> Result<Vec<IdentityEntry>> {
let mut stmt = self.db.prepare("SELECT id, name, uid, data FROM identities ORDER BY id")?;
let mut stmt = self.db.prepare(
"SELECT id, name, uid, data, origin, is_default FROM identities ORDER BY id",
)?;
let rows = stmt.query_map([], |r| {
Ok((r.get::<_, i64>(0)?, r.get(1)?, r.get(2)?, r.get::<_, String>(3)?))
Ok((
r.get::<_, i64>(0)?,
r.get(1)?,
r.get(2)?,
r.get::<_, String>(3)?,
r.get::<_, String>(4)?,
r.get(5)?,
))
})?;
rows.map(|row| {
let (id, name, uid, data) = row?;
let (id, name, uid, data, origin, is_default) = row?;
let identity: Identity = serde_json::from_str(&data)?;
Ok(IdentityEntry { id, name, uid, level: identity.level() })
let origin = IdentityOrigin::parse(&origin);
Ok(IdentityEntry { id, name, uid, level: identity.level(), origin, is_default })
})
.collect()
}
/// The identity the app connects with: the one marked as the default,
/// else the first.
pub fn default_identity(&self) -> Result<Option<IdentityEntry>> {
let identities = self.identities()?;
Ok(identities.iter().find(|i| i.is_default).or(identities.first()).cloned())
}
/// Make `id` the default identity. `by_user`: the user chose it, so one
/// the app created on its own becomes theirs ([`IdentityOrigin::User`])
/// and is never replaced by an import again.
pub fn set_default_identity(&self, id: i64, by_user: bool) -> Result<()> {
let tx = self.db.unchecked_transaction()?;
if tx.execute("UPDATE identities SET is_default = 1 WHERE id = ?1", [id])? == 0 {
return Err(Error::NotFound("identity", id));
}
tx.execute("UPDATE identities SET is_default = 0 WHERE id <> ?1", [id])?;
if by_user {
tx.execute(
"UPDATE identities SET origin = 'user' WHERE id = ?1 AND origin = 'created'",
[id],
)?;
}
tx.commit()?;
Ok(())
}
pub fn identity(&self, id: i64) -> Result<Identity> {
let data: Option<String> = self
.db
@@ -337,22 +427,86 @@ mod tests {
fn identities() {
let store = Store::open_in_memory().unwrap();
let identity = Identity::create();
let id = store.add_identity("main", &identity).unwrap();
let id = store.add_identity("main", &identity, IdentityOrigin::Imported).unwrap();
let list = store.identities().unwrap();
assert_eq!(list.len(), 1);
assert_eq!(list[0].name, "main");
assert_eq!(list[0].uid, identity.key().to_pub().get_uid());
assert!(list[0].level >= 8);
assert_eq!(list[0].origin, IdentityOrigin::Imported);
let loaded = store.identity(id).unwrap();
assert_eq!(loaded.counter(), identity.counter());
// The same key twice is rejected (uid is unique).
assert!(store.add_identity("dup", &identity).is_err());
assert!(store.add_identity("dup", &identity, IdentityOrigin::User).is_err());
store.rename_identity(id, "renamed").unwrap();
assert_eq!(store.identities().unwrap()[0].name, "renamed");
store.delete_identity(id).unwrap();
assert!(matches!(store.identity(id), Err(Error::NotFound(..))));
}
#[test]
fn the_default_identity() {
let store = Store::open_in_memory().unwrap();
assert_eq!(store.default_identity().unwrap(), None);
let made = store.add_identity("Default", &Identity::create(), IdentityOrigin::Created);
let made = made.unwrap();
let other = store.add_identity("Other", &Identity::create(), IdentityOrigin::Imported);
let other = other.unwrap();
// The first one is the default.
let default = store.default_identity().unwrap().unwrap();
assert_eq!((default.id, default.origin), (made, IdentityOrigin::Created));
// An import moves the default without making the old one the user's.
store.set_default_identity(other, false).unwrap();
assert_eq!(store.default_identity().unwrap().unwrap().id, other);
assert_eq!(store.identities().unwrap()[0].origin, IdentityOrigin::Created);
// The user's choice makes the created one theirs.
store.set_default_identity(made, true).unwrap();
let list = store.identities().unwrap();
assert_eq!((list[0].is_default, list[0].origin), (true, IdentityOrigin::User));
assert_eq!((list[1].is_default, list[1].origin), (false, IdentityOrigin::Imported));
assert!(matches!(store.set_default_identity(99, true), Err(Error::NotFound(..))));
assert_eq!(store.default_identity().unwrap().unwrap().id, made);
}
/// A database of version 3 learns where its identities came from: the
/// first one, named `Default`, is the one the app made; the others were
/// imported; the first stays the default.
#[test]
fn migrates_version_3_identities() {
let dir = std::env::temp_dir().join(format!("voelin-store-v3-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
let path = dir.join("client.db");
let (made, imported) = (Identity::create(), Identity::create());
{
let mut db = rusqlite::Connection::open(&path).unwrap();
db.execute_batch(SCHEMA_1).unwrap();
let tx = db.transaction().unwrap();
crate::chat::migrate_2(&tx).unwrap();
tx.commit().unwrap();
db.execute_batch(crate::contacts::SCHEMA_3).unwrap();
db.pragma_update(None, "user_version", 3).unwrap();
for (name, identity) in [("Default", &made), ("Main", &imported)] {
let uid = identity.key().to_pub().get_uid();
let data = serde_json::to_string(identity).unwrap();
db.execute(
"INSERT INTO identities (name, uid, data) VALUES (?1, ?2, ?3)",
params![name, uid, data],
)
.unwrap();
}
}
let store = Store::open(&path).unwrap();
assert_eq!(store.schema_version().unwrap(), Store::SCHEMA_VERSION);
let list = store.identities().unwrap();
assert_eq!((list[0].origin, list[0].is_default), (IdentityOrigin::Created, true));
assert_eq!((list[1].origin, list[1].is_default), (IdentityOrigin::Imported, false));
// The keys are untouched.
assert_eq!(store.identity(list[1].id).unwrap().counter(), imported.counter());
drop(store);
std::fs::remove_dir_all(dir).unwrap();
}
#[test]
fn bookmarks_keep_order_and_fields() {
let store = Store::open_in_memory().unwrap();
+9 -9
View File
@@ -564,24 +564,24 @@ pub fn run(options: RunOptions) -> Result<()> {
let prefs = open_settings(&dir, &options.setting_overrides);
let switches = crate::dev::Switches::from_env();
// New identities of the official TeamSpeak clients, on every start (not
// with the sample data of VOELIN_DEMO_UI); with none of our own yet, the
// client's default identity becomes ours.
let had_identity = !store.identities()?.is_empty();
// with the sample data of VOELIN_DEMO_UI); the client's default
// identity becomes ours while we have none the user chose.
let imported = if prefs.get(&IDENTITY_IMPORT) && !switches.demo_ui {
voelin_core::identity::import_new(&store, &voelin_core::identity::discover())
.unwrap_or_else(|e| {
warn!(%e, "could not import TeamSpeak identities");
Vec::new()
Default::default()
})
} else {
Vec::new()
Default::default()
};
let identity = match store.identities()?.first() {
let identity = match store.default_identity()? {
Some(entry) => store.identity(entry.id)?,
None => {
// Creating an identity takes a moment (security level 8).
let identity = tsclientlib::Identity::create();
store.add_identity(crate::servers::CREATED_IDENTITY, &identity)?;
let origin = voelin_store::IdentityOrigin::Created;
store.add_identity(crate::servers::CREATED_IDENTITY, &identity, origin)?;
identity
}
};
@@ -661,7 +661,7 @@ pub fn run(options: RunOptions) -> Result<()> {
crate::bind::wire(&ui);
with_app(|app| {
app.apply_appearance();
app.load_default_identity();
app.load_own_uids();
app.apply_srtp();
app.refresh_all();
app.refresh_settings_flags();
@@ -674,7 +674,7 @@ pub fn run(options: RunOptions) -> Result<()> {
if app.demo {
app.start_demo();
}
if let Some(text) = crate::servers::imported_status(&imported, had_identity) {
if let Some(text) = crate::servers::imported_status(&imported) {
app.set_status(text);
}
});
+6
View File
@@ -52,4 +52,10 @@ pub(super) fn wire(ui: &MainWindow) {
bridge.on_open_about(|| {
with_app(|app| app.load_notices());
});
bridge.on_use_identity(|id| {
with_app(|app| app.use_identity(id as i64));
});
bridge.on_set_identity_import(|on| {
with_app(|app| app.set_identity_import(on));
});
}
+3 -2
View File
@@ -29,7 +29,8 @@
//! `notifications` (the bell), `join` (join by address), `offline` (an
//! offline message), `picture` (a chat picture opened large), `camera`
//! (the settings' camera preview); settings sections also `account`,
//! `profiles`, `devices`, `notifications`, `integrations`, `advanced`;
//! `profiles` (also `identities`), `devices`, `notifications`,
//! `integrations`, `advanced` (5-10);
//! `studio[:<what>]`: the Stream Studio (with `VOELIN_DEMO_UI` a demo
//! studio from synthetic sources), `studio:window` in a window of its own,
//! `studio:live` going live, `studio:record`, or a dialog: `studio:source`,
@@ -121,7 +122,7 @@ fn section(name: &str) -> SettingsSection {
"3" | "privacy" => SettingsSection::Privacy,
"4" | "appearance" => SettingsSection::Appearance,
"5" | "account" => SettingsSection::Account,
"6" | "profiles" => SettingsSection::Profiles,
"6" | "profiles" | "identities" => SettingsSection::Profiles,
"7" | "devices" => SettingsSection::Devices,
"8" | "notifications" => SettingsSection::Notifications,
"9" | "integrations" => SettingsSection::Integrations,
+66
View File
@@ -0,0 +1,66 @@
//! The identity servers see us as: the store's default (schema 4,
//! `Store::default_identity`), chosen under Settings → Profiles, and the
//! import of the official clients' identities on start
//! (`voelin_core::identity::import_new`, app.rs). The rest of the Profiles
//! page is in `settings_pages.rs`.
use tracing::warn;
use voelin_core::settings::IDENTITY_IMPORT;
use voelin_store::IdentityOrigin;
use crate::app::App;
/// Where an identity came from, as Profiles says it.
pub(crate) fn origin_label(origin: IdentityOrigin) -> &'static str {
match origin {
IdentityOrigin::Created => "Made in Voelin",
IdentityOrigin::Imported => "Imported",
IdentityOrigin::User => "Chosen by you",
}
}
impl App {
/// The user's choice of the identity servers see us as, from the next
/// connection on; no import replaces it.
pub(crate) fn use_identity(&mut self, id: i64) {
let result =
self.store.set_default_identity(id, true).and_then(|()| self.store.identity(id));
match result {
Ok(identity) => {
self.identity = identity;
let name = self
.store
.identities()
.ok()
.and_then(|all| all.into_iter().find(|e| e.id == id))
.map(|e| e.name)
.unwrap_or_default();
self.set_status(format!(
"Servers see you as \u{201c}{name}\u{201d} from your next connection"
));
}
Err(e) => self.set_status(format!("Could not change the identity: {e}")),
}
self.refresh_identities();
}
pub(crate) fn set_identity_import(&mut self, on: bool) {
if let Err(e) = self.prefs.set(&IDENTITY_IMPORT, on) {
warn!(%e, "could not store the setting");
}
self.refresh_identities();
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn rows_say_where_an_identity_came_from() {
assert_eq!(origin_label(IdentityOrigin::Created), "Made in Voelin");
assert_eq!(origin_label(IdentityOrigin::Imported), "Imported");
// Made by the app, then chosen: an import never replaces it.
assert_eq!(origin_label(IdentityOrigin::User), "Chosen by you");
}
}
+1
View File
@@ -10,6 +10,7 @@ mod emoji;
mod events;
mod home;
mod hotkey;
mod identities;
mod images;
mod inbox;
mod members;
+31 -19
View File
@@ -3,7 +3,7 @@
use slint::{ComponentHandle, SharedString};
use tracing::warn;
use voelin_core::identity::Found;
use voelin_core::identity::LaunchImport;
use voelin_core::{Command, ObserveState, Source, VoiceOptions, VoiceState};
use voelin_store::{Bookmark, QueryConfig, QueryTransport};
@@ -14,20 +14,20 @@ use crate::vm;
pub(crate) const CREATED_IDENTITY: &str = "Default";
/// What to tell the user about the identities imported from the official
/// clients at start ([`voelin_core::identity::import_new`]), if any.
/// `had_identity`: we had one before, so it stays the default.
pub(crate) fn imported_status(imported: &[Found], had_identity: bool) -> Option<String> {
let first = imported.first()?;
let n = imported.len();
let names = imported.iter().map(|f| f.nickname.as_str()).collect::<Vec<_>>().join(", ");
Some(match (had_identity, n) {
(true, 1) => format!("Imported the identity \u{201c}{names}\u{201d} from TeamSpeak"),
(true, _) => format!("Imported {n} identities from TeamSpeak: {names}"),
(false, 1) => format!("Using your TeamSpeak identity \u{201c}{names}\u{201d}"),
(false, _) => format!(
"Using your TeamSpeak identity \u{201c}{}\u{201d} ({n} imported: {names})",
first.nickname
/// clients at start ([`voelin_core::identity::import_new`]), if anything.
pub(crate) fn imported_status(report: &LaunchImport) -> Option<String> {
let n = report.added.len();
let names = report.added.iter().map(|f| f.nickname.as_str()).collect::<Vec<_>>().join(", ");
let more = if n > 1 { format!(" ({n} imported: {names})") } else { String::new() };
Some(match &report.default {
Some(f) if report.replaced => format!(
"You now use your TeamSpeak identity \u{201c}{}\u{201d}; your previous one is kept{more}",
f.nickname
),
Some(f) => format!("Using your TeamSpeak identity \u{201c}{}\u{201d}{more}", f.nickname),
None if n == 1 => format!("Imported the identity \u{201c}{names}\u{201d} from TeamSpeak"),
None if n > 1 => format!("Imported {n} identities from TeamSpeak: {names}"),
None => return None,
})
}
@@ -115,9 +115,9 @@ impl App {
/// from TeamSpeak keeps the nickname used there), else the system user's.
pub(crate) fn default_nickname(&self) -> String {
self.store
.identities()
.default_identity()
.ok()
.and_then(|identities| identities.into_iter().next())
.flatten()
.map(|identity| identity.name)
.filter(|name| {
![CREATED_IDENTITY, voelin_core::identity::DEFAULT_NICKNAME]
@@ -478,6 +478,8 @@ impl App {
#[cfg(test)]
mod tests {
use voelin_core::identity::Found;
use super::*;
#[test]
@@ -544,14 +546,24 @@ mod tests {
source: "settings.db".into(),
selected: false,
};
assert_eq!(imported_status(&[], false), None);
let report = |added: &[&str], default: Option<&str>, replaced| LaunchImport {
added: added.iter().map(|n| found(n)).collect(),
default: default.map(found),
replaced,
};
assert_eq!(imported_status(&report(&[], None, false)), None);
assert_eq!(
imported_status(&[found("Main")], false).unwrap(),
imported_status(&report(&["Main"], Some("Main"), false)).unwrap(),
"Using your TeamSpeak identity \u{201c}Main\u{201d}"
);
assert_eq!(
imported_status(&[found("Main"), found("Alt")], true).unwrap(),
imported_status(&report(&["Main", "Alt"], None, false)).unwrap(),
"Imported 2 identities from TeamSpeak: Main, Alt"
);
// Imported earlier, now ours instead of the one the app made.
assert_eq!(
imported_status(&report(&[], Some("Main"), true)).unwrap(),
"You now use your TeamSpeak identity \u{201c}Main\u{201d}; your previous one is kept"
);
}
}
+1 -11
View File
@@ -201,15 +201,6 @@ pub static UI_IMAGE_PREVIEW_KB: Key<u32> = Key::new(
|| 8192,
);
/// `identity.default`: the identity used where a server names none (its
/// id in the identities; 0: the first one).
pub static IDENTITY_DEFAULT: Key<u64> = Key::new(
"identity.default",
Kind::UInt { min: 0 },
"The identity servers see unless their bookmark names another (0: the first).",
|| 0,
);
#[allow(clippy::ptr_arg)] // a validation of `Key<String>` is `fn(&String)`
fn valid_resolution(text: &String) -> Result<(), String> {
if text == "auto" || parse_size(text).is_some() {
@@ -227,7 +218,7 @@ pub fn parse_size(text: &str) -> Option<(u32, u32)> {
}
/// The keys of the home, messages and settings pages, for registering.
pub fn page_keys() -> [&'static dyn voelin_core::settings::Setting; 11] {
pub fn page_keys() -> [&'static dyn voelin_core::settings::Setting; 10] {
[
&NOTIFY_MENTIONS,
&NOTIFY_MESSAGES,
@@ -239,7 +230,6 @@ pub fn page_keys() -> [&'static dyn voelin_core::settings::Setting; 11] {
&VIDEO_RESOLUTION,
&VIDEO_MIRROR,
&UI_IMAGE_PREVIEW_KB,
&IDENTITY_DEFAULT,
]
}
+1
View File
@@ -41,6 +41,7 @@ impl App {
bridge.set_h264_enabled(self.settings.openh264);
bridge.set_image_cache_usage(crate::images::usage_text().into());
self.refresh_h264();
self.refresh_identities();
}
pub(crate) fn close_settings(&mut self) {
+36 -38
View File
@@ -15,12 +15,13 @@ use tracing::warn;
use voelin_core::settings::{
AudioSourceKindSetting, AudioSourceSetting, BlockMode, CACHE_FETCH_IMAGES, CACHE_MAX_MB,
CHAT_DEDUPE_TOLERANCE_MS, CHAT_HISTORY_PAGE, CHAT_RETENTION_DAYS, CHAT_STORE_HISTORY,
CaptureChoice, CodecChoice, FILES_PROGRESS_MS, Key, LayerSetting, PRIVACY_BLOCK_MODE,
PRIVACY_POKES, PRIVACY_PRIVATE_MESSAGES, SRTP_PROFILES, STREAM_AUDIO_SOURCES,
STREAM_BITRATE_KBPS, STREAM_CAPTURE_BACKEND, STREAM_CODEC, STREAM_DECODER_BACKEND,
STREAM_ENCODER_BACKEND, STREAM_FPS, STREAM_HARDWARE_ACCELERATION, STREAM_HARDWARE_DECODING,
STREAM_LAYERS, STREAM_PERMISSIONS, STREAM_SRTP_PROFILES, STUDIO_RECORDING_DIR,
STUDIO_REPLAY_MEMORY_MB, STUDIO_REPLAY_SECONDS, Source as SettingSource, StreamPermissions,
CaptureChoice, CodecChoice, FILES_PROGRESS_MS, IDENTITY_IMPORT, Key, LayerSetting,
PRIVACY_BLOCK_MODE, PRIVACY_POKES, PRIVACY_PRIVATE_MESSAGES, SRTP_PROFILES,
STREAM_AUDIO_SOURCES, STREAM_BITRATE_KBPS, STREAM_CAPTURE_BACKEND, STREAM_CODEC,
STREAM_DECODER_BACKEND, STREAM_ENCODER_BACKEND, STREAM_FPS, STREAM_HARDWARE_ACCELERATION,
STREAM_HARDWARE_DECODING, STREAM_LAYERS, STREAM_PERMISSIONS, STREAM_SRTP_PROFILES,
STUDIO_RECORDING_DIR, STUDIO_REPLAY_MEMORY_MB, STUDIO_REPLAY_SECONDS, Source as SettingSource,
StreamPermissions,
};
use voelin_core::{Command, GatewayRequest};
use voelin_gateway_proto::{Action, ConfigSource, PermRule, UniqueIds, feature};
@@ -31,9 +32,9 @@ use crate::app::{
PrivacyForm, SettingItem, StreamingForm, VideoForm, later, model,
};
use crate::settings::{
IDENTITY_DEFAULT, NOTIFY_EVENTS, NOTIFY_FRIENDS, NOTIFY_MENTIONS, NOTIFY_MESSAGES,
NOTIFY_POKES, NotifyLevel, UI_IMAGE_PREVIEW_KB, VIDEO_BACKGROUND, VIDEO_CAMERA, VIDEO_MIRROR,
VIDEO_RESOLUTION, page_keys, parse_size,
NOTIFY_EVENTS, NOTIFY_FRIENDS, NOTIFY_MENTIONS, NOTIFY_MESSAGES, NOTIFY_POKES, NotifyLevel,
UI_IMAGE_PREVIEW_KB, VIDEO_BACKGROUND, VIDEO_CAMERA, VIDEO_MIRROR, VIDEO_RESOLUTION, page_keys,
parse_size,
};
use crate::social::{allowed_index, allowed_of};
@@ -334,9 +335,6 @@ impl App {
voelin_core::media::configured_codec(&self.prefs),
);
}
if key == IDENTITY_DEFAULT.name() {
self.load_default_identity();
}
if key == VIDEO_CAMERA.name()
|| key == VIDEO_BACKGROUND.name()
|| key == VIDEO_RESOLUTION.name()
@@ -913,18 +911,6 @@ impl App {
// Identities (My Account, Profiles).
/// The identity used unless a bookmark names another: `identity.default`,
/// else the first.
pub(crate) fn load_default_identity(&mut self) {
let wanted = self.prefs.get(&IDENTITY_DEFAULT) as i64;
let entries = self.store.identities().unwrap_or_default();
let id = entries.iter().find(|e| e.id == wanted).or(entries.first()).map(|e| e.id);
if let Some(identity) = id.and_then(|id| self.store.identity(id).ok()) {
self.identity = identity;
}
self.load_own_uids();
}
/// Our unique ids (every identity, both server generations), to tell
/// our own messages.
pub(crate) fn load_own_uids(&mut self) {
@@ -939,19 +925,28 @@ impl App {
self.social.own_uids = uids;
}
/// The identity a bookmark connects with.
pub(crate) fn identity_for(&self, bookmark: Option<i64>) -> tsclientlib::Identity {
/// The identity servers see us as on `bookmark` (the one place that
/// picks it): the bookmark's own if it names one that exists, else the
/// store's default.
fn identity_id_for(&self, bookmark: Option<i64>) -> Option<i64> {
let entries = self.store.identities().unwrap_or_default();
bookmark
.and_then(|b| self.bookmark(b))
.and_then(|b| b.identity)
.filter(|id| entries.iter().any(|e| e.id == *id))
.or_else(|| self.default_identity_id())
}
/// The identity a connection to `bookmark` uses ([`Self::identity_id_for`]).
pub(crate) fn identity_for(&self, bookmark: Option<i64>) -> tsclientlib::Identity {
self.identity_id_for(bookmark)
.and_then(|id| self.store.identity(id).ok())
.unwrap_or_else(|| self.identity.clone())
}
/// The store's default identity (`Store::default_identity`).
fn default_identity_id(&self) -> Option<i64> {
let entries = self.store.identities().unwrap_or_default();
let wanted = self.prefs.get(&IDENTITY_DEFAULT) as i64;
entries.iter().find(|e| e.id == wanted).or(entries.first()).map(|e| e.id)
self.store.default_identity().ok().flatten().map(|e| e.id)
}
pub(crate) fn refresh_account(&self) {
@@ -960,7 +955,7 @@ impl App {
let bookmark = self.current.and_then(|id| self.bookmark(id));
let identity = self.identity_for(self.current);
let ids = UniqueIds::from_omega(&identity.key().to_pub().to_ts());
let entry_id = bookmark.and_then(|b| b.identity).or_else(|| self.default_identity_id());
let entry_id = self.identity_id_for(self.current);
let name = self
.store
.identities()
@@ -985,6 +980,11 @@ impl App {
let bridge = ui.global::<Bridge>();
let entries = self.store.identities().unwrap_or_default();
let default = self.default_identity_id();
let picks: Vec<(&str, Option<i64>)> = self
.bookmarks
.iter()
.map(|b| (b.name.as_str(), self.identity_id_for(Some(b.id))))
.collect();
let items: Vec<IdentityItem> = entries
.iter()
.map(|e| {
@@ -992,13 +992,10 @@ impl App {
let ids =
identity.as_ref().map(|i| UniqueIds::from_omega(&i.key().to_pub().to_ts()));
let improving = self.pages.improving.get(&e.id);
let used: Vec<&str> = self
.bookmarks
let used: Vec<&str> = picks
.iter()
.filter(|b| {
b.identity == Some(e.id) || (b.identity.is_none() && Some(e.id) == default)
})
.map(|b| b.name.as_str())
.filter(|(_, id)| *id == Some(e.id))
.map(|(name, _)| *name)
.collect();
IdentityItem {
id: e.id as i32,
@@ -1007,6 +1004,7 @@ impl App {
uid6: ids.map(|i| i.ts6).unwrap_or_default().into(),
level: i32::from(identity.map_or(e.level, |i| i.level())),
default: Some(e.id) == default,
origin: crate::identities::origin_label(e.origin).into(),
improving: improving.map_or(0, |i| i32::from(i.target)),
reached: improving.map_or(0, |i| i32::from(i.reached)),
used_by: used.join(", ").into(),
@@ -1049,14 +1047,14 @@ impl App {
})
.collect();
bridge.set_found_identities(model(found));
bridge.set_identity_import(self.prefs.get(&IDENTITY_IMPORT));
self.refresh_account();
}
/// "default", "delete", "export", "stop".
/// "delete", "export", "stop" (the default: [`Self::use_identity`]).
pub(crate) fn identity_action(&mut self, id: i32, action: &str) {
let id = i64::from(id);
match action {
"default" => self.put(&IDENTITY_DEFAULT, id as u64),
"delete" => {
if self.default_identity_id() == Some(id) {
self.set_status(
+1
View File
@@ -283,6 +283,7 @@ export component MainWindow inherits Window {
x: (parent.width - self.width) / 2;
y: parent.height - self.height - (Nav.narrow ? 140px : 96px);
text: Bridge.status-text;
widest: min(560px, parent.width - 32px);
}
// The member card of the members panel, over everything.
+10
View File
@@ -553,7 +553,11 @@ export struct IdentityItem {
uid: string,
uid6: string,
level: int,
// The store's default: servers see us as this one unless a bookmark
// names another.
default: bool,
// Where it came from: "Made in Voelin", "Imported", "Chosen by you".
origin: string,
// Raising its level: the level aimed at and the best one reached (0: no).
improving: int,
reached: int,
@@ -882,6 +886,12 @@ export global Bridge {
in property <string> crash-notice;
// Third-party notices, one entry per line, for the About page.
in property <[string]> notices;
// Settings → Profiles: the identity servers see us as (the store's
// default, from the next connection) and the import of the official
// clients' identities on start (identity.import_from_teamspeak).
in-out property <bool> identity-import;
callback use-identity(int);
callback set-identity-import(bool);
callback select-server(int);
// The search field of the top bar: filters the channel tree.
+4 -2
View File
@@ -234,8 +234,10 @@ export component Toast inherits Rectangle {
in property <image> icon: Icons.info;
in property <duration> timeout: 5s;
in-out property <bool> shown;
// The widest it gets (e.g. the window less a margin); longer text wraps.
in property <length> widest: 560px;
height: shown ? row.preferred-height + 16px : 0px;
width: min(row.preferred-width + 24px, 560px);
width: min(row.preferred-width + 24px, widest);
visible: shown;
border-radius: Theme.radius-lg;
background: Theme.surface-3;
@@ -266,7 +268,7 @@ export component Toast inherits Rectangle {
text: root.text;
color: Theme.text;
vertical-alignment: center;
overflow: elide;
wrap: word-wrap;
}
}
}
@@ -236,15 +236,15 @@ export component AccountSection inherits VerticalLayout {
}
}
// Make default, export, delete.
// Use as default, export, delete.
component IdentityActions inherits HorizontalLayout {
in property <IdentityItem> item;
spacing: Theme.space-3;
if !root.item.default: Button {
small: true;
text: @tr("Make default");
text: @tr("Use as default");
y: (parent.height - self.height) / 2;
clicked => { Bridge.identity-action(root.item.id, "default"); }
clicked => { Bridge.use-identity(root.item.id); }
}
Button {
small: true;
@@ -323,8 +323,8 @@ component IdentityRow inherits Rectangle {
spacing: Theme.space-3;
Text {
text: root.item.improving > 0
? @tr("Security level {}; raising it to {} on every core (best so far: {})…", root.item.level, root.item.improving, root.item.reached)
: @tr("Security level {}", root.item.level);
? @tr("{} · security level {}; raising it to {} on every core (best so far: {})…", root.item.origin, root.item.level, root.item.improving, root.item.reached)
: @tr("{} · security level {}", root.item.origin, root.item.level);
color: root.item.improving > 0 ? Theme.accent-text : Theme.text-secondary;
font-size: Theme.font-sm;
vertical-alignment: center;
@@ -381,13 +381,19 @@ export component ProfilesSection inherits VerticalLayout {
wrap: word-wrap;
}
Hint {
text: @tr("The security level is hash cash: servers may require a minimum (often 8). Each level takes about twice as long as the one before. Exported identities are written as TeamSpeak 3 .ini files into your downloads folder; they hold the private key.");
text: @tr("Servers know you by the default identity's unique id, from the next connection on, unless a server names another below. The security level is hash cash: servers may require a minimum (often 8). Each level takes about twice as long as the one before. Exported identities are written as TeamSpeak 3 .ini files into your downloads folder; they hold the private key.");
}
}
Card {
title: @tr("Import from TeamSpeak");
icon: Icons.download;
subtitle: @tr("From the official clients' settings and .ini exports on this device; their files are only read.");
ToggleRow {
text: @tr("Import identities from TeamSpeak on start");
description: @tr("While you use the identity Voelin made for you, the one TeamSpeak uses becomes your default, once.");
checked <=> Bridge.identity-import;
toggled => { Bridge.set-identity-import(Bridge.identity-import); }
}
HorizontalLayout {
alignment: start;
spacing: Theme.space-3;
+1 -1
View File
@@ -43,7 +43,7 @@ export component SettingsNav inherits VerticalLayout {
NavItem {
icon: Icons.users;
text: @tr("Profiles");
subtitle: @tr("Identities, import, export");
subtitle: @tr("Who servers see you as, import, export");
selected: Nav.settings-section == SettingsSection.profiles;
clicked => { Nav.open-settings(SettingsSection.profiles); }
}
+28 -8
View File
@@ -171,14 +171,34 @@ voelinctl identity export <id> <path> [--store <db>]
**On every start** the app does the same as `import --auto`
(`voelin_core::identity::import_new`): identities found in the default
locations that the client database does not have yet are added, the files
are only read. The identity the official client uses by default (field 5 of
its payload, below) goes in first, so when Voelin has no identity of its own
yet, that one becomes Voelin's default (the first identity) and servers see
the same unique id; otherwise Voelin's default stays. What was imported is
shown once, in the status line (the toast on desktop), by nickname. The
runtime setting `identity.import_from_teamspeak` (default on) turns it off,
e.g. `--set identity.import_from_teamspeak=false`. The sample data of
`VOELIN_DEMO_UI` never imports.
are only read. The user should appear as on the official client, so the
identity the official client uses by default (field 5 of its payload, below;
TeamSpeak 6's before TeamSpeak 3's) becomes Voelin's default when Voelin has
none, or only the one it created on its own the first time it started,
which nobody chose. That happens once: the created identity is kept, and
choosing it again in Settings → Profiles makes it the user's own, which
no import replaces; identities that were imported or chosen are never
replaced. The store keeps where each identity came from and which one is the
default (`identities.origin`: `created`, `imported`, `user`;
`identities.is_default`; schema version 4, which marks the first identity
named `Default` of an older database as created). What happened is shown
once in the status line (the toast on desktop), by nickname, e.g. "You now
use your TeamSpeak identity "X"; your previous one is kept". The runtime
setting `identity.import_from_teamspeak` (default on, also in Settings →
Profiles) turns it off, e.g. `--set identity.import_from_teamspeak=false`.
The sample data of `VOELIN_DEMO_UI` never imports.
**Settings → Profiles** lists the stored identities with where they came
from ("Made in Voelin", "Imported", "Chosen by you"), their security level
and unique ids; "Use as default" picks the one servers see from the next
connection on (`Store::set_default_identity` as the user's choice). The
store's default is the only default: a server connects with the identity its
bookmark names, if any (Profiles → Identity per server), else with the
store's default, and My Account shows the one the current server uses. The
page also renames, exports, deletes and raises the security level of
identities, and finds and imports the official clients' identities by
hand. `voelinctl identity list` shows the same (origin and default).
`VOELIN_OPEN=settings:profiles` (or `settings:identities`) opens it.
- **Import** prints what it found as nickname, unique id and security level —
all three are public, everything else in an identity is the private key —
Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 128 KiB

+10 -3
View File
@@ -178,7 +178,7 @@ Settings sections (`settings:<section>`):
| Section | Holds |
|---|---|
| `account` | The identity in use (nickname, TeamSpeak 3 and 6 unique ids, security level) and why there is no myTeamSpeak sign-in |
| `profiles` | Identities: rename, make default (`identity.default`), export as a TeamSpeak 3 .ini, delete, raise the security level on every core; import from the official clients' settings and .ini files (key material is never shown); the identity per server |
| `profiles` (also `identities`) | Identities with where they came from: rename, use as default (the store's default, `Store::set_default_identity`), export as a TeamSpeak 3 .ini, delete, raise the security level on every core; the import of the official clients' identities on start (`identity.import_from_teamspeak`) and by hand from their settings and .ini files (key material is never shown); the identity per server |
| `appearance` | Theme, text size, the phone layout's width, the image cache |
| `voice` | Microphone (device, test, level, noise suppression, echo cancellation, automatic gain), output (device, test sound, volume), streaming permissions, camera (device, preview with the background effect), video settings (resolution, frame rate, codec, hardware acceleration, mirror), stream quality presets with free bitrate entry and the upload it takes |
| `streaming` | Frame rate, bitrate, codec, capture backend, simulcast layers, the stream's audio sources (desktop without Voelin, applications, the shared window's application, microphone; gain and mute each), recording and replay |
@@ -264,6 +264,14 @@ server is saved without one and when it connects
and one found is stored as if typed. `bookmark` and `bookmark:edit` open
it (below).
Settings → Profiles (`ProfilesSection` in `screens/settings-pages.slint`;
`settings_pages.rs`, and `identities.rs` for the default and the import
switch) lists the stored identities with where they came from, marks the
store's default and has "Use as default" for the others, plus the switch
for importing the official clients' identities on start
([identity.md](identity.md)). `settings:profiles` opens it, and
`settings:identities` as well.
## Adding a screen
1. Write the screen in `ui/screens/<name>.slint` from the components
@@ -299,7 +307,6 @@ live when they change (settings page, `--set`, another window):
| `ui.image_preview_kb` | kilobytes | 8192 | pictures linked in chat up to this size show as pictures (0: never) |
| `notify.mentions`, `notify.private_messages`, `notify.pokes`, `notify.event_reminders`, `notify.friends_online` | off / app / desktop | desktop (friends: app) | what the bell and the desktop say about each kind |
| `video.camera`, `video.background`, `video.resolution`, `video.mirror` | device id; none / blur; auto or WxH; bool | first camera, none, auto, true | the camera of the preview and the default of camera sources |
| `identity.default` | identity id | 0 (the first) | the identity used where a bookmark names none |
| `studio.ui` | JSON | see below | the Stream Studio's stream settings: `title`, `game`, `message` (go-live), `show_viewers`, `show_chat`, `show_now_playing`, `audio` (stream audio), `preview_width` (960), `preview_fps` (15) |
In a config file write them as dotted keys at the top level
@@ -329,7 +336,7 @@ Environment variables (see `src/dev.rs`):
- `VOELIN_DEMO_UI=1`: sample servers, channels, members, chat with emoji and
a stream, without a server (nothing is stored).
- `VOELIN_OPEN=<what>[,<what>...]`: `home`, `server`, `settings[:voice|keybinds|streaming|privacy|appearance]`,
- `VOELIN_OPEN=<what>[,<what>...]`: `home`, `server`, `settings[:voice|keybinds|streaming|privacy|appearance|profiles]` (`identities` is the same as `profiles`),
`about`, `share[:live]`, `bookmark[:edit]`, `emoji`, `client`, `panel`, `no-panel`,
`voice`, `pins`, `topics`, `topic:<id>`, `member`, `watch`, `popout`
(the server page, above), `tab:<home|servers|chat|activity|you>` (phone
+8 -2
View File
@@ -25,8 +25,14 @@ fn open_store(path: Option<PathBuf>) -> Result<Store> {
/// Identities in the client database, with the id `export` takes.
pub fn list(store: Option<PathBuf>) -> Result<()> {
for entry in open_store(store)?.identities()? {
println!("{:>3} {:<20} {} level {}", entry.id, entry.name, entry.uid, entry.level);
let store = open_store(store)?;
let default = store.default_identity()?.map(|entry| entry.id);
for entry in store.identities()? {
let mark = if Some(entry.id) == default { " default" } else { "" };
println!(
"{:>3} {:<20} {} level {:<3} {:?}{mark}",
entry.id, entry.name, entry.uid, entry.level, entry.origin
);
}
Ok(())
}