Skip to content

Add configurable fileTypes for upload and HTTP serving #670

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

Merged
merged 10 commits into from
Jun 17, 2022

Conversation

bollwyvl
Copy link
Collaborator

@bollwyvl bollwyvl commented Jun 15, 2022

References

Code changes

  • adds fileTypes, using a subset of the IRenderMime.IFileType to jupyter-lite.json
  • adds to jupyter_lite_config.json as (extra_)file_types which get merged together
  • removes most hard-coded mimetypes from client-side contents manager
  • uses configured mime types in server as well
  • defaults uploaded files to file/base64 instead of json/notebook

User-facing changes

  • a larger collection of uploaded files will work out-of-the-box
  • site owners can customize (or entirely replace) these

Backwards-incompatible changes

  • a number of constants are no longer hoisted

@bollwyvl bollwyvl added the enhancement New feature or request label Jun 15, 2022
@github-actions
Copy link
Contributor

lite-badge 👈 Try it on ReadTheDocs

@jtpio jtpio force-pushed the gh-667-plus-kernel-contents branch from fccd47e to b7387a7 Compare June 16, 2022 10:38
@jtpio jtpio added this to the 0.1.0 milestone Jun 16, 2022
@jtpio
Copy link
Member

jtpio commented Jun 16, 2022

The docs failed to build on the latest main, which looks related to the new release of myst-nb on conda mreged yesterday: conda-forge/myst-nb-feedstock#18

5d6e522 seems to be fixing it.

@bollwyvl
Copy link
Collaborator Author

Thanks for the assist. When last I put it down, most of the arbitrary file types i tried were working for various upload/download scenarios. PDF was still bothersome.

@jtpio
Copy link
Member

jtpio commented Jun 16, 2022

Yes I gave it a spin on RTD and it looked good. Let's get it in.

@jtpio jtpio marked this pull request as ready for review June 16, 2022 13:22
@bollwyvl
Copy link
Collaborator Author

.... i found one more thing with SVG... taking a look.

@jtpio
Copy link
Member

jtpio commented Jun 16, 2022

a larger collection of uploaded files will work out-of-the-box

This fixes the fasta example which was failing to open until now:

image

@bollwyvl
Copy link
Collaborator Author

fixes the fasta example

right, but the more telling thing is:

  • download the fasta
  • re-upload the fasta

I was specifically seeing SVG come out as json, as its Untitled file was starting life as a notebook. I hope to test this out once more, but am pretty slammed these days and might not be able to fix anything i find.

Hate to hold things up, but getting reports like this doesn't work for my niche file format are really boring when the feature is otherwise awesome, and we have a plan for letting owners fix arbitrary formats.

@bollwyvl
Copy link
Collaborator Author

i also haven't tested any of the #655 stuff vs the webrtc backend. if it breaks that, we need to stop and re-think whether we need to be able to put all of the serviceworker stuff behind a build flag.

@bollwyvl
Copy link
Collaborator Author

hm... looks like this is breaking config somehow, e.g. not propagating collaborative...

@jtpio
Copy link
Member

jtpio commented Jun 16, 2022

vs the webrtc backend. if it breaks that, we need to stop and re-think whether we need to be able to put all of the serviceworker stuff behind a build flag.

I tried with the RTD preview for this PR, and editing seems to be working as before:

image

New files and directories created from the kernel are not replicated across peers, but that was also the case before when creating new files from the UI.

Although it's not clear yet how this will work, there will likely be substantial changes needed when updating to JupyterLab 4.0 packages with the RTC logic progressively moving to the server.

@bollwyvl
Copy link
Collaborator Author

files and directories created from the kernel are not replicated across peers

i tried this out too... it looks like they will work, once you open them in both browsers, and somebody decides to accept the Revert option. That's good enough for me!

No further changes planned (other than cleaning up the title of the PR).

@bollwyvl bollwyvl changed the title Add configurable (extra)FileTypes (plus kernel contents) Add configurable fileTypes for upload and HTTP serving Jun 17, 2022
@bollwyvl bollwyvl requested a review from martinRenou June 17, 2022 00:21
@bollwyvl bollwyvl requested a review from jtpio June 17, 2022 00:21
@bollwyvl bollwyvl mentioned this pull request Jun 17, 2022
7 tasks
Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for doing this

Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

More configurable mime types for serving, contents
3 participants