2023-08-08 21:01:13 +01:00
|
|
|
@page
|
2024-02-23 03:23:57 +00:00
|
|
|
@using Humanizer
|
2024-05-05 02:18:20 +01:00
|
|
|
@using OliverBooth.Common.Data.Mastodon
|
|
|
|
@using OliverBooth.Common.Services
|
2023-08-12 20:13:47 +01:00
|
|
|
@model Index
|
2024-02-23 03:23:57 +00:00
|
|
|
@inject IMastodonService MastodonService
|
2023-08-06 15:57:23 +01:00
|
|
|
|
2023-08-11 02:08:03 +01:00
|
|
|
@{
|
|
|
|
ViewData["Title"] = "Blog";
|
2024-05-05 02:18:20 +01:00
|
|
|
IMastodonStatus latestStatus = MastodonService.GetLatestStatus();
|
2023-08-11 02:08:03 +01:00
|
|
|
}
|
|
|
|
|
2024-04-27 16:03:06 +01:00
|
|
|
<div class="card text-center mastodon-update-card">
|
|
|
|
<div class="card-body">
|
|
|
|
@Html.Raw(latestStatus.Content)
|
|
|
|
@foreach (MediaAttachment attachment in latestStatus.MediaAttachments)
|
|
|
|
{
|
|
|
|
switch (attachment.Type)
|
2024-02-23 05:36:31 +00:00
|
|
|
{
|
2024-04-27 16:03:06 +01:00
|
|
|
case AttachmentType.Audio:
|
2024-05-05 02:18:20 +01:00
|
|
|
<p>
|
|
|
|
<audio controls="controls" src="@attachment.Url"></audio>
|
|
|
|
</p>
|
2024-04-27 16:03:06 +01:00
|
|
|
break;
|
2024-02-23 05:36:31 +00:00
|
|
|
|
2024-04-27 16:03:06 +01:00
|
|
|
case AttachmentType.Video:
|
2024-05-05 02:18:20 +01:00
|
|
|
<p>
|
|
|
|
<video controls="controls" class="figure-img img-fluid" src="@attachment.Url"></video>
|
|
|
|
</p>
|
2024-04-27 16:03:06 +01:00
|
|
|
break;
|
2024-02-23 05:36:31 +00:00
|
|
|
|
2024-04-27 16:03:06 +01:00
|
|
|
case AttachmentType.Image:
|
|
|
|
case AttachmentType.GifV:
|
2024-05-05 02:18:20 +01:00
|
|
|
<p>
|
|
|
|
<img class="figure-img img-fluid" src="@attachment.Url">
|
|
|
|
</p>
|
2024-04-27 16:03:06 +01:00
|
|
|
break;
|
2024-02-23 05:36:31 +00:00
|
|
|
}
|
2024-04-27 16:03:06 +01:00
|
|
|
}
|
2024-02-23 03:23:57 +00:00
|
|
|
</div>
|
2024-04-27 16:03:06 +01:00
|
|
|
<div class="card-footer text-muted">
|
|
|
|
<abbr title="@latestStatus.CreatedAt.ToString("F")">@latestStatus.CreatedAt.Humanize()</abbr>
|
|
|
|
•
|
|
|
|
<a href="@latestStatus.OriginalUri" target="_blank">View on Mastodon</a>
|
2024-02-29 18:59:30 +00:00
|
|
|
</div>
|
2024-04-27 16:03:06 +01:00
|
|
|
</div>
|
2023-08-10 04:56:12 +01:00
|
|
|
|
2024-04-27 16:03:06 +01:00
|
|
|
<div id="all-blog-posts">
|
|
|
|
@await Html.PartialAsync("_LoadingSpinner")
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script id="blog-post-template" type="text/x-handlebars-template">
|
|
|
|
<div class="card-header">
|
|
|
|
<span class="text-muted">
|
|
|
|
<img class="blog-author-icon" src="{{author.avatar}}" alt="{{author.name}}">
|
|
|
|
<span>{{author.name}}<span>
|
|
|
|
<span> • </span>
|
|
|
|
<abbr title="{{ post.formattedDate }}">{{ post.date_humanized }}</abbr>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<h2>
|
|
|
|
<a href="{{post.url}}"> {{post.title}}</a>
|
|
|
|
</h2>
|
2023-08-08 21:01:13 +01:00
|
|
|
|
2024-04-27 16:03:06 +01:00
|
|
|
<p>{{{post.excerpt}}}</p>
|
2023-08-08 21:01:13 +01:00
|
|
|
|
2024-04-27 16:03:06 +01:00
|
|
|
{{#if post.trimmed}}
|
|
|
|
<p>
|
|
|
|
<a href="{{post.url}}">
|
|
|
|
Read more...
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
<div class="card-footer">
|
|
|
|
{{#each post.tags}}
|
|
|
|
<a href="?tag={{urlEncode this}}" class="badge text-bg-dark">{{this}}</a>
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
|
|
|
</script>
|