From 844eaadee042970155cd8297c40520601cbfbd26 Mon Sep 17 00:00:00 2001 From: Nell Date: Thu, 24 Sep 2026 13:55:59 +0200 Subject: [PATCH] fix webrtc and login --- .gitignore | 3 +- config.toml | 12 +- frontend/package.json | 1 + frontend/src/layouts/AppLayout.vue | 21 +++ frontend/src/pages/auth/join.vue | 2 +- frontend/src/pages/server/index.vue | 66 +++++++++- frontend/src/stores/app.ts | 2 +- frontend/src/stores/auth.ts | 2 + frontend/src/stores/channel.ts | 1 + frontend/src/stores/voice.ts | 125 ++++++++++++++++++ frontend/vite.config.mts | 20 ++- frontend/yarn.lock | 5 + src/config.rs | 47 +++++++ src/core/mod.rs | 15 ++- src/domain/dto/channel.rs | 3 + src/domain/events/mod.rs | 1 + src/domain/events/voice_presence.rs | 12 ++ src/routes/channel/mapper.rs | 1 + src/routes/gateway/mod.rs | 10 ++ src/routes/rtc/handlers.rs | 16 ++- src/routes/rtc/routes.rs | 1 + src/routes/server/handlers.rs | 1 + src/routes/server/mapper.rs | 26 +++- src/rtc/README.md | 4 + src/rtc/client.rs | 12 +- src/rtc/mod.rs | 195 ++++++++++++++++++++++++++-- src/rtc/stun_diagnostic.rs | 65 ++++++++++ src/voice/service.rs | 2 + 28 files changed, 628 insertions(+), 43 deletions(-) create mode 100644 frontend/src/stores/voice.ts create mode 100644 src/domain/events/voice_presence.rs create mode 100644 src/rtc/stun_diagnostic.rs diff --git a/.gitignore b/.gitignore index fe47fef..bebe9c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target /.idea *.db* -/media/* \ No newline at end of file +/media/* +/certs \ No newline at end of file diff --git a/config.toml b/config.toml index bb3ef81..b5bad02 100644 --- a/config.toml +++ b/config.toml @@ -7,12 +7,16 @@ host = "0.0.0.0" tcp_port = 8080 # Voice/Video port udp_port = 8080 +# If the server is behind NAT, set its public IPv4 here and forward UDP 8080 to it. +# external_ip = "203.0.113.1" +# STUN is enabled by default; customize or set [] to disable it. +# stun_servers = ["stun:stun.l.google.com:19302"] # Uncomment for native self-signed HTTPS/WSS. Keep both files between restarts. -# [network.tls] -# cert_path = "certs/server.pem" -# key_path = "certs/server-key.pem" -# names = ["localhost", "127.0.0.1"] # include the host clients actually use +[network.tls] +cert_path = "certs/server.pem" +key_path = "certs/server-key.pem" +names = ["localhost", "127.0.0.1", "goesseau.eu"] # include the host clients actually use [database] # DSN for database diff --git a/frontend/package.json b/frontend/package.json index 1857eeb..a537574 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -36,6 +36,7 @@ "eslint-config-vuetify": "^4.3.4", "npm-run-all2": "^8.0.4", "sass-embedded": "^1.98.0", + "smol-toml": "^1.9.0", "typescript": "~5.9.3", "unplugin-fonts": "^1.4.0", "vite": "^8.0.0", diff --git a/frontend/src/layouts/AppLayout.vue b/frontend/src/layouts/AppLayout.vue index cda0a07..3bfd92d 100644 --- a/frontend/src/layouts/AppLayout.vue +++ b/frontend/src/layouts/AppLayout.vue @@ -7,8 +7,10 @@ import ContextMenu from "@/components/ContextMenu.vue"; import UserListDrawer from '@/components/UserListDrawer.vue' import ServerSettingsDialog from '@/components/server/ServerSettingsDialog.vue' import {useContextMenu} from '@/composables/useContextMenu' +import {useVoiceStore} from '@/stores/voice' const serverStore = useServerStore() +const voiceStore = useVoiceStore() const route = useRoute() const router = useRouter() const {openContextMenu} = useContextMenu() @@ -212,6 +214,14 @@ function onServerContextMenu(event: MouseEvent, server: Server) { /> +
+ Vocal connecté + Quitter +
+ + {{ voiceStore.error }} + + @@ -284,6 +294,17 @@ function onServerContextMenu(event: MouseEvent, server: Server) {