Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
34b21a25
Commit
34b21a25
authored
Mar 22, 2022
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add preference forceRelay.
This may be useful to get around network blocks in some cases.
parent
4053d9ca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
static/galene.js
static/galene.js
+18
-0
static/protocol.js
static/protocol.js
+24
-2
No files found.
static/galene.js
View file @
34b21a25
...
@@ -47,6 +47,7 @@ let token = null;
...
@@ -47,6 +47,7 @@ let token = null;
* @property {string} [filter]
* @property {string} [filter]
* @property {boolean} [preprocessing]
* @property {boolean} [preprocessing]
* @property {boolean} [hqaudio]
* @property {boolean} [hqaudio]
* @property {boolean} [forceRelay]
*/
*/
/** @type{settings} */
/** @type{settings} */
...
@@ -324,6 +325,22 @@ async function gotConnected(username) {
...
@@ -324,6 +325,22 @@ async function gotConnected(username) {
}
}
}
}
/**
* @this {ServerConnection}
* @param {boolean} up
*/
function
onPeerConnection
(
up
)
{
if
(
!
getSettings
().
forceRelay
)
return
null
;
let
old
=
this
.
rtcConfiguration
;
/** @type {RTCConfiguration} */
let
conf
=
{};
for
(
let
key
in
old
)
conf
[
key
]
=
old
[
key
];
conf
.
iceTransportPolicy
=
'
relay
'
;
return
conf
;
}
/**
/**
* @this {ServerConnection}
* @this {ServerConnection}
* @param {number} code
* @param {number} code
...
@@ -3827,6 +3844,7 @@ async function serverConnect() {
...
@@ -3827,6 +3844,7 @@ async function serverConnect() {
serverConnection
.
close
();
serverConnection
.
close
();
serverConnection
=
new
ServerConnection
();
serverConnection
=
new
ServerConnection
();
serverConnection
.
onconnected
=
gotConnected
;
serverConnection
.
onconnected
=
gotConnected
;
serverConnection
.
onpeerconnection
=
onPeerConnection
;
serverConnection
.
onclose
=
gotClose
;
serverConnection
.
onclose
=
gotClose
;
serverConnection
.
ondownstream
=
gotDownStream
;
serverConnection
.
ondownstream
=
gotDownStream
;
serverConnection
.
onuser
=
gotUser
;
serverConnection
.
onuser
=
gotUser
;
...
...
static/protocol.js
View file @
34b21a25
...
@@ -151,6 +151,14 @@ function ServerConnection() {
...
@@ -151,6 +151,14 @@ function ServerConnection() {
* @type{(this: ServerConnection, code: number, reason: string) => void}
* @type{(this: ServerConnection, code: number, reason: string) => void}
*/
*/
this
.
onclose
=
null
;
this
.
onclose
=
null
;
/**
* onpeerconnection is called before we establish a new peer connection.
* It may either return null, or a new RTCConfiguration that overrides
* the value obtained from the server.
*
* @type{(this: ServerConnection, up: boolean) => RTCConfiguration}
*/
this
.
onpeerconnection
=
null
;
/**
/**
* onuser is called whenever a user in the group changes. The users
* onuser is called whenever a user in the group changes. The users
* array has already been updated.
* array has already been updated.
...
@@ -512,6 +520,19 @@ ServerConnection.prototype.findByLocalId = function(localId) {
...
@@ -512,6 +520,19 @@ ServerConnection.prototype.findByLocalId = function(localId) {
return
null
;
return
null
;
}
}
/**
* @param {boolean} up
* @returns {RTCConfiguration}
*/
ServerConnection
.
prototype
.
getRTCConfiguration
=
function
(
up
)
{
if
(
this
.
onpeerconnection
)
{
let
conf
=
this
.
onpeerconnection
.
call
(
this
,
up
);
if
(
conf
!==
null
)
return
conf
;
}
return
this
.
rtcConfiguration
;
}
/**
/**
* newUpStream requests the creation of a new up stream.
* newUpStream requests the creation of a new up stream.
*
*
...
@@ -529,7 +550,8 @@ ServerConnection.prototype.newUpStream = function(localId) {
...
@@ -529,7 +550,8 @@ ServerConnection.prototype.newUpStream = function(localId) {
if
(
typeof
RTCPeerConnection
===
'
undefined
'
)
if
(
typeof
RTCPeerConnection
===
'
undefined
'
)
throw
new
Error
(
"
This browser doesn't support WebRTC
"
);
throw
new
Error
(
"
This browser doesn't support WebRTC
"
);
let
pc
=
new
RTCPeerConnection
(
sc
.
rtcConfiguration
);
let
pc
=
new
RTCPeerConnection
(
sc
.
getRTCConfiguration
(
true
));
if
(
!
pc
)
if
(
!
pc
)
throw
new
Error
(
"
Couldn't create peer connection
"
);
throw
new
Error
(
"
Couldn't create peer connection
"
);
...
@@ -685,7 +707,7 @@ ServerConnection.prototype.gotOffer = async function(id, label, source, username
...
@@ -685,7 +707,7 @@ ServerConnection.prototype.gotOffer = async function(id, label, source, username
if
(
!
c
)
{
if
(
!
c
)
{
let
pc
;
let
pc
;
try
{
try
{
pc
=
new
RTCPeerConnection
(
sc
.
rtcConfiguration
);
pc
=
new
RTCPeerConnection
(
sc
.
getRTCConfiguration
(
false
)
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
);
console
.
error
(
e
);
sc
.
send
({
sc
.
send
({
...
...
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