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

Support scraping supported expiries #20

Merged
merged 6 commits into from
Dec 7, 2024

Conversation

nain-F49FF806
Copy link
Contributor

Greetings. It is with pleasure I bring to you a new PR.

pbcli offers a useful --expire option but the server may not support arbitrary user set expire duration.
If user provides an expiry that is not configured on the host, the host will unilaterally choose it's default expire duration. With no warning.

But how would we (as client users) know the supported expiry values for arbitrary privatebin hosts?

As discussed in PrivateBin/PrivateBin#1434 in lieu of an API, we can scrape the supported expiry(s) of a host directly. Or at-least attempt to, for hosts with close to default Privatebin webui.
This allows one to use the client without having to manually lookup supported expiry durations on the website.

This PR introduces --scrape-expiries flag, which will do just that: Attempt to scrape expiries supported by a privatebin host, and present them to user.

Users can use this information to confidently enter --expiry duration on the command line.
And similarly for other clients using this library.

Copy link
Owner

@Mydayyy Mydayyy left a comment

Choose a reason for hiding this comment

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

Greetings,

I hope you have been well. Thank you for this contribution. I annotated one minor thing, apart from that it looks good to me.

I hope in the future, privatebin might make this available as a json api, which would simplify things for us.

Best Regards
Mydayyy

src/api.rs Outdated Show resolved Hide resolved
@Mydayyy Mydayyy merged commit c1da0c8 into Mydayyy:master Dec 7, 2024
1 check 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.

2 participants