Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Verify Server Address #210

Open
jackgraddon opened this issue Oct 24, 2023 · 20 comments
Open

Unable to Verify Server Address #210

jackgraddon opened this issue Oct 24, 2023 · 20 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jackgraddon
Copy link

Describe the bug
I am unable to add a server address other than the LAN IP of my server. I cannot connect over Tailscale or Cloudflare Tunnels. I am, however, able to connect to the server through a tunnel after connecting to the server over LAN.

To Reproduce
Steps to reproduce the behavior:

  1. Open app
  2. Type in non-LAN IP address of server (i.e. https://jellyfin.example.com/)
  3. Press Connect
  4. See error

Expected behavior
I would expect this to work just as connecting to the server on the local network does on the first try.

@prayag17
Copy link
Owner

Is this still an issue with https://github.com/prayag17/JellyPlayer/releases/tag/v0.0.2 ?

@limxingzhi
Copy link

It is still an issue with the latest build https://github.com/prayag17/JellyPlayer/releases/tag/v0.0.3-dev

Accessing it over the local network via the IP address works
Accessing https://demo.jellyfin.org/stable works
Accessing it over TailScale's VPN via its domain name doesn't work (e.g. http://my.domain.com:1234)

Server version: 10.8.13
Client device: M1 Macbook Air

@prayag17
Copy link
Owner

Does your domain have a self signed SSL certificate?

@prayag17 prayag17 added bug Something isn't working help wanted Extra attention is needed labels Apr 26, 2024
@Arche151
Copy link

Arche151 commented Aug 5, 2024

same issue here. @prayag17 I don't have a self-signed SSL certificate.

@prayag17
Copy link
Owner

prayag17 commented Aug 5, 2024

What version are you using @Arche151?

@Arche151
Copy link

Arche151 commented Aug 5, 2024

@prayag17 Thanks for the quick response! I am using the 0.0.5 AppImage.

And I attached a screenshot of the error message, that appears when I try to add my server
image

Jellyfin Media Player and other clients work fine, but I'd much rather use Blink.

I tried starting the AppImage from the terminal to see any additional logs that may help, but there were none.

@prayag17
Copy link
Owner

prayag17 commented Aug 5, 2024

Can you send me a screenshot of console window ( ctrl+shift+i)

@Arche151
Copy link

Arche151 commented Aug 5, 2024

@prayag17 Pressing ctrl-shift-i didn't open a console window unfortunately

@prayag17
Copy link
Owner

prayag17 commented Aug 5, 2024

Try a nightly build from the actions tab in repo homepage

@Arche151
Copy link

Arche151 commented Aug 5, 2024

@prayag17 Sorry, I am not that much of an advanced user. can u explain to me how exactly to do that? I clicked on the actions tab but I don't know where to go from there.

@prayag17
Copy link
Owner

prayag17 commented Sep 6, 2024

Hey @Arche151, you can grab the latest dev build from https://github.com/prayag17/Blink/actions/runs/10743418903 > build artifacts and get executable file for your os

@Saturn745
Copy link

Saturn745 commented Sep 28, 2024

I just ran into this myself with the latest commit (built from source) and I found this in the developer console

Failed to load resource: TLS support is not available
Cross-origin redirection to [REDACTED]  denied by Cross-Origin Resource Sharing policy: Origin tauri://localhost is not allowed by Access-Control-Allow-Origin. Status code: 308
XMLHttpRequest cannot load [REDACTED] due to access control checks.
Failed to load resource: Cross-origin redirection to [REDACTED]  denied by Cross-Origin Resource Sharing policy: Origin tauri://localhost is not allowed by Access-Control-Allow-Origin. Status code: 308

I found this which seems to be related
tauri-apps/tauri#2327
With it being apparently fixed in webkit2gtk version 2.34 however I compiled it with 2.44.3 and still had it.

I also found that others who still experienced it replaced the browsers fetch with Tauri's HTTP API

Edit:
Just did a quick look in the source code of Blink and from what I can tell all the HTTP calls are made with jellyfin-sdk-typescript which is auto generated from openapi-generator and the Jellyfin SDK has it configured to generate code which uses Axios for making the HTTP requests which doesn't seem to make it very easy to use the Tauri HTTP API

Another edit:

@prayag17 is there any reason this was commented out? https://github.com/prayag17/Blink/blob/main/src/utils/store/api.tsx#L24
Did it not work?

@prayag17
Copy link
Owner

prayag17 commented Sep 29, 2024

Hey @Saturn745, I was using the Tauri http client during the time period this issue was reported and I subsequently removed it when I moved to Tauri v2.

Tauri's http adapter didn't seem to help in fixing this issue at all before so I didn't bother adding it back but I will add it back in the next commit to take another look at it.

Edit: also I remember setting the scope of http plugin made it difficult to access Jellyfin instances with self-signed ssl certificate

@Saturn745
Copy link

Saturn745 commented Sep 29, 2024

Hey @Saturn745, I was using the Tauri http client during the time period this issue was reported and I subsequently removed it when I moved to Tauri v2.

Tauri's http adapter didn't seem to help in fixing this issue at all before so I didn't bother adding it back but I will add it back in the next commit to take another look at it

Yep I noticed that this project was using Tauri V2 and that adapter didn't work because of that. I was attempting a few things to try and fix this issue but no luck so far

@prayag17
Copy link
Owner

Tauri http axios adapter package is out dated at the moment, I will try and hack a version of it to work with Tauri v2

@Saturn745
Copy link

Tauri http axios adapter package is out dated at the moment, I will try and hack a version of it to work with Tauri v2

Yeah I was attempting to put something together to work with Tauri V2 as well

@Saturn745
Copy link

Saturn745 commented Sep 29, 2024

Tauri's http adapter didn't seem to help in fixing this issue at all before so I didn't bother adding it back but I will add it back in the next commit to take another look at it.

Hey I was just messing with this again and I might have found out why.

Digging through how Blink checks if it's a valid server it via the Jellyfin SDK's DiscoveryService#getRecommendedServerCandidates and just looking around that method eventually calls RecommendedServerDiscovery#fetchRecommendedServerInfo and inside that it creates a new Jellyfin API instance and since it creates one itself it doesn't make use of the Axios Adapter https://github.com/jellyfin/jellyfin-sdk-typescript/blob/master/src/discovery/recommended-server-discovery.ts#L105

What do you think?

Also I found this adapter which uses Tauri V2 https://github.com/Dreaming-Codes/axios-tauri-http-adapter

@Saturn745
Copy link

Saturn745 commented Sep 29, 2024

Alrighty after a bit of tinkering around and some jank hacks I've gotten it to work.

image
image

All of the HTTP requests go through the Tauri HTTP and this issue is no more.

To get this to work, I used that library I sent above in my last message (with some modifications to fix a few bugs, but I'll PR those back to the upstream repo), then I took a few methods from the Jellyfin SDK (getMinScore, toRecommendedServerInfo, fetchRecommendedServerInfo, and discover) and re-implemented them so I could modify fetchRecommendedServerInfo (the others were needed since they are called from fetchRecommendedServerInfo but not exported for use) to pass an axiosClient when creating the Jellyfin API instance for discovering the servers. The re-implementing of the Jellyfin SDK doesn't feel right to me; however, I am not sure how else this could be done. While testing this, another issue I noticed is the images are grabbed on the browser side as well, so that would need to be worked around, and media doesn't seem to play. Do you have any ideas or suggestions?


I can't seem to find much info on using Tauri HTTP with a stream so that part may need to be done on the Rust end?

@prayag17
Copy link
Owner

prayag17 commented Sep 30, 2024

I took a few methods from the Jellyfin SDK (getMinScore, toRecommendedServerInfo, fetchRecommendedServerInfo, and discover) and re-implemented them so I could modify fetchRecommendedServerInfo (the others were needed since they are called from fetchRecommendedServerInfo but not exported for use) to pass an axiosClient when creating the Jellyfin API instance for discovering the servers. The re-implementing of the Jellyfin SDK doesn't feel right to me; however, I am not sure how else this could be done.

The reimplementation of Jellyfin SDK indeed feels a bit wrong to me too but I suppose thats the most optimal way to get around for now. Ofcourse we can just use

axiosClient.get(`${basePath}/System/Ping`)

to check if given server address is a Jellyfin server but this does not auto check for http and https like the official sdk and also it does get a little finicky with response body.

While testing this, another issue I noticed is the images are grabbed on the browser side as well, so that would need to be worked around, and media doesn't seem to play

We can create a blob for images that utilize tauri's fetch api with mime:'image/jpeg' just like audioPlayer component. I can think of several ways to implement this feature, like building an Image component which takes itemId and other required fields are prop inputs and then render images using this component. As for the media playback the same blob url method can be used.
reference to audioPlayer: https://github.com/prayag17/Blink/blob/main/src/components/playback/audioPlayer/index.tsx#L59

(side note: I will have to use tauri's fetch api here instead of the js inbuilt one)

Edit: Tauri does have a streaming example, you can see their implementation for reading video stream in Rust side but I still find the Blob method to be more easier to implement.

@Saturn745
Copy link

to check if given server address is a Jellyfin server but this does not auto check for http and https like the official sdk and also it does get a little finicky with response body.

Yeah the official sdk checks http, https, different ports and other stuff which I guess can be easily readded. I just did what I mentioned earlier as a quick test to make sure I was on the right track

Edit: Tauri does have a streaming example, you can see their implementation for reading video stream in Rust side but I still find the Blob method to be more easier to implement.

Yeah that's the only thing I could find which is why I mentioned it may need to be done from the Rust side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants