MainLayout.razor (1428B)
1 @using System.Net 2 @inherits LayoutComponentBase 3 4 <div class="page"> 5 <div class="sidebar"> 6 <NavMenu/> 7 </div> 8 9 <main> 10 <div class="top-row px-4"> 11 <PortableDevTools></PortableDevTools> 12 <a href="https://git.rory.gay/MatrixRoomUtils.git/" target="_blank">Git</a> 13 <a href="https://matrix.to/#/%23mru%3Arory.gay?via=rory.gay&via=matrix.org&via=feline.support" target="_blank">Matrix</a> 14 @if (showDownload) 15 { 16 <a href="/MRU.tar.xz" target="_blank">Download</a> 17 } 18 </div> 19 20 <article class="Content px-4"> 21 @Body 22 </article> 23 </main> 24 </div> 25 26 @code { 27 private bool showDownload { get; set; } = false; 28 29 protected override async Task OnInitializedAsync() 30 { 31 using var hc = new HttpClient(); 32 var hr = await hc.SendAsync(new(HttpMethod.Head, NavigationManager.ToAbsoluteUri("/MRU-BIN.tar.xz").AbsoluteUri)); 33 showDownload = hr.StatusCode == HttpStatusCode.OK; 34 35 await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); 36 if (!LocalStorageWrapper.Settings.DeveloperSettings.EnableConsoleLogging) 37 { 38 Console.WriteLine("Console logging disabled!"); 39 var sw = new StringWriter(); 40 Console.SetOut(sw); 41 Console.SetError(sw); 42 } 43 44 await base.OnInitializedAsync(); 45 46 } 47 }