()
| 30 | |
| 31 | @server.route("/upload", methods=["POST"]) |
| 32 | def upload(): |
| 33 | access, err = validate.token(request) |
| 34 | |
| 35 | if err: |
| 36 | unauth_count.inc() |
| 37 | return err |
| 38 | |
| 39 | access = json.loads(access) |
| 40 | |
| 41 | if access["admin"]: |
| 42 | if len(request.files) > 1 or len(request.files) < 1: |
| 43 | return "exactly 1 file required", 400 |
| 44 | |
| 45 | for _, f in request.files.items(): |
| 46 | err = util.upload(f, fs_videos, channel, access) |
| 47 | |
| 48 | if err: |
| 49 | return err |
| 50 | |
| 51 | return "success!", 200 |
| 52 | else: |
| 53 | return "not authorized", 401 |
| 54 | |
| 55 | @server.route("/download", methods=["GET"]) |
| 56 | def download(): |
nothing calls this directly
no outgoing calls
no test coverage detected