feat: token to asset

parent c1813021
......@@ -126,11 +126,12 @@ class ProxyNamespace(BaseNamespace):
connection = str(uuid.uuid4())
asset_id = message.get('uuid', None)
user_id = message.get('userid', None)
secret = message.get('secret', None)
self.emit('room', {'room': connection, 'secret': message['secret']})
self.emit('room', {'room': connection, 'secret': secret})
if not asset_id or not user_id:
self.on_connect()
# self.on_connect()
return
asset = self.app.service.get_asset(asset_id)
......@@ -155,6 +156,18 @@ class ProxyNamespace(BaseNamespace):
asset, system_user
)
def on_token(self, message):
# 此处获取token含有的主机的信息
token = message.get('token', None)
secret = message.get('secret', None)
host = self.app.service.get_token_asset(token)
# {
# "user": {UUID},
# "asset": {UUID},
# "system_user": {UUID}
# }
self.on_host({'secret': secret, 'uuid': host['asset'], 'userid': host['system_user']})
def on_resize(self, message):
cols = message.get('cols')
rows = message.get('rows')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment