fix: filter out empty users in auth-keys, potential headscale bug

This commit is contained in:
Aarnav Tale 2025-04-03 16:10:39 -04:00
parent 69c6fc4847
commit 5e332c4a5c
No known key found for this signature in database

View File

@ -22,15 +22,17 @@ export async function loader({
); );
const preAuthKeys = await Promise.all( const preAuthKeys = await Promise.all(
users.users.map((user) => { users.users
const qp = new URLSearchParams(); .filter((user) => user.name?.length > 0) // Filter out any invalid users
qp.set('user', user.name); .map((user) => {
const qp = new URLSearchParams();
qp.set('user', user.name);
return context.client.get<{ preAuthKeys: PreAuthKey[] }>( return context.client.get<{ preAuthKeys: PreAuthKey[] }>(
`v1/preauthkey?${qp.toString()}`, `v1/preauthkey?${qp.toString()}`,
session.get('api_key')!, session.get('api_key')!,
); );
}), }),
); );
return { return {