]> git.ekhem.eu.org Git - guix.git/commitdiff
[emacs] Pull RSS feed from a RSS server.
authorJakub Czajka <jakub@ekhem.eu.org>
Wed, 18 Dec 2024 18:11:14 +0000 (19:11 +0100)
committerJakub Czajka <jakub@ekhem.eu.org>
Wed, 18 Dec 2024 18:23:17 +0000 (19:23 +0100)
emacs/.config/emacs/conf/conf-rss.el

index 15f88cb02adbb3a7bea7c97cf6846a7a1aabd646..ee440978981f19adabea4424410b2c18acaa3a66 100644 (file)
   :type 'directory
   :group 'conf:configuration)
 
-(defcustom conf:elfeed-opml-file
-  (expand-file-name "~/rss_feed.opml")
-  "OPML file with RSS feeds to follow."
+(defcustom conf:elfeed-protocol-certificate
+  ""
+  "Certificate for connecting to a RSS server."
   :type 'file
   :group 'conf:configuration)
 
+(defcustom conf:elfeed-protocol-key
+  ""
+  "Key for connecting to a RSS server."
+  :type 'file
+  :group 'conf:configuration)
+
+;; elfeed-protocol does not support native Miniflux API. However, Miniflux
+;; implements Fever API which elfeed-protocol does support [1].
+;;
+;; [1] https://github.com/fasheng/elfeed-protocol/issues/39
+(use-package elfeed-protocol
+  :ensure t
+  ;; Load when `elfeed' is first opened because `elfeed-protocol' will ask for
+  ;; credentials.
+  :defer t
+  :config
+  (setq elfeed-curl-extra-arguments
+        (list "-E"
+              conf:elfeed-protocol-certificate
+              "--key"
+              conf:elfeed-protocol-key))
+  (setq elfeed-protocol-fever-update-unread-only t)
+  (setq elfeed-protocol-fever-fetch-category-as-tag t)
+  (setq elfeed-protocol-feeds
+        (list
+         (list (concat "fever+https://"
+                       (password-store-get-field "server/miniflux" "username")
+                       "@rss.dobity.eu.org")
+               :api-url "https://rss.dobity.eu.org/fever/"
+               :password (password-store-get "server/miniflux"))))
+  (setq elfeed-protocol-enabled-protocols '(fever)))
+
 (use-package elfeed
   :requires
   (conf-keys)
   :bind
   ("C-c f" . elfeed)
   (:map elfeed-search-mode-map
-       ("?" . conf:elfeed-transient)
-       ([remap elfeed-search-fetch] . conf:elfeed-load-opml-and-fetch))
+        ("?" . conf:elfeed-transient))
   :custom
   (elfeed-db-directory conf:elfeed-db-directory)
-  (elfeed-search-filter "@1-week-ago +unread ![$]")
+  (elfeed-search-filter "@1-week-ago +unread")
   :config
   (transient-define-prefix conf:elfeed-transient ()
     "Transient keymap with usefeul commands for `elfeed'."
       ("h" "help" describe-mode)
       ("q" "quit" elfeed-search-quit-window)]])
 
-  (defun conf:elfeed-load-opml-and-fetch ()
-    "Insert `conf:elfeed-opml-file' file to `elfeed-feeds' and update feed."
-    (interactive)
-    (when (file-exists-p conf:elfeed-opml-file)
-      (elfeed-load-opml conf:elfeed-opml-file))
-    (call-interactively #'elfeed-search-fetch)))
+  (elfeed-protocol-enable))
 
 (provide 'conf-rss)