mydayyy / pbcli Goto Github PK
View Code? Open in Web Editor NEWpbcli is a command line client which allows to upload and download pastes from privatebin directly from the command line.
License: MIT License
pbcli is a command line client which allows to upload and download pastes from privatebin directly from the command line.
License: MIT License
Hello,
while testing I found that pbcli did not work with a PrivateBin instance like https://example.org/localpath/
, that means with a local path added to the URL.
I investigated this further and found a workaround for this problem with the following change:
$ git diff
diff --git a/src/api.rs b/src/api.rs
index a48408a..b8d530c 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -17,7 +17,7 @@ impl API {
pub fn new(mut url: Url, opts: Opts) -> Self {
url.set_fragment(None);
url.set_query(None);
- url.set_path("");
+// url.set_path("");
Self { base: url, opts }
}
@@ -118,4 +118,4 @@ impl API {
s => Err(PasteError::UnknownPasteStatus(s)),
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main.rs b/src/main.rs
index b5a78f9..a63a7bd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -110,7 +110,7 @@ fn handle_post(opts: &Opts) -> PbResult<()> {
std::io::stdout().write_all(serde_json::to_string(&res)?.as_bytes())?;
} else {
let mut url = opts.get_url().clone();
- url.set_path("");
+// url.set_path("");
url.set_query(Some(&res.id));
url.set_fragment(Some(&res.bs58key));
std::io::stdout().write_all(url.to_string().as_bytes())?;
This works with URLs like https://example.org/localpath/
but fails with https://example.org/localpath
(i.e. without the slash at the end). So you probably want to find a more resilient solution.
Privatebin project has a wiki page listing third party clients.
Perhaps this project should also be on there?
Hi,
Would it be possible to have some sanity checks?
Specifically regarding file size, if a user is suffering from log bloat due to an issue on their system or tries to upload a file over a certain size could the user be prompted by pbcli with a message saying "hey you are about to upload a file of X size, please note this may be rejected by the host and/or take a long time to upload are you sure you want to continue? Y/N"
Perhaps have a default allowed file size and include a file size limit flag that could be set in custom configs should pbcli be packaged by a distro?
Love the tool BTW, really appreciate the work.
Privatebin.info [link] has ability to forward to random healthy privatebin instances.
One can try this by going to the following url: https://privatebin.info/directory/forward-me
It seems they are responding with a 303 (See Other) HTTP status response along with the url of a randomly selected instance.
The details can be found here: https://privatebin.info/directory/about#faq-forward
The idea:
pbcli could have a --random-host
flag. When set by user, the CLI application should make a request to above url, fetch the privatebin host provided in the response. And then set that as the active instance for the current invocation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.