Performance:
to improve performance dont call function_exists every time, but store a vec with all available plugin hooks
load plugins immediately on startup, so they can be initialized in the background while lemmy initializes the db, runs migrations etc
Load plugin metadata in parallel
for plugin in LemmyPlugins :: get_or_init ( ) . 0 {
New features (there are a lot of possibilities):
move plugin configuration to a database table and support live reloading
add plugin ui for admins to lemmy-ui with:
list of installed plugins
config for each plugin
list of available plugins to install (hosted on join-lemmy.ml or federated)
plugin stats (which hooks active, how often called, how long execution time)
add more plugin hooks
http endpoints like GET /api/v4/plugin/*name*/ are forwarded to plugin hook http_call(req: HttpRequest): HttpResponse
plugins can make db queries via host function , eg for vote analysis ([0.19] Implement API for analytics of votes given by a person #5669 )
Performance:
function_existsevery time, but store a vec with all available plugin hookslemmy/crates/api/api_utils/src/plugins.rs
Line 113 in 9d98c82
New features (there are a lot of possibilities):
GET /api/v4/plugin/*name*/are forwarded to plugin hookhttp_call(req: HttpRequest): HttpResponse