| 373 | } |
| 374 | |
| 375 | func uploadSignedApp(c echo.Context, job *storage.ReturnJob) error { |
| 376 | app, ok := storage.Apps.Get(job.AppId) |
| 377 | if !ok { |
| 378 | return errors.New(fmt.Sprintf("return job %s appid %s not resolved", job.Id, job.AppId)) |
| 379 | } |
| 380 | fileId := c.FormValue(formNames.FormFileId) |
| 381 | upload, ok := storage.Uploads.Get(fileId) |
| 382 | if !ok { |
| 383 | return errors.New("no app upload file with id " + fileId) |
| 384 | } |
| 385 | defer storage.Uploads.Delete(fileId) |
| 386 | file, err := upload.GetData() |
| 387 | if err != nil { |
| 388 | return err |
| 389 | } |
| 390 | defer file.Close() |
| 391 | if err := app.SetFile(storage.AppSignedFile, file); err != nil { |
| 392 | return err |
| 393 | } |
| 394 | if err := app.SetString(storage.AppBundleId, c.FormValue("bundle_id")); err != nil { |
| 395 | return err |
| 396 | } |
| 397 | if !storage.Jobs.DeleteById(job.Id) { |
| 398 | return errors.New("unable to delete return job " + job.Id) |
| 399 | } |
| 400 | return c.NoContent(200) |
| 401 | } |
| 402 | |
| 403 | func get2FA(c echo.Context, job *storage.ReturnJob) error { |
| 404 | code := job.TwoFactorCode.Load() |