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.

feat(cloud): organize site management into dedicated sections

Timothy Yin47d6f3333466
diff --git a/apps/cloud/app/assets/cloud.css b/apps/cloud/app/assets/cloud.css
index b8670736..5b538516 100644
--- a/apps/cloud/app/assets/cloud.css
+++ b/apps/cloud/app/assets/cloud.css
@@ -2086,6 +2086,42 @@
font-size: 12px;
color: var(--muted-foreground);
}
+.cf-site-address-block {
+ flex-basis: 100%;
+ min-width: 0;
+ display: grid;
+ gap: 8px;
+ padding: 12px 14px;
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ background: var(--muted);
+}
+.cf-site-address-row {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 6px 12px;
+ min-width: 0;
+}
+.cf-site-address-label {
+ font-size: 11px;
+ color: var(--muted-foreground);
+}
+.cf-site-address-value {
+ flex: 1;
+ min-width: 0;
+ font-size: 12px;
+ overflow-wrap: anywhere;
+ user-select: text;
+}
+@media (max-width: 600px) {
+ .cf-site-address-label {
+ flex-basis: 100%;
+ }
+ .cf-site-address-value {
+ flex-basis: calc(100% - 90px);
+ }
+}
.cf-site-settings-stack {
display: grid;
gap: 22px;
@@ -2401,3 +2437,40 @@
padding: 12px 16px;
flex-wrap: wrap;
}
+
+.cf-nav-section {
+ margin-top: 28px;
+}
+.cf-overview-stats {
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 16px;
+}
+.cf-overview-stats .cf-panel-body {
+ display: grid;
+ gap: 10px;
+}
+.cf-overview-stats strong {
+ font-size: 26px;
+ font-weight: 600;
+}
+.cf-gallery-icon {
+ border-radius: 12px;
+ object-fit: cover;
+}
+@media (max-width: 700px) {
+ .cf-overview-stats {
+ grid-template-columns: 1fr;
+ }
+}
+.cf-site-settings-stack,
+.cf-site-settings-stack > *,
+.cf-site-settings .cf-panel-body {
+ min-width: 0;
+}
+.cf-site-settings input[type='file'] {
+ width: 100%;
+ max-width: 100%;
+ min-width: 0;
+ font-size: 12px;
+}
diff --git a/apps/cloud/app/components/CloudSidebarNavigation.vue b/apps/cloud/app/components/CloudSidebarNavigation.vue
index cd427608..fc46d7e9 100644
--- a/apps/cloud/app/components/CloudSidebarNavigation.vue
+++ b/apps/cloud/app/components/CloudSidebarNavigation.vue
@@ -1,5 +1,14 @@
<script setup lang="ts">
-import { ArrowLeft, Images, LibraryBig, PanelsTopLeft } from 'lucide-vue-next'
+import {
+ ArrowLeft,
+ Images,
+ LibraryBig,
+ PanelsTopLeft,
+ LayoutDashboard,
+ Settings,
+ Globe,
+ HardDrive,
+} from 'lucide-vue-next'
const route = useRoute(),
context = useEntryContext()
const site = computed(() =>
@@ -37,13 +46,17 @@ watch(mode, (next) => {
</div>
<p class="cf-nav-label">MANAGE SITE</p>
<nav aria-label="Site navigation">
+ <NuxtLink
+ :to="`/sites/${site.siteId}/overview`"
+ :class="{ active: route.path.endsWith('/overview') }"
+ :aria-current="
+ route.path.endsWith('/overview') ? 'page' : undefined
+ "
+ ><LayoutDashboard :size="17" />Overview</NuxtLink
+ >
<NuxtLink
:to="`/sites/${site.siteId}/photos`"
- :class="{
- active:
- /\/(?:photos)?$/.test(route.path) ||
- route.path === `/sites/${site.siteId}`,
- }"
+ :class="{ active: route.path.endsWith('/photos') }"
:aria-current="
route.path.endsWith('/photos') ? 'page' : undefined
"
@@ -56,6 +69,32 @@ watch(mode, (next) => {
"
><LibraryBig :size="17" />Albums</NuxtLink
>
+ <NuxtLink
+ :to="`/sites/${site.siteId}/information`"
+ :class="{ active: route.path.endsWith('/information') }"
+ :aria-current="
+ route.path.endsWith('/information') ? 'page' : undefined
+ "
+ ><Settings :size="17" />Site information</NuxtLink
+ >
+ </nav>
+ <p class="cf-nav-label cf-nav-section">SITE RESOURCES</p>
+ <nav aria-label="Site resources">
+ <NuxtLink
+ :to="`/sites/${site.siteId}/domains`"
+ :class="{ active: route.path.endsWith('/domains') }"
+ :aria-current="
+ route.path.endsWith('/domains') ? 'page' : undefined
+ "
+ ><Globe :size="17" />Domains</NuxtLink
+ ><NuxtLink
+ :to="`/sites/${site.siteId}/storage`"
+ :class="{ active: route.path.endsWith('/storage') }"
+ :aria-current="
+ route.path.endsWith('/storage') ? 'page' : undefined
+ "
+ ><HardDrive :size="17" />Storage</NuxtLink
+ >
</nav>
</template>
<template v-else
diff --git a/apps/cloud/app/components/CloudSiteHeader.vue b/apps/cloud/app/components/CloudSiteHeader.vue
deleted file mode 100644
index 74733e9b..00000000
--- a/apps/cloud/app/components/CloudSiteHeader.vue
+++ /dev/null
@@ -1,65 +0,0 @@
-<script setup lang="ts">
-import { ArrowUpRight, Settings, Globe } from 'lucide-vue-next'
-const activeContext = useEntryContext()
-const context = shallowRef(activeContext.value)
-// Preserve the outgoing header, while accepting live updates for this Site only.
-watch(activeContext, (next) => {
- if (next?.scope === context.value?.scope) context.value = next
-})
-const { admin, busy, photos, publish } = useCloudSiteMedia()
-const { data } = useFetch<{ site: { slug: string | null } }>(
- `/api/sites/${context.value?.siteId}/settings`,
-)
-const host = computed(() =>
- data.value?.site.slug ? `${data.value.site.slug}.site.chronoframe.art` : '',
-)
-</script>
-<template>
- <div class="cf-site-page-header">
- <div class="cf-site-heading">
- <h1>{{ context?.name }}</h1>
- <div class="cf-site-publication">
- <CloudBadge :tone="context?.published ? 'success' : 'neutral'">{{
- context?.published ? 'Published' : 'Private draft'
- }}</CloudBadge
- ><span>{{ host }}</span>
- </div>
- </div>
- <div class="cf-site-page-actions">
- <CloudButton
- v-if="host && context?.published"
- as-child
- variant="ghost"
- size="sm"
- ><a
- :href="`https://${host}`"
- target="_blank"
- rel="noopener noreferrer"
- >View site<ArrowUpRight :size="14" /></a></CloudButton
- ><CloudButton
- v-if="admin"
- variant="secondary"
- size="sm"
- :disabled="busy || (!photos.length && !context?.published)"
- @click="publish(!context?.published)"
- ><Globe :size="14" />{{
- context?.published ? 'Unpublish' : 'Publish gallery'
- }}</CloudButton
- ><CloudButton
- as-child
- variant="ghost"
- size="icon"
- ><NuxtLink
- :to="`/sites/${context?.siteId}/settings`"
- aria-label="Site settings"
- ><Settings :size="17" /></NuxtLink
- ></CloudButton>
- </div>
- <p
- v-if="!context?.published"
- class="cf-draft-hint"
- >
- Your gallery is private. Publish it when you are ready to share.
- </p>
- </div>
-</template>
diff --git a/apps/cloud/app/components/CloudSitePublication.vue b/apps/cloud/app/components/CloudSitePublication.vue
new file mode 100644
index 00000000..390bd815
--- /dev/null
+++ b/apps/cloud/app/components/CloudSitePublication.vue
@@ -0,0 +1,202 @@
+<script setup lang="ts">
+import { ArrowUpRight, Globe, Copy, Check } from 'lucide-vue-next'
+const activeContext = useEntryContext()
+const context = shallowRef(activeContext.value)
+// Preserve the outgoing header, while accepting live updates for this Site only.
+watch(activeContext, (next) => {
+ if (next?.scope === context.value?.scope) context.value = next
+})
+const { admin, busy, photos, loading, failed, message, publish } =
+ useCloudSiteMedia()
+const { data, status, error, refresh } = useFetch<{
+ site: { slug: string | null }
+}>(`/api/sites/${context.value?.siteId}/settings`)
+const host = computed(() =>
+ data.value?.site.slug ? `${data.value.site.slug}.site.chronoframe.art` : '',
+)
+const address = computed(() => (host.value ? `https://${host.value}` : ''))
+const copied = ref(false),
+ copyError = ref(false),
+ unpublishOpen = ref(false),
+ unpublishError = ref('')
+let copiedTimer: ReturnType<typeof setTimeout> | undefined
+onBeforeUnmount(() => clearTimeout(copiedTimer))
+async function copyAddress() {
+ copied.value = false
+ copyError.value = false
+ try {
+ await navigator.clipboard.writeText(address.value)
+ copied.value = true
+ clearTimeout(copiedTimer)
+ copiedTimer = setTimeout(() => {
+ copied.value = false
+ }, 2500)
+ } catch {
+ copyError.value = true
+ }
+}
+watch(unpublishOpen, () => {
+ unpublishError.value = ''
+})
+async function unpublish() {
+ unpublishError.value = ''
+ await publish(false)
+ if (failed.value) unpublishError.value = message.value
+ if (!context.value?.published) unpublishOpen.value = false
+}
+</script>
+<template>
+ <div class="cf-site-page-header">
+ <div class="cf-site-heading">
+ <h1>Overview</h1>
+ <div class="cf-site-publication">
+ <CloudBadge :tone="context?.published ? 'success' : 'neutral'">{{
+ context?.published ? 'Published' : 'Private draft'
+ }}</CloudBadge>
+ <span>{{
+ context?.published
+ ? 'Your gallery is live.'
+ : 'Only your workspace can manage this gallery.'
+ }}</span>
+ </div>
+ </div>
+ <div class="cf-site-page-actions">
+ <CloudButton
+ v-if="context?.published && address"
+ as-child
+ variant="secondary"
+ size="sm"
+ ><a
+ :href="address"
+ target="_blank"
+ rel="noopener noreferrer"
+ >View site<ArrowUpRight :size="14" /></a
+ ></CloudButton>
+ <CloudButton
+ v-if="admin"
+ :variant="context?.published ? 'ghost' : 'default'"
+ size="sm"
+ :disabled="
+ busy || loading || !host || (!photos.length && !context?.published)
+ "
+ :loading="busy"
+ @click="context?.published ? (unpublishOpen = true) : publish(true)"
+ ><Globe :size="14" />{{
+ context?.published ? 'Unpublish' : 'Publish gallery'
+ }}</CloudButton
+ >
+ </div>
+ <div class="cf-site-address-block">
+ <div
+ v-if="address"
+ class="cf-site-address-row"
+ >
+ <span class="cf-site-address-label">{{
+ context?.published ? 'Public address' : 'Reserved address'
+ }}</span>
+ <span class="cf-site-address-value">{{ address }}</span>
+ <CloudButton
+ variant="ghost"
+ size="sm"
+ :aria-label="copied ? 'Address copied' : 'Copy site address'"
+ @click="copyAddress"
+ ><Check
+ v-if="copied"
+ :size="14"
+ /><Copy
+ v-else
+ :size="14"
+ />{{ copied ? 'Copied' : 'Copy link' }}</CloudButton
+ >
+ </div>
+ <p
+ v-else-if="status === 'pending'"
+ class="cf-draft-hint"
+ >
+ Loading site address…
+ </p>
+ <p
+ v-else-if="error"
+ class="cf-draft-hint"
+ role="alert"
+ >
+ Site address could not be loaded.<CloudButton
+ variant="ghost"
+ size="sm"
+ @click="refresh()"
+ >Retry</CloudButton
+ >
+ </p>
+ <p
+ v-else
+ class="cf-draft-hint"
+ >
+ No default address is available for this site.
+ </p>
+ <p
+ v-if="!context?.published"
+ class="cf-draft-hint"
+ >
+ This address returns 404 until you publish your gallery.
+ {{
+ loading
+ ? 'Checking photographs…'
+ : !photos.length
+ ? 'Upload a photograph and wait for processing to finish before publishing.'
+ : admin
+ ? 'Ready to share? Select Publish gallery above.'
+ : 'Ask a workspace administrator to publish this gallery.'
+ }}
+ </p>
+ <p
+ v-else
+ class="cf-draft-hint"
+ >
+ Hidden photographs stay hidden. Password-protected albums still require
+ a password.
+ </p>
+ <p
+ v-if="copied || copyError"
+ class="cf-draft-hint"
+ role="status"
+ >
+ {{
+ copyError
+ ? 'Could not copy the link. Select and copy the address above.'
+ : 'Site address copied to clipboard.'
+ }}
+ </p>
+ </div>
+ <UModal
+ v-model:open="unpublishOpen"
+ title="Unpublish this gallery?"
+ description="Your public address and shared links will return 404. Your photographs, albums and storage will remain in your workspace. You can publish again later."
+ :dismissible="!busy"
+ >
+ <template
+ v-if="unpublishError"
+ #body
+ ><p
+ role="alert"
+ class="cf-notice cf-notice-error"
+ >
+ {{ unpublishError }}
+ </p></template
+ >
+ <template #footer>
+ <CloudButton
+ variant="secondary"
+ :disabled="busy"
+ @click="unpublishOpen = false"
+ >Cancel</CloudButton
+ >
+ <CloudButton
+ variant="destructive"
+ :loading="busy"
+ @click="unpublish"
+ >Unpublish gallery</CloudButton
+ >
+ </template>
+ </UModal>
+ </div>
+</template>
diff --git a/apps/cloud/app/components/CloudSiteSettings.vue b/apps/cloud/app/components/CloudSiteSettings.vue
index 29ea196d..79cf1947 100644
--- a/apps/cloud/app/components/CloudSiteSettings.vue
+++ b/apps/cloud/app/components/CloudSiteSettings.vue
@@ -9,16 +9,75 @@ const {
key: `site-settings-${props.siteId}`,
})
const name = ref(data.value?.site.name ?? '')
+const profile = reactive({
+ title: data.value?.site.title ?? '',
+ slogan: data.value?.site.slogan ?? '',
+ author: data.value?.site.author ?? '',
+ avatarUrl: data.value?.site.avatarUrl ?? '',
+})
+const iconError = ref(''),
+ iconBusy = ref(false)
+async function chooseIcon(event: Event) {
+ const input = event.target as HTMLInputElement
+ const file = input.files?.[0]
+ iconError.value = ''
+ if (!file) return
+ if (
+ !['image/png', 'image/jpeg', 'image/webp'].includes(file.type) ||
+ file.size > 2 * 1024 * 1024
+ ) {
+ iconError.value = 'Choose a PNG, JPEG or WebP image up to 2 MiB.'
+ input.value = ''
+ return
+ }
+ iconBusy.value = true
+ try {
+ const image = await createImageBitmap(file)
+ try {
+ const canvas = document.createElement('canvas')
+ canvas.width = canvas.height = 128
+ const drawing = canvas.getContext('2d')!
+ const size = Math.min(image.width, image.height)
+ drawing.drawImage(
+ image,
+ (image.width - size) / 2,
+ (image.height - size) / 2,
+ size,
+ size,
+ 0,
+ 0,
+ 128,
+ 128,
+ )
+ const value = canvas.toDataURL('image/webp', 0.85)
+ if (value.length > 65536) throw new Error('Icon too large')
+ profile.avatarUrl = value
+ } finally {
+ image.close()
+ }
+ } catch {
+ iconError.value = 'This image could not be used. Try another image.'
+ } finally {
+ iconBusy.value = false
+ input.value = ''
+ }
+}
const busy = ref(false)
const message = ref('')
const failed = ref(false)
async function reload() {
await refresh()
name.value = data.value?.site.name ?? ''
+ Object.assign(profile, {
+ title: data.value?.site.title ?? '',
+ slogan: data.value?.site.slogan ?? '',
+ author: data.value?.site.author ?? '',
+ avatarUrl: data.value?.site.avatarUrl ?? '',
+ })
message.value = ''
}
-async function save(unpublish = false) {
- if (!data.value || busy.value) return
+async function save() {
+ if (!data.value || busy.value || iconBusy.value) return
busy.value = true
message.value = ''
failed.value = false
@@ -26,9 +85,10 @@ async function save(unpublish = false) {
const result = await $fetch(`/api/sites/${props.siteId}/settings`, {
method: 'PATCH',
body: {
- name: unpublish ? data.value.site.name : name.value,
+ name: name.value,
revision: data.value.site.revision,
- published: unpublish ? false : !!data.value.site.published,
+ published: !!data.value.site.published,
+ profile: { ...profile },
},
})
data.value = { site: { ...result.site, role: data.value.site.role } }
@@ -53,8 +113,8 @@ async function save(unpublish = false) {
<template>
<CloudCard class="cf-site-settings">
<div class="cf-panel-heading">
- <h2>General settings</h2>
- <p>The essentials for your gallery.</p>
+ <h2>Gallery identity</h2>
+ <p>Use the same title, author and icon shown in your public gallery.</p>
</div>
<div
v-if="loadError"
@@ -69,34 +129,13 @@ async function save(unpublish = false) {
</div>
<template v-else-if="data">
<div class="cf-panel-body">
- <div class="cf-readonly-field">
- <span class="cf-field-label">Default address</span>
- <p
- v-if="data.site.slug"
- class="cf-address-preview"
- >
- {{ data.site.slug }}.site.chronoframe.art
- </p>
- <p
- v-else
- class="cf-field-hint"
- >
- This existing site keeps its current domain settings.
- </p>
- <p
- v-if="!data.site.published"
- class="cf-field-hint"
- >
- Reserved for your private draft. Public access is not enabled yet.
- </p>
- </div>
<form
v-if="data.site.role === 'admin'"
class="cf-form"
@submit.prevent="save()"
>
<div class="cf-field">
- <label for="settings-site-name">Site name</label
+ <label for="settings-site-name">Workspace site name</label
><CloudInput
id="settings-site-name"
v-model="name"
@@ -105,10 +144,77 @@ async function save(unpublish = false) {
:disabled="busy"
/>
</div>
+ <p class="cf-field-hint">
+ The workspace name identifies this site in your console. Leave the
+ public title blank to use this name.
+ </p>
+ <div class="cf-field">
+ <label for="gallery-title">Public title</label
+ ><CloudInput
+ id="gallery-title"
+ v-model="profile.title"
+ maxlength="80"
+ :disabled="busy"
+ :placeholder="name"
+ />
+ </div>
+ <div class="cf-field">
+ <label for="gallery-slogan">Slogan</label
+ ><CloudInput
+ id="gallery-slogan"
+ v-model="profile.slogan"
+ maxlength="200"
+ :disabled="busy"
+ />
+ </div>
+ <div class="cf-field">
+ <label for="gallery-author">Author</label
+ ><CloudInput
+ id="gallery-author"
+ v-model="profile.author"
+ maxlength="80"
+ :disabled="busy"
+ />
+ </div>
+ <div class="cf-field">
+ <label for="gallery-icon">Gallery icon</label
+ ><img
+ v-if="profile.avatarUrl"
+ :src="profile.avatarUrl"
+ alt="Gallery icon preview"
+ width="64"
+ height="64"
+ class="cf-gallery-icon"
+ /><input
+ id="gallery-icon"
+ type="file"
+ accept="image/png,image/jpeg,image/webp"
+ :disabled="busy || iconBusy"
+ @change="chooseIcon"
+ />
+ <p class="cf-field-hint">
+ PNG, JPEG or WebP, up to 2 MiB. Cropped to a square and optimized
+ automatically.
+ </p>
+ <CloudButton
+ v-if="profile.avatarUrl"
+ variant="ghost"
+ :disabled="busy || iconBusy"
+ @click="profile.avatarUrl = ''"
+ >Remove icon</CloudButton
+ >
+ <p
+ v-if="iconError"
+ class="cf-error-message"
+ role="alert"
+ >
+ {{ iconError }}
+ </p>
+ </div>
<div class="cf-site-actions">
<CloudButton
type="submit"
- :disabled="busy || !name.trim()"
+ :disabled="busy || iconBusy || !name.trim()"
>{{ busy ? 'Saving…' : 'Save changes' }}</CloudButton
><CloudButton
type="button"
@@ -133,19 +239,6 @@ async function save(unpublish = false) {
{{ message }}
</p>
</div>
- <div
- v-if="data.site.role === 'admin' && data.site.published"
- class="cf-panel-footer"
- >
- <p>Take this gallery offline.</p>
- <CloudButton
- type="button"
- variant="destructive"
- :disabled="busy"
- @click="save(true)"
- >Unpublish site</CloudButton
- >
- </div>
</template>
</CloudCard>
</template>
diff --git a/apps/cloud/app/components/CloudSiteWorkspace.vue b/apps/cloud/app/components/CloudSiteWorkspace.vue
index 45085901..df6be0e8 100644
--- a/apps/cloud/app/components/CloudSiteWorkspace.vue
+++ b/apps/cloud/app/components/CloudSiteWorkspace.vue
@@ -18,7 +18,7 @@ const status = computed(() => (loading.value ? 'pending' : 'success'))
:photos="photos"
:refresh="reload"
:status="status"
- ><CloudSiteHeader />
+ >
<p
v-if="message"
:role="failed ? 'alert' : 'status'"
diff --git a/apps/cloud/app/components/CloudUploadDrawer.vue b/apps/cloud/app/components/CloudUploadDrawer.vue
index c7f74028..62f3064e 100644
--- a/apps/cloud/app/components/CloudUploadDrawer.vue
+++ b/apps/cloud/app/components/CloudUploadDrawer.vue
@@ -59,10 +59,10 @@ async function dropFiles(event: DragEvent) {
>
Connect your private storage in
<NuxtLink
- :to="`/sites/${context?.siteId}/settings`"
+ :to="`/sites/${context?.siteId}/storage`"
class="underline"
@click="uploadOpen = false"
- >site settings</NuxtLink
+ >Storage</NuxtLink
>
before uploading.
</p>
diff --git a/apps/cloud/app/middleware/platform.global.ts b/apps/cloud/app/middleware/platform.global.ts
index 63e39efa..c4d11f08 100644
--- a/apps/cloud/app/middleware/platform.global.ts
+++ b/apps/cloud/app/middleware/platform.global.ts
@@ -49,7 +49,9 @@ export default defineNuxtRouteMiddleware(async (to) => {
}
if (path.startsWith('/sites/')) {
const match =
- /^\/sites\/([1-9][0-9]*)(?:\/(?:photos|albums|settings))?$/.exec(path)
+ /^\/sites\/([1-9][0-9]*)(?:\/(?:overview|photos|albums|information|domains|storage|settings))?$/.exec(
+ path,
+ )
if (!match)
return abortNavigation(
createError({ statusCode: 404, statusMessage: 'Page not found' }),
@@ -57,11 +59,17 @@ export default defineNuxtRouteMiddleware(async (to) => {
try {
context.value = await fetcher(`/api/sites/${match[1]}/context`)
// Resolve legacy URLs before mounting a nested page/Suspense boundary.
- if (path === `/sites/${match[1]}`)
- return navigateTo(`/sites/${match[1]}/photos`, {
- replace: true,
- redirectCode: 302,
- })
+ if (
+ path === `/sites/${match[1]}` ||
+ path === `/sites/${match[1]}/settings`
+ )
+ return navigateTo(
+ `/sites/${match[1]}/${path.endsWith('/settings') ? 'information' : 'overview'}`,
+ {
+ replace: true,
+ redirectCode: 302,
+ },
+ )
} catch (error) {
context.value = null
return abortNavigation(error as Error)
diff --git a/apps/cloud/app/pages/sites/[siteId]/domains.vue b/apps/cloud/app/pages/sites/[siteId]/domains.vue
new file mode 100644
index 00000000..9eddba42
--- /dev/null
+++ b/apps/cloud/app/pages/sites/[siteId]/domains.vue
@@ -0,0 +1,88 @@
+<script setup lang="ts">
+import { Copy } from 'lucide-vue-next'
+definePageMeta({ layout: 'portal' })
+useSeoMeta({ title: 'Domains — ChronoFrame Cloud', robots: 'noindex' })
+const site = useEntryContext().value!
+const { data, error, refresh } = await useFetch(
+ `/api/sites/${site.siteId}/settings`,
+)
+const notice = ref('')
+async function copy() {
+ try {
+ await navigator.clipboard.writeText(
+ `https://${data.value!.site.slug}.site.chronoframe.art`,
+ )
+ notice.value = 'Address copied.'
+ } catch {
+ notice.value = 'Could not copy. Select and copy the address above.'
+ }
+}
+</script>
+<template>
+ <div class="cf-site-settings-stack">
+ <div class="cf-page-heading">
+ <div>
+ <h1 class="cf-page-title">Domains</h1>
+ <p class="cf-page-description">
+ Addresses visitors use to reach your gallery.
+ </p>
+ </div>
+ </div>
+ <CloudCard
+ ><div class="cf-panel-heading">
+ <h2>Default subdomain</h2>
+ <p>Your reserved ChronoFrame address.</p>
+ </div>
+ <div class="cf-panel-body">
+ <p
+ v-if="error"
+ role="alert"
+ >
+ Could not load the address.<CloudButton
+ variant="ghost"
+ @click="refresh()"
+ >Retry</CloudButton
+ >
+ </p>
+ <template v-else-if="data?.site.slug"
+ ><p class="cf-address-preview">
+ https://{{ data.site.slug }}.site.chronoframe.art
+ </p>
+ <CloudButton
+ variant="secondary"
+ size="sm"
+ @click="copy"
+ ><Copy :size="14" />Copy address</CloudButton
+ >
+ <p class="cf-field-hint">
+ {{
+ data.site.published
+ ? 'Published. Hidden photographs and album passwords remain protected.'
+ : 'Reserved for your draft. This address returns 404 until you publish from Overview.'
+ }}
+ </p>
+ <p class="cf-field-hint">
+ Changing the default subdomain is not available yet.
+ </p></template
+ >
+ <p v-else>No default subdomain is assigned.</p>
+ <p
+ v-if="notice"
+ role="status"
+ class="cf-field-hint"
+ >
+ {{ notice }}
+ </p>
+ </div></CloudCard
+ ><CloudCard
+ ><div class="cf-panel-heading">
+ <h2>Custom domains</h2>
+ <CloudBadge>Coming later</CloudBadge>
+ <p>
+ Connect your own domain in a future update. Domain ownership, DNS and
+ certificate verification will be required before activation.
+ </p>
+ </div></CloudCard
+ >
+ </div>
+</template>
diff --git a/apps/cloud/app/pages/sites/[siteId]/information.vue b/apps/cloud/app/pages/sites/[siteId]/information.vue
new file mode 100644
index 00000000..7c32af3a
--- /dev/null
+++ b/apps/cloud/app/pages/sites/[siteId]/information.vue
@@ -0,0 +1,18 @@
+<script setup lang="ts">
+definePageMeta({ layout: 'portal' })
+useSeoMeta({ title: 'Site information — ChronoFrame Cloud', robots: 'noindex' })
+const site = useEntryContext().value!
+</script>
+<template>
+ <div class="cf-site-settings-stack">
+ <div class="cf-page-heading">
+ <div>
+ <h1 class="cf-page-title">Site information</h1>
+ <p class="cf-page-description">
+ Your gallery’s identity and public profile.
+ </p>
+ </div>
+ </div>
+ <CloudSiteSettings :site-id="site.siteId" />
+ </div>
+</template>
diff --git a/apps/cloud/app/pages/sites/[siteId]/overview.vue b/apps/cloud/app/pages/sites/[siteId]/overview.vue
new file mode 100644
index 00000000..bb2b8d4c
--- /dev/null
+++ b/apps/cloud/app/pages/sites/[siteId]/overview.vue
@@ -0,0 +1,51 @@
+<script setup lang="ts">
+definePageMeta({ layout: 'portal' })
+useSeoMeta({ title: 'Overview — ChronoFrame Cloud', robots: 'noindex' })
+const site = useEntryContext().value!
+const { photos, albums, jobs, loading } = useCloudSiteMedia()
+const processingCount = computed(
+ () =>
+ jobs.value.filter((job: { state: string }) =>
+ ['queued', 'running', 'retry_wait'].includes(job.state),
+ ).length,
+)
+</script>
+<template>
+ <div>
+ <CloudSitePublication />
+ <div
+ class="cf-overview-stats"
+ :aria-busy="loading"
+ >
+ <CloudCard
+ ><div class="cf-panel-body">
+ <span class="cf-field-label">Photographs</span
+ ><strong>{{ loading ? '—' : photos.length }}</strong
+ ><NuxtLink
+ :to="`/sites/${site.siteId}/photos`"
+ class="cf-text-link"
+ >Open photo library</NuxtLink
+ >
+ </div></CloudCard
+ ><CloudCard
+ ><div class="cf-panel-body">
+ <span class="cf-field-label">Albums</span
+ ><strong>{{ loading ? '—' : albums.length }}</strong
+ ><NuxtLink
+ :to="`/sites/${site.siteId}/albums`"
+ class="cf-text-link"
+ >Manage albums</NuxtLink
+ >
+ </div></CloudCard
+ ><CloudCard
+ ><div class="cf-panel-body">
+ <span class="cf-field-label">Processing</span
+ ><strong>{{ loading ? '—' : processingCount }}</strong>
+ <p class="cf-field-hint">
+ Upload and processing details are in your photo library.
+ </p>
+ </div></CloudCard
+ >
+ </div>
+ </div>
+</template>
diff --git a/apps/cloud/app/pages/sites/[siteId]/settings.vue b/apps/cloud/app/pages/sites/[siteId]/settings.vue
index b66f2b06..fd3b2eb7 100644
--- a/apps/cloud/app/pages/sites/[siteId]/settings.vue
+++ b/apps/cloud/app/pages/sites/[siteId]/settings.vue
@@ -1,13 +1,5 @@
<script setup lang="ts">
definePageMeta({ layout: 'portal' })
-useSeoMeta({ title: 'Site settings — ChronoFrame Cloud', robots: 'noindex' })
-const context = useEntryContext().value
+// The authenticated middleware redirects this legacy URL before page setup.
</script>
-<template>
- <div class="cf-site-settings-stack">
- <CloudSiteSettings
- v-if="context"
- :site-id="context.siteId"
- /><CloudStorageSettings />
- </div>
-</template>
+<template><div /></template>
diff --git a/apps/cloud/app/pages/sites/[siteId]/storage.vue b/apps/cloud/app/pages/sites/[siteId]/storage.vue
new file mode 100644
index 00000000..8d0aebbf
--- /dev/null
+++ b/apps/cloud/app/pages/sites/[siteId]/storage.vue
@@ -0,0 +1,26 @@
+<script setup lang="ts">
+definePageMeta({ layout: 'portal' })
+useSeoMeta({ title: 'Storage — ChronoFrame Cloud', robots: 'noindex' })
+</script>
+<template>
+ <div class="cf-site-settings-stack">
+ <div class="cf-page-heading">
+ <div>
+ <h1 class="cf-page-title">Storage</h1>
+ <p class="cf-page-description">
+ Choose where your gallery’s media lives.
+ </p>
+ </div>
+ </div>
+ <CloudStorageSettings /><CloudCard
+ ><div class="cf-panel-heading">
+ <h2>Platform storage</h2>
+ <CloudBadge>Coming later</CloudBadge>
+ <p>
+ Managed storage and plan allowances are not available yet. Connect
+ your own private S3-compatible bucket above to get started.
+ </p>
+ </div></CloudCard
+ >
+ </div>
+</template>
diff --git a/apps/cloud/app/pages/sites/index.vue b/apps/cloud/app/pages/sites/index.vue
index 98bac6f9..efab4089 100644
--- a/apps/cloud/app/pages/sites/index.vue
+++ b/apps/cloud/app/pages/sites/index.vue
@@ -77,7 +77,7 @@ const sites = ref(
:key="site.siteId"
>
<NuxtLink
- :to="`/sites/${site.siteId}/photos`"
+ :to="`/sites/${site.siteId}/overview`"
:aria-label="site.name"
:aria-describedby="`site-status-${site.siteId} site-role-${site.siteId}`"
class="cf-site-row"
diff --git a/apps/cloud/server/api/sites/[siteId]/settings.patch.ts b/apps/cloud/server/api/sites/[siteId]/settings.patch.ts
index bead43b9..4e813055 100644
--- a/apps/cloud/server/api/sites/[siteId]/settings.patch.ts
+++ b/apps/cloud/server/api/sites/[siteId]/settings.patch.ts
@@ -6,12 +6,13 @@ import {
} from '../../../utils/site-management'
export default definePlatformHandler(async (event) => {
const { userId, store } = await siteManagement(event, true)
- const body = await siteManagementBody(event)
+ const body = await siteManagementBody(event, 100000)
return {
site: await store.update(userId, Number(getRouterParam(event, 'siteId')), {
name: body.name,
revision: body.revision,
published: body.published,
+ profile: body.profile,
}),
}
})
diff --git a/apps/site/server/api/public/system/settings/all.get.ts b/apps/site/server/api/public/system/settings/all.get.ts
index 10653de6..eb6e6d1a 100644
--- a/apps/site/server/api/public/system/settings/all.get.ts
+++ b/apps/site/server/api/public/system/settings/all.get.ts
@@ -1,5 +1,8 @@
import { PUBLIC_GALLERY_DEFAULTS } from '@chronoframe/contracts/gallery-settings'
-import { definePlatformHandler } from '../../../../../../shared/platform/runtime'
+import {
+ platformDatabase,
+ definePlatformHandler,
+} from '../../../../../../shared/platform/runtime'
import {
publicSiteContext,
siteContextDTO,
@@ -10,6 +13,20 @@ export default definePlatformHandler(async (event) => {
string,
Record<string, unknown>
>
- data.app!.title = context.name
+ const profile = await platformDatabase(event)
+ .prepare(
+ 'SELECT gallery_title AS title, gallery_slogan AS slogan, gallery_author AS author, gallery_avatar AS avatarUrl FROM platform_sites WHERE id = ?',
+ )
+ .bind(context.siteId)
+ .first<{
+ title: string
+ slogan: string
+ author: string
+ avatarUrl: string
+ }>()
+ data.app!.title = profile?.title || context.name
+ data.app!.slogan = profile?.slogan || ''
+ data.app!.author = profile?.author || ''
+ data.app!.avatarUrl = profile?.avatarUrl || ''
return { timestamp: Date.now(), data }
})
diff --git a/packages/platform/migrations/0011_site_identity.sql b/packages/platform/migrations/0011_site_identity.sql
new file mode 100644
index 00000000..4180616c
--- /dev/null
+++ b/packages/platform/migrations/0011_site_identity.sql
@@ -0,0 +1,5 @@
+-- Public gallery identity is distinct from the workspace's internal Site name.
+ALTER TABLE platform_sites ADD COLUMN gallery_title TEXT NOT NULL DEFAULT '';
+ALTER TABLE platform_sites ADD COLUMN gallery_slogan TEXT NOT NULL DEFAULT '';
+ALTER TABLE platform_sites ADD COLUMN gallery_author TEXT NOT NULL DEFAULT '';
+ALTER TABLE platform_sites ADD COLUMN gallery_avatar TEXT NOT NULL DEFAULT '';
diff --git a/packages/platform/src/provisioning.ts b/packages/platform/src/provisioning.ts
index 7643ed42..57e2aac1 100644
--- a/packages/platform/src/provisioning.ts
+++ b/packages/platform/src/provisioning.ts
@@ -50,6 +50,38 @@ export function siteIdentity(name: unknown, slug: unknown) {
throw new ProvisioningError(400, 'Invalid site address')
return { name: name.trim(), slug }
}
+export function siteProfile(value: unknown) {
+ if (!value || typeof value !== 'object' || Array.isArray(value))
+ throw new ProvisioningError(400, 'Invalid gallery profile')
+ const profile = value as Record<string, unknown>
+ function text(key: string, max: number) {
+ const value = profile[key]
+ if (
+ typeof value !== 'string' ||
+ value.length > max ||
+ Array.from(value).some(
+ (char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127,
+ )
+ )
+ throw new ProvisioningError(400, 'Invalid gallery profile')
+ return value.trim()
+ }
+ const avatarUrl = text('avatarUrl', 65536)
+ // Raster uploads only: no scripts, SVG or server-side remote image fetches.
+ if (
+ avatarUrl &&
+ !/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(
+ avatarUrl,
+ )
+ )
+ throw new ProvisioningError(400, 'Invalid gallery icon')
+ return {
+ title: text('title', 80),
+ slogan: text('slogan', 200),
+ author: text('author', 80),
+ avatarUrl,
+ }
+}
export interface ManagedSite {
siteId: number
workspaceId: number
@@ -57,9 +89,13 @@ export interface ManagedSite {
slug: string | null
published: number
revision: number
+ title: string
+ slogan: string
+ author: string
+ avatarUrl: string
}
const fields =
- 's.id AS siteId, s.workspace_id AS workspaceId, s.name, s.slug, s.published, s.revision'
+ 's.id AS siteId, s.workspace_id AS workspaceId, s.name, s.slug, s.published, s.revision, s.gallery_title AS title, s.gallery_slogan AS slogan, s.gallery_author AS author, s.gallery_avatar AS avatarUrl'
/** Transactional D1 writes retain live membership checks, including during retries. */
export function createD1Provisioning(db: PlatformD1) {
async function defaultWorkspace(userId: number) {
@@ -127,7 +163,7 @@ export function createD1Provisioning(db: PlatformD1) {
SELECT ?, ?, ?, ?, ? WHERE EXISTS(SELECT 1 FROM platform_memberships WHERE workspace_id = ? AND user_id = ? AND role = 'admin')
AND (SELECT COUNT(*) FROM platform_sites WHERE workspace_id = ?) < 10
ON CONFLICT(workspace_id, provision_key) DO UPDATE SET provision_key = excluded.provision_key
- RETURNING id AS siteId, workspace_id AS workspaceId, name, slug, published, revision`)
+ RETURNING id AS siteId, workspace_id AS workspaceId, name, slug, published, revision, gallery_title AS title, gallery_slogan AS slogan, gallery_author AS author, gallery_avatar AS avatarUrl`)
.bind(
workspace.id,
identity.name,
@@ -160,12 +196,19 @@ export function createD1Provisioning(db: PlatformD1) {
async update(
userId: number,
siteId: number,
- input: { name: unknown; revision: unknown; published: unknown },
+ input: {
+ name: unknown
+ revision: unknown
+ published: unknown
+ profile?: unknown
+ },
) {
const current = await get(userId, siteId)
if (current.role !== 'admin')
throw new ProvisioningError(403, 'Administrator required')
const name = siteIdentity(input.name, current.slug ?? 'legacy-site').name
+ const profile =
+ input.profile === undefined ? current : siteProfile(input.profile)
if (
!Number.isSafeInteger(input.revision) ||
typeof input.published !== 'boolean'
@@ -175,12 +218,16 @@ export function createD1Provisioning(db: PlatformD1) {
if (input.published && !current.published)
throw new ProvisioningError(400, 'Publishing is not available yet')
const result = await db
- .prepare(`UPDATE platform_sites SET name = ?, published = ?, revision = revision + 1
+ .prepare(`UPDATE platform_sites SET name = ?, published = ?, gallery_title = ?, gallery_slogan = ?, gallery_author = ?, gallery_avatar = ?, revision = revision + 1
WHERE id = ? AND revision = ? AND EXISTS(SELECT 1 FROM platform_memberships WHERE workspace_id = platform_sites.workspace_id AND user_id = ? AND role = 'admin')
- RETURNING id AS siteId, workspace_id AS workspaceId, name, slug, published, revision`)
+ RETURNING id AS siteId, workspace_id AS workspaceId, name, slug, published, revision, gallery_title AS title, gallery_slogan AS slogan, gallery_author AS author, gallery_avatar AS avatarUrl`)
.bind(
name,
input.published ? 1 : 0,
+ profile.title,
+ profile.slogan,
+ profile.author,
+ profile.avatarUrl,
siteId,
input.revision as number,
userId,
diff --git a/tests/platform-provisioning.test.ts b/tests/platform-provisioning.test.ts
index 250f8d7a..476fe8fc 100644
--- a/tests/platform-provisioning.test.ts
+++ b/tests/platform-provisioning.test.ts
@@ -7,6 +7,7 @@ import {
siteIdentity,
type PlatformD1,
} from '../packages/platform/src/index.ts'
+import { siteProfile } from '../packages/platform/src/provisioning.ts'
const require = createRequire(import.meta.url)
const { Miniflare, convertV4MiniflareOptions } = createRequire(
require.resolve('wrangler/package.json'),
@@ -78,6 +79,7 @@ test('Real D1 provisioning preserves old tenants, serializes defaults and enforc
await migrate('0002_visitor_access.sql')
await migrate('0003_account_security.sql')
await migrate('0004_workspace_sites.sql')
+ await migrate('0011_site_identity.sql')
await db
.prepare('UPDATE platform_users SET email_verified=0 WHERE id=44')
.run()
@@ -185,6 +187,58 @@ test('Real D1 provisioning preserves old tenants, serializes defaults and enforc
).published,
0,
)
+ const profile = {
+ title: 'Public title',
+ slogan: 'Small moments',
+ author: 'Photographer',
+ avatarUrl: 'data:image/png;base64,AA==',
+ }
+ const profiled = await store.update(42, 8, {
+ name: 'Workspace name',
+ published: false,
+ revision: 3,
+ profile,
+ })
+ assert.equal(profiled.title, profile.title)
+ assert.equal((await store.get(42, 8)).avatarUrl, profile.avatarUrl)
+ const preserved = await store.update(42, 8, {
+ name: 'Renamed workspace',
+ published: false,
+ revision: 4,
+ })
+ assert.equal(
+ preserved.title,
+ profile.title,
+ 'legacy clients preserve public profile',
+ )
+ await assert.rejects(
+ store.update(42, 8, {
+ name: 'Stale',
+ published: false,
+ revision: 4,
+ profile: { ...profile, title: 'Lost update' },
+ }),
+ { statusCode: 409 },
+ )
+ await assert.rejects(
+ store.update(43, 8, {
+ name: 'Member edit',
+ published: false,
+ revision: 5,
+ profile,
+ }),
+ { statusCode: 403 },
+ )
+ await assert.rejects(
+ store.update(44, 8, {
+ name: 'Foreign',
+ published: false,
+ revision: 5,
+ profile,
+ }),
+ { statusCode: 404 },
+ )
+ assert.equal((await store.get(42, 8)).title, profile.title)
// The pilot bound is enforced in the INSERT, including parallel writes.
await Promise.allSettled(
Array.from({ length: 15 }, (_, i) =>
@@ -229,3 +283,19 @@ test('Real D1 provisioning preserves old tenants, serializes defaults and enforc
await mf.dispose()
}
})
+
+test('Gallery identity accepts bounded plain text and raster data only', () => {
+ const profile = { title: ' Gallery ', slogan: '', author: '', avatarUrl: '' }
+ assert.equal(siteProfile(profile).title, 'Gallery')
+ for (const avatarUrl of [
+ 'javascript:alert(1)',
+ 'https://127.0.0.1/icon',
+ 'data:image/svg+xml;base64,PHN2Zz4=',
+ 'x'.repeat(65537),
+ ])
+ assert.throws(() => siteProfile({ ...profile, avatarUrl }), {
+ statusCode: 400,
+ })
+ for (const title of ['x'.repeat(81), 'bad\nvalue'])
+ assert.throws(() => siteProfile({ ...profile, title }), { statusCode: 400 })
+})