mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -07:00
0779aa8439
- Implemented ProgressionEventsController to handle progression event retrieval and active events. - Created RoomConsumablesController for listing and purchasing room consumables. - Developed RoomCurrenciesController for managing room currencies, including creation, updates, and balance retrieval. - Added RoomEarningsDistributionsController to fetch earnings distribution data for rooms. - Introduced ScreenShareReportsController for reporting screen share incidents. - Established SubscriptionSeasonsController to provide current subscription season details and rewards. - Launched UgcPurchasablesController for managing user-generated content purchasables, including bulk operations. - Added new data entities for customization and room economy, including custom avatar items, room currencies, and UGC purchasables.
41 lines
1.5 KiB
C#
41 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using DorkNet.Server.Auth;
|
|
using DorkNet.Server.Data;
|
|
using DorkNet.Server.Data.Entities;
|
|
|
|
namespace DorkNet.Server.Controllers.API.ScreenShareReports;
|
|
|
|
[ApiController]
|
|
[Authorize]
|
|
public class ScreenShareReportsController(DorkNetDbContext db) : ControllerBase
|
|
{
|
|
[HttpPost("api/screensharereports/v1/report")]
|
|
public async Task<IActionResult> Report(
|
|
[FromForm] long? targetPlayerId,
|
|
[FromForm] long? roomId,
|
|
[FromForm] int? reportCategory,
|
|
[FromForm] string? details)
|
|
{
|
|
var reporter = this.RequireCurrentPlayerId();
|
|
var target = targetPlayerId
|
|
?? (long.TryParse(Request.Query["targetPlayerId"].FirstOrDefault(), out var qTarget) ? qTarget : 0);
|
|
var room = roomId
|
|
?? (long.TryParse(Request.Query["roomId"].FirstOrDefault(), out var qRoom) ? qRoom : 0);
|
|
var category = reportCategory
|
|
?? (int.TryParse(Request.Query["reportCategory"].FirstOrDefault(), out var qCategory) ? qCategory : 5);
|
|
var message = details ?? Request.Query["details"].FirstOrDefault() ?? string.Empty;
|
|
|
|
db.Reports.Add(new ReportEntity
|
|
{
|
|
ReporterPlayerId = reporter,
|
|
TargetPlayerId = target,
|
|
RoomId = room,
|
|
Category = category,
|
|
Message = message[..Math.Min(1000, message.Length)],
|
|
});
|
|
await db.SaveChangesAsync();
|
|
return Ok(new { Success = true, Error = string.Empty });
|
|
}
|
|
}
|