Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work for #5 and (possible duplicate) #29
Created a base system to have plugins :D
Plugins will be located in
backend/plugins
, they need to be added to theindex.mjs
file so expanse can read them.Comments with an example were included :P
I required the plugins to have some functions that expanse will call at some point.
The current ones are:
getId()
to identify the plugin (ideally would be unique for future usages)receiveItem(item)
for the plugin to process items that are saved in the DB, regardless of from which user it came fromreceiveUserItem(user, category, item, config)
for the plugin to process items of a user.getAvailableConfig()
for future usage to be able to template a config screen for the user.An example of how it works can be found in my fork for ImgBB :3
So, this is a base implementation, there is some stuff that I want to improve/implement:
This is where the uniqueness of
getId()
will be in play.This is where
getAvailableConfig()
to get an object with the possible properties to configure plus possible values and more stuff to create a dynamic form for the user.Also in here the DB will need to be updated with a new table to store the plugin configuration for each user, then it'll be sent as the last parameter of
receiveUserItem
I need help with something! 😓
In my fork I'm using SQLite, so can someone please test that the function
get_items(ids)
works well with postgres?