Refactor AvatarGiftsController: change ToWire method to public for external access; update AdminController to use ToWire for gift notifications

This commit is contained in:
Alexa
2026-06-02 02:39:29 +03:00
parent 27c560906f
commit 96eb368d41
3 changed files with 15 additions and 28 deletions
+13 -2
View File
@@ -39,8 +39,19 @@ export interface PlayerDetail extends Player {
// matches the host's signing key id).
export function profileImageUrl(name: string | null | undefined, width = 96): string | null {
if (!name) return null;
const apex = typeof window !== 'undefined' && window.location.host.endsWith('localhost') ? 'localhost' : 'rec.net';
return `https://img.${apex}/${encodeURIComponent(name)}?width=${width}&cropSquare=1&sig=p1`;
const apex = adminApex();
const scheme = apex === 'localhost' ? 'http' : 'https';
return `${scheme}://img.${apex}/${encodeURIComponent(name)}?width=${width}&cropSquare=1&sig=p1`;
}
function adminApex(): string {
if (typeof window === 'undefined') return 'rec.net';
const host = window.location.hostname.toLowerCase();
if (host === 'localhost' || host.endsWith('.localhost')) return 'localhost';
const parts = host.split('.');
return parts.length > 2 ? parts.slice(1).join('.') : host;
}
export interface Room {