♻️ Move the web reader from Sphere to Insight (w.i.p)

This commit is contained in:
2026-01-02 00:15:56 +08:00
parent c4b2b2f61f
commit ede49333f8
18 changed files with 59 additions and 64 deletions

View File

@@ -0,0 +1,41 @@
using System.Text.Json;
using DysonNetwork.Shared.Proto;
namespace DysonNetwork.Shared.Models.Embed;
/// <summary>
/// The embeddable can be used in the post or messages' meta's embeds fields
/// To render a richer type of content.
///
/// A simple example of using link preview embed:
/// <code>
/// {
/// // ... post content
/// "meta": {
/// "embeds": [
/// {
/// "type": "link",
/// "title: "...",
/// /// ...
/// }
/// ]
/// }
/// }
/// </code>
/// </summary>
public abstract class EmbeddableBase
{
public abstract string Type { get; }
public static Dictionary<string, object> ToDictionary(dynamic input)
{
var jsonRaw = JsonSerializer.Serialize(
input,
GrpcTypeHelper.SerializerOptionsWithoutIgnore
);
return JsonSerializer.Deserialize<Dictionary<string, object>>(
jsonRaw,
GrpcTypeHelper.SerializerOptionsWithoutIgnore
);
}
}