lgommans / dro.pm

Drop links, text and files for easy sharing
GNU General Public License v3.0
23 stars 5 forks source link

Let deleted link live for 12 hours #7

Closed MagicLegend closed 9 months ago

MagicLegend commented 3 years ago

Hi!

To prevent others from stumbling upon my content, I use the 'delete' option a lot. However, I believe this immediately frees the url for others to use, which could lead to someone being redirected somewhere I didn't intend. Perhaps it would be possible to occupy the url for an x amount of hours; before releasing it for re-use.

What do you think?

lgommans commented 3 years ago

That's actually how it already works :)

  1. Open https://dro.pm
  2. Type some garbage so it shows the link (the link is actually already allocated, or at least it tries to, before you do anything to make it work faster)
  3. If you open the link, of course you see what you typed
  4. Now delete the link and try to open it again. It will say the link is empty. But it's still yours, because:
  5. Type something again: you'll get the same link (or rather, it was never deallocated) and it will work again

The delete button is the same, under the hood, as emptying out the text field. Or if you uploaded a file, as typing something in the text field and then deleting the text.

Perhaps the phrasing could be better, like "Clear" instead of "Delete". I think delete is more obvious to people, though, so I'm not sure what the best solution is. Maybe after clicking delete it could show a message that the link was cleared but can be reused if people want to.

The timeout is not super long, by the way, if I remember correctly it's only 1.5 hours. Similar to what happens when you open dro.pm but you don't add any data (don't type/paste text, don't upload a file): it will allocate a link as soon as you open the page, but also deallocate that link again (server-side) after a while.

A grace period to keep a link reserved before it can be reassigned is not a bad idea, though a bit of a separate topic since this would also apply to regular links (those that aren't deleted/cleared).

lgommans commented 9 months ago

I use the 'delete' option a lot. However, I believe this immediately frees the url for others to use

So to confirm: this is not the case, but I was wrong (in my previous reply) about it probably being 1.5 hours, it's 10 minutes instead (code reference).

Please let me know your thoughts on this, otherwise I will assume it works in a way that everyone likes and close the ticket

MagicLegend commented 9 months ago

Hey! Gotcha, I think this is fine. A longer delay could prevent possible misredirects, but I don't think it's that big of an issue. I actually can't remember the last time I'd have had this issue. Thanks :)