(c *gin.Context, err error)
| 32 | const maxTaskPluginSourceBytes = 8 << 20 |
| 33 | |
| 34 | func taskPluginCompileError(c *gin.Context, err error) { |
| 35 | var unknownField *jsplugin.UnknownMetaFieldError |
| 36 | if errors.As(err, &unknownField) { |
| 37 | common.ApiErrorT(c, "Plugin metadata contains an unknown field \"{{field}}\". If this plugin was downloaded from the official marketplace, it may require a newer version of new-api. Try updating new-api and installing the plugin again.", map[string]any{"field": unknownField.Field}) |
| 38 | return |
| 39 | } |
| 40 | common.ApiError(c, err) |
| 41 | } |
| 42 | |
| 43 | type taskPluginUploadRequest struct { |
| 44 | Source string `json:"source" binding:"required"` |
no test coverage detected