summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Vinson <nvinson234@gmail.com>2020-10-24 09:40:16 -0400
committerRasmus Thomsen <oss@cogitri.dev>2021-02-19 09:31:23 +0100
commitf9b08c50009485817e8b44300f79a92e37fe9f22 (patch)
tree335858c36ce7e4b449fa909b2a4a0b48e4a01672
parent3f9e38c7d75be638e71c9391de21ae064028f545 (diff)
downloadwgetpaste-f9b08c50009485817e8b44300f79a92e37fe9f22.tar.gz
Add srpunge paste bin
Service owner states in https://github.com/rupa/sprunge/issues/46 that the size limit for both ix.io and sprunge.us is "roughly a meg". As "meg" appears to mean 1 MiB, the size is set at 1 million bytes (1 MB).
-rwxr-xr-xwgetpaste20
1 files changed, 19 insertions, 1 deletions
diff --git a/wgetpaste b/wgetpaste
index 96b1cb1..0f8219b 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -41,7 +41,7 @@ POST_generic() {
}
### services
-SERVICES="0x0 bpaste codepad dpaste gists ix_io snippets"
+SERVICES="0x0 bpaste codepad dpaste gists ix_io snippets sprunge"
# 0x0
ENGINE_0x0=0x0
URL_0x0="http://0x0.st"
@@ -72,6 +72,10 @@ SIZE_ix_io="1000000 1%MB"
ENGINE_snippets=snippets
URL_snippets="https://gitlab.com/api/v4/snippets"
ADDITIONAL_HEADERS_snippets=("Content-Type: application/json")
+# sprunge
+ENGINE_sprunge=sprunge
+URL_sprunge="http://sprunge.us"
+SIZE_sprunge="1000000 1%MB"
# tinyurl
ENGINE_tinyurl=tinyurl
URL_tinyurl="http://tinyurl.com/ api-create.php"
@@ -292,6 +296,20 @@ POST_snippets() {
local description="${2}" content="${6}"
echo "{\"title\": \"${description}\", \"content\": \"${content}\", \"description\": \"${description}\", \"file_name\": \"${description}\", \"visibility\": \"${VISIBILITY_snippets}\" }"
}
+# sprunge
+escape_description_sprunge() { echo "$*"; }
+escape_input_sprunge() { echo "$*"; }
+POST_sprunge() {
+ local content="${6}" boundary="WGETPASTE-1sQZYb7qiSkT18ZwWPNg18gEmHRztv"
+ echo "--$boundary"
+ echo "Content-Disposition: form-data; name=\"sprunge\""
+ echo ""
+ echo "${content}"
+ echo "--${boundary}--"
+ ADDITIONAL_HEADERS_sprunge=("Content-Type: multipart/form-data; boundary=${boundary}")
+}
+REGEX_RAW_sprunge='s|^http.*|\0|'
+REGEX_URL_sprunge='s|^http.*|\0|p'
### errors
die() {