[backend/api] Add BannerUrl to InstanceResponse
This commit is contained in:
parent
72bb4123f8
commit
4085d6398c
2 changed files with 10 additions and 2 deletions
|
@ -34,8 +34,14 @@ public class InstanceController(
|
||||||
{
|
{
|
||||||
var limits = new Limitations { NoteLength = instanceConfig.Value.CharacterLimit };
|
var limits = new Limitations { NoteLength = instanceConfig.Value.CharacterLimit };
|
||||||
|
|
||||||
var iconId = await meta.GetAsync(MetaEntity.IconFileId);
|
var (iconId, bannerId) = await meta.GetManyAsync(MetaEntity.IconFileId, MetaEntity.BannerFileId);
|
||||||
var iconUrl = await db.DriveFiles.Where(p => p.Id == iconId).Select(p => p.PublicUrl).FirstOrDefaultAsync();
|
|
||||||
|
var iconUrl = await db.DriveFiles.Where(p => p.Id == iconId)
|
||||||
|
.Select(p => p.PublicUrl ?? p.RawAccessUrl)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
var bannerUrl = await db.DriveFiles.Where(p => p.Id == bannerId)
|
||||||
|
.Select(p => p.PublicUrl ?? p.RawAccessUrl)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
return new InstanceResponse
|
return new InstanceResponse
|
||||||
{
|
{
|
||||||
|
@ -44,6 +50,7 @@ public class InstanceController(
|
||||||
Registration = (Registrations)securityConfig.Value.Registrations,
|
Registration = (Registrations)securityConfig.Value.Registrations,
|
||||||
Name = await meta.GetAsync(MetaEntity.InstanceName),
|
Name = await meta.GetAsync(MetaEntity.InstanceName),
|
||||||
IconUrl = iconUrl,
|
IconUrl = iconUrl,
|
||||||
|
BannerUrl = bannerUrl,
|
||||||
Limits = limits
|
Limits = limits
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ public class InstanceResponse
|
||||||
public required Registrations Registration { get; set; }
|
public required Registrations Registration { get; set; }
|
||||||
public required string? Name { get; set; }
|
public required string? Name { get; set; }
|
||||||
public required string? IconUrl { get; set; }
|
public required string? IconUrl { get; set; }
|
||||||
|
public required string? BannerUrl { get; set; }
|
||||||
public required Limitations Limits { get; set; }
|
public required Limitations Limits { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue