45 lines
2.1 KiB
C#
45 lines
2.1 KiB
C#
using PrivaPub.ClientModels.Resources;
|
|||
|
|
|
||
|
|
using System.ComponentModel.DataAnnotations;
|
||
|
|
|
||
|
|
namespace PrivaPub.ClientModels.Admin
|
||
|
|
{
|
||
|
|
// one of the server's custom emoji as the administrator's page shows it (/clientapi/admin/emoji/list, completion program
|
||
|
|
// R7): disabled ones too, deleted ones never
|
||
|
|
public class ViewLocalEmoji
|
||
|
|
{
|
||
|
|
public string Id { get; set; }
|
||
|
|
public string Shortcode { get; set; }
|
||
|
|
public string Category { get; set; }
|
||
|
|
public bool VisibleInPicker { get; set; } = true;
|
||
|
|
public bool Disabled { get; set; } = false;
|
||
|
|
public string Url { get; set; }//its picture: a PNG, or an animated GIF
|
||
|
|
public string StaticUrl { get; set; }//a still PNG of it
|
||
|
|
public string ContentType { get; set; }
|
||
|
|
public int? Width { get; set; }
|
||
|
|
public int? Height { get; set; }
|
||
|
|
public long Size { get; set; } = 0;
|
||
|
|
public string Uri { get; set; }//its id on other servers (/emojis/{shortcode}): why a shortcode never changes
|
||
|
|
public DateTime CreatedAt { get; set; }
|
||
|
|
public DateTime UpdatedAt { get; set; }
|
||
|
|
public DateTime ImageUpdatedAt { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
// POST /clientapi/admin/emoji/insert and /emoji/update, as multipart/form-data with the picture as `image` (PNG, GIF,
|
||
|
|
// WebP or JPEG, 256 KB at most; required to insert, optional to update). The shortcode names the emoji: an update
|
||
|
|
// changes the emoji with that shortcode, and an emoji is never renamed (its shortcode is its id elsewhere); an update
|
||
|
|
// sends the emoji as it should be, its category (none when empty), whether it is in the picker and whether it is
|
||
|
|
// disabled.
|
||
|
|
public class LocalEmojiForm
|
||
|
|
{
|
||
|
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||
|
|
RegularExpression(Constants.ShortcodeRegex, ErrorMessageResourceName = "InvalidShortcode", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||
|
|
public string Shortcode { get; set; }
|
||
|
|
|
||
|
|
[StringLength(64, ErrorMessageResourceName = "MaxLengthString", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||
|
|
public string Category { get; set; }
|
||
|
|
|
||
|
|
public bool VisibleInPicker { get; set; } = true;
|
||
|
|
public bool Disabled { get; set; } = false;//kept, but offered nowhere and taken into no new post
|
||
|
|
}
|
||
|
|
}
|