Show WeCom machine name after brand title on shell and login.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,6 +32,18 @@ export function getUsername(): string | null {
|
||||
return localStorage.getItem(USER_KEY);
|
||||
}
|
||||
|
||||
/** 与企微通知同一机器名(公开接口,登录前可用)。 */
|
||||
export async function fetchMachineName(): Promise<string> {
|
||||
try {
|
||||
const res = await fetch(`${getApiBase()}/api/auth/branding`);
|
||||
if (!res.ok) return "";
|
||||
const data = (await res.json()) as { machine_name?: string };
|
||||
return String(data.machine_name || "").trim();
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function tokenExpiresAtMs(): number | null {
|
||||
const raw = localStorage.getItem(TOKEN_EXP_KEY);
|
||||
if (!raw) return null;
|
||||
|
||||
Reference in New Issue
Block a user