2023-08-08 21:01:13 +01:00
|
|
|
@page
|
2024-02-23 03:23:57 +00:00
|
|
|
@using Humanizer
|
2024-02-23 05:36:31 +00:00
|
|
|
@using OliverBooth.Data.Mastodon
|
2024-02-23 03:23:57 +00:00
|
|
|
@using OliverBooth.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-02-23 05:36:31 +00:00
|
|
|
MastodonStatus latestStatus = MastodonService.GetLatestStatus();
|
2024-02-29 18:59:30 +00:00
|
|
|
bool doAprilFools = DateOnly.FromDateTime(DateTime.UtcNow) == new DateOnly(2024, 04, 01) || Environment.GetEnvironmentVariable("DO_AF") == "1";
|
2023-08-11 02:08:03 +01:00
|
|
|
}
|
|
|
|
|
2024-02-29 18:59:30 +00:00
|
|
|
@if (doAprilFools)
|
|
|
|
{
|
|
|
|
<h1>UNDER CONSTRUCTION</h1>
|
|
|
|
<div style="text-align: center">
|
|
|
|
<img src="~/img/construction_90x85.gif">
|
|
|
|
<img src="~/img/underconstruction_323x118.gif">
|
|
|
|
<img src="~/img/construction_90x85.gif">
|
|
|
|
<p>Coming soon WATCH THIS SPACE</p>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<div class="card text-center mastodon-update-card">
|
|
|
|
<div class="card-body">
|
|
|
|
@Html.Raw(latestStatus.Content)
|
|
|
|
@foreach (MediaAttachment attachment in latestStatus.MediaAttachments)
|
2024-02-23 05:36:31 +00:00
|
|
|
{
|
2024-02-29 18:59:30 +00:00
|
|
|
switch (attachment.Type)
|
|
|
|
{
|
|
|
|
case AttachmentType.Audio:
|
|
|
|
<p><audio controls="controls" src="@attachment.Url"></audio></p>
|
|
|
|
break;
|
2024-02-23 05:36:31 +00:00
|
|
|
|
2024-02-29 18:59:30 +00:00
|
|
|
case AttachmentType.Video:
|
|
|
|
<p><video controls="controls" class="figure-img img-fluid" src="@attachment.Url"></video></p>
|
|
|
|
break;
|
2024-02-23 05:36:31 +00:00
|
|
|
|
2024-02-29 18:59:30 +00:00
|
|
|
case AttachmentType.Image:
|
|
|
|
case AttachmentType.GifV:
|
|
|
|
<p><img class="figure-img img-fluid" src="@attachment.Url"></p>
|
|
|
|
break;
|
|
|
|
}
|
2024-02-23 05:36:31 +00:00
|
|
|
}
|
2024-02-29 18:59:30 +00:00
|
|
|
</div>
|
|
|
|
<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>
|
|
|
|
</div>
|
2024-02-23 03:23:57 +00:00
|
|
|
</div>
|
|
|
|
|
2024-02-29 18:59:30 +00:00
|
|
|
<div id="all-blog-posts">
|
|
|
|
@await Html.PartialAsync("_LoadingSpinner")
|
|
|
|
</div>
|
2023-08-10 04:56:12 +01:00
|
|
|
|
2024-02-29 18:59:30 +00:00
|
|
|
<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>
|
2023-08-10 14:36:51 +01:00
|
|
|
<span> • </span>
|
2024-02-29 18:59:30 +00:00
|
|
|
<abbr title="{{ post.formattedDate }}">{{ post.date_humanized }}</abbr>
|
|
|
|
{{#if post.enable_comments}}
|
|
|
|
<span> • </span>
|
|
|
|
<a href="{{post.url}}#disqus_thread" data-disqus-identifier="{{post.disqus_identifier}}">
|
|
|
|
Loading comment count …
|
|
|
|
</a>
|
|
|
|
{{/if}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<h2>
|
|
|
|
<a href="{{post.url}}"> {{post.title}}</a>
|
|
|
|
</h2>
|
2023-08-08 21:01:13 +01:00
|
|
|
|
2024-02-29 18:59:30 +00:00
|
|
|
<p>{{{post.excerpt}}}</p>
|
2023-08-08 21:01:13 +01:00
|
|
|
|
2024-02-29 18:59:30 +00: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>
|
|
|
|
}
|