From dc7c26f3559be00e272c5c880f87c7550d80baae Mon Sep 17 00:00:00 2001 From: Elrond Date: Thu, 21 Mar 2013 09:01:48 +0100 Subject: [PATCH] piwigo: Sent a fake cookie. shotwell needs a pwg_id cookie to continue. And really, it's the only cookie it supports, so in the long run, we need to send a proper session cookie as pwg_id. --- mediagoblin/plugins/piwigo/views.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mediagoblin/plugins/piwigo/views.py b/mediagoblin/plugins/piwigo/views.py index 2b6b7b0c..d0629b73 100644 --- a/mediagoblin/plugins/piwigo/views.py +++ b/mediagoblin/plugins/piwigo/views.py @@ -69,6 +69,19 @@ def pwg_categories_getList(request): } +def possibly_add_cookie(request, response): + # TODO: We should only add a *real* cookie, if + # authenticated. And if there is no cookie already. + if True: + response.set_cookie( + 'pwg_id', + "some_fake_for_now", + path=request.environ['SCRIPT_NAME'], + domain=mg_globals.app_config.get('csrf_cookie_domain'), + secure=(request.scheme.lower() == 'https'), + httponly=True) + + @csrf_exempt def ws_php(request): if request.method not in ("GET", "POST"): @@ -86,4 +99,8 @@ def ws_php(request): if isinstance(result, BaseResponse): return result - return response_xml(result) + response = response_xml(result) + + possibly_add_cookie(request, response) + + return response -- 2.25.1