2026-10-07 11:56:59 +02:00
|
|
|
using System.ComponentModel;
|
2022-02-14 01:51:52 +01:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
2026-10-07 11:56:59 +02:00
|
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
|
|
|
|
2022-02-14 01:51:52 +01:00
|
|
|
namespace decePubClient.Models;
|
2022-02-14 01:51:37 +01:00
|
|
|
|
2026-10-07 11:56:59 +02:00
|
|
|
public enum UploadState
|
|
|
|
|
{
|
|
|
|
|
Uploading,
|
|
|
|
|
Processing,
|
|
|
|
|
Ready,
|
|
|
|
|
Failed
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A file attached in the composer. It is uploaded as soon as it is picked, streamed from the browser's file (nothing of
|
|
|
|
|
/// it is kept but a small preview), and its id is kept, so a post that fails never sends it again.
|
|
|
|
|
/// </summary>
|
2022-02-14 01:51:37 +01:00
|
|
|
public class UploadMedia
|
|
|
|
|
{
|
2022-02-14 01:51:52 +01:00
|
|
|
public string ContentType { get; set; }
|
|
|
|
|
public string FileName { get; set; }
|
|
|
|
|
public string AltText { get; set; }
|
2026-10-07 11:56:59 +02:00
|
|
|
public long Size { get; set; }
|
2022-02-14 01:51:52 +01:00
|
|
|
|
2022-02-15 00:08:41 +01:00
|
|
|
[JsonIgnore, Bindable(false)]
|
2026-10-07 11:56:59 +02:00
|
|
|
public IBrowserFile File { get; set; }
|
|
|
|
|
/// <summary>A small picture of it (a thumbnail the browser made), or for media already posted its server's preview.</summary>
|
2022-02-14 01:51:52 +01:00
|
|
|
[JsonIgnore, Bindable(false)]
|
2026-10-07 11:56:59 +02:00
|
|
|
public string Preview { get; set; }
|
|
|
|
|
[JsonIgnore, Bindable(false)]
|
|
|
|
|
public UploadState State { get; set; }
|
|
|
|
|
[JsonIgnore, Bindable(false)]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
[JsonIgnore, Bindable(false)]
|
|
|
|
|
public string Error { get; set; }
|
|
|
|
|
/// <summary>The description the server holds: a different one is sent before the post.</summary>
|
|
|
|
|
[JsonIgnore, Bindable(false)]
|
|
|
|
|
public string SentAltText { get; set; }
|
|
|
|
|
/// <summary>Already on the post being edited: its description changes through the edit.</summary>
|
|
|
|
|
[JsonIgnore, Bindable(false)]
|
|
|
|
|
public bool Posted { get; set; }
|
|
|
|
|
[JsonIgnore, Bindable(false)]
|
|
|
|
|
public CancellationTokenSource Cancel { get; set; }
|
|
|
|
|
[JsonIgnore, Bindable(false)]
|
|
|
|
|
public Task Done { get; set; } = Task.CompletedTask;
|
|
|
|
|
}
|