gitignore change,

fix response status for create room
master
Mustafa Yontar 5 years ago
parent 5a1062aaa0
commit cebcb79759
  1. 1
      .gitignore
  2. 26
      app.py

1
.gitignore vendored

@ -6,6 +6,7 @@ __pycache__/
# C extensions
*.so
.venv/
static/
.idea/
# Distribution / packaging
.Python

@ -1,7 +1,9 @@
import argparse
import base64
import json
import os
from getpass import getpass
from pathlib import Path
from random import randint
import sh
from flask import Flask, request, jsonify
@ -89,6 +91,28 @@ def room(rid):
return jsonify({'rid': r.room_id, "can_modify": False})
@app.route('/api/upload', methods=('POST',))
@jwt_required
def upload_file():
file = request.json.get('file')
file_name = request.json.get('file_name')
file_content = base64.b64decode(file)
with open("static/{}".format(file_name), "wb+") as f:
f.write(file_content)
return "ok"
@app.route('/api/files')
@jwt_required
def get_file():
p = Path("./static")
files = []
for i in p.glob("*.*"):
files.append(i.name)
return jsonify(files)
@app.route('/api/create/room', methods=['POST'])
@jwt_required
def create_room():
@ -120,7 +144,7 @@ def create_room():
have_room = False
room.ridn = ridn
room.save()
return jsonify({"msg": "seccess", "ridn": ridn}), 00
return jsonify({"msg": "seccess", "ridn": ridn}), 200
else:
return jsonify({"msg": "You don't have a this access"}), 403

Loading…
Cancel
Save