Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add maximum expiry #62

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Add maximum expiry #62

merged 2 commits into from
Jul 10, 2024

Conversation

HeapUnderfl0w
Copy link
Contributor

@HeapUnderfl0w HeapUnderfl0w commented Jul 6, 2024

This aims to implement #54, and also be an improvement over #55.

Changes Made:

  • Add WASTEBIN_MAX_PASTE_EXPIRY WASTEBIN_MAX_PASTE_EXPIRATION
  • Ensure both the form and json routes honor the set limit (if any) (currently not done by add maximum expiration logic #55)
    • Currently it simply clamps the expiry time
    • Invalid values or too large values will cause an error
  • Remove invalid options from the new-paste UI
    • Correctly hide never expire if any limit is set
    • Always show burn, even if the limit is 0
    • Default select the "top" most expiry (either "never", or 10 minutes)

Copy link
Owner

@matze matze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, looks good, just some questions.

README.md Outdated Show resolved Hide resolved
src/env.rs Outdated Show resolved Hide resolved
src/pages.rs Outdated Show resolved Hide resolved
src/pages.rs Outdated Show resolved Hide resolved
@bt-nia
Copy link

bt-nia commented Jul 8, 2024

thanks @HeapUnderfl0w ! 🎉 This certainly looks more sophisticated than what I did.
Hopefully this one sees more traction in terms of approval :)

@matze
Copy link
Owner

matze commented Jul 8, 2024

Hopefully this one sees more traction in terms of approval :)

Don't worry, I wasn't outright rejecting your proposal. A few more iterations and it would've landed. But yes, let's go with this one here.

@HeapUnderfl0w HeapUnderfl0w force-pushed the max-paste-expiry branch 2 times, most recently from d00b84b to bea0dc2 Compare July 9, 2024 13:32
@HeapUnderfl0w
Copy link
Contributor Author

This should be all of the concerns addressed.

@HeapUnderfl0w
Copy link
Contributor Author

@matze currently the json endpoints silently clamp the expiration value to the maximum.

Would you want to error out of here too? (some kind of http error)
Id personally would want to leave them as-is, as they are more advanced APIs anyway.

Copy link
Owner

@matze matze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the tiny end user clarification, rest looks good.

README.md Outdated Show resolved Hide resolved
@matze
Copy link
Owner

matze commented Jul 9, 2024

Id personally would want to leave them as-is, as they are more advanced APIs anyway.

Yes, keep as is for now.

expiry -> expiration
hard fail on invalid expiration values
@matze matze merged commit 000d30f into matze:master Jul 10, 2024
1 check passed
@HeapUnderfl0w HeapUnderfl0w deleted the max-paste-expiry branch July 10, 2024 17:42
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.

3 participants