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(albums): clarify conflicts for previously used URLs

Ahmet Ömer6d576546e9a5
diff --git a/docs/guide/usage.md b/docs/guide/usage.md
index a3de3843..5a5ddfe9 100644
--- a/docs/guide/usage.md
+++ b/docs/guide/usage.md
@@ -21,6 +21,8 @@ For Apple Live Photos, use matching image and MOV filenames, such as `IMG_1234.h
Albums group photos by subject. ChronoFrame supports ordering for both albums and the photos within them.
+On self-hosted sites, album URLs are generated from titles. You can set a custom URL in the album form. Old URLs redirect after a rename; URLs from deleted albums remain reserved so an old link cannot open a different album. Choose a new URL if one was used before.
+
::: warning Hidden albums also affect shared photos
Hidden albums restrict public visibility. ChronoFrame also restricts anonymous access to their photos, even when a photo belongs to a public album as well. Check the public gallery after changing visibility.
:::
diff --git a/docs/zh/guide/usage.md b/docs/zh/guide/usage.md
index fc17e61d..f64d7f32 100644
--- a/docs/zh/guide/usage.md
+++ b/docs/zh/guide/usage.md
@@ -21,6 +21,8 @@ Apple Live Photo 的照片和 MOV 文件使用同一文件名,例如 `IMG_1234
相册可将同一主题的照片集中展示,支持相册排序和相册内照片排序。
+在自行部署的站点中,相册网址根据标题生成,也可以在相册表单中自定义。修改网址后,旧网址会重定向;删除相册后,其网址仍会保留,以免旧链接指向其他相册。曾使用过的网址不能重复使用,请选择新的网址。
+
::: warning 隐藏相册也会影响公开相册中的照片
隐藏相册用于限制公开展示,同时限制匿名访客访问其中的照片,即使该照片还属于公开相册;请在调整可见性后检查公开画廊的结果。
:::
diff --git a/packages/database/README.md b/packages/database/README.md
index 72863461..e86c48e8 100644
--- a/packages/database/README.md
+++ b/packages/database/README.md
@@ -8,6 +8,8 @@ Migrations are canonical here. `server/database/migrations` remains a compatibil
The default self-hosted Site is fixed by its entry, while every site repository requires an explicit existing Site. Migration creates default Workspace/Site memberships and enforces immutable ownership and same-site relationships. Settings uniqueness and caches include Site. Historical storage connection configurations are retained as immutable revisions for existing object references.
+Album slugs are reserved per Site after a rename or deletion. Deletion keeps a tombstone in `album_slugs` so an old URL can never identify a different album; the registry therefore grows with distinct URLs used over time. Automatic slug generation skips reserved values, and custom reuse returns a conflict.
+
`pnpm db:migrate` and application startup use the same journal-compatible runner. Existing files with pending migrations receive a consistent `*.pre-migration-*.sqlite3` backup before changes. Schema and journal updates share a transaction, foreign keys are checked before commit, and enforcement is restored afterwards. Keep backups with their matching application versions; restoring only an older binary does not reverse schema constraints.
Jobs use source generations, retained deletion tombstones, leases, attempt tokens and input digests. Resource mutation and follow-up task creation share one transaction. Publication guards live only inside the publication transaction and roll back with it; workers never hold database transactions during native processing or storage I/O.
diff --git a/packages/database/src/album-slugs.ts b/packages/database/src/album-slugs.ts
index 577a7e6f..588fe929 100644
--- a/packages/database/src/album-slugs.ts
+++ b/packages/database/src/album-slugs.ts
@@ -65,7 +65,11 @@ export function claimAlbumSlug(
.get()
if (existing) {
if (existing.albumId === albumId && existing.isCurrent) return slug
- if (!automatic) throw new CoreError(409, 'Album URL slug already exists')
+ if (!automatic)
+ throw new CoreError(
+ 409,
+ 'Album URL slug is in use or was previously used',
+ )
continue
}
db.update(tables.albumSlugs)
diff --git a/packages/gallery/i18n/locales/en.json b/packages/gallery/i18n/locales/en.json
index 38012234..83b89fab 100644
--- a/packages/gallery/i18n/locales/en.json
+++ b/packages/gallery/i18n/locales/en.json
@@ -927,7 +927,7 @@
"slugHint": "Clear this field to generate from the title. Changing it redirects old links.",
"slugCurrent": "Current URL",
"slugInvalid": "Use lowercase letters, numbers, and single hyphens (up to 80 characters). The URL cannot consist only of numbers.",
- "slugConflict": "This album URL is already in use.",
+ "slugConflict": "This album URL is in use or was used previously. Choose a different URL.",
"description": "Description",
"descriptionPlaceholder": "Enter album description (optional)",
"coverPhoto": "Album Cover",
diff --git a/packages/gallery/i18n/locales/ja.json b/packages/gallery/i18n/locales/ja.json
index 7a21ebdd..06c502a0 100644
--- a/packages/gallery/i18n/locales/ja.json
+++ b/packages/gallery/i18n/locales/ja.json
@@ -849,7 +849,7 @@
"slugHint": "空欄にするとタイトルから生成します。変更前の URL はリダイレクトされます。",
"slugCurrent": "現在の URL",
"slugInvalid": "小文字の英字、数字、単一のハイフンを使用してください(最大80文字)。数字のみの URL は使用できません。",
- "slugConflict": "このアルバム URL は既に使用されています。",
+ "slugConflict": "このアルバム URL は現在使用中か、過去に使用されたため再利用できません。別の URL を選んでください。",
"description": "説明",
"descriptionPlaceholder": "アルバムの説明を入力(オプション)",
"coverPhoto": "アルバムカバー",
diff --git a/packages/gallery/i18n/locales/ru.json b/packages/gallery/i18n/locales/ru.json
index a4be25e7..43ec6860 100644
--- a/packages/gallery/i18n/locales/ru.json
+++ b/packages/gallery/i18n/locales/ru.json
@@ -927,7 +927,7 @@
"slugHint": "Очистите поле, чтобы создать адрес из названия. Старые ссылки будут перенаправлены.",
"slugCurrent": "Текущий адрес",
"slugInvalid": "Используйте строчные латинские буквы, цифры и одиночные дефисы (до 80 символов). Адрес не может состоять только из цифр.",
- "slugConflict": "Этот адрес альбома уже используется.",
+ "slugConflict": "Этот адрес альбома используется сейчас или использовался ранее. Выберите другой адрес.",
"description": "Описание",
"descriptionPlaceholder": "Введите описание альбома (необязательно)",
"coverPhoto": "Обложка альбома",
diff --git a/packages/gallery/i18n/locales/zh-Hans.json b/packages/gallery/i18n/locales/zh-Hans.json
index 337fef84..c6a242b8 100644
--- a/packages/gallery/i18n/locales/zh-Hans.json
+++ b/packages/gallery/i18n/locales/zh-Hans.json
@@ -927,7 +927,7 @@
"slugHint": "清空此字段可根据标题生成。旧链接将自动重定向。",
"slugCurrent": "当前网址",
"slugInvalid": "仅可使用小写英文字母、数字和单个连字符(最多 80 个字符)。网址不能仅由数字组成。",
- "slugConflict": "此相簿网址已被使用。",
+ "slugConflict": "此相簿网址正在使用或曾被使用,无法重复使用。请选择其他网址。",
"description": "描述",
"descriptionPlaceholder": "输入相簿描述(可选)",
"coverPhoto": "相簿封面",
diff --git a/packages/gallery/i18n/locales/zh-Hant-HK.json b/packages/gallery/i18n/locales/zh-Hant-HK.json
index e100f384..87758b9f 100644
--- a/packages/gallery/i18n/locales/zh-Hant-HK.json
+++ b/packages/gallery/i18n/locales/zh-Hant-HK.json
@@ -849,7 +849,7 @@
"slugHint": "清除此欄位可根據標題產生。舊連結會自動重新導向。",
"slugCurrent": "目前網址",
"slugInvalid": "只可使用小寫英文字母、數字及單個連字號(最多 80 個字元)。網址不可只由數字組成。",
- "slugConflict": "此相簿網址已被使用。",
+ "slugConflict": "此相簿網址正在使用或曾經使用,不能重用。請選擇其他網址。",
"description": "描述",
"descriptionPlaceholder": "輸入相簿描述(可選)",
"coverPhoto": "相簿封面",
diff --git a/packages/gallery/i18n/locales/zh-Hant-TW.json b/packages/gallery/i18n/locales/zh-Hant-TW.json
index c0f7fa05..2233ea45 100644
--- a/packages/gallery/i18n/locales/zh-Hant-TW.json
+++ b/packages/gallery/i18n/locales/zh-Hant-TW.json
@@ -849,7 +849,7 @@
"slugHint": "清除此欄位可根據標題產生。舊連結會自動重新導向。",
"slugCurrent": "目前網址",
"slugInvalid": "僅可使用小寫英文字母、數字與單個連字號(最多 80 個字元)。網址不可僅由數字組成。",
- "slugConflict": "此相簿網址已被使用。",
+ "slugConflict": "此相簿網址正在使用或曾經使用,無法重複使用。請選擇其他網址。",
"description": "描述",
"descriptionPlaceholder": "輸入相簿描述(選填)",
"coverPhoto": "相簿封面",
diff --git a/tests/album-slug-persistence.test.ts b/tests/album-slug-persistence.test.ts
index 1005e44f..27d29091 100644
--- a/tests/album-slug-persistence.test.ts
+++ b/tests/album-slug-persistence.test.ts
@@ -130,6 +130,13 @@ test('album slugs remain unique, redirectable, and reserved after deletion', asy
resolveAlbumSlug(db, DEFAULT_SITE, 'a-new-title')?.albumId,
null,
)
+ await assert.rejects(
+ writer.update(second.id, { slug: 'a-new-title' }, access),
+ (error) =>
+ error instanceof CoreError &&
+ error.statusCode === 409 &&
+ /previously used/.test(error.message),
+ )
assert.equal(
(await writer.create({ title: 'My Album' }, access)).slug,
'my-album-3',