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
12858e1f
Commit
12858e1f
authored
May 18, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement commands /lock and /unlock.
parent
037f002a
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 @
12858e1f
...
@@ -1248,6 +1248,16 @@ func handleClientMessage(c *client, m clientMessage) error {
...
@@ -1248,6 +1248,16 @@ func handleClientMessage(c *client, m clientMessage) error {
if
err
!=
nil
{
if
err
!=
nil
{
return
c
.
error
(
err
)
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"
:
case
"kick"
:
if
!
c
.
permissions
.
Op
{
if
!
c
.
permissions
.
Op
{
c
.
error
(
userError
(
"not authorised"
))
c
.
error
(
userError
(
"not authorised"
))
...
...
group.go
View file @
12858e1f
...
@@ -199,6 +199,7 @@ type group struct {
...
@@ -199,6 +199,7 @@ type group struct {
dead
bool
dead
bool
description
*
groupDescription
description
*
groupDescription
videoCount
uint32
videoCount
uint32
locked
uint32
mu
sync
.
Mutex
mu
sync
.
Mutex
clients
map
[
string
]
*
client
clients
map
[
string
]
*
client
...
@@ -366,6 +367,10 @@ func addClient(name string, client *client, user, pass string) (*group, []userid
...
@@ -366,6 +367,10 @@ func addClient(name string, client *client, user, pass string) (*group, []userid
}
}
client
.
permissions
=
perms
client
.
permissions
=
perms
if
!
perms
.
Op
&&
atomic
.
LoadUint32
(
&
g
.
locked
)
!=
0
{
return
nil
,
nil
,
userError
(
"group is locked"
)
}
g
.
mu
.
Lock
()
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
defer
g
.
mu
.
Unlock
()
...
...
static/sfu.js
View file @
12858e1f
...
@@ -888,6 +888,16 @@ function handleInput() {
...
@@ -888,6 +888,16 @@ function handleInput() {
type
:
'
clearchat
'
,
type
:
'
clearchat
'
,
});
});
return
;
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
'
/op
'
:
case
'
/unop
'
:
case
'
/unop
'
:
case
'
/kick
'
:
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