Classroom güncellemesi hatalar için
This commit is contained in:
parent
22742966f1
commit
b3415a4222
3 changed files with 21 additions and 8 deletions
|
|
@ -129,12 +129,22 @@ public class ClassroomHub : Hub
|
||||||
? new ClassroomSettingsDto()
|
? new ClassroomSettingsDto()
|
||||||
: JsonSerializer.Deserialize<ClassroomSettingsDto>(classroom.SettingsJson);
|
: JsonSerializer.Deserialize<ClassroomSettingsDto>(classroom.SettingsJson);
|
||||||
|
|
||||||
initialMuteState = !isTeacher && classroomSettings.AutoMuteNewParticipants ? true : classroomSettings.DefaultMicrophoneState == "muted";
|
initialMuteState = !isTeacher && classroomSettings.AutoMuteNewParticipants
|
||||||
|
? true
|
||||||
|
: classroomSettings.DefaultMicrophoneState == "muted";
|
||||||
|
|
||||||
var participant = await _participantRepository.FirstOrDefaultAsync(
|
var participant = await _participantRepository.FirstOrDefaultAsync(
|
||||||
x => x.SessionId == sessionId && x.UserId == userId
|
x => x.SessionId == sessionId && x.UserId == userId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 🚨 Kick edilmiş kullanıcı tekrar giriş yapamaz
|
||||||
|
if (participant != null && !participant.IsActive)
|
||||||
|
{
|
||||||
|
await Clients.Caller.SendAsync("Error", "You are not allowed to rejoin this class.");
|
||||||
|
Context.Abort(); // bağlantıyı anında kapat
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (participant == null)
|
if (participant == null)
|
||||||
{
|
{
|
||||||
participant = new ClassroomParticipant(
|
participant = new ClassroomParticipant(
|
||||||
|
|
@ -458,10 +468,6 @@ public class ClassroomHub : Hub
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Eğer bağlantı zaten iptal edilmişse boşuna uğraşma
|
|
||||||
if (Context.ConnectionAborted.IsCancellationRequested)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var userId = _currentUser.Id;
|
var userId = _currentUser.Id;
|
||||||
if (!userId.HasValue)
|
if (!userId.HasValue)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
|
using System.Security.Claims;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
|
||||||
namespace Kurs.Platform.Classrooms;
|
namespace Kurs.Platform.Classrooms;
|
||||||
|
|
||||||
public class CustomUserIdProvider : IUserIdProvider
|
public class CustomUserIdProvider : IUserIdProvider
|
||||||
{
|
{
|
||||||
public string GetUserId(HubConnectionContext connection)
|
public string? GetUserId(HubConnectionContext connection)
|
||||||
{
|
{
|
||||||
return connection.User?.FindFirst("sub")?.Value;
|
return connection.User?.FindFirst("sub")?.Value
|
||||||
|
?? connection.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export class SignalRService {
|
||||||
.withUrl(`${import.meta.env.VITE_API_URL}/classroomhub`, {
|
.withUrl(`${import.meta.env.VITE_API_URL}/classroomhub`, {
|
||||||
accessTokenFactory: () => auth.session.token || '',
|
accessTokenFactory: () => auth.session.token || '',
|
||||||
})
|
})
|
||||||
.withAutomaticReconnect()
|
//.withAutomaticReconnect()
|
||||||
.configureLogging(signalR.LogLevel.Information)
|
.configureLogging(signalR.LogLevel.Information)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
|
@ -127,6 +127,10 @@ export class SignalRService {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//2. tane problem var.
|
||||||
|
//1. problem kick yapamıyorum
|
||||||
|
//2. Öğrenci veya öğretmen farklı bir sayfaya gidince ekranda donuk şekilde duruyor.
|
||||||
|
|
||||||
this.connection.on('ForceDisconnect', async (message: string) => {
|
this.connection.on('ForceDisconnect', async (message: string) => {
|
||||||
console.warn('⚠️ ForceDisconnect received:', message)
|
console.warn('⚠️ ForceDisconnect received:', message)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue