feat: integrate image proxying for user avatars in OAuth profile mapping

This commit is contained in:
2026-03-01 17:33:56 +01:00
parent 7e6dfa59a5
commit f080ceaf87

View File

@@ -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`
};
}