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
4bc873a5
Commit
4bc873a5
authored
Sep 01, 2022
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Publish websocket endpoint in group status.
parent
4e275a63
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
8 deletions
+24
-8
group/group.go
group/group.go
+4
-2
rtpconn/webclient.go
rtpconn/webclient.go
+2
-2
static/galene.js
static/galene.js
+6
-1
webserver/webserver.go
webserver/webserver.go
+12
-3
No files found.
group/group.go
View file @
4bc873a5
...
@@ -1177,6 +1177,7 @@ func (desc *Description) GetPermission(group string, creds ClientCredentials) (s
...
@@ -1177,6 +1177,7 @@ func (desc *Description) GetPermission(group string, creds ClientCredentials) (s
type
Status
struct
{
type
Status
struct
{
Name
string
`json:"name"`
Name
string
`json:"name"`
Endpoint
string
`json:"endpoint"`
DisplayName
string
`json:"displayName,omitempty"`
DisplayName
string
`json:"displayName,omitempty"`
Description
string
`json:"description,omitempty"`
Description
string
`json:"description,omitempty"`
AuthServer
string
`json:"authServer,omitempty"`
AuthServer
string
`json:"authServer,omitempty"`
...
@@ -1185,10 +1186,11 @@ type Status struct {
...
@@ -1185,10 +1186,11 @@ type Status struct {
ClientCount
*
int
`json:"clientCount,omitempty"`
ClientCount
*
int
`json:"clientCount,omitempty"`
}
}
func
(
g
*
Group
)
Status
(
authentified
bool
)
Status
{
func
(
g
*
Group
)
Status
(
authentified
bool
,
endpoint
string
)
Status
{
desc
:=
g
.
Description
()
desc
:=
g
.
Description
()
d
:=
Status
{
d
:=
Status
{
Name
:
g
.
name
,
Name
:
g
.
name
,
Endpoint
:
endpoint
,
DisplayName
:
desc
.
DisplayName
,
DisplayName
:
desc
.
DisplayName
,
AuthServer
:
desc
.
AuthServer
,
AuthServer
:
desc
.
AuthServer
,
AuthPortal
:
desc
.
AuthPortal
,
AuthPortal
:
desc
.
AuthPortal
,
...
@@ -1209,7 +1211,7 @@ func GetPublic() []Status {
...
@@ -1209,7 +1211,7 @@ func GetPublic() []Status {
gs
:=
make
([]
Status
,
0
)
gs
:=
make
([]
Status
,
0
)
Range
(
func
(
g
*
Group
)
bool
{
Range
(
func
(
g
*
Group
)
bool
{
if
g
.
Description
()
.
Public
{
if
g
.
Description
()
.
Public
{
gs
=
append
(
gs
,
g
.
Status
(
false
))
gs
=
append
(
gs
,
g
.
Status
(
false
,
""
))
}
}
return
true
return
true
})
})
...
...
rtpconn/webclient.go
View file @
4bc873a5
...
@@ -1148,7 +1148,7 @@ func handleAction(c *webClient, a interface{}) error {
...
@@ -1148,7 +1148,7 @@ func handleAction(c *webClient, a interface{}) error {
if
a
.
group
!=
""
{
if
a
.
group
!=
""
{
g
:=
group
.
Get
(
a
.
group
)
g
:=
group
.
Get
(
a
.
group
)
if
g
!=
nil
{
if
g
!=
nil
{
s
:=
g
.
Status
(
true
)
s
:=
g
.
Status
(
true
,
""
)
status
=
&
s
status
=
&
s
data
=
g
.
Data
()
data
=
g
.
Data
()
}
}
...
@@ -1170,7 +1170,7 @@ func handleAction(c *webClient, a interface{}) error {
...
@@ -1170,7 +1170,7 @@ func handleAction(c *webClient, a interface{}) error {
return
errors
.
New
(
"Permissions changed in no group"
)
return
errors
.
New
(
"Permissions changed in no group"
)
}
}
perms
:=
append
([]
string
(
nil
),
c
.
permissions
...
)
perms
:=
append
([]
string
(
nil
),
c
.
permissions
...
)
status
:=
g
.
Status
(
true
)
status
:=
g
.
Status
(
true
,
""
)
c
.
write
(
clientMessage
{
c
.
write
(
clientMessage
{
Type
:
"joined"
,
Type
:
"joined"
,
Kind
:
"change"
,
Kind
:
"change"
,
...
...
static/galene.js
View file @
4bc873a5
...
@@ -3431,7 +3431,12 @@ async function serverConnect() {
...
@@ -3431,7 +3431,12 @@ async function serverConnect() {
serverConnection
.
onusermessage
=
gotUserMessage
;
serverConnection
.
onusermessage
=
gotUserMessage
;
serverConnection
.
onfiletransfer
=
gotFileTransfer
;
serverConnection
.
onfiletransfer
=
gotFileTransfer
;
let
url
=
`ws
${
location
.
protocol
===
'
https:
'
?
'
s
'
:
''
}
://
${
location
.
host
}
/ws`
;
let
url
=
groupStatus
.
endpoint
;
if
(
!
url
)
{
console
.
warn
(
"
no endpoint in status
"
);
url
=
`ws
${
location
.
protocol
===
'
https:
'
?
'
s
'
:
''
}
://
${
location
.
host
}
/ws`
;
}
try
{
try
{
await
serverConnection
.
connect
(
url
);
await
serverConnection
.
connect
(
url
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
webserver/webserver.go
View file @
4bc873a5
...
@@ -102,7 +102,7 @@ func cspHeader(w http.ResponseWriter, connect string) {
...
@@ -102,7 +102,7 @@ func cspHeader(w http.ResponseWriter, connect string) {
c
=
"connect-src "
+
connect
+
" ws: wss: 'self';"
c
=
"connect-src "
+
connect
+
" ws: wss: 'self';"
}
}
w
.
Header
()
.
Add
(
"Content-Security-Policy"
,
w
.
Header
()
.
Add
(
"Content-Security-Policy"
,
c
+
" img-src data: 'self'; media-src blob: 'self'; default-src 'self'"
)
c
+
" img-src data: 'self'; media-src blob: 'self'; default-src 'self'"
)
}
}
func
notFound
(
w
http
.
ResponseWriter
)
{
func
notFound
(
w
http
.
ResponseWriter
)
{
...
@@ -327,7 +327,7 @@ func groupHandler(w http.ResponseWriter, r *http.Request) {
...
@@ -327,7 +327,7 @@ func groupHandler(w http.ResponseWriter, r *http.Request) {
return
return
}
}
status
:=
g
.
Status
(
false
)
status
:=
g
.
Status
(
false
,
""
)
cspHeader
(
w
,
status
.
AuthServer
)
cspHeader
(
w
,
status
.
AuthServer
)
serveFile
(
w
,
r
,
filepath
.
Join
(
StaticRoot
,
"galene.html"
))
serveFile
(
w
,
r
,
filepath
.
Join
(
StaticRoot
,
"galene.html"
))
}
}
...
@@ -351,7 +351,16 @@ func groupStatusHandler(w http.ResponseWriter, r *http.Request) {
...
@@ -351,7 +351,16 @@ func groupStatusHandler(w http.ResponseWriter, r *http.Request) {
return
return
}
}
d
:=
g
.
Status
(
false
)
scheme
:=
"wss"
if
Insecure
{
scheme
=
"ws"
}
endpoint
:=
url
.
URL
{
Scheme
:
scheme
,
Host
:
r
.
Host
,
Path
:
"/ws"
,
}
d
:=
g
.
Status
(
false
,
endpoint
.
String
())
w
.
Header
()
.
Set
(
"content-type"
,
"application/json"
)
w
.
Header
()
.
Set
(
"content-type"
,
"application/json"
)
w
.
Header
()
.
Set
(
"cache-control"
,
"no-cache"
)
w
.
Header
()
.
Set
(
"cache-control"
,
"no-cache"
)
...
...
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