summaryrefslogtreecommitdiff
path: root/Components
diff options
context:
space:
mode:
Diffstat (limited to 'Components')
-rw-r--r--Components/App.razor24
-rw-r--r--Components/Pages/Error.razor36
-rw-r--r--Components/_Imports.razor11
3 files changed, 71 insertions, 0 deletions
diff --git a/Components/App.razor b/Components/App.razor
new file mode 100644
index 0000000..394c7ba
--- /dev/null
+++ b/Components/App.razor
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
+ <base href="/" />
+ <ResourcePreloader />
+ <link rel="stylesheet" href="@Assets["app.css"]" />
+ <link rel="stylesheet" href="@Assets["HyperBooru.Server.styles.css"]" />
+ <link rel="stylesheet" href="/styles/global.css" />
+ <link href="/favicon.ico" rel="icon" />
+ <link href="/manifest.webmanifest" rel="manifest" />
+ <script type="text/javascript" src="/js/dialog.js"></script>
+ <script type="text/javascript" src="/js/keyboard.js"></script>
+ <script type="text/javascript" src="/js/mobile.js"></script>
+ <ImportMap />
+ <HeadOutlet @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)" />
+ </head>
+
+ <body>
+ <Routes @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)" />
+ <script src="@Assets["_framework/blazor.web.js"]"></script>
+ </body>
+</html>
diff --git a/Components/Pages/Error.razor b/Components/Pages/Error.razor
new file mode 100644
index 0000000..576cc2d
--- /dev/null
+++ b/Components/Pages/Error.razor
@@ -0,0 +1,36 @@
+@page "/Error"
+@using System.Diagnostics
+
+<PageTitle>Error</PageTitle>
+
+<h1 class="text-danger">Error.</h1>
+<h2 class="text-danger">An error occurred while processing your request.</h2>
+
+@if (ShowRequestId)
+{
+ <p>
+ <strong>Request ID:</strong> <code>@RequestId</code>
+ </p>
+}
+
+<h3>Development Mode</h3>
+<p>
+ Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
+</p>
+<p>
+ <strong>The Development environment shouldn't be enabled for deployed applications.</strong>
+ It can result in displaying sensitive information from exceptions to end users.
+ For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
+ and restarting the app.
+</p>
+
+@code{
+ [CascadingParameter]
+ private HttpContext? HttpContext { get; set; }
+
+ private string? RequestId { get; set; }
+ private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
+
+ protected override void OnInitialized() =>
+ RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
+}
diff --git a/Components/_Imports.razor b/Components/_Imports.razor
new file mode 100644
index 0000000..2986fa6
--- /dev/null
+++ b/Components/_Imports.razor
@@ -0,0 +1,11 @@
+@using System.Net.Http
+@using System.Net.Http.Json
+@using Microsoft.AspNetCore.Components.Forms
+@using Microsoft.AspNetCore.Components.Routing
+@using Microsoft.AspNetCore.Components.Web
+@using static Microsoft.AspNetCore.Components.Web.RenderMode
+@using Microsoft.AspNetCore.Components.Web.Virtualization
+@using Microsoft.JSInterop
+@using HyperBooru.Server
+@using HyperBooru.Client
+@using HyperBooru.Server.Components