-
Notifications
You must be signed in to change notification settings - Fork 391
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
JS: Refactor link & badge generation, use URLs (not string) for base URLs #1778
Conversation
38fbf20
to
969df0e
Compare
…URLs This is two changes that were easier to make together - BASE_URL and BADGE_BASE_URL are now URL objects rather than strings that are manipulated. With this done, we no longer use string manipulation for URLs anywhere! - Both BASE_URL and BADGE_BASE_URL are now always set, as we had a bunch of code that was using BADGE_BASE_URL if available but falls back to BASE_URL + origin if it was not set. This fallback is now implemented globally, and correctly. - BASE_URL is also now always fully qualified, and we document that the python code ensures it has a trailing slash always. - The function to make links and generate badge markup is moved into `@jupyterhub/binderhub-client` as it is reasonably generic and not super specific to our frontend alone. This also involves them not reading BASE_URL and BADGE_BASE_URL globally, but having that information be passed in. Tests are also added here to catch any future issues that may arise. - Note for future fix - BADGE_BASE_URL is really PUBLIC_BASE_URL or similar, as it is used both for the location of the badge image (original intent) but also for the links we generate to share. This is relevant only for federation, where we want shared links to point to mybinder.org even though the API call itself may go to a specific member of the federation. I will do this deprecation + rename in a future PR so as to not make this PR bigger. Ref jupyterhub#774
Test failures still unrelated |
Like in #1773 (comment)
I've done my best to review this, and I think it looks good! |
I removed |
Thanks @consideRatio, I appreciate it! When both these PRs are merged, I'll roll them out to mybinder.org and keep an eye out. |
jupyterhub/binderhub#1778 Merge pull request #1778 from yuvipanda/badgey
This is two changes that were easier to make together
is now implemented globally, and correctly.
the python code ensures it has a trailing slash always.
@jupyterhub/binderhub-client
as it is reasonably generic and not super specific to our frontend alone. This also involves them not reading BASE_URL and BADGE_BASE_URL globally, but having that information be passed in. Tests are also added here to catch any future issues that may arise.Here is a screen recording of me testing this out. You can see url generation + badge generation work fine for a couple cases, as well as building + launching.
Screen.Recording.2023-10-16.at.2.04.36.PM.mov
Ref #774