From 2696b65e7bbb7597aef03ed512a81479f4097ea1 Mon Sep 17 00:00:00 2001 From: Ethan Moss Date: Sun, 5 Jan 2025 17:55:20 +0000 Subject: [PATCH 1/5] FIX: Remove unnecessary dependency Curl is not an emacs package, this is removed. --- ntfy.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfy.el b/ntfy.el index ec36fc3..9006afa 100644 --- a/ntfy.el +++ b/ntfy.el @@ -7,21 +7,21 @@ ;; Modified: 2022-05-04 ;; Version: 0.1.2 ;; Keywords: ntfy notification push-notification pub-sub -;; Package-Requires: ((emacs "27.2") (curl)) +;; Package-Requires: ((emacs "27.2")) ;; SPDX-License-Identifier: MIT ;; This file is not part of GNU Emacs. ;;; Commentary: ;; Interface to use the https://ntfy.sh service (or self-hosted version) to send notification from Emacs. -;; +;; ;;; Code: (defcustom ntfy-server nil "Set server for ntfy service." :group 'ntfy :type 'string) - + (defcustom ntfy-topic nil "Set ntfy topic/channel." :group 'ntfy From 5e43c07cfa04605f33cfe7cf38ad546392553fb3 Mon Sep 17 00:00:00 2001 From: Ethan Moss Date: Sun, 5 Jan 2025 19:33:53 +0000 Subject: [PATCH 2/5] FIX: Added URL as dependency --- ntfy.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfy.el b/ntfy.el index 9006afa..ad12cd8 100644 --- a/ntfy.el +++ b/ntfy.el @@ -7,7 +7,7 @@ ;; Modified: 2022-05-04 ;; Version: 0.1.2 ;; Keywords: ntfy notification push-notification pub-sub -;; Package-Requires: ((emacs "27.2")) +;; Package-Requires: ((emacs "27.2") (url "22.1")) ;; SPDX-License-Identifier: MIT ;; This file is not part of GNU Emacs. From 7f88bdd27f9d4010871c2418dec147933b30d9da Mon Sep 17 00:00:00 2001 From: Ethan Moss Date: Sun, 5 Jan 2025 19:36:46 +0000 Subject: [PATCH 3/5] FIX: need URL required --- ntfy.el | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfy.el b/ntfy.el index ad12cd8..b519e4a 100644 --- a/ntfy.el +++ b/ntfy.el @@ -16,6 +16,7 @@ ;; Interface to use the https://ntfy.sh service (or self-hosted version) to send notification from Emacs. ;; ;;; Code: +(require 'url) (defcustom ntfy-server nil "Set server for ntfy service." From 0205d7dbd31e0295dea22bf85000a8fa1cf939aa Mon Sep 17 00:00:00 2001 From: Ethan Moss Date: Sun, 5 Jan 2025 19:38:55 +0000 Subject: [PATCH 4/5] FIX: moved from Curl process -> Emacs URL Lib --- ntfy.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ntfy.el b/ntfy.el index b519e4a..d6f4093 100644 --- a/ntfy.el +++ b/ntfy.el @@ -57,13 +57,13 @@ Custom HEADER and TAGS are set for the notification." (ntfy--publish-message message header tags)) (defun ntfy--publish-message (message &optional header tags) - "Publish message to server with curl with MESSAGE. + "Publish message to server with Emacs Lib URL with MESSAGE. Configured HEADER and TAGS are used unless specified." - (start-process "nfty.el" nil "curl" - "-H" (format "Title: %s" (or header ntfy-header)) - "-H" (format "Tags: %s" (or tags ntfy-tags)) - "-d" (format "%s" message) - (format "%s/%s" ntfy-server ntfy-topic))) + (let ((url-request-method "POST") + (url-request-data message) + (url-request-extra-headers `(("Title" . ,(or header ntfy-header)) + ("Tags" . ,(or tags ntfy-tags))))) + (url-retrieve-synchronously (format "%s/%s" ntfy-server ntfy-topic)))) (defun ntfy-send-url (url) "Send URL from mini-buffer." @@ -71,13 +71,13 @@ Configured HEADER and TAGS are used unless specified." (ntfy--publish-url url)) (defun ntfy--publish-url (url) -"Publish URL to server with curl." -(start-process "nfty.el" nil "curl" - "-H" (format "Title: %s" "Emacs shared a URL") - "-H" (format "Tags: %s" "link") - "-H" (format "Actions: view, %s, %s" url url) - "-d" (format "%s" url) - (format "%s/%s" ntfy-server ntfy-topic))) + "Publish URL to server with Emacs Lib URL." + (let ((url-request-method "POST") + (url-request-data (concat "Click to follow the shared URL;\n" url)) + (url-request-extra-headers `(("Title" . "Emacs shared a URL") + ("Tags" . "link") + ("Actions" . ,(format "view, View Link, %s" url url))))) + (url-retrieve-synchronously (format "%s/%s" ntfy-server ntfy-topic)))) (provide 'ntfy) ;;; ntfy.el ends here From 9abe595b725681b3ad2e72de018e22bc74b0775c Mon Sep 17 00:00:00 2001 From: Ethan Moss Date: Sun, 5 Jan 2025 19:40:17 +0000 Subject: [PATCH 5/5] VERSION BUMP --- ntfy.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfy.el b/ntfy.el index d6f4093..b0c7f9b 100644 --- a/ntfy.el +++ b/ntfy.el @@ -4,8 +4,8 @@ ;; Author: Shom Bandopadhaya ;; Created: 2022-04-30 -;; Modified: 2022-05-04 -;; Version: 0.1.2 +;; Modified: 2025-01-05 +;; Version: 0.2.0 ;; Keywords: ntfy notification push-notification pub-sub ;; Package-Requires: ((emacs "27.2") (url "22.1")) ;; SPDX-License-Identifier: MIT