3 ms·
Nice, I'm building a plugin system for my webapp too! I gave up completely on security [0] though because my plugins want DOM access, and may possibly manipulat
by AlexErrant 4y ago
Nice, I'm building a plugin system for my webapp too! I gave up completely on security [0] though because my plugins want DOM access, and may possibly manipulate elements outside their specific control, so I was like "fuck it". Thankfully there's a clear difference between my webapp and website, so hopefully I'll be able to educate my users to not trust stuff on the app side. We'll see :|
Separately, how are you thinking about designing your plugin system? I built a PoC here [1] that basically revolves around combining a DI container with the decorator pattern. We start with an initial default DI container/object, then that container is passed to a plugin which wraps certain methods or adds new ones. That new container is then passed to the next plugin which wraps it, etc, etc. Actual implementation is here [2]. The only thing that sucks about my design is that plugins must call `.bind(this)` when wrapping a method. So basically plugins have unfettered access to my DI container. Perhaps I'm giving plugins too much power? :shrug_shoulders:
0: https://github.com/AlexErrant/Pentive/blob/main/design-decisions/frontend.md#plugins https://github.com/AlexErrant/Pentive/blob/main/design-decis...
1: https://github.com/AlexErrant/Pentive/blob/main/app/src/plugin-manager.proof-of-concept.ts https://github.com/AlexErrant/Pentive/blob/main/app/src/plug...
2: https://github.com/AlexErrant/Pentive/blob/main/app/src/plugin-manager.ts https://github.com/AlexErrant/Pentive/blob/main/app/src/plug...
- turblety 4y agoI'm not too sure right now about the design of the plugin system, but I'm thinking it'll just be setting a bunch of JSON data, declaring how elements/menus/pages will behave. Still need to work on this part.