momentum-xyz / ubercontroller

New controller
GNU Affero General Public License v3.0
9 stars 1 forks source link

extend media manager to handle scripts for the FE plugins #282

Closed antst closed 1 year ago

antst commented 1 year ago

Add handling of FE plugins to the media managing subsystem in the UC 1) Add EPs to store/retrieve. Similar to assets, but named "feplugin" 2) it should check that file type corresponds to what it should be in case of FE plugin (presumably JS, but check up with Mitia)

dmitry-yudakov commented 1 year ago

I'd suggest a more generic approach of plugin as the plugin is a archive/directory with manifest.json or metadata.json in it along with bunch of files.

antst commented 1 year ago

Details:

Plugins are uploaded a tar.gz bundle. Archive must have present fine manifest.json

Media-manager needs: 1) to have another directory, where it stores plugins (similar to directories for other assets)

2) PUT endpoint: on upload of plugin, MM has to check file-type (tar.gz), and then creates subdirectory with name which is md5 hash of the tar.gz archive (similar to what we do with the rest), then try to unarchive bundle to this directory and check that there is present file "manifest.json". if OK then plugin is accepted, if not, then abort, and delete subdirectory 3) once plugin is uploaded then we need to register in DB (pending to happen in outer UC bits) 4) GET endpoint: media.GET("/render/plugin/:directory/:filepath", n.apiMediaGetPluginFile), returns a file ":filepath" from ":directory" (which is hash)

dmitry-yudakov commented 1 year ago

implemented in #289