update attachent upload

This commit is contained in:
2026-03-18 19:33:09 +01:00
parent 84b3dd69f1
commit 4355fa78fa
2 changed files with 52 additions and 58 deletions

View File

@@ -38,7 +38,7 @@ Load the extension in Chrome: **Extensions → Load unpacked → select `dist/`*
- Memos API v1: `/api/v1/memos`, `/api/v1/attachments`
- Requires Memos v0.22+
- Bearer token auth via `chrome.storage.sync`
- Attachment flow: upload via `POST /api/v1/attachments` (JSON + base64 `content`), create memo, then link each attachment to the memo via `PATCH /api/v1/attachments/{id}` with `{ memo: "memos/{id}" }`
- Attachment flow: create memo first (`POST /api/v1/memos`), then upload each attachment via `POST /api/v1/attachments` (JSON + base64 `content` + `memo: "memos/{id}"`), then patch the memo content to replace original image URLs with attachment URLs (`PATCH /api/v1/memos/{id}`)
### Content Extraction
- Removes boilerplate: nav, ads, sidebars, cookie banners (45+ selectors)
@@ -49,8 +49,9 @@ Load the extension in Chrome: **Extensions → Load unpacked → select `dist/`*
- Filters images smaller than 32px (icons/tracking pixels)
- Deduplicates images
- Supports data URIs
- Uploads images as attachments (`POST /api/v1/attachments`) with base64-encoded content
- After memo creation, links each attachment to the memo via `PATCH /api/v1/attachments/{id}`
- Uploads images as attachments (`POST /api/v1/attachments`) with base64-encoded content and `memo` reference
- Memo is created first; attachment uploads include `memo: "memos/{id}"` to associate them immediately
- After all uploads, memo content is patched to replace original image URLs with attachment file URLs
- Attachment file URL pattern: `{memosUrl}/file/attachments/{id}`
### Storage