save cookies between sessions

phoen
Daniel Barlow 2022-02-06 15:05:00 +00:00
parent 92265c3d4b
commit 68af0b779f
2 changed files with 20 additions and 9 deletions

View File

@ -9,5 +9,4 @@ Touchscreen-friendly wrapper around Webkit
- find out if it's going to eat cpu like luakit does
- some kind of bookmarks/favourites/pinned tabs/memory of visited sites
- ESC in url bar cancels typing
- support cookies (may need to save them across sessions?)
- warning for insecure sites

View File

@ -4,11 +4,20 @@
(local Gtk lgi.Gtk)
(local WebKit2 lgi.WebKit2)
(local cache-dir (.. (os.getenv "HOME") "/.cache"))
(local cache-dir (.. (os.getenv "HOME") "/.cache/just"))
(local content-filter-store
(WebKit2.UserContentFilterStore {:path cache-dir}))
(-> (WebKit2.WebContext:get_default)
(: :get_website_data_manager)
(: :get_cookie_manager)
(: :set_persistent_storage
(.. cache-dir "/cookies.db")
WebKit2.CookiePersistentStorage.SQLITE))
(fn event-bus []
(let [subscriptions {}
vivify (fn [n v]
@ -88,7 +97,7 @@ progress, trough {
(bus:publish (if self.is_loading :start-loading :stop-loading))
))
(let [current-url "https://terse.telent.net/admin/stream"
(let [current-url "https://terse.telent.net"
bus (event-bus)
window (Gtk.Window {
:title "Just browsing"
@ -107,12 +116,10 @@ progress, trough {
:fraction 1.0
:margin 0
})
url (doto (Gtk.Entry {
:on_activate
(fn [self]
(bus:publish :fetch self.text))
})
(: :set_text current-url))
url (Gtk.Entry {
:on_activate
(fn [self] (bus:publish :fetch self.text))
})
stop (doto (Gtk.Button {
:on_clicked #(bus:publish :stop-loading)
})
@ -165,4 +172,9 @@ progress, trough {
(window:show_all))
(: (WebKit2.WebContext:get_default) :get_website_data_manager)
(Gtk.main)