diff --git a/routes/css.cpp b/routes/css.cpp index afb9545..13bea6d 100644 --- a/routes/css.cpp +++ b/routes/css.cpp @@ -9,6 +9,7 @@ void css_route(const httplib::Request& req, httplib::Response& res) { --text-color: white; --illust-badge-background-color: rgba(0, 0, 0, .5); + --illust-badge-ai-background-color: rgba(255, 0, 0, .5); --error-background-color: rgb(100, 0, 0); --error-border-color: red; @@ -93,6 +94,9 @@ void css_route(const httplib::Request& req, httplib::Response& res) { background-color: var(--illust-badge-background-color); text-decoration: none !important; } + .illustbadge.ai { + background-color: var(--illust-badge-ai-background-color); + } /* ILLUSTRATIONS PAGE */ .illusttags { diff --git a/servehelper.cpp b/servehelper.cpp index 5e710e3..a790f2d 100644 --- a/servehelper.cpp +++ b/servehelper.cpp @@ -156,7 +156,7 @@ static inline Element generate_illusts_grid_item(const httplib::Request& req, co }) }); - if (illust.page_count > 1) { + if (illust.page_count > 1 || illust.ai_generated) { div.nodes.push_back(generate_illust_badge(illust, std::move(illust_url))); } @@ -164,10 +164,15 @@ static inline Element generate_illusts_grid_item(const httplib::Request& req, co } static inline Element generate_illust_badge(const Illust& illust, const std::string& illust_url) { - std::string text = std::to_string(illust.page_count) + " pages"; - std::string illust_preview_url = illust_url + "?preview=1"; + const char* css_class = !illust.ai_generated ? "illustbadge" : "illustbadge ai"; - return Element("a", {{"class", "illustbadge"}, {"href", std::move(illust_preview_url)}}, { - std::move(text) - }); + if (illust.page_count > 1) { + return Element("a", {{"class", css_class}, {"href", illust_url + "?preview=1"}}, { + std::to_string(illust.page_count), " pages" + }); + } else { + return Element("span", {{"class", css_class}}, { + "AI" + }); + } }