Piwigo / Piwigo-Android

Piwigo Native Android App
GNU General Public License v3.0
141 stars 43 forks source link

Pictures not loading when piwigo_privacy by Yoni Jah activated #251

Open ollimaz opened 4 years ago

ollimaz commented 4 years ago

The Pictures and Videos don't load if the Plugin piwigo_privacy by Yoni Jah is activated.

Tested on some Android devices.

ramack commented 4 years ago

@yonjah how does the piwigo_privacy plugin protect the images? The App receives 401 error codes when accessing the image URLs read via REST. Does it require HTTP-AUTH for accessing the images?

@EddyLB how did you solve it in the iOS app?

yonjah commented 4 years ago

Hi @ramack sorry for the late reply a bit busier than usual.

Privacy plugin has two different modes of operation -

  1. Basic mode. in this mode image urls are rewritten to go through get.php file that checks access.
  2. Advance mode. In this mode image urls are left the same and nginx auth redirect is used to allow access.

The only thing I can think of that will be different is if the android app is not accessing the correct URL in basic mode As a workaround it might be possible to try advance mode and see if it solves the issue @ollimaz you think you'll be able to give advance mode a try ?

ollimaz commented 4 years ago

Hi @yonjah I installed a new version of piwigo with NGINX and activated piwigo_privacy with advanced mode.

In advanced mode the pictures are loading. Thanks

ramack commented 4 years ago

@yonjah thanks for the response and the workaround. Neverthe less I'd like to understand why it doesn't work in basic mode. Can you tell us in which way the piwigo-privacy is rewriting the URLs and how does it check the access? Does it use http-auth?

yonjah commented 4 years ago

HI @ramack the privacy plugin is using piwigo hooks to change the url. see - https://github.com/yonjah/piwigo_privacy/blob/master/main.inc.php#L19

The urls are replaced to point to get.php file instead of static images. In get.php access is verified by checking the regular user session as done by piwigo core, there is no use for http-auth.

coolo commented 4 years ago

The release on play store doesn't follow redirects very reliably, so it's very possible that this is just a symptom of that

Catfriend1 commented 4 years ago

Do you welcome contributions for the support of aquiring pictures through get.php as a fallback in case the "normal" method doesn't work?

Catfriend1 commented 4 years ago

The app does query get.php correctly but no session data (cookie? header?) is sent which forces piw_privacy to deny the request

Catfriend1 commented 4 years ago

@ollimaz I can't get it to work in advanced mode, pictures are not loading. Could you help me and explain what to do that they load in the app? Thank you.

Catfriend1 commented 4 years ago

I've described how to solve it: https://github.com/Piwigo/Piwigo-Android/issues/257#issuecomment-687784304

havet commented 1 year ago

The problem persists. I upgraded to Piwigo 13.5.0 and the plugin was disabled, because it was considered incompatible with this version . Now suddenly I could see a few pictures with the Android app Piwigo NG, but the majority of pictures where still invisible. I had some indications that only cached images where visible.

Unfortunately, now Piwigo worked miserably: only a few cached images where displayed. The same applied to the app for Iphone/iPad, that used to work excellently.

Now I've enabled the plug-in again and Piwigo works as charm in both browser and as iPhone app. But unfortunately, the Android app only works for public albums. Albums protected with any of the schemes to restrict access to some of the users after log-in are still inaccessible.

Update: Made a fresh installation of Piwigo, without the piwigo_privacy plugin: the Android app works as a charm with this installation. What puzzles me is that the Piwigo app for iphone/ipad works with both installations - the piwigo_privacy plugin isn't any problem for that app. Why doesn't the Android app work - I've understood that it's based on the code for the iphone app.