sigma.js icon indicating copy to clipboard operation
sigma.js copied to clipboard

Added crossOrigin option

Open jpeirson opened this issue 1 year ago • 0 comments

Pull request type

Check the type of change your PR introduces:

  • [ ] Bugfix
  • [x] Feature
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

NOTE: Before to create a PR, read our contributing guide

NOTE: Try to limit your pull request to one type, submit multiple pull requests if needed.

What is the current behavior?

Issue Number: N/A

NOTE: Describe the current behavior that you are modifying, or link to a relevant issue.

When using the node.image program, the crossOrigin attribute is hardcoded to "" (anonymous fetch). If the img resource requires credentials, then image requests will always fail with HTTP 401, and the requested images will never be rendered on nodes.

What is the new behavior?

NOTE: Describe the behavior or changes that are being added by this PR.

Builds on PR #1147, where rather than hardcoding the crossOrigin attribute, the caller can provide a param value. Param value must be a valid HTML img crossOrigin value (TS check only). No breaking change in behavior - new params arg is optional. Also, FWIW, I've added a null param value which allows a user to override the behavior from PR #1147 and not specify a crossOrigin attribute.

This change specifically supports the (my) use case where node image URL resources are protected by a layer of authentication.

Other information

NOTE: Any other information that is important to this PR such as screenshots of how the component looks before and after the change.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin

jpeirson avatar Oct 17 '23 19:10 jpeirson