Moar federation

This commit is contained in:
Tim Zöller 2025-12-02 22:23:29 +01:00
parent d47daa6dfc
commit 4c9bcc718f
5 changed files with 376 additions and 29 deletions

View file

@ -247,6 +247,12 @@ const FitPubAuth = {
return;
}
// Activity detail pages are public (for viewing public activities)
// Pattern: /activities/{uuid}
if (currentPath.startsWith('/activities/') && currentPath.split('/').length === 3) {
return;
}
// Check if authenticated
if (!this.isAuthenticated()) {
// Redirect to login for protected pages

View file

@ -271,7 +271,11 @@
async function loadActivity() {
try {
const response = await FitPubAuth.authenticatedFetch(`/api/activities/${activityId}`);
// Use authenticated fetch if user is logged in, otherwise regular fetch
// This allows public activities to be viewed without authentication
const response = FitPubAuth.isAuthenticated()
? await FitPubAuth.authenticatedFetch(`/api/activities/${activityId}`)
: await fetch(`/api/activities/${activityId}`);
if (response.ok) {
const activity = await response.json();