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

feat(cli): Use well-known endpoint to resolve API #6733

Merged
merged 2 commits into from
Mar 5, 2024
Merged

Conversation

bo0tzz
Copy link
Member

@bo0tzz bo0tzz commented Jan 29, 2024

Fixes #6487

@bo0tzz bo0tzz added the cli Tasks related to the Immich CLI label Jan 29, 2024
Copy link

cloudflare-workers-and-pages bot commented Jan 29, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: fe9bd06
Status: ✅  Deploy successful!
Preview URL: https://ed7790d0.immich.pages.dev
Branch Preview URL: https://feat-cli-well-known.immich.pages.dev

View logs

@bo0tzz bo0tzz marked this pull request as draft January 29, 2024 20:22
@bo0tzz
Copy link
Member Author

bo0tzz commented Jan 29, 2024

Would fix #6487, #6731

@bo0tzz
Copy link
Member Author

bo0tzz commented Jan 29, 2024

The fallback logic for constructing the URL is a bit more complex than I'd anticipated. For example, this code currently doesn't handle cases where .well-known returns successfully but builds an invalid endpoint.

@etnoy
Copy link
Contributor

etnoy commented Jan 30, 2024

I'm not exactly sure what well-known does. Could you summarize the idea here?

@jrasm91
Copy link
Contributor

jrasm91 commented Jan 30, 2024

The API is served at /api usually, but it you type in the root path / to the mobile app, there is a special endpoint (/.well-known/immich) that can check instead and it returns a response that indicates where the API is actually located. It is like a special discovery endpoint that can be used so the user isn't required to remember to add /api

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably more easily write an e2e test for this now btw.

cli/src/commands/login.command.ts Outdated Show resolved Hide resolved
@jrasm91 jrasm91 marked this pull request as ready for review March 5, 2024 16:12
@jrasm91 jrasm91 merged commit 4dc0fc4 into main Mar 5, 2024
28 checks passed
@jrasm91 jrasm91 deleted the feat/cli-well-known branch March 5, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Tasks related to the Immich CLI
Projects
None yet
3 participants