From 6c53f3dc43f072dce4ffe4a1bd306074dd20ff39 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sun, 17 Aug 2025 22:10:27 +1000 Subject: Initial commit --- Pages/Index.cshtml | 15 +++++++ Pages/Index.cshtml.cs | 15 +++++++ Pages/Index.cshtml.css | 7 ++++ Pages/Shared/_Layout.cshtml | 25 ++++++++++++ Pages/Shared/_Layout.cshtml.css | 18 +++++++++ Pages/ViewMedia.cshtml | 88 +++++++++++++++++++++++++++++++++++++++++ Pages/ViewMedia.cshtml.cs | 23 +++++++++++ Pages/ViewMedia.cshtml.css | 52 ++++++++++++++++++++++++ Pages/_ViewStart.cshtml | 3 ++ 9 files changed, 246 insertions(+) create mode 100644 Pages/Index.cshtml create mode 100644 Pages/Index.cshtml.cs create mode 100644 Pages/Index.cshtml.css create mode 100644 Pages/Shared/_Layout.cshtml create mode 100644 Pages/Shared/_Layout.cshtml.css create mode 100644 Pages/ViewMedia.cshtml create mode 100644 Pages/ViewMedia.cshtml.cs create mode 100644 Pages/ViewMedia.cshtml.css create mode 100644 Pages/_ViewStart.cshtml (limited to 'Pages') diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml new file mode 100644 index 0000000..80e05d9 --- /dev/null +++ b/Pages/Index.cshtml @@ -0,0 +1,15 @@ +@page +@model HyperBooru.Pages.IndexModel + + + +
+ + +
+ +@foreach(var media in Model.Media) { + + + +} \ No newline at end of file diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs new file mode 100644 index 0000000..e03a330 --- /dev/null +++ b/Pages/Index.cshtml.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace HyperBooru.Pages; + +public class IndexModel : PageModel { + public IEnumerable Media => db.Media; + + private HyperBooruDbContext db; + + public IndexModel(HyperBooruDbContext db) => + this.db = db; + + public void OnGet() {} +} \ No newline at end of file diff --git a/Pages/Index.cshtml.css b/Pages/Index.cshtml.css new file mode 100644 index 0000000..f573988 --- /dev/null +++ b/Pages/Index.cshtml.css @@ -0,0 +1,7 @@ +img { + max-height: 200px; +} + +form#upload { + padding-bottom: 30px; +} \ No newline at end of file diff --git a/Pages/Shared/_Layout.cshtml b/Pages/Shared/_Layout.cshtml new file mode 100644 index 0000000..be445cc --- /dev/null +++ b/Pages/Shared/_Layout.cshtml @@ -0,0 +1,25 @@ +@{ + ViewBag.Title ??= "HyperBooru"; + ViewBag.ContentScroll ??= true; + ViewBag.ContentMargin ??= "30px"; +} + + + + + + + + + @ViewBag.Title + + + +
+ @RenderBody() +
+ + \ No newline at end of file diff --git a/Pages/Shared/_Layout.cshtml.css b/Pages/Shared/_Layout.cshtml.css new file mode 100644 index 0000000..5b2ba65 --- /dev/null +++ b/Pages/Shared/_Layout.cshtml.css @@ -0,0 +1,18 @@ +div#navbar { + background: var(--col-navbar-bg); + box-shadow: rgba(0, 0, 0, 0.5) 0px 10px 10px; +} + +div#navbar > a { + display: inline-block; + padding: 20px 20px 20px 20px; +} + +div#navbar > a:hover { + background: rgba(255, 255, 255, 0.4); +} + +div#navbar > a:active { + background: #fff; + color: var(--col-navbar-bg); +} \ No newline at end of file diff --git a/Pages/ViewMedia.cshtml b/Pages/ViewMedia.cshtml new file mode 100644 index 0000000..967759b --- /dev/null +++ b/Pages/ViewMedia.cshtml @@ -0,0 +1,88 @@ +@page +@model HyperBooru.Pages.ViewMediaModel +@{ + ViewBag.ContentScroll = false; +} + + + + + +
+ +
+
+ File Info + Tags +
+@*
+ + + + + +
*@ +
+

Upload history

+
+ + + + + + + + + @foreach(var file in Model.Media.UploadedFiles) { + + + + + + + + } +
Created OnLast WriteUploaded OnFilenameOriginal Checksum
@(file.CreateTime?.ToString() ?? "N/A")@(file.LastWriteTime?.ToString() ?? "N/A")@file.UploadTime@file.Filename@file.OriginalChecksum
+
+
+ + + + +
Tag Name
+ +
+
+
\ No newline at end of file diff --git a/Pages/ViewMedia.cshtml.cs b/Pages/ViewMedia.cshtml.cs new file mode 100644 index 0000000..fe8d150 --- /dev/null +++ b/Pages/ViewMedia.cshtml.cs @@ -0,0 +1,23 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace HyperBooru.Pages; + +public class ViewMediaModel : PageModel { + public DbMedia Media { get; private set; } + + private HyperBooruDbContext db; + + public ViewMediaModel(HyperBooruDbContext db) => + this.db = db; + + public IActionResult OnGet([FromQuery(Name = "m")] Guid mediaId) { + var media = db.Media.First(m => m.Guid == mediaId); + if(media is null) + return NotFound(); + + Media = media; + + return Page(); + } +} \ No newline at end of file diff --git a/Pages/ViewMedia.cshtml.css b/Pages/ViewMedia.cshtml.css new file mode 100644 index 0000000..ff8a1cd --- /dev/null +++ b/Pages/ViewMedia.cshtml.css @@ -0,0 +1,52 @@ +div#content { + display: flex; + align-items: start; + height: 100%; +} + +div#content > img { + max-width: 60%; + height: 100%; + object-fit: contain; +} + +div#metadata { + margin-left: 15px; + width: 100%; +} + +div#metadata > div { + display: none; +} + +div#metadata > div.selected { + display: inherit !important; +} + +div#metadata-header { + display: inherit !important; + border-bottom: 1px solid white; +} + +div#metadata-header > a { + display: inline-block; + padding: 10px 10px 9px 10px; +} + +div#metadata-header > a.selected { + border-bottom: 4px solid white; + padding-bottom: 5px; +} + +div#metadata-header > a:hover { + background: rgba(255, 255, 255, 0.4); +} + +div#metadata-fileinfo > table th { + font-size: 8pt; +} + +div#metadata-fileinfo > table td { + font-family: 'Lucida Console'; + font-size: 8pt; +} \ No newline at end of file diff --git a/Pages/_ViewStart.cshtml b/Pages/_ViewStart.cshtml new file mode 100644 index 0000000..1af6e49 --- /dev/null +++ b/Pages/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} \ No newline at end of file -- cgit v1.3