From 9a6fcfb6de13551afdc207d6e6a8ed131e64c66f Mon Sep 17 00:00:00 2001 From: Cody Larkin Date: Thu, 2 Apr 2026 19:32:17 -0400 Subject: [PATCH] added offers list to api --- RelayServer/Endpoints/RtcEndpoints.cs | 8 +++++++- RelayServer/Services/Rtc/RtcCallService.cs | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RelayServer/Endpoints/RtcEndpoints.cs b/RelayServer/Endpoints/RtcEndpoints.cs index 7ec7347..d567e42 100644 --- a/RelayServer/Endpoints/RtcEndpoints.cs +++ b/RelayServer/Endpoints/RtcEndpoints.cs @@ -24,6 +24,12 @@ public static class RtcEndpoints await rtcCallService.WriteOfferAsync(request.ChannelId, request.Username, request.Sdp); return Results.Ok(); }); + // List all offers. + app.MapGet("/api/rtc/offers", async (RtcCallService rtcCallService) => + { + return Results.Ok(await rtcCallService.GetOffersAsync()); + + }); // Return whether the specified channel currently has an active call. app.MapGet("/api/rtc/active/{channelId}", async (string channelId, RtcCallService rtcCallService) => @@ -32,7 +38,7 @@ public static class RtcEndpoints }); // Return the latest stored SDP offer for the specified channel. - app.MapGet("/api/rtc/offer/{channelId}", async (string channelId, RtcCallService rtcCallService) => + app.MapGet("/api/rtc/offers/{channelId}", async (string channelId, RtcCallService rtcCallService) => { var offer = await rtcCallService.GetOfferAsync(channelId); return offer is null ? Results.NotFound() : Results.Ok(offer); diff --git a/RelayServer/Services/Rtc/RtcCallService.cs b/RelayServer/Services/Rtc/RtcCallService.cs index 56fa854..dec82ac 100644 --- a/RelayServer/Services/Rtc/RtcCallService.cs +++ b/RelayServer/Services/Rtc/RtcCallService.cs @@ -279,4 +279,10 @@ public sealed class RtcCallService await _db.Merge(activeCall); } } + + public async Task GetOffersAsync() + { + var offers = await _db.Select("rtc_offers"); + return offers; + } } \ No newline at end of file