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

fix: use DOM base href for web XHRs #565

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

JVMerkle
Copy link
Contributor

@JVMerkle JVMerkle commented Dec 2, 2024

By using html.document.baseUri.toString() as base URL for the web-app, the base tag in the DOM is considered correctly.
This allows serving the application from a sub-directory (e.g. https://foo.com/kitchenowl/).

Tested with and without subdir-serving.

Future todo's: Replace DOM <base href="..."> with environment variable content etc. for easy containerized deployment.

Partial implementation for #130, #237

@TomBursch TomBursch added the enhancement New feature or request label Dec 3, 2024
@JVMerkle
Copy link
Contributor Author

JVMerkle commented Dec 3, 2024

Hi @TomBursch,
using conditional imports the other platforms seem to work fine. Obviously the structure is not pretty nice, any suggestions regarding location/naming of the dart:html wrapper? (see latest commit)
Please note I have no idea of dart, conditional imports might not be the way to go here.

@JVMerkle JVMerkle marked this pull request as draft December 3, 2024 19:16
@TomBursch
Copy link
Owner

Hi @JVMerkle, thanks for the PR! Conditional imports are fine. I think putting the code into lib/platform/dart_html/ would be better, or what do you think? But other than that, I'm happy with it.

@JVMerkle JVMerkle force-pushed the bugfix/web-base-href branch from 4ce8f2b to fcd03ab Compare December 4, 2024 10:59
@JVMerkle
Copy link
Contributor Author

JVMerkle commented Dec 4, 2024

Hi @TomBursch, lib/platform sounds nice. I am also preparing another MR where the base can be controlled with BASE_HREF. BR, Julian

@JVMerkle JVMerkle marked this pull request as ready for review December 4, 2024 11:00
By using `html.document.baseUri.toString()` as base URL for the web-app, the base tag in the DOM is considered correctly.
This allows serving the application from a sub-directory (e.g. https://foo.com/kitchenowl/).
@TomBursch TomBursch force-pushed the bugfix/web-base-href branch from 3e21f09 to 1a889ee Compare December 4, 2024 12:24
@TomBursch TomBursch merged commit 20935d9 into TomBursch:main Dec 4, 2024
@JVMerkle JVMerkle deleted the bugfix/web-base-href branch December 4, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants