Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(cloud): refresh principal-scoped Site catalogs after revocation

HoshinoSuzumiBotf72019e800d3
diff --git a/apps/cloud/app/middleware/platform.global.ts b/apps/cloud/app/middleware/platform.global.ts
index 86f12a58..a9de182e 100644
--- a/apps/cloud/app/middleware/platform.global.ts
+++ b/apps/cloud/app/middleware/platform.global.ts
@@ -8,13 +8,16 @@ export default defineNuxtRouteMiddleware(async (to) => {
return navigateTo('/sites', { redirectCode: 302 })
if (path === '/sites' || path.startsWith('/sites/')) {
const fetcher = useRequestFetch()
- const session = await fetcher<{ authenticated: boolean }>(
- '/api/auth/session',
- ).catch((error) => {
+ const session = await fetcher<{
+ authenticated: boolean
+ user: { id: number } | null
+ }>('/api/auth/session').catch((error) => {
if ([401, 403].includes(error.statusCode ?? error.status))
- return { authenticated: false }
+ return { authenticated: false, user: null }
throw error
})
+ useState<number | null>('platform-user-id', () => null).value =
+ session.user?.id ?? null
if (!session.authenticated)
return navigateTo('/signin', { redirectCode: 302 })
if (path !== '/sites') {
diff --git a/apps/cloud/app/pages/sites/index.vue b/apps/cloud/app/pages/sites/index.vue
index d2575c7b..1b559f65 100644
--- a/apps/cloud/app/pages/sites/index.vue
+++ b/apps/cloud/app/pages/sites/index.vue
@@ -1,7 +1,9 @@
<script setup lang="ts">
useSeoMeta({ title: 'Your sites — ChronoFrame', robots: 'noindex' })
+const userId = useState<number | null>('platform-user-id', () => null)
const { data, error } = await useFetch('/api/sites', {
- key: 'platform-site-list',
+ key: computed(() => `platform-sites:${userId.value}`),
+ getCachedData: () => undefined,
cache: 'no-store',
})
if (error.value)