feat(web): add spaces, grouped channels and file chat
This commit is contained in:
1 parent
c7d8ef15bc
commit
f6cfb12716
111 files changed
+4371
-506
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import type { PersonalProfile } from './accountVault';
|
||||
let identity: { username: string; token: string } | undefined;
|
||||
let publicKey: JsonWebKey | undefined;
|
||||
let personal: PersonalProfile | undefined;
|
||||
export function setAccountIdentity(value: { username: string; token: string } | undefined, key?: JsonWebKey, profile?: PersonalProfile): void { identity = value; publicKey = key; personal = value ? profile : undefined; }
|
||||
export function accountDisplay(): { username: string; displayName: string; avatar?: string } | undefined {
|
||||
return identity ? { username: identity.username, displayName: personal?.displayName || identity.username, ...(personal?.avatar ? { avatar: personal.avatar } : {}) } : undefined;
|
||||
}
|
||||
export function accountPublicKey(): JsonWebKey {
|
||||
if (!identity || !publicKey) throw new Error('请先解锁账号');
|
||||
return publicKey;
|
||||
}
|
||||
export function accountToken(): string | undefined { return identity?.token; }
|
||||
export function requireAccount(): string {
|
||||
if (!identity) throw new Error('请先登录账号');
|
||||
return identity.username;
|
||||
}
|
||||
Reference in new issue
Block a user