Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
coco
Commits
40d8bab1
Commit
40d8bab1
authored
Apr 06, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
[Update] merge
parents
dcc74364
55d16aeb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
httpd.py
coco/httpd.py
+21
-6
No files found.
coco/httpd.py
View file @
40d8bab1
...
...
@@ -159,20 +159,35 @@ class ProxyNamespace(BaseNamespace):
def
on_token
(
self
,
message
):
# 此处获取token含有的主机的信息
logger
.
debug
(
"On token trigger"
)
logger
.
debug
(
message
)
token
=
message
.
get
(
'token'
,
None
)
secret
=
message
.
get
(
'secret'
,
None
)
user_id
=
message
.
get
(
'user'
,
None
)
self
.
current_user
=
self
.
app
.
service
.
get_user_profile
(
user_id
)
host
=
self
.
app
.
service
.
get_token_asset
(
token
)
.
json
()
connection
=
str
(
uuid
.
uuid4
())
self
.
emit
(
'room'
,
{
'room'
:
connection
,
'secret'
:
secret
})
if
not
(
token
or
secret
):
logger
.
debug
(
"token or secret is None"
)
self
.
emit
(
'data'
,
{
'data'
:
"
\n
Operation not permitted!"
,
'room'
:
connection
})
self
.
emit
(
'disconnect'
)
return
None
host
=
self
.
app
.
service
.
get_token_asset
(
token
)
logger
.
debug
(
host
)
if
not
host
:
logger
.
debug
(
"host is None"
)
self
.
emit
(
'data'
,
{
'data'
:
"
\n
Operation not permitted!"
,
'room'
:
connection
})
self
.
emit
(
'disconnect'
)
return
None
user_id
=
host
.
get
(
'user'
,
None
)
logger
.
debug
(
"self.current_user"
)
self
.
current_user
=
self
.
app
.
service
.
get_user_profile
(
user_id
)
logger
.
debug
(
self
.
current_user
)
# {
# "user": {UUID},
# "asset": {UUID},
# "system_user": {UUID}
# }
connection
=
str
(
uuid
.
uuid4
())
self
.
emit
(
'room'
,
{
'room'
:
connection
,
'secret'
:
secret
})
self
.
on_host
({
'secret'
:
secret
,
'uuid'
:
host
[
'asset'
],
'userid'
:
host
[
'system_user'
]})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment