1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-05-17 17:32:45 +00:00

Compare commits

..

No commits in common. "ec0419a6d793aab5fb8bbb64ac64f0a8ef31ac8e" and "758f714096430300e0e5a47058af1eb22cfc20e1" have entirely different histories.

3 changed files with 4 additions and 12 deletions

View File

@ -47,11 +47,6 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
# Fetch the registration of the current user
user = self.scope['user']
if user.is_anonymous:
# User is not authenticated
await self.close()
return
reg = await Registration.objects.aget(user_id=user.id)
self.registration = reg
@ -76,10 +71,6 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
Called when the websocket got disconnected, for any reason.
:param close_code: The error code.
"""
if self.scope['user'].is_anonymous:
# User is not authenticated
return
# Unregister from channel layers
if not self.registration.is_volunteer:
await self.channel_layer.group_discard(f"team-{self.registration.team.trigram}", self.channel_name)

View File

@ -736,7 +736,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
function setupSocket(nextDelay = 1000) {
function setupSocket() {
// Open a global websocket
socket = new WebSocket(
(document.location.protocol === 'https:' ? 'wss' : 'ws') + '://' + window.location.host + '/ws/draw/'
@ -753,7 +753,7 @@ document.addEventListener('DOMContentLoaded', () => {
// Manage errors
socket.addEventListener('close', e => {
console.error('Chat socket closed unexpectedly, restarting…')
setTimeout(() => setupSocket(2 * nextDelay), nextDelay)
setupSocket()
})
// When the socket is opened, set the language in order to receive alerts in the good language

View File

@ -1886,7 +1886,8 @@ class GSheetNotificationsView(View):
return HttpResponse(status=404)
tournament = await Tournament.objects.prefetch_related('participations', 'pools').aget(pk=kwargs['pk'])
expected_channel_id = sha1(f"{tournament.name}-{timezone.now().date()}-{request.site.domain}".encode()) \
request.site.domain = "test.ynerant.fr"
expected_channel_id = sha1(f"{tournament.name}{timezone.now().date()}{request.site.domain}".encode()) \
.hexdigest()
if request.headers['X-Goog-Channel-ID'] != expected_channel_id: