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
a21d562b
Unverified
Commit
a21d562b
authored
Feb 01, 2018
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: token to asset
parent
c1813021
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
httpd.py
coco/httpd.py
+15
-2
No files found.
coco/httpd.py
View file @
a21d562b
...
@@ -126,11 +126,12 @@ class ProxyNamespace(BaseNamespace):
...
@@ -126,11 +126,12 @@ class ProxyNamespace(BaseNamespace):
connection
=
str
(
uuid
.
uuid4
())
connection
=
str
(
uuid
.
uuid4
())
asset_id
=
message
.
get
(
'uuid'
,
None
)
asset_id
=
message
.
get
(
'uuid'
,
None
)
user_id
=
message
.
get
(
'userid'
,
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
:
if
not
asset_id
or
not
user_id
:
self
.
on_connect
()
#
self.on_connect()
return
return
asset
=
self
.
app
.
service
.
get_asset
(
asset_id
)
asset
=
self
.
app
.
service
.
get_asset
(
asset_id
)
...
@@ -155,6 +156,18 @@ class ProxyNamespace(BaseNamespace):
...
@@ -155,6 +156,18 @@ class ProxyNamespace(BaseNamespace):
asset
,
system_user
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
):
def
on_resize
(
self
,
message
):
cols
=
message
.
get
(
'cols'
)
cols
=
message
.
get
(
'cols'
)
rows
=
message
.
get
(
'rows'
)
rows
=
message
.
get
(
'rows'
)
...
...
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