From fd08c4ddde3ad795ee814f1d1671a305ae3c89e9 Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Thu, 31 Jul 2025 23:03:04 +0100 Subject: [PATCH] Use large user icons --- src/app/browser/add-friend/index.tsx | 2 +- src/app/browser/components/nintendo-switch-user.tsx | 2 +- src/app/browser/friend/index.tsx | 2 +- src/app/browser/main/friends.tsx | 2 +- src/app/browser/main/sidebar.tsx | 3 ++- src/app/main/monitor.ts | 8 ++++---- src/app/main/na-auth.ts | 3 ++- src/cli/nso/notify.ts | 8 ++++---- src/cli/presence-server.ts | 4 ++-- src/cli/util/presence-embed-render.ts | 2 +- src/cli/util/presence-embed-server.ts | 4 ++-- src/common/presence-embed.ts | 2 +- src/discord/util.ts | 8 ++++---- 13 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/app/browser/add-friend/index.tsx b/src/app/browser/add-friend/index.tsx index e34061e..e0fe6b6 100644 --- a/src/app/browser/add-friend/index.tsx +++ b/src/app/browser/add-friend/index.tsx @@ -171,7 +171,7 @@ function AddFriend(props: { !props.setFriendCode ? styles.targetUserNoFriendCodeField : null, theme.targetUser, ]}> - + {props.lookupUser.name} diff --git a/src/app/browser/components/nintendo-switch-user.tsx b/src/app/browser/components/nintendo-switch-user.tsx index 849c231..d80bf21 100644 --- a/src/app/browser/components/nintendo-switch-user.tsx +++ b/src/app/browser/components/nintendo-switch-user.tsx @@ -12,7 +12,7 @@ export default function NintendoSwitchUser(props: { const user = 'friend' in props ? props.friend : props.user; return <> - {' '} {user.name} diff --git a/src/app/browser/friend/index.tsx b/src/app/browser/friend/index.tsx index 1d4ddd0..54570af 100644 --- a/src/app/browser/friend/index.tsx +++ b/src/app/browser/friend/index.tsx @@ -87,7 +87,7 @@ function Friend(props: { return - + {friend.name} {friend.presence.updatedAt ? diff --git a/src/app/browser/main/friends.tsx b/src/app/browser/main/friends.tsx index 3c3f61d..988d64b 100644 --- a/src/app/browser/main/friends.tsx +++ b/src/app/browser/main/friends.tsx @@ -73,7 +73,7 @@ function Friend(props: { const game = 'name' in props.friend.presence.game ? props.friend.presence.game : null; const content = - + {game ? : null} {props.friend.name} diff --git a/src/app/browser/main/sidebar.tsx b/src/app/browser/main/sidebar.tsx index abf457a..2156ca8 100644 --- a/src/app/browser/main/sidebar.tsx +++ b/src/app/browser/main/sidebar.tsx @@ -92,7 +92,8 @@ function User(props: { {props.user.nso ? - + {props.user.nso.nsoAccount.user.name} diff --git a/src/app/main/monitor.ts b/src/app/main/monitor.ts index 005ea3d..75ead87 100644 --- a/src/app/main/monitor.ts +++ b/src/app/main/monitor.ts @@ -575,7 +575,7 @@ export class ElectronNotificationManager extends NotificationManager { title: friend.name, body: this.t('playing', {name: currenttitle.name + (currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : '')})!, - icon: await tryGetNativeImageFromUrl(friend.imageUri), + icon: await tryGetNativeImageFromUrl(friend.image2Uri), }).show(); } @@ -583,7 +583,7 @@ export class ElectronNotificationManager extends NotificationManager { new Notification({ title: friend.name, body: this.t('offline')!, - icon: await tryGetNativeImageFromUrl(friend.imageUri), + icon: await tryGetNativeImageFromUrl(friend.image2Uri), }).show(); } @@ -594,7 +594,7 @@ export class ElectronNotificationManager extends NotificationManager { title: friend.name, body: this.t('playing', {name: currenttitle.name + (currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : '')})!, - icon: await tryGetNativeImageFromUrl(friend.imageUri), + icon: await tryGetNativeImageFromUrl(friend.image2Uri), }).show(); } @@ -605,7 +605,7 @@ export class ElectronNotificationManager extends NotificationManager { title: friend.name, body: this.t('playing', {name: currenttitle.name + (currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : '')})!, - icon: await tryGetNativeImageFromUrl(friend.imageUri), + icon: await tryGetNativeImageFromUrl(friend.image2Uri), }).show(); } } diff --git a/src/app/main/na-auth.ts b/src/app/main/na-auth.ts index a7b34ff..e987f09 100644 --- a/src/app/main/na-auth.ts +++ b/src/app/main/na-auth.ts @@ -327,7 +327,8 @@ export async function addNsoAccount(app: App, use_in_app_browser = true) { na_username: data.user.screenName, }) ?? 'Already signed in as ' + data.nsoAccount.user.name + ' (Nintendo Account ' + data.user.nickname + ' / ' + data.user.screenName + ')', - icon: await tryGetNativeImageFromUrl(data.nsoAccount.user.imageUri), + icon: await tryGetNativeImageFromUrl(data.nsoAccount.user.image2Uri ?? + data.nsoAccount.user.imageUri), }).show(); return {nso, data}; diff --git a/src/cli/nso/notify.ts b/src/cli/nso/notify.ts index f91ae4d..6270faa 100644 --- a/src/cli/nso/notify.ts +++ b/src/cli/nso/notify.ts @@ -144,7 +144,7 @@ export class TerminalNotificationManager extends NotificationManager { message: 'Playing ' + currenttitle.name + (currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : ''), // icon: currenttitle.imageUri, - icon: friend.imageUri, + icon: friend.image2Uri, }); } @@ -152,7 +152,7 @@ export class TerminalNotificationManager extends NotificationManager { this.notifier.notify({ title: friend.name, message: 'Offline', - icon: friend.imageUri, + icon: friend.image2Uri, }); } @@ -164,7 +164,7 @@ export class TerminalNotificationManager extends NotificationManager { message: 'Playing ' + currenttitle.name + (currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : ''), // icon: currenttitle.imageUri, - icon: friend.imageUri, + icon: friend.image2Uri, }); } @@ -176,7 +176,7 @@ export class TerminalNotificationManager extends NotificationManager { message: 'Playing ' + currenttitle.name + (currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : ''), // icon: currenttitle.imageUri, - icon: friend.imageUri, + icon: friend.image2Uri, }); } diff --git a/src/cli/presence-server.ts b/src/cli/presence-server.ts index 324fec7..8e9acd3 100644 --- a/src/cli/presence-server.ts +++ b/src/cli/presence-server.ts @@ -1226,10 +1226,10 @@ class Server extends HttpServer { const result = await this.handlePresenceRequest(req, null, presence_user_nsaid); const url_map = await this.downloadImages({ - url: result.friend.imageUri, + url: result.friend.image2Uri, }, this.getResourceBaseUrls(req)); - const image_url = url_map[result.friend.imageUri]; + const image_url = url_map[result.friend.image2Uri]; res.statusCode = 303; res.setHeader('Location', image_url); diff --git a/src/cli/util/presence-embed-render.ts b/src/cli/util/presence-embed-render.ts index d05422d..cf8373f 100644 --- a/src/cli/util/presence-embed-render.ts +++ b/src/cli/util/presence-embed-render.ts @@ -67,7 +67,7 @@ export async function handler(argv: ArgumentsCamelCase) { const [presence, user, data] = await getPresenceFromUrl(argv.url); const result = data as PresenceResponse; - const image_urls = [result.friend.imageUri]; + const image_urls = [result.friend.image2Uri]; if ('imageUri' in result.friend.presence.game) image_urls.push(result.friend.presence.game.imageUri); for (const stage of result.splatoon3_vs_setting?.vsStages ?? []) image_urls.push(stage.image.url); diff --git a/src/cli/util/presence-embed-server.ts b/src/cli/util/presence-embed-server.ts index faa29c4..73d99ff 100644 --- a/src/cli/util/presence-embed-server.ts +++ b/src/cli/util/presence-embed-server.ts @@ -123,7 +123,7 @@ class Server extends HttpServer { return; } - const image_urls = [result.friend.imageUri]; + const image_urls = [result.friend.image2Uri]; if ('imageUri' in result.friend.presence.game) image_urls.push(result.friend.presence.game.imageUri); for (const stage of result.splatoon3_vs_setting?.vsStages ?? []) image_urls.push(stage.image.url); @@ -168,7 +168,7 @@ class Server extends HttpServer { const [presence, user, data] = await getPresenceFromUrl(this.base_url + '/' + presence_user_nsaid + qs_2); const result = data as PresenceResponse; - const image_urls = [result.friend.imageUri]; + const image_urls = [result.friend.image2Uri]; if ('imageUri' in result.friend.presence.game) image_urls.push(result.friend.presence.game.imageUri); if (result.splatoon3_fest_team?.myVoteState === FestVoteState.VOTED) image_urls.push(result.splatoon3_fest_team.image.url); diff --git a/src/common/presence-embed.ts b/src/common/presence-embed.ts index b736938..a221033 100644 --- a/src/common/presence-embed.ts +++ b/src/common/presence-embed.ts @@ -187,7 +187,7 @@ export function renderUserEmbedSvg( `}} + href="${image(result.friend.image2Uri) ?? result.friend.image2Uri}" /> ${result.friend.name} diff --git a/src/discord/util.ts b/src/discord/util.ts index 7d9d808..a818454 100644 --- a/src/discord/util.ts +++ b/src/discord/util.ts @@ -51,8 +51,8 @@ export function getDiscordPresence( if (title.smallImageKey) { activity.setSmallImage(title.smallImageKey, title.smallImageText); - } else if (context?.friendcode && context.user?.imageUri) { - activity.setSmallImage(context.user.imageUri, 'SW-' + context.friendcode.id); + } else if (context?.friendcode && context.user?.image2Uri) { + activity.setSmallImage(context.user.image2Uri, 'SW-' + context.friendcode.id); } if (game.shopUri) { @@ -179,8 +179,8 @@ export function getInactiveDiscordPresence( state: 'Not playing', largeImageKey: 'nintendoswitch', largeImageText: product, - smallImageKey: context?.friendcode ? context?.user?.imageUri : undefined, - smallImageText: context?.friendcode && context?.user?.imageUri ? 'SW-' + context.friendcode.id : undefined, + smallImageKey: context?.friendcode ? context?.user?.image2Uri : undefined, + smallImageText: context?.friendcode && context?.user?.image2Uri ? 'SW-' + context.friendcode.id : undefined, }, }; }