Piwigo / Piwigo-Android

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

no Pictures shown in Android App #257

Open Dino0811 opened 3 years ago

Dino0811 commented 3 years ago

Describe the bug and how to reproduce I can't see any picture in android app, not for the album, not in an album.

Expected behavior If i open the android app i can see my albums (text but no galery image), i can go into the album but won't see an image - just (for example an album with 4 pictures) can see 4 white sqares.

What did you do already

Screenshots ...

Smartphone (please complete the following information): -> "what did you already"

Additional context my piwigo-server is set up as docker (linuxserver/piwigo) and i use an letsencrypt/ngix-reverse proxy, so i can access all my dockers by subdomain.domain.de

DocEverdream commented 3 years ago

same issue here, nokia 8 / android 9, piwigo docker isntallation with treafik 2.0 reverse proxy.

ramack commented 3 years ago

For me this looks like a duplicate of #184, can you check the details there? - In my eyes the issue is, that the URLs of the pictures are returned with HTTP - without "s" in case you put piwigo behind the revers-proxy. In my eyes this is a security flaw, as it exposes which images are viewed without encryption and should be fixed by patching the REST-return data in the reverse-proxy or in piwigo core.

Next Piwigo-Android version will likely hide the issue by loading the HTTP-URLs. In case the reverse-proxy is setup correctly it should redirect to the https variant which will at least secure the image transfer.

Dino0811 commented 3 years ago

Hi,

thank's for the hint...this seems to be the problem!

this https://github.com/Piwigo/Piwigo-Android/issues/184#issuecomment-640928300 helped me (quick and dirty) - pictures are shown, but upload doesn't work.

hopefully the fixed android-app will be out soon :) - thanks!

Catfriend1 commented 3 years ago

Ok, reading through the code I've found "webservicefactory" which crafts the requests and can be initialized to use account login data (e.g. cookie) when sending a request to the server.

The ImageRESTrepository uses this class and communicates as useragent "Piwigo Android 1.0.x" , the downloadFileAtUrl somehow takes a different piece of code execution: it communicates as "okhttp ....". The first I'm not sure but the latter definitely misses to send the cookie of the logged in user with the GET request.

How can this be added/extended in WebserviceFactory class? Can you please point me to or just add the two lines.?

Getting this in would make piwigo Android compatible with the piwigo privacy plugin (run via nginx in in advanced mode) and not break any default "piwigo product" behaviour because a pc browser (like firefox, chrome) already works because it sends the cookies with every php/js/css/jpg/... along by default which the android app doesn't (when using okhttp).

I've verified this working by temporarily allowing the okhttp useragent without going through the authentication check (php on server modified for testing in private lan zone). The app loaded all thumbs and pictures full size correctly then.

Thank you.

ramack commented 3 years ago

Sorry for the long time till response...

The issue doesn't look like being located in the WebServiceFactory for me. I guess it is in the picasso, which creates it's own okhttp instance when created in ApplicationModule.providePicasso().

Catfriend1 commented 3 years ago

Ok, I hope a fix is possible.

chuugar commented 3 years ago

I had this same issue when using a reverse proxy : Internet -> HTTPS -> HTTP. I finally found a fix to this to wait until the next release. Within local/config/config.inc.php :

$_SERVER['HTTPS']='on';
$_SERVER['SERVER_PORT']=443;
$conf['gallery_url'] = "https://myserver.lo";`
guiyou65 commented 3 years ago

Thanks a lot Chuugar !

havet commented 3 years ago

I don't see any pictures, neither in the the old version, nor in the NG-version. Testing on a Sony Xperia with Android 8.0.0 BTW The IOS-version works like a charm ...

Maybe the issue is related to the way https is implemented on the server? https://piwigo.org/forum/viewtopic.php?id=29002

Binero has configured their environment in a way that gives PHP the following data:

 $_SERVER['HTTPS'] = 'on'
 $_SERVER['SERVER_PORT'] = 80

The fix to be able to log in:

I've created two files in: ~/mydomain.com/public_html – first (the hidden) ".user.ini":

; Fix SERVER_PORT making redirects work in Piwigo. auto_prepend_file = /storage/content/96/**/mydomain.com/public_html/https_port_fix.php

... and second: "https_port_fix.php":

<?php // Fix SERVER_PORT making redirects work in Piwigo. $_SERVER['SERVER_PORT'] = 443; $_SERVER['HTTPS'] = 'on';

The fix results in making the PHP snippet above load first in every PHP-script to fix the settings, to not confuse Piwigo.

havet commented 1 year ago

I upgraded to Piwigo 13.5.0 and the plugin "piwigo_privacy" 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 in my browser: 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.

bhlevca commented 10 months ago

This is a very old bug. I stopped using the app when the mobile version of the browser worked impeccably.

I am hosting the Piwigo server myself behind a reverse NAT proxy with Apache. It appears that the app is incapable of handling the reverse proxy requests while the browser is.

It would be nice to see this solved and have an app opening your files, but you can set a shortcut with the browser to do the same thing. I won't hold my breath and I have actually given up on this one.