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

docs: improve document about settings #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ Note that when using insecure context StreamSaver will navigate to the download

# Configuration

By default, `https://jimmywarting.github.io/StreamSaver.js/mitm.html?version=2.0.0` will be used to create the iframe in secure context. But it could be unavailable when using Firefox or an environment where `github.io` can not be accessed, then you need to config a custom `mitm.html` by yourself.

Copy link
Owner

@jimmywarting jimmywarting Sep 19, 2021

Choose a reason for hiding this comment

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

I do not believe it is a specific Firefox issue?

I think it's more about 3th party cookie restrictions

you see, if you disable 3th party cookies in chrome or in safari then jimmywarting.github.io/StreamSaver.js/mitm.html won't work either...

It's should say something like:

StreamSaver uses a 3th party service to install a service worker on an external domain (hidden in a iframe). This can sometimes be restricted by disabling 3th party cookies in your browser. To get around this issue it's best to self-host the service worker and replace streamSaver.mitm to your own domain.

Toughts?
It may also be a problem in incognito mode where things are more private

Copy link
Author

Choose a reason for hiding this comment

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

It seems #242 is not mentioned in the new sentence?

Copy link
Owner

@jimmywarting jimmywarting Sep 19, 2021

Choose a reason for hiding this comment

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

unrelated, but... My https://github.com/jimmywarting/native-file-system-adapter works a bit differently... same concept doe... but it communicates with service workers directly without a mitm or any hidden iframes or will use the native file system access window.showSaveFilePicker

you are more required to self host the service worker yourself

Copy link
Owner

@jimmywarting jimmywarting Sep 19, 2021

Choose a reason for hiding this comment

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

It seems #242 is not mentioned in the new sentence?

???

fyi, it could also be a restriction with CSP...

should definitely put up a guide of how to set it up more properly, a setting for communicating with service worker directly instead of via a iframe could also be preferred.

Copy link
Author

@JounQin JounQin Sep 19, 2021

Choose a reason for hiding this comment

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

I mean my words or an environment where `github.io` can not be accessed

Copy link
Author

Choose a reason for hiding this comment

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

a setting for communicating with service worker directly instead of via a iframe could also be preferred.

I didn't know we can skip mimt even. 😂

Copy link
Author

Choose a reason for hiding this comment

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

will use the native file system access window.showSaveFilePicker

Yeah, I'm also doing this myself.

There a some few settings you can apply to StreamSaver to configure what it should use

```js
// StreamSaver can detect and use the Ponyfill that is loaded from the cdn.
streamSaver.WritableStream = streamSaver.WritableStream
streamSaver.TransformStream = streamSaver.TransformStream
// if you decide to host mitm + sw yourself
streamSaver.WritableStream = streamSaver.WritableStream || ponyfill.WritableStream
// if you decide to host mitm + sw yourself, notice you need to make sure a `sw.js` file be available too.
streamSaver.mitm = 'https://example.com/custom_mitm.html'
```

Expand Down