Summary Files Commits Branches @commit @diff @stats
path: root / badwolf.c
diff options
context:
space:
mode:
Commit6f5101265679f0753168da9487520b6479fa6fd1 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-07-17 19:39:23 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-07-17 19:39:23 +0300
Files938bb5d3607cecb3358894207ad39aae1e972608 /badwolf.c
goodwolf-6f5101265679f0753168da9487520b6479fa6fd1.tar
goodwolf-6f5101265679f0753168da9487520b6479fa6fd1.tar.gz
goodwolf-6f5101265679f0753168da9487520b6479fa6fd1.zip
Parent7981d89f239ff0731582d1911a8a6901129948fe (diff)
badwolf: Added the switch -g which allows separated permanent storage between tabs
1 files changed, 12 insertions, 1 deletions
-rw-r--r--badwolf.c13
diff --git a/badwolf.c b/badwolf.c
index 5309a73..02e9dcf 100644
--- a/badwolf.c
+++ b/badwolf.c
@@ -32,6 +32,7 @@ static gboolean tray_enabled = false;
static gboolean alt_useragent = false;
static int custom_favicon_size = 30;
static gboolean persistent_storage = false;
+static gboolean separated_storage = false;
static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data);
static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView,
@@ -750,9 +751,17 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b
webkit_web_context_set_web_extensions_directory(web_context, web_extensions_directory);
webkit_web_context_set_favicon_database_directory(web_context, NULL);
if (persistent_storage) {
+ char context_id_str[BADWOLF_CTX_SIZ] = {0, 0, 0, 0, 0, 0, 0};
+ if (separated_storage) {
+ fmt_context_id(browser->context_id, context_id_str);
+ g_mkdir_with_parents(
+ g_build_filename(g_get_user_config_dir(), "badwolf", context_id_str, NULL),
+ 0755);
+ }
+
webkit_cookie_manager_set_persistent_storage(
webkit_website_data_manager_get_cookie_manager(website_data_manager),
- g_build_filename(g_get_user_config_dir(), "badwolf", "cookies.txt", NULL),
+ g_build_filename(g_get_user_config_dir(), "badwolf", context_id_str, "cookies.txt", NULL),
WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
webkit_cookie_manager_set_accept_policy(
webkit_website_data_manager_get_cookie_manager(website_data_manager),
@@ -1246,6 +1255,8 @@ main(int argc, char *argv[])
alt_useragent = TRUE;
else if (argv[1][1] == 'p')
persistent_storage = TRUE;
+ else if (argv[1][1] == 'g')
+ separated_storage = TRUE;
else if (argv[1][1] == 's') {
argv++;
argc--;