summaryrefslogtreecommitdiff
path: root/Pages/Component/Titlebar.razor
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2026-05-22 00:52:16 +1000
committerJake Mannens <jake@asger.xyz>2026-05-23 22:22:55 +1000
commit12eaa5814ef20b0910e8d64a753378b6f6797989 (patch)
tree062cf477c29054e0f089cb80f0cd79a9f3b7ccd9 /Pages/Component/Titlebar.razor
parent6de5d7f5364fe1d54703da6d6b7cb08ea26e939f (diff)
Initial commitwasm-initial
Diffstat (limited to 'Pages/Component/Titlebar.razor')
-rw-r--r--Pages/Component/Titlebar.razor87
1 files changed, 0 insertions, 87 deletions
diff --git a/Pages/Component/Titlebar.razor b/Pages/Component/Titlebar.razor
deleted file mode 100644
index 48257b2..0000000
--- a/Pages/Component/Titlebar.razor
+++ /dev/null
@@ -1,87 +0,0 @@
-@inject IJSRuntime jsRuntime
-@inject IUserService userService
-
-<script suppress-error="BL9992">
- async function login() {
- var username = document.querySelector('input#username');
- var password = document.querySelector('input#password');
-
- var formData = new FormData();
- formData.append('username', username.value);
- formData.append('password', password.value);
-
- var resp = await fetch('/Login', {
- method: 'POST',
- body: formData
- });
-
- if(resp.ok) {
- window.location.href = '/';
- } else if(resp.status == 403) {
- var form = document.querySelector('form.login');
- form.classList.remove('bad-login');
- @* TODO: improve this hacky method of triggering reflow *@
- form.offsetWidth;
- form.classList.add('bad-login');
- username.value = password.value = null;
- username.focus();
- } else {
- alert('Unknown error while attempting to login!');
- }
- }
-
- async function logout() {
- var resp = await fetch('/Logout', { method: 'POST' });
- if(resp.ok) {
- window.location.href = '/Login';
- } else {
- alert('Error logging out!');
- }
- }
-</script>
-
-<AuthorizeView>
- <Authorized>
- <div id="navbar">
- <p class="mobile">HyperBooru</p>
- <a class="mobile menu-button" href="javascript:toggleMobileMenu();">&#x2630</a>
-
- <a class="desktop" href="/">Home</a>
- <a class="desktop" href="/TagDefinitions">Tags</a>
- <a class="desktop" href="/Gallery?ingest=true">Ingest</a>
- <a class="desktop" href="/Upload">Upload</a>
- <a class="desktop" href="javascript:;" @onclick=@(() => aboutDialog.Show())>About</a>
-
- <p class="desktop" id="nsfw-label">NSFW</p>
- <div id="nsfw-switch" class="desktop">
- <NsfwSwitch/>
- </div>
- <form action="/Gallery" method="get" class="desktop">
- <input type="text" name="q" placeholder="Search"/>
- </form>
- <a class="desktop" href="javascript:logout();">Logout</a>
- </div>
- <AboutDialog @ref=aboutDialog/>
- </Authorized>
- <NotAuthorized>
- <div id="navbar">
- <h2>Login</h2>
- <form class="login" action="javascript:login();">
- <input
- id="username"
- placeholder="Username"
- type="text"
- autocorrect="off"
- autocapitalize="off"
- autocomplete="off"
- autofocus/>
- <input id="password" placeholder="Password" type="password"/>
- </form>
- <a href="javascript:login();">Login</a>
- </div>
- </NotAuthorized>
-</AuthorizeView>
-
-@code {
- private AboutDialog aboutDialog;
-}