♻️ No idea what happended

This commit is contained in:
2025-07-09 16:38:37 +08:00
parent 63b2b989ba
commit e477bd83a1
17 changed files with 250 additions and 68 deletions

View File

@@ -12,10 +12,7 @@ using Quartz;
namespace DysonNetwork.Sphere;
public class AppDatabase(
DbContextOptions<AppDatabase> options,
IConfiguration configuration
) : DbContext(options)
public class AppDatabase(DbContextOptions<AppDatabase> options, IConfiguration configuration) : DbContext(options)
{
public DbSet<CloudFile> Files { get; set; }
public DbSet<CloudFileReference> FileReferences { get; set; }

View File

@@ -25,6 +25,7 @@
<PackageReference Include="FFMpegCore" Version="5.2.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.12.1" />
<PackageReference Include="Livekit.Server.Sdk.Dotnet" Version="1.0.8" />
<PackageReference Include="MagicOnion.Abstractions" Version="7.0.5" />
<PackageReference Include="MagicOnion.Client" Version="7.0.5" />
<PackageReference Include="MagicOnion.Server" Version="7.0.5" />
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />

View File

@@ -1,3 +1,4 @@
using DysonNetwork.Shared.Etcd;
using DysonNetwork.Sphere;
using DysonNetwork.Sphere.Startup;
using Microsoft.EntityFrameworkCore;
@@ -14,15 +15,16 @@ builder.ConfigureAppKestrel();
// Add metrics and telemetry
builder.Services.AddAppMetrics();
// Add remote services
builder.Services.AddMagicOnion();
builder.Services.AddEtcdService(builder.Configuration);
// Add application services
builder.Services.AddAppServices(builder.Configuration);
builder.Services.AddAppRateLimiting();
builder.Services.AddAppAuthentication();
builder.Services.AddAppSwagger();
// Add gRPC services
builder.Services.AddGrpc();
// Configure MagicOnion client for IAccountService
builder.Services.AddSingleton<IAccountService>(provider =>
{
@@ -86,8 +88,4 @@ var tusDiskStore = app.Services.GetRequiredService<TusDiskStore>();
// Configure application middleware pipeline
app.ConfigureAppMiddleware(builder.Configuration, tusDiskStore);
// Remove direct gRPC service mappings for Pass services
// app.MapGrpcService<DysonNetwork.Pass.Auth.AuthGrpcService>();
// app.MapGrpcService<DysonNetwork.Pass.Account.AccountGrpcService>();
app.Run();

View File

@@ -8,7 +8,8 @@
"applicationUrl": "http://localhost:5071",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"workingDirectory": "/Users/littlesheep/Documents/Projects/DysonNetwork/DysonNetwork.Sphere"
},
"https": {
"commandName": "Project",
@@ -17,7 +18,8 @@
"applicationUrl": "https://localhost:7099;http://localhost:5071",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"workingDirectory": "/Users/littlesheep/Documents/Projects/DysonNetwork/DysonNetwork.Sphere"
}
}
}

View File

@@ -209,14 +209,18 @@ public static class ServiceCollectionExtensions
services.AddScoped<CustomAppService>();
// Add MagicOnion services
services.AddMagicOnionService<IAccountService>();
services.AddMagicOnionService<IAccountEventService>();
services.AddMagicOnionService<IAccountUsernameService>();
services.AddMagicOnionService<IActionLogService>();
services.AddMagicOnionService<IMagicSpellService>();
services.AddMagicOnionService<INotificationService>();
services.AddMagicOnionService<IRelationshipService>();
services.AddRemoteService<IAccountService>();
services.AddRemoteService<IAccountEventService>();
services.AddRemoteService<IAccountProfileService>();
services.AddRemoteService<IAccountUsernameService>();
services.AddRemoteService<IActionLogService>();
services.AddRemoteService<ICustomAppService>();
services.AddRemoteService<IMagicSpellService>();
services.AddRemoteService<INotificationService>();
services.AddRemoteService<IPermissionService>();
services.AddRemoteService<IPublisherService>();
services.AddRemoteService<IRelationshipService>();
return services;
}
}

View File

@@ -12,7 +12,7 @@ public class LastActiveInfo
public Instant SeenAt { get; set; }
}
public class LastActiveFlushHandler(DysonNetwork.Shared.Services.IAccountService accounts, DysonNetwork.Shared.Services.IAccountProfileService profiles) : IFlushHandler<LastActiveInfo>
public class LastActiveFlushHandler(IAccountService accounts) : IFlushHandler<LastActiveInfo>
{
public async Task FlushAsync(IReadOnlyList<LastActiveInfo> items)
{

View File

@@ -10,7 +10,8 @@
"AllowedHosts": "*",
"ConnectionStrings": {
"App": "Host=localhost;Port=5432;Database=dyson_network;Username=postgres;Password=postgres;Include Error Detail=True;Maximum Pool Size=20;Connection Idle Lifetime=60",
"FastRetrieve": "localhost:6379"
"FastRetrieve": "localhost:6379",
"Etcd": "localhost:2379"
},
"Authentication": {
"Schemes": {