added media class

This commit is contained in:
2026-03-28 23:14:51 -04:00
parent 3a5dde9ee3
commit b8d01b567c
6 changed files with 47 additions and 17 deletions
+8 -8
View File
@@ -9,10 +9,7 @@ using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using MongoDB.Bson.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace AobaServer.Services;
@@ -20,7 +17,7 @@ public class AobaRpcService(AobaService aobaService, AccountsService accountsSer
{
public override async Task<MediaResponse> GetMedia(Id request, ServerCallContext context)
{
var media = await aobaService.GetMediaFromLegacyIdAsync(request.ToObjectId());
var media = await aobaService.GetMediaFromLegacyIdAsync(request.ToObjectId(), context.CancellationToken);
return media.ToResponse();
}
@@ -31,6 +28,12 @@ public class AobaRpcService(AobaService aobaService, AccountsService accountsSer
return result.ToResponse();
}
public override async Task<Empty> SetMediaClass(SetMediaClassRequest request, ServerCallContext context)
{
await aobaService.SetMediaClassAsync(request.Id.ToObjectId(), (AobaCore.Models.MediaClass)request.Class, context.CancellationToken);
return new Empty();
}
public override async Task<ShareXResponse> GetShareXDestination(Empty request, ServerCallContext context)
{
var userId = context.GetHttpContext().User.GetId();
@@ -50,10 +53,7 @@ public class AobaRpcService(AobaService aobaService, AccountsService accountsSer
};
return new ShareXResponse
{
Destination = JsonSerializer.Serialize(dest, new JsonSerializerOptions
{
WriteIndented = true
})
Destination = JsonSerializer.Serialize(dest)
};
}