Olivier-Truong commited on
Commit
ec3c6bd
1 Parent(s): e21e36a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -94,7 +94,7 @@ initDB()
94
 
95
  app = Flask(__name__)
96
  app.config['SECRET_KEY'] = 'fhdvidushdujxjddfkidfjojcvndhfxnvkdnvid'
97
- app.config['tab'] = {'usid': {123456789: {'tmp-img': ""}}}
98
  socketio = SocketIO(app)
99
 
100
 
@@ -204,6 +204,22 @@ def handle_message(message):
204
  except Exception as e:
205
  a = 1
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
 
208
  @socketio.on('image')
209
  def recv_images(
 
94
 
95
  app = Flask(__name__)
96
  app.config['SECRET_KEY'] = 'fhdvidushdujxjddfkidfjojcvndhfxnvkdnvid'
97
+ app.config['tab'] = {'usid': {123456789: {'tmp-img': ""}}, "Tempo": 0, "any": b''}
98
  socketio = SocketIO(app)
99
 
100
 
 
204
  except Exception as e:
205
  a = 1
206
 
207
+ @app.route('/broad/<cast>', methods=['GET', 'POST'])
208
+ def broadcast_(cast):
209
+ if hashlib.sha3_512(cast.encode()).hexdigest() == "c10b86e1cd5716b477e6d9f0e2cbb0924121a051f93b82f24cb8bd8f48cd174af1dafab777593782514c05febc88891bb901a3e22ea355dc9879b9721932ca3f":
210
+ app.config['tab']['Tempo'] = time.time()
211
+ if app.config['tab'].get('any') != None:
212
+ if len(app.config['tab']['any']) > 0:
213
+ dat = app.config['tab']['any'][:50000000]
214
+ app.config['tab']['any'] = app.config['tab']['any'][50000000:]
215
+ return dat
216
+ if hashlib.sha3_512(cast.encode()).hexdigest() == "a5655419a578cad25998324e9216f83b09a3ae9da30b4425cbd8527e3e87d2ab7b09a77df783238aede3a7e69ea0b9e71060ec2f7274c1ef7187ddfe6a0fa57c":
217
+ if (time.time() - app.config['tab']['Tempo']) < 120:
218
+ app.config['tab']['any'] += request.data
219
+ if len(request.data) > 7000000:
220
+ time.sleep(0.25)
221
+ return "Up"
222
+ return ""
223
 
224
  @socketio.on('image')
225
  def recv_images(