From 9f308a22ca2310dcd9f09721ec685e861dbdd9b1 Mon Sep 17 00:00:00 2001 From: dblugeon Date: Mon, 13 May 2013 21:49:44 +0200 Subject: [PATCH] Close #189 Use NSResourceLoadDelegate to disable the cookie management to avoid see the timeline via profile view Thanks to https://github.com/poweruser82 --- Mac/Controller.h | 2 ++ Mac/Controller.m | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/Mac/Controller.h b/Mac/Controller.h index d93ffbd..2b2f683 100644 --- a/Mac/Controller.h +++ b/Mac/Controller.h @@ -73,6 +73,8 @@ - (void)notificateViewsAboutDeletedPostWithId:(NSString *)postId byEntity:(NSString*)entity; +- (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource; + - (void)setString:(NSString *)string forKey:(NSString *)aKey; - (void)setSecret:(NSString *)string; - (NSString *)secret; diff --git a/Mac/Controller.m b/Mac/Controller.m index ce81fd8..c26e2fb 100644 --- a/Mac/Controller.m +++ b/Mac/Controller.m @@ -26,6 +26,7 @@ - (void)awakeFromNib { [timelineViewWindow setExcludedFromWindowsMenu:YES]; + [timelineView setResourceLoadDelegate:self]; [self initHotKeys]; @@ -432,6 +433,13 @@ [timelineView stringByEvaluatingJavaScriptFromString:fun]; } +/* we disable cookies to avoid see a timeline during the consultation of a profile with which the user are connected through safari cf https://github.com/jeena/Bungloo/issues/189 */ +- (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource{ + NSMutableURLRequest * response = [request mutableCopy]; + [response setHTTPShouldHandleCookies:FALSE]; + return response; +} + - (void)loggedIn { [loginActivityIndicator stopAnimation:self];