summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Vinson <nvinson234@gmail.com>2020-10-23 07:25:43 -0400
committerRasmus Thomsen <oss@cogitri.dev>2021-02-19 09:31:23 +0100
commita933682a5b9b71be0c6b9a6a5f9b0c39b0f69431 (patch)
tree6d1ae40cd7ab1bb7c375046be12d15ef04c8fe51
parentb4dbc737c83541ef8a0e2f2b20b12da15e0f1394 (diff)
downloadwgetpaste-a933682a5b9b71be0c6b9a6a5f9b0c39b0f69431.tar.gz
Use new dpaste API
Updates the code to use the new dpaste API and corrects the max dpaste size limit value.
-rwxr-xr-xwgetpaste36
1 files changed, 29 insertions, 7 deletions
diff --git a/wgetpaste b/wgetpaste
index bb7bd68..b01a14e 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -53,10 +53,10 @@ URL_codepad="http://codepad.org/"
SIZE_codepad="64000 64%KB"
# dpaste
ENGINE_dpaste=dpaste
-URL_dpaste="http://dpaste.com/"
-SIZE_dpaste="25000 25%kB"
+URL_dpaste="http://dpaste.com/api/v2/"
+SIZE_dpaste="250000 250%kB"
DESCRIPTION_SIZE_dpaste="50"
-DEFAULT_EXPIRATION_dpaste="30 days"
+DEFAULT_EXPIRATION_dpaste="1"
# gists
ENGINE_gists=gists
URL_gists="https://api.github.com/gists"
@@ -86,13 +86,35 @@ LANGUAGES_dpaste="Plain%Text Apache%Config Bash CSS Diff Django%Template/HTML Ha
Python Python%Interactive/Traceback Ruby Ruby%HTML%(ERB) SQL XML"
LANGUAGE_VALUES_dpaste="% Apache Bash Css Diff DjangoTemplate Haskell JScript Python PythonConsole \
Ruby Rhtml Sql Xml"
-EXPIRATIONS_dpaste="30%days 30%days%after%last%view"
-EXPIRATION_VALUES_dpaste="off on"
+EXPIRATIONS_dpaste=$(printf "%s " {1..365})
POST_dpaste() {
- POST_generic "submit=Paste+it poster title language hold % content" "$1" "$2" "$3" "$4" "$5" "$6"
+ local title="${2}"
+ local syntax="${3}"
+ local expiry_days="${4}"
+ local content="${6}"
+ local boundary="WGETPASTE-cK7MKXxfDNm87mXJzyX0kpKaCkiaQC"
+ echo -e "--$boundary\r"
+ echo -e "Content-Disposition: form-data; name=\"title\"\r"
+ echo -e "\r"
+ echo -e "${title}\r"
+ echo -e "--$boundary\r"
+ echo -e "Content-Disposition: form-data; name=\"syntax\"\r"
+ echo -e "\r"
+ echo -e "${syntax}\r"
+ echo -e "--$boundary\r"
+ echo -e "Content-Disposition: form-data; name=\"expiry_days\"\r"
+ echo -e "\r"
+ echo -e "${expiry_days}\r"
+ echo -e "--$boundary\r"
+ echo -e "Content-Disposition: form-data; name=\"content\"\r"
+ echo -e "\r"
+ echo -e "${content}\r"
+ echo -e "--${boundary}--\r"
+ ADDITIONAL_HEADERS_dpaste=("Content-Type: multipart/form-data; boundary=${boundary}")
}
+REGEX_RAW_dpaste='s|^http.*|\0.txt|'
+REGEX_URL_dpaste='s|^http.*|\0|p'
-REGEX_RAW_dpaste='s|^\(http://[^/]*/\)\([[:alnum:]]*\)$|\1\2.txt|'
# gists
LANGUAGES_gists="ActionScript Ada Apex AppleScript Arc Arduino ASP Assembly
Augeas AutoHotkey Batchfile Befunge BlitzMax Boo Brainfuck Bro C C# C++