Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
<script setup lang="ts">
import { PUBLIC_GALLERY_DEFAULTS } from '@chronoframe/contracts/gallery-settings'
import type { SettingValue } from '@chronoframe/contracts/settings'
const props = defineProps<{ siteId: number; role?: string }>()
const settings = useSettingsStore()
const context = useEntryContext()
const scope = context.value?.scope
settings.data = structuredClone(PUBLIC_GALLERY_DEFAULTS) as Record<
string,
Record<string, SettingValue>
>
settings.data.app!.title = useEntryContext().value?.name ?? 'ChronoFrame'
const { data: maps } = await useFetch(`/api/sites/${props.siteId}/map`, {
key: `site-maps-${props.siteId}`,
})
if (context.value?.scope === scope) {
if (maps.value) settings.data.map = { ...maps.value.effective }
settings.isInitialized = true
}
const media = provideCloudSiteMedia(props)
const { photos, loading, message, failed, reload, loadError, refreshMedia } =
media
const status = computed(() => (loading.value ? 'pending' : 'success'))
const toast = useToast()
watch(
message,
(text) => {
if (text && text !== loadError.value)
toast.add({ title: text, color: failed.value ? 'error' : 'success' })
},
{ flush: 'sync' },
)
</script>
<template>
<PhotosProvider
:photos="photos"
:refresh="reload"
:status="status"
>
<CfAlert
class="mb-4"
v-if="loadError"
tone="error"
>
{{ loadError }}
<template #actions
><CfButton
size="sm"
variant="secondary"
:loading="loading"
@click="refreshMedia"
>{{ $t('cloud.messages.retry') }}</CfButton
></template
></CfAlert
>
<slot /><CloudUploadDrawer />
</PhotosProvider>
</template>