refactor: move to new mastodon instance

This commit is contained in:
Oliver Booth 2024-07-05 00:46:40 +01:00
parent 8dbfeb8d38
commit 901a8347b9
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
2 changed files with 4 additions and 2 deletions

View File

@ -106,7 +106,7 @@
<hr> <hr>
<ul class="footer-nav"> <ul class="footer-nav">
<li><a title="@("@oliver@mastodon.olivr.me")" href="https://mastodon.olivr.me/@@oliver" rel="me" class="brand-mastodon"><i class="fa-brands fa-mastodon"></i></a></li> <li><a title="@("@oliverbooth@mastodon.social")" href="https://mastodon.social/@@oliverbooth" rel="me" class="brand-mastodon"><i class="fa-brands fa-mastodon"></i></a></li>
<li><a title="LinkedIn/oliverlukebooth" href="https://www.linkedin.com/in/oliverlukebooth/" class="brand-linkedin"><i class="fa-brands fa-linkedin"></i></a></li> <li><a title="LinkedIn/oliverlukebooth" href="https://www.linkedin.com/in/oliverlukebooth/" class="brand-linkedin"><i class="fa-brands fa-linkedin"></i></a></li>
<li><a title="Blog RSS Feed" asp-controller="Rss" asp-action="OnGet"><i class="fa-solid fa-rss text-orange"></i></a></li> <li><a title="Blog RSS Feed" asp-controller="Rss" asp-action="OnGet"><i class="fa-solid fa-rss text-orange"></i></a></li>
<li><a title="View Source" href="https://git.oliverbooth.dev/oliverbooth/oliverbooth.dev"><i class="fa-solid fa-code"></i></a></li> <li><a title="View Source" href="https://git.oliverbooth.dev/oliverbooth/oliverbooth.dev"><i class="fa-solid fa-code"></i></a></li>

View File

@ -27,11 +27,13 @@ internal sealed class MastodonService : IMastodonService
/// <inheritdoc /> /// <inheritdoc />
public IMastodonStatus GetLatestStatus() public IMastodonStatus GetLatestStatus()
{ {
string domain = _configuration.GetSection("Mastodon:Domain").Value ?? string.Empty;
string token = _configuration.GetSection("Mastodon:Token").Value ?? string.Empty; string token = _configuration.GetSection("Mastodon:Token").Value ?? string.Empty;
string account = _configuration.GetSection("Mastodon:Account").Value ?? string.Empty; string account = _configuration.GetSection("Mastodon:Account").Value ?? string.Empty;
using var request = new HttpRequestMessage(); using var request = new HttpRequestMessage();
request.Headers.Add("Authorization", $"Bearer {token}"); request.Headers.Add("Authorization", $"Bearer {token}");
request.RequestUri = new Uri($"https://mastodon.olivr.me/api/v1/accounts/{account}/statuses"); request.RequestUri = new Uri($"https://{domain}/api/v1/accounts/{account}/statuses");
using HttpResponseMessage response = _httpClient.Send(request); using HttpResponseMessage response = _httpClient.Send(request);
using var stream = response.Content.ReadAsStream(); using var stream = response.Content.ReadAsStream();