From 63d6353d3882d5df0896944fcc6e6a7a486b1fa0 Mon Sep 17 00:00:00 2001 From: bitbronze <48721834+bitbronze@users.noreply.github.com> Date: Tue, 18 Mar 2025 16:39:19 +0300 Subject: [PATCH] Change the email returned by Headscale API to username Change the email returned by Headscale API to username for PreAuthKey frontend. --- app/routes/settings/auth-keys.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/routes/settings/auth-keys.tsx b/app/routes/settings/auth-keys.tsx index 3829273..bb9cf1b 100644 --- a/app/routes/settings/auth-keys.tsx +++ b/app/routes/settings/auth-keys.tsx @@ -26,10 +26,17 @@ export async function loader({ request }: LoaderFunctionArgs) { const qp = new URLSearchParams(); qp.set('user', user.name); - return pull<{ preAuthKeys: PreAuthKey[] }>( + var result = pull<{ preAuthKeys: PreAuthKey[] }>( `v1/preauthkey?${qp.toString()}`, session.get('hsApiKey')!, ); + + // Change the email returned by Headscale API to username + result.forEach((preauthkey_item, index) => { + preauthkey_item.user = user; + }); + + return result; }), );