allows public acces to public profiles

This commit is contained in:
Christian Beutel
2025-07-04 11:11:56 +02:00
parent 7c478f6f3f
commit a7194027d8
6 changed files with 31 additions and 30 deletions

View File

@@ -26,7 +26,7 @@ export async function GET(event: RequestEvent) {
let followers: APOrderedCollectionPage;
// fetch followers locally to not run into auth issues with private profiles
if (actor.id === event.locals.user.actor) {
if (actor.id === event.locals.user?.actor) {
const r = await event.fetch(actor[type as "followers" | "following"]! + '?' + new URLSearchParams({ page }))
if (!r.ok) {

View File

@@ -12,9 +12,9 @@ export const load: ServerLoad = async ({ params, locals, fetch }) => {
try {
const { actor, profile } = await profile_show(params.handle, fetch);
const isOwnProfile = profile.id === locals.user.actor;
const isOwnProfile = profile.id === locals.user?.actor;
const follow = await follows_a_b(locals.user.actor!, profile.id, fetch) ?? null
const follow = locals.user?.actor ? await follows_a_b(locals.user.actor!, profile.id, fetch) : null
return { profile, isOwnProfile, follow: follow, actor }
} catch (e) {

View File

@@ -134,7 +134,7 @@
<p class="font-semibold">{data.profile.following}</p>
<p>{$_("following")}</p>
</a>
{#if !data.isOwnProfile}
{#if !data.isOwnProfile && data.user}
<div class="px-6 mt-2">
<Button
loading={followLoading}