8go / matrix-commander

simple but convenient CLI-based Matrix client app for sending and receiving
GNU General Public License v3.0
563 stars 59 forks source link

No support for .well-known/matrix/server #165

Open jackrosenthal opened 8 months ago

jackrosenthal commented 8 months ago

The matrix spec permits hosting a file .well-known/matrix/server on the server's web root, delegating the server tasks to another hostname: https://spec.matrix.org/v1.9/server-server-api/#resolving-server-names

It appears that matrix-commander does not check this file:

% matrix-commander --login PASSWORD
Enter URL of your homeserver: [https://matrix.example.org] ohea.xyz
Enter your user ID:  [@john:example.org]  or  [john] for @john:ohea.xyz : jrosenth
...
Correct? (Yes or Ctrl-C to abort) Yes
2024-01-20 17:14:53,701:    ERROR: matrix-commander: E248: The program matrix-commander.py failed. Sorry.
2024-01-20 17:14:53,701:    ERROR: matrix-commander: 404, message='Not Found', url=URL('https://ohea.xyz/_matrix/client/r0/login')
2024-01-20 17:14:53,701:     INFO: matrix-commander: 2 errors and 0 warnings occurred.

(The file at https://ohea.xyz/.well-known/matrix/server should've been used here to determine the server's hostname is matrix.ohea.xyz:443).

8go commented 5 months ago

Correct, that is not implemented.

Anyone wants to add that feature through a PR?

phptek commented 1 month ago

In my case the hostname of the chat server available via a browser differs from the domain available on the .well-known path (not sure if this is normal). So when inputting the room identifier, there's either going to be a hostname mismatch on the user and/or room, or the issue described above occurs.

Additionally:

FYI, I'm definetely using the correct username/password pair, as I have successfully logged-in via a browser several times using the same creds.

The provided login data is: homeserver='https://matrix.my-domain.co:443'
                            user id='@mytestbot:matrix.my-domain.co'
                            password='***'
                            device name='test'
                            room id='!BZRGpTcfepwOPpYPRs:matrix.my-domain.co'
Correct? (Yes or Ctrl-C to abort) Yes
2024-08-22 03:22:57,629:     INFO: matrix-commander: The persistent storage directory /data/store was created for you.
2024-08-22 03:22:57,759:  WARNING:    nio.responses: Error validating response: 'user_id' is a required property
2024-08-22 03:22:57,760:     INFO: matrix-commander: The persistent storage directory /data/store was deleted for you.
2024-08-22 03:22:57,762:    ERROR: matrix-commander: E234: Log in failed. Most likely wrong credentials were entered. homeserver='https://matrix.my-domain.co:443'; device name='rm'; user='mytestbot:matrix.my-domain.co'; room_id='!BZRGpTcfepwOPpYPRs:matrix.my-domain.co'. Failed to log in: Invalid username or password, M_FORBIDDEN
2024-08-22 03:22:57,762:     INFO: matrix-commander: 2 errors and 0 warnings occurred.