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

Clarify or fix default IP usage #24

Open
FoxxMD opened this issue Oct 22, 2024 · 2 comments
Open

Clarify or fix default IP usage #24

FoxxMD opened this issue Oct 22, 2024 · 2 comments

Comments

@FoxxMD
Copy link

FoxxMD commented Oct 22, 2024

Almost all of the examples in the readme as well as the API Reference documentation show code examples like

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40",
});

which implies that it is possible to use this library without specifying a server url. This is somewhat reinforced by the server index being optional.

However, it looks like the actual client library defaults to using a private IP address, 10.10.10.47, when no server url is provided. This leads to the same error shown in #20 if using the client code as shown in all examples because that IP address obviously isn't used by everyone.

Please let me know if this address is supposed to be special to Plex somehow and I just don't understand.

Otherwise, it seems like the documentation should specify that serverURL always needs to be specified and, ideally, that it is NOT optional when initializing a new client.

@JasonLandbridge
Copy link
Collaborator

which implies that it is possible to use this library without specifying a server url.

Yes, there is a difference between the central plex.tv API and the Plex Media Server (the app you install on a server to self-host). In the case of plex.tv, the url is hard-coded and with anything else it requires a server url of where the API is hosted.

However, it looks like the actual client library defaults to using a private IP address, 10.10.10.47, when no server url is provided.

This is purely an example ip and means nothing

Otherwise, it seems like the documentation should specify that serverURL always needs to be specified and, ideally, that it is NOT optional when initializing a new client.

That's the tricky thing, it is not always needed. With plex.tv, no but anything else yes. But this single library handles both use-cases so it's "sometimes" needed.

I do agree more clarification is always welcome. If you can give some specific pointers or clarifications then I will see if I can add it to the documentation

@FoxxMD
Copy link
Author

FoxxMD commented Oct 22, 2024

It looks like all of the endpoints that require an actual PMS instance displays a prefix protocol://ip:port on the endpoint info in the documentation

image

and those that are hardcoded for use with plex.tv do not have this

image

If it's possible to modify the generated SDK docs to the right hand side so that serverURL is present when the prefix is also present that would go a long way to clarifying which endpoints require a PMS instance.

image


It would also be helpful to include this clarification at, before, or in the SDK Example Usage section in the readme. The example usage code will fail with connection/timeout error since no serverURL is defined. (Also, I think the example is outdated since it does not show xPlexClientIdentifier ?) As a new user I would expect the example (minimal) usage to work if I substitute the shown variable and since there is no more info shown in the example I'd be at a lost as to why it didn't.


If possible it would also be good to get rid of the default IP address in the config so that if a user tries to use a PMS-instance required endpoint without a serverURL they will get an error about host missing or something else other than "connection/timeout error" since that error implies it could work but that's misleading.

The default address makes on-boarding confusing if the user hasn't fully read the docs -- and even then its only mentioned once in the entire readme and zero times in the generated docs site. They will make an assumption that config is valid because they do not know about the default ip which might lead them to try diagnosing the connection issue without realizing a "valid" IP was provided without their knowledge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Open Issues
Development

No branches or pull requests

2 participants