P5: remote objects are read in every shape, and videos, events, audio and links keep their own details
- ObjectShapes reads `url`, `icon` and `image` as a value, a Link or an array; Markdown `content` (PeerTube) is rendered; a missing `mediaType` is inferred from the extension or the attachment type (Bridgy); alt text comes from `name`, `summary` or their language maps; thumbnails come from attachment `icon`, object `icon[]`, `image` or a Loops `preview`; durations are ISO 8601 or seconds; per-attachment `sensitive` is kept; the language falls back to `@context` `@language` (Pleroma); titles and excerpts are plain text; hashtags normalise with NFKC like Mastodon. - Typed details on Post: Link (Lemmy link posts, Mbin `source` URLs, Mastodon 4.7 Link attachments with an FEP-8967 publisher preview), Video (PeerTube files with their streams, HLS playlist, poster, captions, chapters, licence, channel, live state, comment policy), Audio (Funkwhale), Event (Mobilizon, Gancio, Hubzilla: times, zone, floating time, places and addresses, online link, capacity, status), the cover image, and the author's own source text. - Mastodon API: a card built from those details without fetching anything, an event's "when · where" line, attachment thumbnails and durations, and no media file offered as a preview image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
This commit is contained in:
1 parent
dcd024100a
commit
fc111d8c46
12 files changed
+751
-38
No files matched your search
@@ -25,6 +25,18 @@ namespace PrivaPub.Models.Post
|
||||
public List<PostMention> Mentions { get; set; } = new();
|
||||
public List<string> Tags { get; set; } = new();
|
||||
public List<PostMedia> Media { get; set; } = new();
|
||||
[BsonIgnoreIfNull]
|
||||
public PostSource Source { get; set; }//the remote author's own text (Markdown, MFM, BBCode)
|
||||
[BsonIgnoreIfNull]
|
||||
public string CoverURL { get; set; }//a remote object's own image: article cover, video poster, event banner
|
||||
[BsonIgnoreIfNull]
|
||||
public PostLink Link { get; set; }
|
||||
[BsonIgnoreIfNull]
|
||||
public VideoDetails Video { get; set; }
|
||||
[BsonIgnoreIfNull]
|
||||
public AudioDetails Audio { get; set; }
|
||||
[BsonIgnoreIfNull]
|
||||
public EventDetails Event { get; set; }
|
||||
public List<float> Location { get; set; } = new();
|
||||
public float RangeKm { get; set; } = 5.0f;
|
||||
[BsonIgnoreIfNull]
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
namespace PrivaPub.Models.Post
|
||||
{
|
||||
public class PostSource
|
||||
{
|
||||
public string Content { get; set; }
|
||||
public string MediaType { get; set; }//text/markdown, text/x.misskeymarkdown (MFM), text/bbcode…
|
||||
}
|
||||
|
||||
public class PostLink
|
||||
{
|
||||
public string Href { get; set; }
|
||||
public string MediaType { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ImageURL { get; set; }
|
||||
public bool FromPublisher { get; set; }//title, description and image came with the post (FEP-8967 preview), nothing was fetched
|
||||
}
|
||||
|
||||
public class MediaVariant
|
||||
{
|
||||
public string Url { get; set; }
|
||||
public string MediaType { get; set; }
|
||||
public int? Width { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public double? Fps { get; set; }
|
||||
public long? Size { get; set; }
|
||||
public List<string> Streams { get; set; } = new();//"audio", "video", from PeerTube's ffprobe_codec_type
|
||||
}
|
||||
|
||||
public class VideoDetails
|
||||
{
|
||||
public double? DurationSeconds { get; set; }
|
||||
public List<MediaVariant> Variants { get; set; } = new();
|
||||
public string PlaylistURL { get; set; }//HLS
|
||||
public bool IsLive { get; set; }
|
||||
public int? State { get; set; }//PeerTube: 1 published, 4 waiting for live, 5 live ended
|
||||
public long? Views { get; set; }
|
||||
public int? CommentsPolicy { get; set; }//PeerTube: 1 open, 2 closed, 3 needs approval
|
||||
public bool? DownloadEnabled { get; set; }
|
||||
public string Licence { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string ChannelURI { get; set; }
|
||||
public string EmbedURL { get; set; }
|
||||
public string ChaptersURL { get; set; }
|
||||
public List<Caption> Captions { get; set; } = new();
|
||||
}
|
||||
|
||||
public class Caption
|
||||
{
|
||||
public string Language { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
|
||||
public class AudioDetails
|
||||
{
|
||||
public double? DurationSeconds { get; set; }
|
||||
public List<MediaVariant> Variants { get; set; } = new();
|
||||
public string Album { get; set; }
|
||||
public int? Position { get; set; }
|
||||
public string Licence { get; set; }
|
||||
}
|
||||
|
||||
public class EventDetails
|
||||
{
|
||||
public DateTime? Start { get; set; }
|
||||
public DateTime? End { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public bool FloatingTime { get; set; }//"-00:00": a local time with no zone (Hubzilla)
|
||||
public List<EventPlace> Places { get; set; } = new();
|
||||
public string OnlineURL { get; set; }
|
||||
public string JoinMode { get; set; }
|
||||
public int? ParticipantCount { get; set; }
|
||||
public int? Capacity { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string Category { get; set; }
|
||||
}
|
||||
|
||||
public class EventPlace
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Address { get; set; }
|
||||
public double? Latitude { get; set; }
|
||||
public double? Longitude { get; set; }
|
||||
public string Url { get; set; }//a VirtualLocation
|
||||
}
|
||||
}
|
||||
@@ -16,5 +16,8 @@ namespace PrivaPub.Models.Post
|
||||
public int? Width { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public float[] Focus { get; set; }
|
||||
public string RemotePreviewURL { get; set; }//the remote thumbnail (attachment icon), served through the proxy
|
||||
public double? DurationSeconds { get; set; }
|
||||
public bool? Sensitive { get; set; }//Misskey marks each attachment
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user