From 8c266c3d92fdc9e975de974457d5308c2350a0d5 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 27 May 2015 16:19:14 +1000 Subject: [PATCH] * honor config options 'proxy' and 'cookies' --- twatch-lite | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/twatch-lite b/twatch-lite index 406baf0..2167520 100755 --- a/twatch-lite +++ b/twatch-lite @@ -205,8 +205,14 @@ my $state = load_state ($opts{state}); my $ua = LWP::UserAgent->new; $ua->agent("twatch-lite/$VERSION"); $ua->show_progress(1) if $opts{verbose}; -$ua->env_proxy; -# TODO: save cookies? +if ($config->{proxy}) { + $ua->proxy(['http', 'https'], $config->{proxy}); +} else { + $ua->env_proxy; +} +if ($config->{cookies}) { + $ua->cookie_jar({ file => "$ENV{HOME}/.config/twatch-lite/cookies.txt" }); +} foreach my $feed (@{ $config->{feeds} }) { my $host = $feed->{hostname}; @@ -218,5 +224,6 @@ foreach my $feed (@{ $config->{feeds} }) { } save_state($opts{state}, $state); -# cleanup exit 0; + +__END__