diff --git a/lib/PoorBooru.pm b/lib/PoorBooru.pm index 56d849c..e054a5c 100644 --- a/lib/PoorBooru.pm +++ b/lib/PoorBooru.pm @@ -129,10 +129,26 @@ get "/tag/:tag_id_or_name" => sub { }; }; +get "/view/:media_id" => sub { + my $media_id = route_parameters->get("media_id"); + + my $res = api_get("/media/$media_id"); + send_error("API error", 500) if !$res->{success}; + + my $data = decode_json($res->{content}); + + template "media" => { + no_title => 1, + title => $data->{id}, + image_src => "$POORBOORU_API/download/" . $data->{id}, + media_id => $data->{id}, + media_filename => $data->{filename}, + media_size => $data->{size}, + media_tags => [], + }; +}; + get "/random" => sub { }; -get "/view/:media_id" => sub { -}; - true; diff --git a/public/css/style.css b/public/css/style.css index 747e90b..a82fc38 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -29,7 +29,11 @@ box-sizing: border-box; } +dd, +dl, +dt, h1, +h2, p { margin: 0; } @@ -44,7 +48,13 @@ body { line-height: 2.4; } +main { + padding-top: 1.5rem; +} + +dl, h1, +h2, p { margin-bottom: 1.5rem; } @@ -59,6 +69,11 @@ h1 { line-height: 2; } +h2 { + font-size: 2.5rem; + line-height: 1.2; +} + a { color: var(--accent-color-0); } @@ -73,6 +88,14 @@ a:active { color: var(--accent-color-1); } +dt { + font-weight: bold; +} + +dd { + margin-left: 3rem; +} + .viewport { margin-left: auto; margin-right: auto; @@ -135,6 +158,10 @@ a:active { width: 100%; } +.media-image { + max-width: 100%; +} + .flex-c-horizontal { display: flex; } diff --git a/views/layouts/main.tt b/views/layouts/main.tt index f08388d..e1fef2b 100644 --- a/views/layouts/main.tt +++ b/views/layouts/main.tt @@ -18,7 +18,9 @@
+[% UNLESS no_title %]

[% title %]

+[% END %]
[% content %]
[% IF pager %]