mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Add banner (large) image
This commit is contained in:
parent
7681978435
commit
e144571904
17 changed files with 231 additions and 11 deletions
8
PluralKit.Core/Database/Migrations/15.sql
Normal file
8
PluralKit.Core/Database/Migrations/15.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- SCHEMA VERSION 15: 2021-08-01
|
||||
-- add banner (large) images to entities with "cards"
|
||||
|
||||
alter table systems add column banner_image text;
|
||||
alter table members add column banner_image text;
|
||||
alter table groups add column banner_image text;
|
||||
|
||||
update info set schema_version = 15;
|
||||
|
|
@ -12,7 +12,7 @@ namespace PluralKit.Core
|
|||
internal class DatabaseMigrator
|
||||
{
|
||||
private const string RootPath = "PluralKit.Core.Database"; // "resource path" root for SQL files
|
||||
private const int TargetSchemaVersion = 14;
|
||||
private const int TargetSchemaVersion = 15;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DatabaseMigrator(ILogger logger)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace PluralKit.Core
|
|||
public string? DisplayName { get; private set; }
|
||||
public string? Description { get; private set; }
|
||||
public string? Icon { get; private set; }
|
||||
public string? BannerImage { get; private set; }
|
||||
public string? Color { get; private set; }
|
||||
|
||||
public PrivacyLevel DescriptionPrivacy { get; private set; }
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ namespace PluralKit.Core {
|
|||
public SystemId System { get; private set; }
|
||||
public string Color { get; private set; }
|
||||
public string AvatarUrl { get; private set; }
|
||||
public string BannerImage { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string DisplayName { get; private set; }
|
||||
public LocalDate? Birthday { get; private set; }
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace PluralKit.Core {
|
|||
public string Description { get; }
|
||||
public string Tag { get; }
|
||||
public string AvatarUrl { get; }
|
||||
public string BannerImage { get; }
|
||||
public string Color { get; }
|
||||
public string Token { get; }
|
||||
public Instant Created { get; }
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace PluralKit.Core
|
|||
public Partial<string?> DisplayName { get; set; }
|
||||
public Partial<string?> Description { get; set; }
|
||||
public Partial<string?> Icon { get; set; }
|
||||
public Partial<string?> BannerImage { get; set; }
|
||||
public Partial<string?> Color { get; set; }
|
||||
|
||||
public Partial<PrivacyLevel> DescriptionPrivacy { get; set; }
|
||||
|
|
@ -23,6 +24,7 @@ namespace PluralKit.Core
|
|||
.With("display_name", DisplayName)
|
||||
.With("description", Description)
|
||||
.With("icon", Icon)
|
||||
.With("banner_image", BannerImage)
|
||||
.With("color", Color)
|
||||
.With("description_privacy", DescriptionPrivacy)
|
||||
.With("icon_privacy", IconPrivacy)
|
||||
|
|
@ -32,7 +34,9 @@ namespace PluralKit.Core
|
|||
public new void CheckIsValid()
|
||||
{
|
||||
if (Icon.Value != null && !MiscUtils.TryMatchUri(Icon.Value, out var avatarUri))
|
||||
throw new InvalidPatchException("avatar_url");
|
||||
throw new InvalidPatchException("icon");
|
||||
if (BannerImage.Value != null && !MiscUtils.TryMatchUri(BannerImage.Value, out var bannerImage))
|
||||
throw new InvalidPatchException("banner");
|
||||
if (Color.Value != null && (!Regex.IsMatch(Color.Value, "^[0-9a-fA-F]{6}$")))
|
||||
throw new InvalidPatchException("color");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace PluralKit.Core
|
|||
public Partial<string> Hid { get; set; }
|
||||
public Partial<string?> DisplayName { get; set; }
|
||||
public Partial<string?> AvatarUrl { get; set; }
|
||||
public Partial<string?> BannerImage { get; set; }
|
||||
public Partial<string?> Color { get; set; }
|
||||
public Partial<LocalDate?> Birthday { get; set; }
|
||||
public Partial<string?> Pronouns { get; set; }
|
||||
|
|
@ -32,6 +33,7 @@ namespace PluralKit.Core
|
|||
.With("hid", Hid)
|
||||
.With("display_name", DisplayName)
|
||||
.With("avatar_url", AvatarUrl)
|
||||
.With("banner_image", BannerImage)
|
||||
.With("color", Color)
|
||||
.With("birthday", Birthday)
|
||||
.With("pronouns", Pronouns)
|
||||
|
|
@ -52,6 +54,8 @@ namespace PluralKit.Core
|
|||
{
|
||||
if (AvatarUrl.Value != null && !MiscUtils.TryMatchUri(AvatarUrl.Value, out var avatarUri))
|
||||
throw new InvalidPatchException("avatar_url");
|
||||
if (BannerImage.Value != null && !MiscUtils.TryMatchUri(BannerImage.Value, out var bannerImage))
|
||||
throw new InvalidPatchException("banner");
|
||||
if (Color.Value != null && (!Regex.IsMatch(Color.Value, "^[0-9a-fA-F]{6}$")))
|
||||
throw new InvalidPatchException("color");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace PluralKit.Core
|
|||
public Partial<string?> Description { get; set; }
|
||||
public Partial<string?> Tag { get; set; }
|
||||
public Partial<string?> AvatarUrl { get; set; }
|
||||
public Partial<string?> BannerImage { get; set; }
|
||||
public Partial<string?> Color { get; set; }
|
||||
public Partial<string?> Token { get; set; }
|
||||
public Partial<string> UiTz { get; set; }
|
||||
|
|
@ -29,6 +30,7 @@ namespace PluralKit.Core
|
|||
.With("description", Description)
|
||||
.With("tag", Tag)
|
||||
.With("avatar_url", AvatarUrl)
|
||||
.With("banner_image", BannerImage)
|
||||
.With("color", Color)
|
||||
.With("token", Token)
|
||||
.With("ui_tz", UiTz)
|
||||
|
|
@ -46,6 +48,8 @@ namespace PluralKit.Core
|
|||
{
|
||||
if (AvatarUrl.Value != null && !MiscUtils.TryMatchUri(AvatarUrl.Value, out var avatarUri))
|
||||
throw new InvalidPatchException("avatar_url");
|
||||
if (BannerImage.Value != null && !MiscUtils.TryMatchUri(BannerImage.Value, out var bannerImage))
|
||||
throw new InvalidPatchException("banner");
|
||||
if (Color.Value != null && (!Regex.IsMatch(Color.Value, "^[0-9a-fA-F]{6}$")))
|
||||
throw new InvalidPatchException("color");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue