Add a Blossom option to delete blobs when their events are deleted#35
Add a Blossom option to delete blobs when their events are deleted#35dtonon wants to merge 2 commits into
Conversation
| } | ||
|
|
||
| // match blob urls that point to this server: <domain>/<sha256> | ||
| re := regexp.MustCompile(regexp.QuoteMeta(domain) + `/([0-9a-f]{64})`) |
There was a problem hiding this comment.
it should match every URL, not only those pointed to this server, because blossom objects are naturally hosted in multiple places and the primary URL in the event may not be this server.
There was a problem hiding this comment.
But I can't delete other people's files on a server that doesn't belong to me, right?
There was a problem hiding this comment.
What I mean is:
- Bob uses two blossom servers, M and N. He uploads blob Z to both.
- Then Bob's client creates the URL in the post pointing to
N/z, he publishes the post to his relays, M and O (M is this pyramid instance that acts as both a blossom server and a relay). - Now Bob deletes his note from M (the relay).
- While cleaning up blobs related to Bob's note that has just been deleted, we need M to find blob Z even though the URL in the note is
N/z.
|
I thought about doing this, but the problem is that the same blob may be referenced by multiple events, even from the same author, so it becomes a much harder problem. |
|
I think it makes more sense probably to add a "garbage collect" button that scans all events from an author for blobs, then delete those blobs that aren't referenced by any. On the other hand, this breaks everything if people are storing things that are only referenced elsewhere. Turns out blossom is a bit of a big mess. |
Damn I hadn't thought of that. It seems like an extreme case, but when you think about it, it's not really that extreme, also because if the same user uploads the same file again, they might expect it to be saved as a duplicate, and so be immune to the deletion of another post. |
|
A check has been added to prevent a blob from being deleted if it is referenced by other events. |
|
I guess this fixes it, but it feels too inefficient to run through all the events of this person just to check if any references a blob. Specially because some clients will flood relays with deletions, that might have blobs in them, notably replaceable events (which act like deletions). But maybe it will be ok. I'll think about it a little more. |
|
An option is to limit the linked deletion to admins. This is actually the use case I started from (remove entirely spam and sensitive content). |
Another feature from my dev fork of Pyramid to experiment with Squalk.
The idea is to introduce an automatism to keep the blossom storage as clean as possible, and to let an admin to moderate efficiently a message without leaving media around.