1 files changed, 15 insertions, 1 deletions
diff --git a/MatrixRoomUtils.Web/Shared/MainLayout.razor b/MatrixRoomUtils.Web/Shared/MainLayout.razor
index 4aa01c6..87442d8 100644
--- a/MatrixRoomUtils.Web/Shared/MainLayout.razor
+++ b/MatrixRoomUtils.Web/Shared/MainLayout.razor
@@ -1,4 +1,6 @@
-@inherits LayoutComponentBase
+@using MatrixRoomUtils.Core.Extensions
+@using System.Net
+@inherits LayoutComponentBase
<div class="page">
<div class="sidebar">
@@ -9,6 +11,10 @@
<div class="top-row px-4">
<a href="https://git.rory.gay/MatrixRoomUtils.git/" target="_blank">Git</a>
<a href="https://matrix.to/#/%23mru%3Arory.gay?via=rory.gay&via=matrix.org&via=feline.support" target="_blank">Matrix</a>
+ @if (showDownload)
+ {
+ <a href="/MRU.tar.xz" target="_blank">Download</a>
+ }
</div>
<article class="content px-4">
@@ -18,6 +24,14 @@
</div>
@code {
+ private bool showDownload { get; set; } = false;
+ protected override async Task OnInitializedAsync()
+ {
+ using var hc = new HttpClient();
+ var hr = await hc.SendAsync(new(HttpMethod.Head, NavigationManager.ToAbsoluteUri("/MRU.tar.xz").AbsoluteUri));
+ showDownload = hr.StatusCode == HttpStatusCode.OK;
+ await base.OnInitializedAsync();
+ }
}
\ No newline at end of file
|