From 6e66dca749831fdf8497442208cdcc6ff9518cf3 Mon Sep 17 00:00:00 2001 From: keis Date: Fri, 3 Dec 2010 02:01:52 +0100 Subject: bring it all together add script that loads all cookies from a file by calling add_cookie disable cookie_handler in config call load_cookies.sh from config don't start cookie daemon in uzbl-browser --- examples/config/config | 3 ++- examples/data/scripts/load_cookies.sh | 22 ++++++++++++++++++++++ src/uzbl-browser | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100755 examples/data/scripts/load_cookies.sh diff --git a/examples/config/config b/examples/config/config index c5a0e86..213bb88 100644 --- a/examples/config/config +++ b/examples/config/config @@ -42,7 +42,7 @@ set scripts_dir = @data_home/uzbl:@prefix/share/uzbl/examples/data:scripts # These handlers can't be moved to the new event system yet as we don't # support events that can wait for a response from a script. -set cookie_handler = talk_to_socket @cache_home/uzbl/cookie_daemon_socket +#set cookie_handler = talk_to_socket @cache_home/uzbl/cookie_daemon_socket set scheme_handler = sync_spawn @scripts_dir/scheme.py set authentication_handler = sync_spawn @scripts_dir/auth.py set download_handler = sync_spawn @scripts_dir/download.sh @@ -391,6 +391,7 @@ set stack = @mode_config stack set default_mode = command # === Post-load misc commands ================================================ +sync_spawn @scripts_dir/load_cookies.sh # Set the "home" page. set uri = uzbl.org/doesitwork/@COMMIT diff --git a/examples/data/scripts/load_cookies.sh b/examples/data/scripts/load_cookies.sh new file mode 100755 index 0000000..a192d3b --- /dev/null +++ b/examples/data/scripts/load_cookies.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +if [ "$1" != "" ]; then + cookie_file=$1 +else + cookie_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/cookies.txt +fi + +echo $cookie_file + +awk -F \\t ' +BEGIN { + scheme["TRUE"] = "https"; + scheme["FALSE"] = "http"; +} +$0 ~ /^#HttpOnly_/ { +printf("add_cookie \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", substr($1,length("#HttpOnly_"),length($1)), $3, $6, $7, scheme[$4], $5) +} +$0 !~ /^#/ { +printf("add_cookie \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", $1, $3, $6, $7, scheme[$4], $5) +} +' $cookie_file > $UZBL_FIFO diff --git a/src/uzbl-browser b/src/uzbl-browser index 3c9562d..faa2829 100755 --- a/src/uzbl-browser +++ b/src/uzbl-browser @@ -68,7 +68,7 @@ fi # we could also check if its pid file exists to avoid having to spawn it. #if [ ! -f "$XDG_CACHE_HOME"/uzbl/cookie_daemon_socket.pid ] #then - ${UZBL_COOKIE_DAEMON:-uzbl-cookie-manager} +# ${UZBL_COOKIE_DAEMON:-uzbl-cookie-manager} #fi # uzbl-event-manager will exit if one is already running. -- cgit v1.2.3