Fix node/user avatar generated wrongly from hostname

It should always be generated from the Node Id.
This commit is contained in:
Rūdolfs Ošiņš
2026-05-05 16:01:01 +02:00
parent 2e19c93a9c
commit 613e5e1810
11 changed files with 41 additions and 10 deletions
+2 -1
View File
@@ -19,6 +19,7 @@
export let baseUrl: BaseUrl;
export let commit: Commit;
export let repo: Repo;
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
let enabledArchiveDownload = false;
@@ -69,7 +70,7 @@
}
</style>
<Layout {nodeAvatarUrl} {baseUrl} {repo}>
<Layout {nodeId} {nodeAvatarUrl} {baseUrl} {repo}>
<svelte:fragment slot="breadcrumb">
<Separator />
<Link
+2 -1
View File
@@ -35,6 +35,7 @@
export let repo: Repo;
export let revision: string | undefined;
export let tree: Tree;
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
$: currentRefname = formatQualifiedRefname(
@@ -101,7 +102,7 @@
}
</style>
<Layout {nodeAvatarUrl} {baseUrl} {repo} activeTab="source">
<Layout {nodeId} {nodeAvatarUrl} {baseUrl} {repo} activeTab="source">
<svelte:fragment slot="breadcrumb">
<Separator />
<Link
+2
View File
@@ -27,6 +27,7 @@
export let issue: Issue;
export let repo: Repo;
export let rawPath: (commit?: string) => string;
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
$: uniqueEmbeds = uniqBy(
@@ -119,6 +120,7 @@
<Layout
{baseUrl}
{nodeId}
{nodeAvatarUrl}
{repo}
activeTab="issues"
+2 -1
View File
@@ -20,6 +20,7 @@
export let issues: Issue[];
export let repo: Repo;
export let status: IssueState["status"];
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
let loading = false;
@@ -102,7 +103,7 @@
}
</style>
<Layout {nodeAvatarUrl} {baseUrl} {repo} activeTab="issues">
<Layout {nodeId} {nodeAvatarUrl} {baseUrl} {repo} activeTab="issues">
<svelte:fragment slot="breadcrumb">
<Separator />
<Link
+2 -1
View File
@@ -15,6 +15,7 @@
export let baseUrl: BaseUrl;
export let repo: Repo;
export let stylePaddingBottom: string = "2.5rem";
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
</script>
@@ -100,7 +101,7 @@
alt="Node avatar"
src={nodeAvatarUrl} />
{:else}
<UserAvatar nodeId={baseUrl.hostname} styleWidth="1.5rem" />
<UserAvatar {nodeId} styleWidth="1.5rem" />
{/if}
{baseUrl.hostname}
</Link>
+2
View File
@@ -84,6 +84,7 @@
export let rawPath: (commit?: string) => string;
export let repo: Repo;
export let view: PatchView;
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
function badgeColor(status: string): ComponentProps<Badge>["variant"] {
@@ -296,6 +297,7 @@
<Layout
{baseUrl}
{repo}
{nodeId}
{nodeAvatarUrl}
activeTab="patches"
stylePaddingBottom="0">
+2 -1
View File
@@ -21,6 +21,7 @@
export let patches: Patch[];
export let repo: Repo;
export let status: PatchState["status"];
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
let loading = false;
@@ -107,7 +108,7 @@
}
</style>
<Layout {nodeAvatarUrl} {baseUrl} {repo} activeTab="patches">
<Layout {nodeId} {nodeAvatarUrl} {baseUrl} {repo} activeTab="patches">
<svelte:fragment slot="breadcrumb">
<Separator />
<Link
+2
View File
@@ -34,6 +34,7 @@
export let revision: string | undefined;
export let seedingPolicy: SeedingPolicy;
export let tree: Tree;
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
let mobileFileTree = false;
@@ -125,6 +126,7 @@
<Layout
{baseUrl}
{nodeId}
{nodeAvatarUrl}
{repo}
activeTab="source"
+21 -4
View File
@@ -167,6 +167,7 @@ export type RepoLoadedRoute =
path: string;
rawPath: (commit?: string) => string;
blobResult: BlobResult;
nodeId: string;
nodeAvatarUrl: string | undefined;
};
}
@@ -182,6 +183,7 @@ export type RepoLoadedRoute =
revision: string | undefined;
tree: Tree;
commitHeaders: CommitHeader[];
nodeId: string;
nodeAvatarUrl: string | undefined;
};
}
@@ -191,6 +193,7 @@ export type RepoLoadedRoute =
baseUrl: BaseUrl;
repo: Repo;
commit: Commit;
nodeId: string;
nodeAvatarUrl: string | undefined;
};
}
@@ -201,6 +204,7 @@ export type RepoLoadedRoute =
repo: Repo;
rawPath: (commit?: string) => string;
issue: Issue;
nodeId: string;
nodeAvatarUrl: string | undefined;
};
}
@@ -211,6 +215,7 @@ export type RepoLoadedRoute =
repo: Repo;
issues: Issue[];
status: IssueState["status"];
nodeId: string;
nodeAvatarUrl: string | undefined;
};
}
@@ -221,6 +226,7 @@ export type RepoLoadedRoute =
repo: Repo;
patches: Patch[];
status: PatchState["status"];
nodeId: string;
nodeAvatarUrl: string | undefined;
};
}
@@ -233,6 +239,7 @@ export type RepoLoadedRoute =
patch: Patch;
stats: Diff["stats"];
view: PatchView;
nodeId: string;
nodeAvatarUrl: string | undefined;
};
};
@@ -321,6 +328,7 @@ export async function loadRepoRoute(
baseUrl: route.node,
repo,
commit,
nodeId: node.id,
nodeAvatarUrl: node.avatarUrl,
},
};
@@ -372,6 +380,7 @@ async function loadPatchesView(
patches,
status,
repo,
nodeId: node.id,
nodeAvatarUrl: node.avatarUrl,
},
};
@@ -400,6 +409,7 @@ async function loadIssuesView(
issues,
status,
repo,
nodeId: node.id,
nodeAvatarUrl: node.avatarUrl,
},
};
@@ -417,7 +427,7 @@ async function loadTreeView(
let repoPromise: Promise<Repo>;
let seedingPolicyPromise: Promise<SeedingPolicy>;
let nodePromise: Promise<Partial<Node>>;
let nodePromise: Promise<Pick<Node, "id" | "avatarUrl">>;
if (
(previousLoaded.resource === "repo.source" ||
previousLoaded.resource === "repo.history") &&
@@ -427,6 +437,7 @@ async function loadTreeView(
repoPromise = Promise.resolve(previousLoaded.params.repo);
seedingPolicyPromise = Promise.resolve(previousLoaded.params.seedingPolicy);
nodePromise = Promise.resolve({
id: previousLoaded.params.nodeId,
avatarUrl: previousLoaded.params.nodeAvatarUrl,
});
} else {
@@ -519,6 +530,7 @@ async function loadTreeView(
tree,
path,
blobResult,
nodeId: node.id,
nodeAvatarUrl: node.avatarUrl,
},
};
@@ -581,7 +593,7 @@ async function loadHistoryView(
let repoPromise: Promise<Repo>;
let seedingPolicyPromise: Promise<SeedingPolicy>;
let nodePromise: Promise<Partial<Node>>;
let nodePromise: Promise<Pick<Node, "id" | "avatarUrl">>;
if (
(previousLoaded.resource === "repo.source" ||
previousLoaded.resource === "repo.history") &&
@@ -591,6 +603,7 @@ async function loadHistoryView(
repoPromise = Promise.resolve(previousLoaded.params.repo);
seedingPolicyPromise = Promise.resolve(previousLoaded.params.seedingPolicy);
nodePromise = Promise.resolve({
id: previousLoaded.params.nodeId,
avatarUrl: previousLoaded.params.nodeAvatarUrl,
});
} else {
@@ -670,6 +683,7 @@ async function loadHistoryView(
revision: route.revision,
tree,
commitHeaders,
nodeId: node.id,
nodeAvatarUrl: node.avatarUrl,
},
};
@@ -694,6 +708,7 @@ async function loadIssueView(route: RepoIssueRoute): Promise<RepoLoadedRoute> {
repo,
rawPath,
issue,
nodeId: node.id,
nodeAvatarUrl: node.avatarUrl,
},
};
@@ -711,7 +726,7 @@ async function loadPatchView(
let repoPromise: Promise<Repo>;
let patchPromise: Promise<Patch>;
let nodePromise: Promise<Partial<Node>>;
let nodePromise: Promise<Pick<Node, "id" | "avatarUrl">>;
if (
previousLoaded.resource === "repo.patch" &&
@@ -721,6 +736,7 @@ async function loadPatchView(
repoPromise = Promise.resolve(previousLoaded.params.repo);
patchPromise = Promise.resolve(previousLoaded.params.patch);
nodePromise = Promise.resolve({
id: previousLoaded.params.nodeId,
avatarUrl: previousLoaded.params.nodeAvatarUrl,
});
} else {
@@ -728,7 +744,7 @@ async function loadPatchView(
patchPromise = api.repo.getPatchById(route.repo, route.patch);
nodePromise = api.getNode();
}
const [repo, patch, { avatarUrl }] = await Promise.all([
const [repo, patch, { id: nodeId, avatarUrl }] = await Promise.all([
repoPromise,
patchPromise,
nodePromise,
@@ -798,6 +814,7 @@ async function loadPatchView(
patch,
stats,
view,
nodeId,
nodeAvatarUrl: avatarUrl,
},
};
+2 -1
View File
@@ -19,6 +19,7 @@
export let baseUrl: BaseUrl;
export let node: NodeIdentity;
export let did: { prefix: string; pubkey: string };
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
export let stats: NodeStats;
</script>
@@ -103,7 +104,7 @@
alt="Node avatar"
src={nodeAvatarUrl} />
{:else}
<UserAvatar nodeId={baseUrl.hostname} styleWidth="1.5rem" />
<UserAvatar {nodeId} styleWidth="1.5rem" />
{/if}
{baseUrl.hostname}
</Link>
+2
View File
@@ -20,6 +20,7 @@ export interface UserLoadedRoute {
did: { prefix: string; pubkey: string };
baseUrl: BaseUrl;
node: NodeIdentity;
nodeId: string;
nodeAvatarUrl: string | undefined;
stats: NodeStats;
};
@@ -56,6 +57,7 @@ export async function loadUserRoute({
did: parsedDid,
baseUrl,
node: user,
nodeId: node.id,
nodeAvatarUrl: node.avatarUrl,
stats,
},