fds
This commit is contained in:
parent
29b0bcd9f9
commit
60724a744e
1 changed files with 13 additions and 14 deletions
|
@ -14,20 +14,19 @@ def chat( v):
|
||||||
return render_template("chat.html", v=v)
|
return render_template("chat.html", v=v)
|
||||||
|
|
||||||
|
|
||||||
if "load_chat" in sys.argv:
|
sex = SocketIO(app)
|
||||||
sex = SocketIO(app)
|
|
||||||
|
|
||||||
@sex.on('speak')
|
@sex.on('speak')
|
||||||
@auth_required
|
@auth_required
|
||||||
def speak(data, v):
|
def speak(data, v):
|
||||||
|
|
||||||
data={
|
data={
|
||||||
"avatar": v.profile_url,
|
"avatar": v.profile_url,
|
||||||
"username":v.username,
|
"username":v.username,
|
||||||
"text":sanitize(data[:1000].strip()),
|
"text":sanitize(data[:1000].strip()),
|
||||||
"time": time.strftime("%d %b %Y at %H:%M:%S", time.gmtime(int(time.time()))),
|
"time": time.strftime("%d %b %Y at %H:%M:%S", time.gmtime(int(time.time()))),
|
||||||
"userlink":v.url
|
"userlink":v.url
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('speak', data)
|
emit('speak', data)
|
||||||
return '', 204
|
return '', 204
|
Loading…
Add table
Add a link
Reference in a new issue