eww: Use encrypted bookmarks

master
Pierre Neidhardt 2018-07-13 17:42:22 +02:00
parent 10c228f5db
commit 2df6b2022d
1 changed files with 10 additions and 1 deletions

View File

@ -198,6 +198,15 @@ word(s) will be searched for via `eww-search-prefix'."
(plist-get eww-data :title)))))
(advice-add 'eww-add-bookmark :override 'ambrevar/eww-add-bookmark)
(defun ambrevar/eww-read-bookmarks ()
(let ((file (expand-file-name "eww-bookmarks.gpg" eww-bookmarks-directory)))
(setq eww-bookmarks
(unless (zerop (or (nth 7 (file-attributes file)) 0))
(with-temp-buffer
(insert-file-contents file)
(read (current-buffer)))))))
(advice-add 'eww-read-bookmarks :override 'ambrevar/eww-read-bookmarks)
(defun ambrevar/eww-write-bookmarks ()
(require 'rx)
;; PATCH
@ -207,7 +216,7 @@ word(s) will be searched for via `eww-search-prefix'."
;; Ignore protocol when sorting.
(replace-regexp-in-string "^[a-zA-Z]+://" "" (plist-get a :url))
(replace-regexp-in-string "^[a-zA-Z]+://" "" (plist-get b :url))))))
(with-temp-file (expand-file-name "eww-bookmarks" eww-bookmarks-directory)
(with-temp-file (expand-file-name "eww-bookmarks.gpg" eww-bookmarks-directory)
;; PATCH: Remove newline for tags.
(insert
(replace-regexp-in-string