mirror of
https://github.com/bulwarkmail/native.git
synced 2026-11-03 00:06:39 +00:00
15 lines
530 B
TypeScript
15 lines
530 B
TypeScript
// Registry cap. Raised from 5: the per-account cost is one stored credential
|
|
// set and one cached snapshot; the SSE socket budget is bounded separately
|
|
// (MAX_SSE_STREAMS), so nothing scales with this number at runtime.
|
|
export const MAX_ACCOUNTS = 10;
|
|
|
|
export function generateAccountId(username: string, serverUrl: string): string {
|
|
let host = serverUrl;
|
|
try {
|
|
host = new URL(serverUrl).hostname;
|
|
} catch {
|
|
host = serverUrl.replace(/^https?:\/\//, '').replace(/\/.*$/, '');
|
|
}
|
|
return `${username}@${host}`;
|
|
}
|