| 88 | } |
| 89 | |
| 90 | func postCommunityPluginInstall(installsURL string, body []byte) bool { |
| 91 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |
| 92 | defer cancel() |
| 93 | request, err := http.NewRequestWithContext(ctx, http.MethodPost, installsURL, bytes.NewReader(body)) |
| 94 | if err != nil { |
| 95 | return false |
| 96 | } |
| 97 | request.Header.Set("Content-Type", "application/json") |
| 98 | response, err := http.DefaultClient.Do(request) |
| 99 | if err != nil { |
| 100 | return false |
| 101 | } |
| 102 | _ = response.Body.Close() |
| 103 | return true |
| 104 | } |
| 105 | |
| 106 | func UploadTaskPlugin(c *gin.Context) { |
| 107 | var request taskPluginUploadRequest |