BUD-12: Identical Media Deduplication#96
Open
v0l wants to merge 2 commits into
Open
Conversation
Contributor
Author
v0l
added a commit
to v0l/route96
that referenced
this pull request
Mar 13, 2026
Adds perceptual hash (pHash) based deduplication for image uploads per the BUD-12 spec (hzrd149/blossom#96). Backend: - Compute pHash synchronously inside fs.put for every image upload; store the result on NewFileResult and propagate to FileUpload - Insert the phash row inside the add_file transaction alongside the uploads row, satisfying the FK constraint on upload_phash - On PUT /upload and PUT /media, query find_similar_images using the already-computed hash; return 409 Conflict with X-Identical-Media and X-Reason headers when a match is found within the configured Hamming distance - New settings: identical_media_dedup (bool) and identical_media_dedup_distance (u32, default 0) Frontend: - IdenticalMediaError class in blossom.ts captures the existing sha256 from X-Identical-Media on 409 responses - Upload view shows a side-by-side comparison panel of the user's upload vs the existing server blob at full size (max-h-96) - Mirror button calls PUT /mirror to register the existing blob to the user's account, then dismisses the panel - Config editor: bool toggle for identical_media_dedup and integer field for identical_media_dedup_distance with min/max bounds
Contributor
Author
|
Added a mechanism for clients to acknowledge a deduplication response and request uploading a distinct copy anyway. When a server returns Servers MAY honour this and proceed with the upload, or MAY continue to reject it — it is entirely up to server policy. This keeps deduplication enforcement server-side while giving clients a standard way to express intent. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
409 Conflictand anX-Identical-Media: <sha256>header pointing to the existing equivalent blob409upload failure