Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
erp5
Commits
5f6e57a8
Commit
5f6e57a8
authored
Oct 12, 2016
by
Hardik Juneja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_webrtc_gadget: update webrtc module to support erp5 as a handshake option
parent
e888d233
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
13 deletions
+77
-13
bt5/erp5_webrtc_gadget/PathTemplateItem/web_page_module/gadget_webrtc_handshake_js.js
...emplateItem/web_page_module/gadget_webrtc_handshake_js.js
+72
-8
bt5/erp5_webrtc_gadget/PathTemplateItem/web_page_module/gadget_webrtc_handshake_js.xml
...mplateItem/web_page_module/gadget_webrtc_handshake_js.xml
+2
-2
bt5/erp5_webrtc_gadget/PathTemplateItem/web_page_module/gadget_webrtc_jio_bridge_js.js
...mplateItem/web_page_module/gadget_webrtc_jio_bridge_js.js
+1
-1
bt5/erp5_webrtc_gadget/PathTemplateItem/web_page_module/gadget_webrtc_jio_bridge_js.xml
...plateItem/web_page_module/gadget_webrtc_jio_bridge_js.xml
+2
-2
No files found.
bt5/erp5_webrtc_gadget/PathTemplateItem/web_page_module/gadget_webrtc_handshake_js.js
View file @
5f6e57a8
...
@@ -45,14 +45,22 @@
...
@@ -45,14 +45,22 @@
g
.
props
=
{};
g
.
props
=
{};
})
})
.
declareMethod
(
'
create_room
'
,
function
(
roomid
)
{
.
declareMethod
(
'
create_room
'
,
function
(
roomid
,
type
)
{
var
gadget
=
this
;
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
})
.
push
(
function
(
jio_gadget
)
{
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
put
(
roomid
,
{});
if
(
type
===
"
erp5
"
)
{
return
jio_gadget
.
post
({
title
:
roomid
,
portal_type
:
"
Webrtc Room
"
,
parent_relative_url
:
"
webrtc_rooms_module
"
});
}
else
{
return
jio_gadget
.
put
(
roomid
,
{});
}
})
})
.
push
(
null
,
function
(
e
){
.
push
(
null
,
function
(
e
){
console
.
log
(
e
);
console
.
log
(
e
);
...
@@ -60,19 +68,29 @@
...
@@ -60,19 +68,29 @@
})
})
.
declareMethod
(
'
register
'
,
function
(
roomid
,
peerid
,
config
)
{
.
declareMethod
(
'
register
'
,
function
(
roomid
,
peerid
,
config
)
{
var
gadget
=
this
;
var
gadget
=
this
,
id
;
gadget
.
props
.
config
=
config
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
createJio
(
gadget
,
config
);
return
createJio
(
gadget
,
config
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
create_room
(
roomid
);
return
gadget
.
create_room
(
roomid
,
config
.
type
);
})
})
.
push
(
function
()
{
.
push
(
function
(
id
)
{
gadget
.
erp5_roomid
=
id
;
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
})
.
push
(
function
(
jio_gadget
)
{
.
push
(
function
(
jio_gadget
)
{
if
(
config
.
type
===
"
erp5
"
)
{
var
url
=
config
.
url
+
"
/
"
+
gadget
.
erp5_roomid
+
"
/WebrtcRoom_storeOfferAnswer
"
;
return
jio_gadget
.
putAttachment
(
gadget
.
erp5_roomid
,
url
,
new
Blob
([
JSON
.
stringify
({
roomid
:
roomid
,
peerid
:
peerid
,
data
:
'
1
'
})]));
}
return
jio_gadget
.
putAttachment
(
roomid
,
peerid
,
''
);
return
jio_gadget
.
putAttachment
(
roomid
,
peerid
,
''
);
});
});
// TODO: create new function, show registered peers?
// TODO: create new function, show registered peers?
...
@@ -86,8 +104,27 @@
...
@@ -86,8 +104,27 @@
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
})
.
push
(
function
(
jio_gadget
)
{
.
push
(
function
(
jio_gadget
)
{
if
(
gadget
.
props
.
config
.
type
===
"
erp5
"
)
{
var
url
=
gadget
.
props
.
config
.
url
+
"
/
"
+
gadget
.
erp5_roomid
+
"
/WebrtcRoom_storeOfferAnswer
"
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
options
.
data
instanceof
Blob
)
{
return
jIO
.
util
.
readBlobAsText
(
options
.
data
);
}
else
{
return
{
target
:{
result
:
options
.
data
}};
}
})
.
push
(
function
(
evt
)
{
return
jio_gadget
.
putAttachment
(
gadget
.
erp5_roomid
,
url
,
new
Blob
([
JSON
.
stringify
({
roomid
:
roomid
,
peerid
:
options
.
name
,
data
:
evt
.
target
.
result
})]));
});
}
return
jio_gadget
.
putAttachment
(
roomid
,
options
.
name
,
options
.
data
);
return
jio_gadget
.
putAttachment
(
roomid
,
options
.
name
,
options
.
data
);
})
})
;
})
})
.
declareMethod
(
'
get_answer
'
,
function
(
roomid
,
attachment
)
{
.
declareMethod
(
'
get_answer
'
,
function
(
roomid
,
attachment
)
{
...
@@ -98,6 +135,11 @@
...
@@ -98,6 +135,11 @@
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
})
.
push
(
function
(
jio_gadget
)
{
.
push
(
function
(
jio_gadget
)
{
if
(
gadget
.
props
.
config
.
type
===
"
erp5
"
)
{
var
url
=
gadget
.
props
.
config
.
url
+
"
/
"
+
gadget
.
erp5_roomid
+
"
/WebrtcRoom_getOfferAnswer?roomid=
"
+
roomid
+
"
&name=
"
+
attachment
;
return
jio_gadget
.
getAttachment
(
gadget
.
erp5_roomid
,
url
);
}
return
jio_gadget
.
getAttachment
(
roomid
,
attachment
);
return
jio_gadget
.
getAttachment
(
roomid
,
attachment
);
});
});
})
})
...
@@ -110,6 +152,23 @@
...
@@ -110,6 +152,23 @@
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
})
.
push
(
function
(
jio_gadget
)
{
.
push
(
function
(
jio_gadget
)
{
if
(
gadget
.
props
.
config
.
type
===
"
erp5
"
)
{
var
url
=
gadget
.
props
.
config
.
url
+
"
/
"
+
gadget
.
erp5_roomid
+
"
/WebrtcRoom_getAllOfferAnswer?roomid=
"
+
roomid
;
return
jio_gadget
.
getAttachment
(
gadget
.
erp5_roomid
,
url
)
.
push
(
function
(
res
)
{
return
jIO
.
util
.
readBlobAsText
(
res
);
})
.
push
(
function
(
evt
)
{
var
res
=
evt
.
target
.
result
.
replace
(
/'/g
,
'
"
'
);
res
=
JSON
.
parse
(
res
);
var
offers
=
{}
for
(
var
i
in
res
)
{
offers
[
res
[
i
]]
=
''
;
}
return
offers
;
});
}
return
jio_gadget
.
allAttachments
(
roomid
);
return
jio_gadget
.
allAttachments
(
roomid
);
});
});
})
})
...
@@ -168,7 +227,7 @@
...
@@ -168,7 +227,7 @@
}
else
{
}
else
{
offers
=
a
;
offers
=
a
;
return
false
;
return
false
;
}
}
});
});
});
});
};
};
...
@@ -184,6 +243,11 @@
...
@@ -184,6 +243,11 @@
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
})
.
push
(
function
(
jio_gadget
)
{
.
push
(
function
(
jio_gadget
)
{
if
(
gadget
.
props
.
config
.
type
===
"
erp5
"
)
{
var
url
=
gadget
.
props
.
config
.
url
+
"
/
"
+
gadget
.
erp5_roomid
+
"
/WebrtcRoom_deleteOfferAnswer?roomid=
"
+
roomid
+
"
&name=
"
+
peerid
+
"
_
"
+
to
;
return
jio_gadget
.
getAttachment
(
gadget
.
erp5_roomid
,
url
);
}
return
jio_gadget
.
removeAttachment
(
roomid
,
peerid
+
"
_
"
+
to
);
return
jio_gadget
.
removeAttachment
(
roomid
,
peerid
+
"
_
"
+
to
);
});
});
});
});
...
...
bt5/erp5_webrtc_gadget/PathTemplateItem/web_page_module/gadget_webrtc_handshake_js.xml
View file @
5f6e57a8
...
@@ -222,7 +222,7 @@
...
@@ -222,7 +222,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.
14301.62370.56661
</string>
</value>
<value>
<string>
954.
35891.65212.64409
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
5066759.3
5
</float>
<float>
147
6275774.4
5
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_webrtc_gadget/PathTemplateItem/web_page_module/gadget_webrtc_jio_bridge_js.js
View file @
5f6e57a8
...
@@ -258,7 +258,7 @@
...
@@ -258,7 +258,7 @@
// TODO: have a array for channel_defer for concurency?
// TODO: have a array for channel_defer for concurency?
gadget
.
props
.
channel_defer
=
RSVP
.
defer
();
gadget
.
props
.
channel_defer
=
RSVP
.
defer
();
for
(
var
offer
in
offers
)
{
for
(
var
offer
in
offers
)
{
jsonOffer
=
JSON
.
parse
(
offers
[
offer
]);
jsonOffer
=
JSON
.
parse
(
offers
[
offer
]);
if
(
jsonOffer
.
action
===
"
offer
"
)
{
if
(
jsonOffer
.
action
===
"
offer
"
)
{
gadget
.
props
.
counter
+=
1
;
gadget
.
props
.
counter
+=
1
;
connections
.
push
(
connectCallback
(
jsonOffer
,
handler_gadget
));
connections
.
push
(
connectCallback
(
jsonOffer
,
handler_gadget
));
...
...
bt5/erp5_webrtc_gadget/PathTemplateItem/web_page_module/gadget_webrtc_jio_bridge_js.xml
View file @
5f6e57a8
...
@@ -222,7 +222,7 @@
...
@@ -222,7 +222,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.
14300.3742.31044
</string>
</value>
<value>
<string>
954.
35841.9537.7133
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
147
5066648.69
</float>
<float>
147
6272709.15
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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