Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CollabSpace Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mona Schulz
CollabSpace Backend
Commits
7dfeca18
Unverified
Commit
7dfeca18
authored
1 year ago
by
Florian Raith
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add setting to mute everyone (#61)
parent
9c7f7810
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
browser-extension/options.js
+1
-16
1 addition, 16 deletions
browser-extension/options.js
src/channel/channel.gateway.ts
+37
-1
37 additions, 1 deletion
src/channel/channel.gateway.ts
src/channel/channel.ts
+16
-0
16 additions, 0 deletions
src/channel/channel.ts
with
54 additions
and
17 deletions
browser-extension/options.js
+
1
−
16
View file @
7dfeca18
async
function
START_RECORDING
()
{
console
.
log
(
'
start recording
'
);
// const stream = await navigator.mediaDevices.getDisplayMedia({
// preferCurrentTab: true,
// });
const
stream
=
await
new
Promise
((
resolve
,
reject
)
=>
{
chrome
.
tabCapture
.
capture
(
{
...
...
@@ -31,19 +25,10 @@ async function START_RECORDING() {
const
promise
=
new
Promise
((
resolve
)
=>
{
const
peer
=
new
peerjs
.
Peer
();
// peer.on('call', (call) => {
// call.answer(stream);
// });
peer
.
on
(
'
open
'
,
(
id
)
=>
{
resolve
(
id
);
console
.
log
(
'
open peer:
'
,
id
);
peer
.
on
(
'
connection
'
,
(
conn
)
=>
{
console
.
log
(
'
established connection:
'
,
conn
);
conn
.
on
(
'
open
'
,
()
=>
{
console
.
log
(
'
connected:
'
+
conn
.
peer
);
conn
.
send
(
'
hello from the server
'
);
peer
.
call
(
conn
.
peer
,
stream
);
});
...
...
@@ -55,5 +40,5 @@ async function START_RECORDING() {
}
async
function
STOP_RECORDING
()
{
console
.
log
(
'
stop recording
'
);
//
}
This diff is collapsed.
Click to expand it.
src/channel/channel.gateway.ts
+
37
−
1
View file @
7dfeca18
...
...
@@ -9,7 +9,7 @@ import {
import
{
MikroORM
,
UseRequestContext
}
from
'
@mikro-orm/core
'
;
import
{
Server
,
Socket
}
from
'
socket.io
'
;
import
{
ChannelService
}
from
'
./channel.service
'
;
import
{
Channel
}
from
'
./channel
'
;
import
{
Channel
,
Settings
}
from
'
./channel
'
;
import
*
as
process
from
'
process
'
;
import
*
as
dotenv
from
'
dotenv
'
;
import
{
BrowserService
}
from
'
../browser/browser.service
'
;
...
...
@@ -167,6 +167,7 @@ export class ChannelGateway implements OnGatewayConnection {
channelId
:
channel
.
id
,
whiteboardCanvas
:
channel
.
canvasJSON
,
},
settings
:
channel
.
settings
,
teacher
,
students
,
};
...
...
@@ -311,6 +312,41 @@ export class ChannelGateway implements OnGatewayConnection {
return
true
;
}
/**
* Handle an 'update-settings' event to update channel settings.
*
* @param client The connected socket client.
* @param payload The payload containing settings.
* @returns A boolean indicating success.
*/
@
SubscribeMessage
(
'
update-settings
'
)
@
UseRequestContext
()
public
async
updateSettings
(
@
ConnectedSocket
()
client
:
Socket
,
@
MessageBody
()
payload
:
Settings
,
)
{
const
channel
=
await
this
.
channels
.
fromClientOrFail
(
client
);
channel
.
settings
=
payload
;
this
.
server
.
to
(
channel
.
id
).
emit
(
'
update-settings
'
,
payload
);
return
true
;
}
@
SubscribeMessage
(
'
disable-audio-for
'
)
@
UseRequestContext
()
public
async
disableAudioFor
(
@
ConnectedSocket
()
client
:
Socket
,
@
MessageBody
()
payload
:
{
userId
:
string
},
)
{
const
channel
=
await
this
.
channels
.
fromClientOrFail
(
client
);
channel
.
disableAudioFor
(
payload
.
userId
);
this
.
server
.
to
(
channel
.
id
).
emit
(
'
disable-audio-for
'
,
payload
.
userId
);
return
true
;
}
/**
* Handle an 'close-channel' event to close a channel.
* @param client The connected socket client.
...
...
This diff is collapsed.
Click to expand it.
src/channel/channel.ts
+
16
−
0
View file @
7dfeca18
...
...
@@ -19,6 +19,10 @@ export interface Student extends ChannelUser {
permission
:
boolean
;
}
export
interface
Settings
{
globalMute
:
boolean
;
}
/**
* Represents a channel for a room in the application.
*/
...
...
@@ -30,6 +34,10 @@ export class Channel {
public
canvasJSON
:
string
;
public
settings
:
Settings
=
{
globalMute
:
false
,
};
/**
* Creates a new Channel instance.
*
...
...
@@ -208,6 +216,14 @@ export class Channel {
}
}
public
disableAudioFor
(
studentId
:
string
)
{
const
student
=
this
.
getStudent
(
studentId
);
if
(
student
)
{
student
.
audio
=
false
;
}
}
/**
* Updates the hand signal setting of a student.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment