feat: article attachments with content-addressed dedup
Add an attachments table and AJAX upload/management on the article create and edit pages. - Attachment model with article_id (0 while pending on create), session_token ownership, and SHA-256 content-addressed stored_name - Upload validates via the platform policy (switch/type/size) and deduplicates on disk by content hash - Plan-A binding: attachments uploaded before an article exists are owned by a session token and bound to the new article on save - Delete soft-removes the record and drops the disk file only when no remaining rows reference it (reference counting for deduped files) - Edit page loads existing attachments via JSON list endpoint - Row actions: insert into body (markdown image/link), set as cover (image only), and delete - Download URLs use the configured default download base URL when set, else the local /uploads path Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -121,6 +121,17 @@ var translations = map[Lang]map[string]string{
|
||||
"article_content_required": "Content is required.",
|
||||
"article_back_home": "Back to Home",
|
||||
"article_not_found": "Article not found.",
|
||||
"article_attachments": "Attachments",
|
||||
"article_upload": "Upload",
|
||||
"article_att_name": "File",
|
||||
"article_att_size": "Size",
|
||||
"article_att_insert": "Insert",
|
||||
"article_att_set_cover": "Set as Cover",
|
||||
"article_att_cover_set": "Cover URL set.",
|
||||
"article_att_pick": "Please choose a file.",
|
||||
"article_att_uploading": "Uploading...",
|
||||
"article_att_error": "Upload failed. Please try again.",
|
||||
"article_att_delete_confirm": "Delete this attachment?",
|
||||
|
||||
// Article management
|
||||
"article_list_title": "Articles",
|
||||
@@ -293,6 +304,17 @@ var translations = map[Lang]map[string]string{
|
||||
"article_content_required": "正文不能为空。",
|
||||
"article_back_home": "返回首页",
|
||||
"article_not_found": "文章不存在。",
|
||||
"article_attachments": "附件",
|
||||
"article_upload": "上传",
|
||||
"article_att_name": "文件",
|
||||
"article_att_size": "大小",
|
||||
"article_att_insert": "插入正文",
|
||||
"article_att_set_cover": "设为封面",
|
||||
"article_att_cover_set": "已设为封面。",
|
||||
"article_att_pick": "请先选择文件。",
|
||||
"article_att_uploading": "上传中...",
|
||||
"article_att_error": "上传失败,请重试。",
|
||||
"article_att_delete_confirm": "删除该附件?",
|
||||
|
||||
// 文章管理
|
||||
"article_list_title": "文章管理",
|
||||
|
||||
Reference in New Issue
Block a user