Piwigo / piwigo-flutter-app

Piwigo mobile application for Android
GNU General Public License v2.0
82 stars 26 forks source link

Android App (1.2.1) won't login to Piwigo 13.1.0 #135

Open bringabong opened 1 year ago

bringabong commented 1 year ago

Hi,

The Android app does not succeed to login to my Piwigo 13.1.0 instance. When i supply a username and password, the circle just keeps on spinning forever. No error message is displayed.

If i omit username/password, i can access the gallery as guest, but don't see any images.

This happens both when accessing the site through a reverse proxy (with letsencrypt SSL cert), and when accessing it locally through plain http and private ip address. In both cases, logging in through a web browser works just fine.

Here's what the nginx log shows while attempring to access it through the app. Please let me know if you need any more log or other debug data.


192.168.0.2 - - [17/Nov/2022:01:35:41 +0100] "GET /ws.php?format=json&method=pwg.session.getStatus HTTP/1.1" 200 345 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:41 +0100] "GET /ws.php?format=json&method=reflection.getMethodList HTTP/1.1" 200 2044 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:41 +0100] "GET /ws.php?format=json&method=reflection.getMethodList HTTP/1.1" 200 2044 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:41 +0100] "GET /ws.php?format=json&method=pwg.categories.getList&cat_id=0&thumbnail_size=medium HTTP/1.1" 200 30917 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:43 +0100] "GET /ws.php?format=json&method=reflection.getMethodList HTTP/1.1" 200 2044 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:43 +0100] "GET /ws.php?format=json&method=pwg.categories.getImages&cat_id=163&per_page=100&page=0 HTTP/1.1" 200 163012 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:43 +0100] "GET /ws.php?format=json&method=pwg.categories.getList&cat_id=163&thumbnail_size=medium HTTP/1.1" 200 504 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:46 +0100] "GET /ws.php?format=json&method=reflection.getMethodList HTTP/1.1" 200 2044 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:46 +0100] "GET /ws.php?format=json&method=pwg.categories.getList&cat_id=0&thumbnail_size=medium HTTP/1.1" 200 30917 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:47 +0100] "GET /ws.php?format=json&method=reflection.getMethodList HTTP/1.1" 200 2044 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:47 +0100] "GET /ws.php?format=json&method=pwg.categories.getImages&cat_id=78&per_page=100&page=0 HTTP/1.1" 200 111897 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:47 +0100] "GET /ws.php?format=json&method=pwg.categories.getList&cat_id=78&thumbnail_size=medium HTTP/1.1" 200 495 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:48 +0100] "GET /ws.php?format=json&method=reflection.getMethodList HTTP/1.1" 200 2044 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:35:48 +0100] "GET /ws.php?format=json&method=pwg.categories.getList&cat_id=0&thumbnail_size=medium HTTP/1.1" 200 30917 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:36:19 +0100] "GET /ws.php?format=json&method=pwg.session.getStatus HTTP/1.1" 200 345 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:36:19 +0100] "GET /ws.php?format=json&method=reflection.getMethodList HTTP/1.1" 200 2044 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:36:19 +0100] "GET /ws.php?format=json&method=reflection.getMethodList HTTP/1.1" 200 2044 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:36:19 +0100] "GET /ws.php?format=json&method=pwg.categories.getList&cat_id=0&thumbnail_size=medium HTTP/1.1" 200 30917 "-" "Dart/2.16 (dart:io)"
192.168.0.2 - - [17/Nov/2022:01:36:37 +0100] "POST /ws.php?format=json&method=pwg.session.login HTTP/1.1" 200 502 "-" "Dart/2.16 (dart:io)"
remi-martin commented 1 year ago

Hi, this might be related to #134. All I know for now is that this issue also happens on iOS, so it might not be related to the app directly.

The logs you gave do not show any error, so anything looks right to the API. What could really help us would be to have access to a Piwigo server having this issue.

remi-martin commented 1 year ago

Also, what is you php version ?

bringabong commented 1 year ago

Hi, i'm using php8.0.25. I will be happy to give you access to the server, just let me know what sort of access you need, and how to pass the credentials to you.

remi-martin commented 1 year ago

Ok, we think the issue might be related to the support of PHP that was added in Piwigo 13.

I'd need the url you use to login from the mobile app. For the account, you can create a new one and give the credentials to my mail address: remi.martin@epitech.eu, if you don't mind :)

skywalkie2018 commented 1 year ago

Hi, tried to check where could be the problem. In my case Wireshark provided some hint:

image

So it looks like a simple table update ... checking Mysql and found that "yes" the column is missing:

MariaDB [piwigo]> describe piwigo_activity; +--------------+-----------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+-----------------------+------+-----+---------------------+----------------+ | activity_id | int(11) unsigned | NO | PRI | NULL | auto_increment | | object | varchar(255) | NO | | NULL | | | object_id | int(11) unsigned | NO | | NULL | | | action | varchar(255) | NO | | NULL | | | performed_by | mediumint(8) unsigned | NO | | NULL | | | session_idx | varchar(255) | NO | | NULL | | | ip_address | varchar(50) | YES | | NULL | | | occured_on | timestamp | NO | | current_timestamp() | | | details | varchar(255) | YES | | NULL | | +--------------+-----------------------+------+-----+---------------------+----------------+

a quick update of this can be done by following command: MariaDB [piwigo]> alter table piwigo_activity add column if not exists user_agent varchar(255);

Now login from Piwigo NG app works again (well at least for me). Hope this helps.

remi-martin commented 1 year ago

I sent this to the development team, I'll let you know if this helps !

remi-martin commented 1 year ago

What plugins are enabled in your Piwigo ?

remi-martin commented 1 year ago

misclick :/

skywalkie2018 commented 1 year ago

What plugins are enabled in your Piwigo ?

gdump+ (ver 12.a) Fotorama (ver 12.b)

piwigo / self-hosted: 13.2.0 (docker) piwigo NG (android app) v 1.2.1 PHP: 7.4.26 MySQL: 5.5.5-10.8.3-MariaDB-1:10.8.3+maria~jammy [2022-11-22 16:03:56] Graphics Library: ImageMagick 7.0.11-14

bringabong commented 1 year ago

Hi, i have mailed you the url and credentials, hope it helps with debugging.

remi-martin commented 1 year ago
I/flutter (14126): <pre><br />
I/flutter (14126): <b>Warning</b>:  [mysql error 1054] Unknown column 'user_agent' in 'field list'
I/flutter (14126): 
I/flutter (14126): INSERT  INTO `piwigo_activity`
I/flutter (14126):   (`object`,`object_id`,`action`,`performed_by`,`session_idx`,`ip_address`,`details`,`user_agent`)
I/flutter (14126):   VALUES('user','4','login','4','av6ufh5nvfnrjuu1f7r22ise84','192.168.0.2','a:1:{s:6:\"method\";s:17:\"pwg.session.login\";}','Dart/2.18 (dart:io)') in <b>/gallery/include/dblayer/functions_mysqli.inc.php</b> on line <b>847</b><br />
I/flutter (14126): </pre>{"stat":"ok","result":true}

This is what I get when I try to login.

bringabong commented 1 year ago

that points to the same issue that @skywalkie2018 saw, the missing column in the database

remi-martin commented 1 year ago

For the login at least, there is another issue where thumbnails are not shown

remi-martin commented 1 year ago

When trying to see a photo through it's url I get this: [Firefox logs]

An error occurred during a connection to _server_url_. SSL received a record that exceeded the maximum permissible length.

[Piwigo NG logs]

I/flutter (32197): HandshakeException: Handshake error in client (OS Error: WRONG_VERSION_NUMBER(tls_record.cc:242))
bringabong commented 1 year ago

That is odd, i can not reproduce that, both in chrome and firefox i can view the direct image url's without errors

The message "SSL received a record that exceeded the maximum permissible length" usually means that a https client is attempting to connect to a http host, but that should not happen in my case, as the reverse proxy handles all the ssl, and the server that runs piwigo over http is not even open to the outside.

Intel11 commented 1 year ago

Hi, tried to check where could be the problem. In my case Wireshark provided some hint:

image

So it looks like a simple table update ... checking Mysql and found that "yes" the column is missing:

MariaDB [piwigo]> describe piwigo_activity; +--------------+-----------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+-----------------------+------+-----+---------------------+----------------+ | activity_id | int(11) unsigned | NO | PRI | NULL | auto_increment | | object | varchar(255) | NO | | NULL | | | object_id | int(11) unsigned | NO | | NULL | | | action | varchar(255) | NO | | NULL | | | performed_by | mediumint(8) unsigned | NO | | NULL | | | session_idx | varchar(255) | NO | | NULL | | | ip_address | varchar(50) | YES | | NULL | | | occured_on | timestamp | NO | | current_timestamp() | | | details | varchar(255) | YES | | NULL | | +--------------+-----------------------+------+-----+---------------------+----------------+

a quick update of this can be done by following command: MariaDB [piwigo]> alter table piwigo_activity add column if not exists user_agent varchar(255);

Now login from Piwigo NG app works again (well at least for me). Hope this helps.

Hi, I also had this problem with Piwigo 13.3 and piwigo NG app 1.2.1, and this solved my problem. Thanks.

remi-martin commented 1 year ago

By the way, the development team is aware of this issue and your workarounds, they might fix it in future update.

skywalkie2018 commented 1 year ago

Great! seems like it is not a bug for this app anymore right ?

remi-martin commented 1 year ago

Yup, it comes from the server, this issue appeared with the migration to Piwigo 13