Skip to content

feat(api): create and change image blocks through the player API - #121

Merged
3DExtended merged 1 commit into
mainfrom
claude/api-image-blocks
Nov 4, 2026
Merged

3DExtended merged 1 commit into
mainfrom
claude/api-image-blocks

Conversation

@3DExtended

Copy link
Copy Markdown
Owner

What changes

  • POST /api/external/v1/documents/{id}/image-blocks uploads an image as multipart/form-data with image, visibleTo and an optional markdownText.
  • PUT /api/external/v1/image-blocks/{id} changes the caption and readers; the image stays.
  • imageUrl in the player API is now a full link, for existing image blocks too. The stored URL stays relative because the app prefixes its own base URL.
  • App and API share IImageUploadService.

Behaviour to review

  • The app's upload gets stricter. /Image/streamimageupload now also rejects files whose first bytes are not PNG or JPEG. All 921 images currently stored on prod have matching signatures, so none of those would have been rejected.
  • visibleTo is a JSON array in a form field, e.g. visibleTo=["id"] or []. Repeated form fields cannot express an explicit empty list, and the field must stay required so nothing is shared by accident.
  • visibleTo does not protect the image file. /public/getimage/... works without login for anyone with the link. That is how app images already work; it is documented in notes.md and not changed here.

Testing

  • dotnet test RPGTableHelper.Backend.slnf -c Release: 500 passed, 1 skipped.
  • New tests cover visibility, the served image, the app's relative URL, invalid visibleTo, non-image files, foreign documents, read-only keys, updates and deletes.
  • Not tested on a deployed server: X-Forwarded-Proto is only simulated in a test, so https links behind the Cloudflare tunnel still need a real upload after deploy.
  • Not tested by hand: how the app renders an image block created through the API. The test only checks that the app's endpoint returns it with a relative URL.

No migration, no app change.

🤖 Generated with Claude Code

POST documents/{id}/image-blocks uploads an image with its caption and
visibleTo in one call; PUT image-blocks/{id} changes caption and readers.
imageUrl is now a full link, while the app keeps its relative one.

App and API share IImageUploadService, which also checks the file's first
bytes: before, only the file name and the client's content type were checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3845d967-7174-4028-806f-75554d96a7b3
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@3DExtended
3DExtended merged commit 74ec9a1 into main Nov 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant