[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste 1600425 291/298: Merge branch 'dsedivec-master'
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste 1600425 291/298: Merge branch 'dsedivec-master' |
Date: |
Thu, 9 Dec 2021 19:00:32 -0500 (EST) |
branch: elpa/webpaste
commit 16004250b0b4e651000bf6eb1daee68a53bed5a0
Merge: a9c4aa4 533bb40
Author: Elis Hirwing <elis@hirwing.se>
Commit: Elis Hirwing <elis@hirwing.se>
Merge branch 'dsedivec-master'
---
README.org | 1 +
tests/integration/test-webpaste-providers.el | 13 +++++++++++-
webpaste.el | 30 +++++++++++++++++++++++++++-
3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index 7414417..d0a10f8 100644
--- a/README.org
+++ b/README.org
@@ -198,6 +198,7 @@ webpaste first and then just read the documentation by
running this:
- [X] gist.github.com
- [X] paste.pound-python.org
- [X] paste.mozilla.org
+ - [X] bpa.st
- [ ] paste.debian.net
- [ ] bpaste.net
- [ ] eval.in
diff --git a/tests/integration/test-webpaste-providers.el
b/tests/integration/test-webpaste-providers.el
index 5103582..4ee6814 100644
--- a/tests/integration/test-webpaste-providers.el
+++ b/tests/integration/test-webpaste-providers.el
@@ -80,7 +80,18 @@
(funcall (webpaste--get-provider-by-name "paste.pound-python.org")
paste-message :sync t)
(expect (spy-calls-count 'webpaste--return-url) :to-equal 1)
- (expect (spy-calls-count 'webpaste--paste-text) :to-equal 0)))
+ (expect (spy-calls-count 'webpaste--paste-text) :to-equal 0))
+
+
+ (it
+ "can paste with bpa.st [ci]"
+
+ (spy-on 'file-name-nondirectory :and-return-value "file.txt")
+
+ (funcall (webpaste--get-provider-by-name "bpa.st") paste-message :sync t)
+
+ (expect (spy-calls-count 'webpaste--return-url) :to-equal 1)
+ (expect (spy-calls-count 'webpaste--paste-text) :to-equal 0)))
;;; test-webpaste-providers.el ends here
diff --git a/webpaste.el b/webpaste.el
index da89aa0..fb2e404 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -155,7 +155,14 @@ This uses `browse-url-generic' to open URLs."
:post-field "code"
:post-lang-field-name "language"
:lang-overrides ((emacs-lisp-mode . "clojure"))
- :success-lambda webpaste--providers-success-response-url))
+ :success-lambda webpaste--providers-success-response-url)
+
+ ("bpa.st"
+ :uri "https://bpa.st/api/v1/paste"
+ :post-data (("expiry" . "1day"))
+ :post-field-lambda webpaste--providers-pinnwand-request
+ :lang-overrides ((emacs-lisp-mode . "emacs"))
+ :success-lambda webpaste--providers-pinnwand-success))
"Define all webpaste.el providers.
Consists of provider name and arguments to be sent to `webpaste--provider' when
@@ -300,6 +307,27 @@ This is the default failover hook that we use for most
providers."
;; Otherwise we return the formatted post data
post-data))))
+(cl-defun webpaste--providers-pinnwand-request ()
+ "Build request for pinnwand pastebins."
+ (cl-function (lambda (&key text post-data provider-uri &allow-other-keys)
+ "Build request for pinnwand pastebins."
+ (let* ((lexer (or (webpaste--get-buffer-language
provider-uri) "text"))
+ (file `(("lexer" . ,lexer) ("content" . ,text)))
+ (file-name (buffer-file-name)))
+ (when file-name
+ (push (cons "name"
+ (file-name-nondirectory file-name))
+ file))
+ (json-encode `((expiry . ,(or (cdr (assoc "expiry"
post-data)) "1day"))
+ (files . ,(vector file))))))))
+
+
+(cl-defun webpaste--providers-pinnwand-success ()
+ "Parse JSON response from pinnwand pastebins in DATA."
+ (cl-function (lambda (&key data &allow-other-keys)
+ (webpaste--return-url (cdr (assq 'link (json-read-from-string
data)))))))
+
+
(cl-defun webpaste--get-lang-alist-with-overrides (overrides)
- [nongnu] elpa/webpaste 7c3bc88 215/298: Remove unused local variable, (continued)
- [nongnu] elpa/webpaste 7c3bc88 215/298: Remove unused local variable, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9972cf4 224/298: Fix some checkdock warnings, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b1cdedb 213/298: Simplify travis file, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste bd38635 253/298: [readme] Add two new suggestions for providers, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 01c2858 261/298: Fix typos, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste e7fed98 246/298: Reindent entire webpaste.el to match updated indentation style, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9d3c866 233/298: WP-25: Implement support for raw pastes, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste ef33b0f 269/298: Fix provider definition issue and add test for paste.mozilla.org, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b713d5e 259/298: travis: Drop tests for versions where cask seems to be incompatible, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 2decf1e 276/298: Revert "Fix bug in webpaste-paste-buffer-or-region when you don't have a region", ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 1600425 291/298: Merge branch 'dsedivec-master',
ELPA Syncer <=
- [nongnu] elpa/webpaste bbdc5e5 296/298: providers: Drop paste.pound-python.org, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 49a7123 236/298: Add missing TOC link about raw pastes, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste e0a35fd 232/298: WP-25: Add test for raw pastes, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 5505685 226/298: Drop simpleclip support, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7397cbc 220/298: Fix duplicate elements added to alists, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 69a8eed 240/298: Merge branch 'kaushalmodi-add-toml-lang-to-ptpbpw-default', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 01a65a0 262/298: Merge branch 'DamienCassou-typos', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste ed33094 266/298: Support mozilla hosted pastebin service, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste badf3b5 257/298: nix-shell: Improve the shell so all tests just runs, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 933c62f 245/298: CONTRIBUTING: Add some more clarifications, ELPA Syncer, 2021/12/09