Skip to content

Protected API endpoint for running ml5.js example upload script #1773

Closed as not planned
@bomanimc

Description

@bomanimc

Hi!

@catarak, thanks for your help reviewing and debugging #1762!

The majority of or ml5.js PR contributions are to our examples. Our examples are hosted on a custom website but are primarily viewed using the p5.js Web Editor. To support more rapid deployment of example changes, it'd be helpful to be able to update the public examples on the p5.js Web Editor as soon as we merge in new contributions. The upcoming Public API for the p5.js Web Editor will solve this, but until it's released, uploading new scripts to the p5js Web Editor requires someone from the ml5.js team typically will need to contact @catarak (or another person with server access to the p5.js web editor) to run the script on the production servers.

In the interim period prior to the launch of the Public API, one idea I wanted to propose was adding a password-protected endpoint to the p5.js Web Editor server (i.e. /upload-ml5-examples) that simply runs the upload script we revised in #1762. A few considerations I thought of regarding this approach:

Pros

  • Give the ml5.js team a way to update the p5.js web editor scripts on a more frequent basis without adding more work to @catarak's plate!
  • Fairly lightweight stop-gap solution that can easily be deleted when the Public API is released in the future since the endpoint will have very few users.

Cons

  • It may be too much of a special case that potentially sets a precedent for an approach to running server-side scripts that would be best to avoid long-term.
  • Possible risk of the endpoint credentials getting leaked and too many requests being sent to the p5 web editor servers that run this (presumably) heavy script.
    • This could be addressed by adding a rate limiter on the endpoint and ensuring that the credentials are only shared with a few primary software maintainers on the ml5.js team.

What do others think? The cons here are valid, so I totally understand if it'd be preferable not to move forward with this change. If this idea sounds good though, I'd be happy to submit a PR for this change!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions