freeCodeCamp / CodeAlly-CodeRoad-freeCodeCamp

10 stars 5 forks source link

Tutorials should perserve the progress across container sessions. #32

Closed AdamZaczek closed 2 years ago

AdamZaczek commented 3 years ago

Describe the bug Progress in the tutorial is lost if the user stops the session and comes back again later on. The progress is stored in localStorage and should be stored in a file instead.

To Reproduce Steps to reproduce the behavior:

  1. Open a tutorial
  2. Make some progress
  3. Open another tutorial
  4. Go back to the first tutorial
  5. See that the progress is lost

Expected behavior Progress should be persisted

Additional context We need to know where is the progress stored and read so we can apply the fix @ShMcK. Thanks in advance!

ShMcK commented 3 years ago

My initial thoughts:

Considerations:

AdamZaczek commented 3 years ago

I agree with your implementation thoughts,

Regarding considerations: We should not write to the workplace directory or it will mess with Git Agreed

We may hit permissions errors in VSCode or Node when trying to write to a file outside of the workplace We already tested this in another case and it works as long as the final file path is not protected. It won't be once we pass the proper CODEROAD_SESSION_FILE_PATH variable.

We may hit file system permission errors if the process does not have to write or read access As above

The file should be read as text and validated as it could be a vector for attack Good point!

Do you want to handle the Coderoad part of the task? We will provide you with the env variable.

ShMcK commented 3 years ago

I think I can handle the CodeRoad part, I have a basic implementation ready (see PR above). But I'll test it more and adjust.

ShMcK commented 3 years ago

Now published in CodeRoad v0.16 on open-vsx.

To make it work, add the following env var: CODEROAD_SESSION_STORAGE_PATH and pass in the path to the folder where session can be stored.

AdamZaczek commented 3 years ago

Awesome, I'm handling this today!

AdamZaczek commented 3 years ago

This feature probably causes https://github.com/freeCodeCamp/CodeAlly-CodeRoad-freeCodeCamp/issues/33 to happen. Needs investigation.

AdamZaczek commented 2 years ago

Just a heads up - this is already updated according to @ShMcK's suggestion from #33.

AdamZaczek commented 2 years ago

This is already working @moT01, thanks to Shawn pointing out a missing env variables issue when continuing an existing project.

Closing!