giejay / Immich-Android-TV

An Android TV app for the self hosted photos and videos backup solution.
GNU General Public License v3.0
146 stars 5 forks source link

[FR] Accept self signed certificates #10

Closed blasterspike closed 4 months ago

blasterspike commented 5 months ago

Is your feature request related to a problem? Please describe.

I have Immich behind an nginx reverse proxy and I'm using a self-signed certificate. When I try to connect Immich TV to my server, I get the error

Could not fetch items:
java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

and I can't access any of my pictures.

Describe the solution you'd like

Maybe a pop-up on the TV asking if I want to proceed with accepting the certificate.

Additional context

None

giejay commented 5 months ago

I have added an option in release 1.20 to disable SSL verification. Use with care!

blasterspike commented 5 months ago

Thanks for the prompt update! I have enabled that flag but now I'm getting

Could not fetch items: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

I have updated Immich Server to 1.94.1.

giejay commented 5 months ago

You are seeing proper json when going to https://myimmichinstance/api/album?

blasterspike commented 4 months ago

At the beginning I didn't have any albums, so the api was just returning [] but then I added some albums but I'm still getting the same error.

giejay commented 4 months ago

I will add a debug option which logs the responses, which you can then sent to me

giejay commented 4 months ago

I released version 1.22 which contains a debug mode. Please share your user id which you can also find in the debug settings.

blasterspike commented 4 months ago

I have enabled the debug mode and my user ID is: bb13a2fb-6fb9-4ff1-b52b-adca77d64913.

giejay commented 4 months ago

Somehow your user id is not showing up in the Crashlytics log. Are you perhaps blocking Firebase using a tool like AdGuard/PiHole?

blasterspike commented 4 months ago

Good catch! I'm indeed using pfBlockerng. I don't know what Firebase is but I temporarily disabled pfBlockerng, I went into the app and moved around Photos and Albums a couple of times with the error. Let me know if you are are now able to see something.

giejay commented 4 months ago

Unfortunately, I'm still not able to see your id. Did you force close the app after you shut down pf?

blasterspike commented 4 months ago

The app was already force closed. I have tried again now, also disabling and re-enabling the debug mode. Let me know if you can see anything.

giejay commented 4 months ago

Unfortunately, still nothing for your user id. Maybe I can somehow store the logs and then you can share them yourself using email or by making a photo of the text or something.

blasterspike commented 4 months ago

Yes that's fine. I can take a photo with an iPhone and I can select the text from the picture for example.

giejay commented 4 months ago

It was an issue in the code, not logging to Firebase properly. I have pushed version 1.26. Can you retest after installing that version?

blasterspike commented 4 months ago

I have

  1. Disabled pfBlockerNG
  2. Installed v1.27 (it was already installed to be fair)
  3. Force stopped the app
  4. Navigated inside the app to get the same error

The user ID is still the same. Let me know if you can see anything. Thanks again for your support!

giejay commented 4 months ago

Yes, thanks for that, I finally can see the error!

https://immich.lan//api/assets?page=1&size=100&order=desc HTTP/2 200 server: nginx/1.25.3 date: Fri, 23 Feb 2024 09:47:47 GMT content-type: text/html; charset=utf-8 content-length: 2907 x-powered-by: Express cache-control: no-store etag: "b5b-JFQ/cZ6s74KuJYlgxK5bpbbZQV0" strict-transport-security: max-age=63072000   <!doctype html> <html lang="en" class="dark">   <head>     <!-- (used for SSR) -->     <!-- metadata:tags -->      <meta charset="utf-8" />     <meta name="viewport" content="width=device-width, initial-scale=1" />     <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />     <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16.png" />     <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png" />     <link rel="icon" type="image/png" sizes="48x48" href

Did you end the hostname with a forward slash?

blasterspike commented 4 months ago

Yes, that was the issue 🤦‍♂️ After removing the trailing slash, I started seeing the albums and the photos but I can't see any thumbnails, of either photos or albums, and when I open a picture it still shows the default image, meaning that it doesn't load the original one. Immich is currently behind an nginx reverse proxy, as you might have seen from the logs, but I have checked the nginx logs and it is returning 200 to the API calls from the AndroidTV app. Any hints? Or do you want me to open a separate issue?

giejay commented 4 months ago

Can you try to load https://immich.lan/api/asset/thumbnail/{id} in your browser?

The Id you can find by going here and taking a random one: https://immich.lan/api/assets

blasterspike commented 4 months ago

https://immich.lan/api/asset/thumbnail/{id} loads the thumbnail correctly from a browser. Immich TV is installed on an nVidia Shield and the Shield, my browser and the Immich Server are all on the same network.

giejay commented 4 months ago

I also added debug logging when an error occurs in loading a photo in version 1.27.1. It will be available in a couple of hours.

blasterspike commented 4 months ago

I have 1.28.1 installed with the debugging enabled and pfBlockerNG disabled. Let me know if you were able to see some logs regarding this issue.

giejay commented 4 months ago

Yes, I found the issue and I will publish 1.29 and you should finally be able to see your photos/videos;)

blasterspike commented 4 months ago

Now everything works fine, thank you very much for your assistance and the wonderful product you have created for the Immich community!

giejay commented 4 months ago

Great to hear that!