(res http.ResponseWriter, req *http.Request)
| 140 | } |
| 141 | |
| 142 | func StartOpencloudHandler(res http.ResponseWriter, req *http.Request) { |
| 143 | if req.Method != http.MethodPost { |
| 144 | sendResponse(res, http.StatusMethodNotAllowed, "") |
| 145 | return |
| 146 | } |
| 147 | |
| 148 | if opencloud.IsOpencloudRunning() { |
| 149 | sendResponse(res, http.StatusConflict, "opencloud server is already running") |
| 150 | return |
| 151 | } |
| 152 | |
| 153 | common.Wg.Add(1) |
| 154 | go opencloud.Start(nil) |
| 155 | |
| 156 | success, message := opencloud.WaitForConnection() |
| 157 | if success { |
| 158 | sendResponse(res, http.StatusOK, message) |
| 159 | return |
| 160 | } |
| 161 | |
| 162 | sendResponse(res, http.StatusInternalServerError, message) |
| 163 | } |
| 164 | |
| 165 | func CommandHandler(res http.ResponseWriter, req *http.Request) { |
| 166 | if req.Method != http.MethodPost { |
nothing calls this directly
no test coverage detected