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
4f531b80
Commit
4f531b80
authored
May 18, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement commands /lock and /unlock.
parent
fc6c26e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
client.go
client.go
+10
-0
group.go
group.go
+5
-0
static/sfu.js
static/sfu.js
+10
-0
No files found.
client.go
View file @
4f531b80
...
...
@@ -1214,6 +1214,16 @@ func handleClientMessage(c *client, m clientMessage) error {
if
err
!=
nil
{
return
c
.
error
(
err
)
}
case
"lock"
,
"unlock"
:
if
!
c
.
permissions
.
Op
{
c
.
error
(
userError
(
"not authorised"
))
return
nil
}
var
locked
uint32
if
m
.
Type
==
"lock"
{
locked
=
1
}
atomic
.
StoreUint32
(
&
c
.
group
.
locked
,
locked
)
case
"kick"
:
if
!
c
.
permissions
.
Op
{
c
.
error
(
userError
(
"not authorised"
))
...
...
group.go
View file @
4f531b80
...
...
@@ -183,6 +183,7 @@ type group struct {
dead
bool
description
*
groupDescription
videoCount
uint32
locked
uint32
mu
sync
.
Mutex
clients
map
[
string
]
*
client
...
...
@@ -351,6 +352,10 @@ func addClient(name string, client *client, user, pass string) (*group, []userid
}
client
.
permissions
=
perms
if
!
perms
.
Op
&&
atomic
.
LoadUint32
(
&
g
.
locked
)
!=
0
{
return
nil
,
nil
,
userError
(
"group is locked"
)
}
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
...
...
static/sfu.js
View file @
4f531b80
...
...
@@ -867,6 +867,16 @@ function handleInput() {
type
:
'
clearchat
'
,
});
return
;
case
'
/lock
'
:
case
'
/unlock
'
:
if
(
!
permissions
.
op
)
{
displayError
(
"
You're not an operator
"
);
return
;
}
send
({
type
:
cmd
===
'
/lock
'
?
'
lock
'
:
'
unlock
'
,
});
return
;
case
'
/op
'
:
case
'
/unop
'
:
case
'
/kick
'
:
...
...
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