get all plugins (TODO: filtering)
(
State(state): State<AppState>,
Extension(maybe_session): Extension<OptionalSession>,
)
| 58 | |
| 59 | // get all plugins (TODO: filtering) |
| 60 | pub async fn get_published_public_plugins( |
| 61 | State(state): State<AppState>, |
| 62 | Extension(maybe_session): Extension<OptionalSession>, |
| 63 | ) -> ApiResult<Json<Vec<PluginResponse>>> { |
| 64 | let plugins = state |
| 65 | .db |
| 66 | .get_published_public_plugins() |
| 67 | .await |
| 68 | .map_err(|err| { |
| 69 | error!(?err, "failed fetching plugins"); |
| 70 | ApiErrorResponse::InternalError |
| 71 | })?; |
| 72 | |
| 73 | let plugins = fetch_plugin_authors( |
| 74 | &state.discord_config, |
| 75 | maybe_session.as_ref().map(|v| &v.session.user), |
| 76 | &plugins, |
| 77 | ) |
| 78 | .await?; |
| 79 | |
| 80 | Ok(Json(plugins)) |
| 81 | } |
| 82 | |
| 83 | // get user plugins |
| 84 | pub async fn get_user_plugins( |
nothing calls this directly
no test coverage detected