Created
May 6, 2026 04:40
-
-
Save MasWag/44d3e814176926bd331cc3068f74d504 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (leaf simple-httpd | |
| :ensure t | |
| :require t | |
| :config | |
| (setq httpd-host "0.0.0.0")) | |
| (leaf elfeed-web | |
| :vc (:url "https://github.com/MasWag/elfeed" | |
| :lisp-dir "web/") | |
| :after elfeed simple-httpd | |
| ;; :ensure t | |
| :config | |
| (defservlet* elfeed/content/:ref text/html () | |
| "Serve content-addressable content at REF." | |
| (with-elfeed-web | |
| (let ((content (elfeed-deref (elfeed-ref--create :id ref)))) | |
| (if content | |
| (princ (concat "<html><head><meta charset=\"utf-8\"></head><body>" content "</body></html>")) | |
| (princ (json-encode '(:error 404))) | |
| (httpd-send-header t "application/json" 404))))) | |
| (defservlet* elfeed/sync-pull application/json () | |
| "Pull from remote." | |
| (with-elfeed-web | |
| (elfeed-sync-pull) | |
| (shell-command-to-string "mkdir -p ~/.elfeed/data/ && rsync -av backup:.elfeed/data/ ~/.elfeed/data/"))) | |
| (defservlet* elfeed/sync-push application/json () | |
| "Push from remote." | |
| (with-elfeed-web | |
| (elfeed-sync-push))) | |
| (defservlet* elfeed/feed-update application/json () | |
| "Update all the feeds in `elfeed-feeds'." | |
| (with-elfeed-web | |
| (elfeed-update))) | |
| (defservlet* elfeed/mark-read/:webid application/json () | |
| "Marks the given entry in the database as read." | |
| (with-elfeed-web | |
| (with-elfeed-db-visit (entry _) | |
| (when (string= webid (elfeed-web-make-webid entry)) | |
| (elfeed-untag entry 'unread))) | |
| (princ (json-encode t)))) | |
| (defservlet* elfeed/mark-unread/:webid application/json () | |
| "Marks the given entry in the database as unread." | |
| (with-elfeed-web | |
| (with-elfeed-db-visit (entry _) | |
| (when (string= webid (elfeed-web-make-webid entry)) | |
| (elfeed-tag entry 'unread))) | |
| (princ (json-encode t)))) | |
| (defservlet* elfeed/mark-flagged/:webid application/json () | |
| "Marks the given entry in the database as flagged." | |
| (with-elfeed-web | |
| (with-elfeed-db-visit (entry _) | |
| (when (string= webid (elfeed-web-make-webid entry)) | |
| (elfeed-tag entry 'flagged))) | |
| (princ (json-encode t)))) | |
| (defservlet* elfeed/mark-unflagged/:webid application/json () | |
| "Marks the given entry in the database as unread." | |
| (with-elfeed-web | |
| (with-elfeed-db-visit (entry _) | |
| (when (string= webid (elfeed-web-make-webid entry)) | |
| (elfeed-untag entry 'flagged))) | |
| (princ (json-encode t)))) | |
| (elfeed-web-start)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment