From f080ceaf87ece76cf7c20df8c9d2e85c6550e7a8 Mon Sep 17 00:00:00 2001 From: Stan Runge Date: Sun, 1 Mar 2026 17:33:56 +0100 Subject: [PATCH] feat: integrate image proxying for user avatars in OAuth profile mapping --- src/lib/server/auth.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/server/auth.ts b/src/lib/server/auth.ts index 29b4f1f..e418a45 100644 --- a/src/lib/server/auth.ts +++ b/src/lib/server/auth.ts @@ -7,6 +7,7 @@ import { getRequestEvent } from '$app/server'; import { db } from '$lib/server/db'; import { genericOAuth } from 'better-auth/plugins'; import { team, teamMember } from './db/schema'; +import { proxyImage } from './storage/r2'; export const auth = betterAuth({ baseURL: env.ORIGIN, @@ -79,10 +80,10 @@ export const auth = betterAuth({ raw: data }; }, - mapProfileToUser(profile) { + async mapProfileToUser(profile) { return { name: profile.username, - image: profile.avatar_url, + image: await proxyImage(profile.avatar_url), email: `${profile.id}@osu.local` }; }