🚨 Fix complier warnings
This commit is contained in:
@@ -9,11 +9,11 @@ public class AppDatabase(
|
|||||||
IConfiguration configuration
|
IConfiguration configuration
|
||||||
) : DbContext(options)
|
) : DbContext(options)
|
||||||
{
|
{
|
||||||
public DbSet<Developer> Developers { get; set; }
|
public DbSet<Developer> Developers { get; set; } = null!;
|
||||||
|
|
||||||
public DbSet<CustomApp> CustomApps { get; set; }
|
public DbSet<CustomApp> CustomApps { get; set; } = null!;
|
||||||
public DbSet<CustomAppSecret> CustomAppSecrets { get; set; }
|
public DbSet<CustomAppSecret> CustomAppSecrets { get; set; } = null!;
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseNpgsql(
|
optionsBuilder.UseNpgsql(
|
||||||
|
@@ -8,9 +8,6 @@ using Google.Protobuf.WellKnownTypes;
|
|||||||
using NodaTime.Serialization.Protobuf;
|
using NodaTime.Serialization.Protobuf;
|
||||||
using NodaTime;
|
using NodaTime;
|
||||||
|
|
||||||
using DysonNetwork.Shared.Proto;
|
|
||||||
using Google.Protobuf.WellKnownTypes;
|
|
||||||
using NodaTime.Serialization.Protobuf;
|
|
||||||
using VerificationMark = DysonNetwork.Shared.Data.VerificationMark;
|
using VerificationMark = DysonNetwork.Shared.Data.VerificationMark;
|
||||||
|
|
||||||
namespace DysonNetwork.Develop.Identity;
|
namespace DysonNetwork.Develop.Identity;
|
||||||
@@ -134,8 +131,8 @@ public class CustomAppSecret : ModelBase
|
|||||||
|
|
||||||
public Guid AppId { get; set; }
|
public Guid AppId { get; set; }
|
||||||
public CustomApp App { get; set; } = null!;
|
public CustomApp App { get; set; } = null!;
|
||||||
|
|
||||||
|
|
||||||
public static CustomAppSecret FromProtoValue(DysonNetwork.Shared.Proto.CustomAppSecret p)
|
public static CustomAppSecret FromProtoValue(DysonNetwork.Shared.Proto.CustomAppSecret p)
|
||||||
{
|
{
|
||||||
return new CustomAppSecret
|
return new CustomAppSecret
|
||||||
@@ -161,4 +158,4 @@ public class CustomAppSecret : ModelBase
|
|||||||
AppId = Id.ToString(),
|
AppId = Id.ToString(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@ public class CloudFile : ModelBase, ICloudFile, IIdentifiedResource
|
|||||||
|
|
||||||
/// The object name which stored remotely,
|
/// The object name which stored remotely,
|
||||||
/// multiple cloud file may have same storage id to indicate they are the same file
|
/// multiple cloud file may have same storage id to indicate they are the same file
|
||||||
///
|
///
|
||||||
/// If the storage id was null and the uploaded at is not null, means it is an embedding file,
|
/// If the storage id was null and the uploaded at is not null, means it is an embedding file,
|
||||||
/// The embedding file means the file is store on another site,
|
/// The embedding file means the file is store on another site,
|
||||||
/// or it is a webpage (based on mimetype)
|
/// or it is a webpage (based on mimetype)
|
||||||
@@ -72,8 +72,8 @@ public class CloudFile : ModelBase, ICloudFile, IIdentifiedResource
|
|||||||
DeletedAt = DeletedAt,
|
DeletedAt = DeletedAt,
|
||||||
Id = Id,
|
Id = Id,
|
||||||
Name = Name,
|
Name = Name,
|
||||||
FileMeta = FileMeta,
|
FileMeta = FileMeta ?? [],
|
||||||
UserMeta = UserMeta,
|
UserMeta = UserMeta ?? [],
|
||||||
SensitiveMarks = SensitiveMarks,
|
SensitiveMarks = SensitiveMarks,
|
||||||
MimeType = MimeType,
|
MimeType = MimeType,
|
||||||
Hash = Hash,
|
Hash = Hash,
|
||||||
@@ -141,4 +141,4 @@ public class CloudFileReference : ModelBase
|
|||||||
ExpiredAt = ExpiredAt?.ToTimestamp()
|
ExpiredAt = ExpiredAt?.ToTimestamp()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,6 @@ namespace DysonNetwork.Drive.Storage;
|
|||||||
public class FileService(
|
public class FileService(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
TusDiskStore store,
|
|
||||||
ILogger<FileService> logger,
|
ILogger<FileService> logger,
|
||||||
IServiceScopeFactory scopeFactory,
|
IServiceScopeFactory scopeFactory,
|
||||||
ICacheService cache
|
ICacheService cache
|
||||||
@@ -268,14 +267,26 @@ public class FileService(
|
|||||||
// Add detailed stream information
|
// Add detailed stream information
|
||||||
["video_streams"] = mediaInfo.VideoStreams.Select(s => new
|
["video_streams"] = mediaInfo.VideoStreams.Select(s => new
|
||||||
{
|
{
|
||||||
s.AvgFrameRate, s.BitRate, s.CodecName, s.Duration, s.Height, s.Width, s.Language,
|
s.AvgFrameRate,
|
||||||
s.PixelFormat, s.Rotation
|
s.BitRate,
|
||||||
|
s.CodecName,
|
||||||
|
s.Duration,
|
||||||
|
s.Height,
|
||||||
|
s.Width,
|
||||||
|
s.Language,
|
||||||
|
s.PixelFormat,
|
||||||
|
s.Rotation
|
||||||
}).Where(s => double.IsNormal(s.AvgFrameRate)).ToList(),
|
}).Where(s => double.IsNormal(s.AvgFrameRate)).ToList(),
|
||||||
["audio_streams"] = mediaInfo.AudioStreams.Select(s => new
|
["audio_streams"] = mediaInfo.AudioStreams.Select(s => new
|
||||||
{
|
{
|
||||||
s.BitRate, s.Channels, s.ChannelLayout, s.CodecName, s.Duration, s.Language,
|
s.BitRate,
|
||||||
s.SampleRateHz
|
s.Channels,
|
||||||
})
|
s.ChannelLayout,
|
||||||
|
s.CodecName,
|
||||||
|
s.Duration,
|
||||||
|
s.Language,
|
||||||
|
s.SampleRateHz
|
||||||
|
})
|
||||||
.ToList(),
|
.ToList(),
|
||||||
};
|
};
|
||||||
if (mediaInfo.PrimaryVideoStream is not null)
|
if (mediaInfo.PrimaryVideoStream is not null)
|
||||||
@@ -319,7 +330,7 @@ public class FileService(
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.LogInformation("Processing file {FileId} in background...", fileId);
|
logger.LogInformation("Processing file {FileId} in background...", fileId);
|
||||||
|
|
||||||
var fileExtension = Path.GetExtension(originalFilePath);
|
var fileExtension = Path.GetExtension(originalFilePath);
|
||||||
|
|
||||||
if (!pool.PolicyConfig.NoOptimization)
|
if (!pool.PolicyConfig.NoOptimization)
|
||||||
@@ -869,4 +880,4 @@ file class UpdatableCloudFile(CloudFile file)
|
|||||||
.SetProperty(f => f.UserMeta, userMeta!)
|
.SetProperty(f => f.UserMeta, userMeta!)
|
||||||
.SetProperty(f => f.IsMarkedRecycle, IsMarkedRecycle);
|
.SetProperty(f => f.IsMarkedRecycle, IsMarkedRecycle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@ public class AppDatabase(
|
|||||||
) : DbContext(options)
|
) : DbContext(options)
|
||||||
{
|
{
|
||||||
public DbSet<Notification.Notification> Notifications { get; set; } = null!;
|
public DbSet<Notification.Notification> Notifications { get; set; } = null!;
|
||||||
public DbSet<PushSubscription> PushSubscriptions { get; set; }
|
public DbSet<PushSubscription> PushSubscriptions { get; set; } = null!;
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
@@ -175,4 +175,4 @@ public static class OptionalQueryExtensions
|
|||||||
{
|
{
|
||||||
return condition ? transform(source) : source;
|
return condition ? transform(source) : source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,7 @@ public class NotificationController(
|
|||||||
[Required][MaxLength(1024)] public string Title { get; set; } = null!;
|
[Required][MaxLength(1024)] public string Title { get; set; } = null!;
|
||||||
[MaxLength(2048)] public string? Subtitle { get; set; }
|
[MaxLength(2048)] public string? Subtitle { get; set; }
|
||||||
[Required][MaxLength(4096)] public string Content { get; set; } = null!;
|
[Required][MaxLength(4096)] public string Content { get; set; } = null!;
|
||||||
public Dictionary<string, object>? Meta { get; set; }
|
public Dictionary<string, object?>? Meta { get; set; }
|
||||||
public int Priority { get; set; } = 10;
|
public int Priority { get; set; } = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ public class NotificationController(
|
|||||||
Title = request.Title,
|
Title = request.Title,
|
||||||
Subtitle = request.Subtitle,
|
Subtitle = request.Subtitle,
|
||||||
Content = request.Content,
|
Content = request.Content,
|
||||||
Meta = request.Meta,
|
Meta = request.Meta ?? [],
|
||||||
},
|
},
|
||||||
request.AccountId,
|
request.AccountId,
|
||||||
save
|
save
|
||||||
|
@@ -24,37 +24,37 @@ public class AppDatabase(
|
|||||||
IConfiguration configuration
|
IConfiguration configuration
|
||||||
) : DbContext(options)
|
) : DbContext(options)
|
||||||
{
|
{
|
||||||
public DbSet<Publisher.Publisher> Publishers { get; set; }
|
public DbSet<Publisher.Publisher> Publishers { get; set; } = null!;
|
||||||
public DbSet<PublisherMember> PublisherMembers { get; set; }
|
public DbSet<PublisherMember> PublisherMembers { get; set; } = null!;
|
||||||
public DbSet<PublisherSubscription> PublisherSubscriptions { get; set; }
|
public DbSet<PublisherSubscription> PublisherSubscriptions { get; set; } = null!;
|
||||||
public DbSet<PublisherFeature> PublisherFeatures { get; set; }
|
public DbSet<PublisherFeature> PublisherFeatures { get; set; } = null!;
|
||||||
|
|
||||||
public DbSet<Post.Post> Posts { get; set; }
|
public DbSet<Post.Post> Posts { get; set; } = null!;
|
||||||
public DbSet<PostReaction> PostReactions { get; set; }
|
public DbSet<PostReaction> PostReactions { get; set; } = null!;
|
||||||
public DbSet<PostTag> PostTags { get; set; }
|
public DbSet<PostTag> PostTags { get; set; } = null!;
|
||||||
public DbSet<PostCategory> PostCategories { get; set; }
|
public DbSet<PostCategory> PostCategories { get; set; } = null!;
|
||||||
public DbSet<PostCollection> PostCollections { get; set; }
|
public DbSet<PostCollection> PostCollections { get; set; } = null!;
|
||||||
public DbSet<PostFeaturedRecord> PostFeaturedRecords { get; set; }
|
public DbSet<PostFeaturedRecord> PostFeaturedRecords { get; set; } = null!;
|
||||||
|
|
||||||
public DbSet<Poll.Poll> Polls { get; set; }
|
public DbSet<Poll.Poll> Polls { get; set; } = null!;
|
||||||
public DbSet<Poll.PollQuestion> PollQuestions { get; set; }
|
public DbSet<Poll.PollQuestion> PollQuestions { get; set; } = null!;
|
||||||
public DbSet<Poll.PollAnswer> PollAnswers { get; set; }
|
public DbSet<Poll.PollAnswer> PollAnswers { get; set; } = null!;
|
||||||
|
|
||||||
public DbSet<Realm.Realm> Realms { get; set; }
|
public DbSet<Realm.Realm> Realms { get; set; } = null!;
|
||||||
public DbSet<RealmMember> RealmMembers { get; set; }
|
public DbSet<RealmMember> RealmMembers { get; set; } = null!;
|
||||||
|
|
||||||
public DbSet<ChatRoom> ChatRooms { get; set; }
|
public DbSet<ChatRoom> ChatRooms { get; set; } = null!;
|
||||||
public DbSet<ChatMember> ChatMembers { get; set; }
|
public DbSet<ChatMember> ChatMembers { get; set; } = null!;
|
||||||
public DbSet<Message> ChatMessages { get; set; }
|
public DbSet<Message> ChatMessages { get; set; } = null!;
|
||||||
public DbSet<RealtimeCall> ChatRealtimeCall { get; set; }
|
public DbSet<RealtimeCall> ChatRealtimeCall { get; set; } = null!;
|
||||||
public DbSet<MessageReaction> ChatReactions { get; set; }
|
public DbSet<MessageReaction> ChatReactions { get; set; } = null!;
|
||||||
|
|
||||||
public DbSet<Sticker.Sticker> Stickers { get; set; }
|
public DbSet<Sticker.Sticker> Stickers { get; set; } = null!;
|
||||||
public DbSet<StickerPack> StickerPacks { get; set; }
|
public DbSet<StickerPack> StickerPacks { get; set; } = null!;
|
||||||
public DbSet<StickerPackOwnership> StickerPackOwnerships { get; set; }
|
public DbSet<StickerPackOwnership> StickerPackOwnerships { get; set; } = null!;
|
||||||
|
|
||||||
public DbSet<WebReader.WebArticle> WebArticles { get; set; }
|
public DbSet<WebReader.WebArticle> WebArticles { get; set; } = null!;
|
||||||
public DbSet<WebReader.WebFeed> WebFeeds { get; set; }
|
public DbSet<WebReader.WebFeed> WebFeeds { get; set; } = null!;
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
|
@@ -25,7 +25,7 @@ public class ChatRoom : ModelBase, IIdentifiedResource
|
|||||||
// Outdated fields, for backward compability
|
// Outdated fields, for backward compability
|
||||||
[MaxLength(32)] public string? PictureId { get; set; }
|
[MaxLength(32)] public string? PictureId { get; set; }
|
||||||
[MaxLength(32)] public string? BackgroundId { get; set; }
|
[MaxLength(32)] public string? BackgroundId { get; set; }
|
||||||
|
|
||||||
[Column(TypeName = "jsonb")] public CloudFileReferenceObject? Picture { get; set; }
|
[Column(TypeName = "jsonb")] public CloudFileReferenceObject? Picture { get; set; }
|
||||||
[Column(TypeName = "jsonb")] public CloudFileReferenceObject? Background { get; set; }
|
[Column(TypeName = "jsonb")] public CloudFileReferenceObject? Background { get; set; }
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ public class ChatMember : ModelBase
|
|||||||
public Instant? JoinedAt { get; set; }
|
public Instant? JoinedAt { get; set; }
|
||||||
public Instant? LeaveAt { get; set; }
|
public Instant? LeaveAt { get; set; }
|
||||||
public bool IsBot { get; set; } = false;
|
public bool IsBot { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The break time is the user doesn't receive any message from this member for a while.
|
/// The break time is the user doesn't receive any message from this member for a while.
|
||||||
/// Expect mentioned him or her.
|
/// Expect mentioned him or her.
|
||||||
@@ -115,7 +115,7 @@ public class ChatMemberTransmissionObject : ModelBase
|
|||||||
public Instant? JoinedAt { get; set; }
|
public Instant? JoinedAt { get; set; }
|
||||||
public Instant? LeaveAt { get; set; }
|
public Instant? LeaveAt { get; set; }
|
||||||
public bool IsBot { get; set; } = false;
|
public bool IsBot { get; set; } = false;
|
||||||
|
|
||||||
public Instant? BreakUntil { get; set; }
|
public Instant? BreakUntil { get; set; }
|
||||||
public Instant? TimeoutUntil { get; set; }
|
public Instant? TimeoutUntil { get; set; }
|
||||||
public ChatTimeoutCause? TimeoutCause { get; set; }
|
public ChatTimeoutCause? TimeoutCause { get; set; }
|
||||||
@@ -127,7 +127,7 @@ public class ChatMemberTransmissionObject : ModelBase
|
|||||||
Id = member.Id,
|
Id = member.Id,
|
||||||
ChatRoomId = member.ChatRoomId,
|
ChatRoomId = member.ChatRoomId,
|
||||||
AccountId = member.AccountId,
|
AccountId = member.AccountId,
|
||||||
Account = member.Account,
|
Account = member.Account!,
|
||||||
Nick = member.Nick,
|
Nick = member.Nick,
|
||||||
Role = member.Role,
|
Role = member.Role,
|
||||||
Notify = member.Notify,
|
Notify = member.Notify,
|
||||||
@@ -142,4 +142,4 @@ public class ChatMemberTransmissionObject : ModelBase
|
|||||||
DeletedAt = member.DeletedAt
|
DeletedAt = member.DeletedAt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -970,7 +970,7 @@ public class ChatRoomController(
|
|||||||
? localizer["ChatInviteDirectBody", sender.Nick]
|
? localizer["ChatInviteDirectBody", sender.Nick]
|
||||||
: localizer["ChatInviteBody", member.ChatRoom.Name ?? "Unnamed"];
|
: localizer["ChatInviteBody", member.ChatRoom.Name ?? "Unnamed"];
|
||||||
|
|
||||||
CultureService.SetCultureInfo(member.Account.Language);
|
CultureService.SetCultureInfo(member.Account!.Language);
|
||||||
await pusher.SendPushNotificationToUserAsync(
|
await pusher.SendPushNotificationToUserAsync(
|
||||||
new SendPushNotificationToUserRequest
|
new SendPushNotificationToUserRequest
|
||||||
{
|
{
|
||||||
|
@@ -383,7 +383,7 @@ public partial class ChatService(
|
|||||||
|
|
||||||
// Get keys of messages to remove (where sender is not found)
|
// Get keys of messages to remove (where sender is not found)
|
||||||
var messagesToRemove = messages
|
var messagesToRemove = messages
|
||||||
.Where(m => messageSenders.All(s => s.Id != m.Value.SenderId))
|
.Where(m => messageSenders.All(s => s.Id != m.Value!.SenderId))
|
||||||
.Select(m => m.Key)
|
.Select(m => m.Key)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
@@ -647,4 +647,4 @@ public class SyncResponse
|
|||||||
{
|
{
|
||||||
public List<MessageChange> Changes { get; set; } = [];
|
public List<MessageChange> Changes { get; set; } = [];
|
||||||
public Instant CurrentTimestamp { get; set; }
|
public Instant CurrentTimestamp { get; set; }
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,6 @@ using System.Net;
|
|||||||
using DysonNetwork.Shared.PageData;
|
using DysonNetwork.Shared.PageData;
|
||||||
using DysonNetwork.Shared.Proto;
|
using DysonNetwork.Shared.Proto;
|
||||||
using DysonNetwork.Sphere.Post;
|
using DysonNetwork.Sphere.Post;
|
||||||
using DysonNetwork.Sphere.Publisher;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using OpenGraphNet;
|
using OpenGraphNet;
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ public class PostPageData(
|
|||||||
if (currentUser != null)
|
if (currentUser != null)
|
||||||
{
|
{
|
||||||
var friendsResponse = await accounts.ListFriendsAsync(new ListRelationshipSimpleRequest
|
var friendsResponse = await accounts.ListFriendsAsync(new ListRelationshipSimpleRequest
|
||||||
{ AccountId = currentUser.Id });
|
{ AccountId = currentUser.Id });
|
||||||
userFriends = friendsResponse.AccountsId.Select(Guid.Parse).ToList();
|
userFriends = friendsResponse.AccountsId.Select(Guid.Parse).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,4 +71,4 @@ public class PostPageData(
|
|||||||
["OpenGraph"] = og
|
["OpenGraph"] = og
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -216,9 +216,10 @@ public class PostController(
|
|||||||
if (useVector)
|
if (useVector)
|
||||||
queryable = queryable.Where(p => p.SearchVector.Matches(EF.Functions.ToTsQuery(query)));
|
queryable = queryable.Where(p => p.SearchVector.Matches(EF.Functions.ToTsQuery(query)));
|
||||||
else
|
else
|
||||||
queryable = queryable.Where(p => EF.Functions.ILike(p.Title, $"%{query}%") ||
|
queryable = queryable.Where(p =>
|
||||||
EF.Functions.ILike(p.Description, $"%{query}%") ||
|
(p.Title != null && EF.Functions.ILike(p.Title, $"%{query}%")) ||
|
||||||
EF.Functions.ILike(p.Content, $"%{query}%")
|
(p.Description != null && EF.Functions.ILike(p.Description, $"%{query}%")) ||
|
||||||
|
(p.Content != null && EF.Functions.ILike(p.Content, $"%{query}%"))
|
||||||
);
|
);
|
||||||
|
|
||||||
var totalCount = await queryable.CountAsync();
|
var totalCount = await queryable.CountAsync();
|
||||||
|
Reference in New Issue
Block a user