Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sfu
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
Alain Takoudjou
sfu
Commits
8399ee2c
Commit
8399ee2c
authored
Sep 24, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement group description.
parent
7183730a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
README
README
+2
-0
group/group.go
group/group.go
+11
-8
static/mainpage.js
static/mainpage.js
+5
-1
No files found.
README
View file @
8399ee2c
...
...
@@ -99,6 +99,8 @@ fields, all of which are optional.
respectively with operator privileges, with presenter privileges, and
as passive listeners;
- `public`: if true, then the group is visible on the landing page;
- `description`: a human-readable description of the group; this is
displayed on the landing page for public groups;
- `max-clients`: the maximum number of clients that may join the group at
a time;
- `allow-recording`: if true, then recording is allowed in this group;
...
...
group/group.go
View file @
8399ee2c
...
...
@@ -75,7 +75,7 @@ type Group struct {
name
string
mu
sync
.
Mutex
description
*
groupD
escription
description
*
d
escription
// indicates that the group no longer exists, but it still has clients
dead
bool
locked
*
string
...
...
@@ -90,7 +90,7 @@ func (g *Group) Name() string {
func
(
g
*
Group
)
Locked
()
(
bool
,
string
)
{
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
if
(
g
.
locked
!=
nil
)
{
if
g
.
locked
!=
nil
{
return
true
,
*
g
.
locked
}
else
{
return
false
,
""
...
...
@@ -135,7 +135,7 @@ func (g *Group) API() *webrtc.API {
return
groups
.
api
}
func
Add
(
name
string
,
desc
*
groupD
escription
)
(
*
Group
,
error
)
{
func
Add
(
name
string
,
desc
*
d
escription
)
(
*
Group
,
error
)
{
groups
.
mu
.
Lock
()
defer
groups
.
mu
.
Unlock
()
...
...
@@ -429,10 +429,11 @@ func matchUser(user ClientCredentials, users []ClientCredentials) (bool, bool) {
return
false
,
false
}
type
groupD
escription
struct
{
type
d
escription
struct
{
loadTime
time
.
Time
`json:"-"`
modTime
time
.
Time
`json:"-"`
fileSize
int64
`json:"-"`
Description
string
`json:"description,omitempty"`
Redirect
string
`json:"redirect,omitempty"`
Public
bool
`json:"public,omitempty"`
MaxClients
int
`json:"max-clients,omitempty"`
...
...
@@ -443,7 +444,7 @@ type groupDescription struct {
Other
[]
ClientCredentials
`json:"other,omitempty"`
}
func
descriptionChanged
(
name
string
,
old
*
groupD
escription
)
(
bool
,
error
)
{
func
descriptionChanged
(
name
string
,
old
*
d
escription
)
(
bool
,
error
)
{
fi
,
err
:=
os
.
Stat
(
filepath
.
Join
(
Directory
,
name
+
".json"
))
if
err
!=
nil
{
return
false
,
err
...
...
@@ -454,14 +455,14 @@ func descriptionChanged(name string, old *groupDescription) (bool, error) {
return
false
,
err
}
func
GetDescription
(
name
string
)
(
*
groupD
escription
,
error
)
{
func
GetDescription
(
name
string
)
(
*
d
escription
,
error
)
{
r
,
err
:=
os
.
Open
(
filepath
.
Join
(
Directory
,
name
+
".json"
))
if
err
!=
nil
{
return
nil
,
err
}
defer
r
.
Close
()
var
desc
groupD
escription
var
desc
d
escription
fi
,
err
:=
r
.
Stat
()
if
err
!=
nil
{
...
...
@@ -479,7 +480,7 @@ func GetDescription(name string) (*groupDescription, error) {
return
&
desc
,
nil
}
func
(
desc
*
groupDescription
)
GetPermission
(
creds
ClientCredentials
)
(
ClientPermissions
,
error
)
{
func
(
desc
*
description
)
GetPermission
(
creds
ClientCredentials
)
(
ClientPermissions
,
error
)
{
var
p
ClientPermissions
if
!
desc
.
AllowAnonymous
&&
creds
.
Username
==
""
{
return
p
,
UserError
(
"anonymous users not allowed in this group, please choose a username"
)
...
...
@@ -513,6 +514,7 @@ func (desc *groupDescription) GetPermission (creds ClientCredentials) (ClientPer
type
Public
struct
{
Name
string
`json:"name"`
Description
string
`json:"description,omitempty"`
ClientCount
int
`json:"clientCount"`
}
...
...
@@ -522,6 +524,7 @@ func GetPublic() []Public {
if
g
.
Public
()
{
gs
=
append
(
gs
,
Public
{
Name
:
g
.
name
,
Description
:
g
.
description
.
Description
,
ClientCount
:
len
(
g
.
clients
),
})
}
...
...
static/mainpage.js
View file @
8399ee2c
...
...
@@ -44,8 +44,12 @@ async function listPublicGroups() {
td
.
appendChild
(
a
);
tr
.
appendChild
(
td
);
let
td2
=
document
.
createElement
(
'
td
'
);
td2
.
textContent
=
`(
${
group
.
clientCount
}
clients)`
;
if
(
group
.
description
)
td2
.
textContent
=
group
.
description
;
tr
.
appendChild
(
td2
);
let
td3
=
document
.
createElement
(
'
td
'
);
td3
.
textContent
=
`(
${
group
.
clientCount
}
clients)`
;
tr
.
appendChild
(
td3
);
table
.
appendChild
(
tr
);
}
}
...
...
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