fix and update

This commit is contained in:
lendry
2026-07-01 16:26:43 +03:00
parent f7c01a3963
commit ee8aaf9889
9 changed files with 50 additions and 8 deletions

View File

@@ -68,6 +68,25 @@ export class MediaService {
return { userId, hasAvatar: true };
}
async createFedcmAvatarUrl(userId: string): Promise<string | undefined> {
const user = await this.prisma.user.findUnique({ where: { id: userId } });
if (!user) {
return undefined;
}
const legacyUrl = user.avatarUrl?.trim();
if (legacyUrl) {
return legacyUrl;
}
if (!user.avatarStorageKey) {
return undefined;
}
const { accessUrl } = await this.createStreamAccessUrl(user.avatarStorageKey, userId);
return accessUrl;
}
async getAvatarAccessUrl(requesterId: string, targetUserId: string) {
const user = await this.prisma.user.findUnique({ where: { id: targetUserId } });
if (!user?.avatarStorageKey) {