mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-19 17:37:43 +00:00
np
This commit is contained in:
@ -5,6 +5,7 @@ struct FeedReader {
|
||||
|
||||
bool found = false;
|
||||
tao::json::value feedJson;
|
||||
tao::json::value content;
|
||||
std::string pubkey;
|
||||
std::string feedName;
|
||||
|
||||
@ -39,6 +40,12 @@ struct FeedReader {
|
||||
found = true;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!found) return;
|
||||
|
||||
try {
|
||||
content = tao::json::from_string(feedJson.at("content").get_string());
|
||||
} catch (...) {}
|
||||
}
|
||||
|
||||
std::vector<FeedEvent> getEvents(lmdb::txn &txn, Decompressor &decomp, uint64_t resultsPerPage, uint64_t page) const {
|
||||
|
@ -282,11 +282,30 @@ HTTPResponse WebServer::generateReadResponse(lmdb::txn &txn, Decompressor &decom
|
||||
} else if (u.path.size() == 3 && u.path[2] == "info") {
|
||||
feedReader.emplace(txn, decomp, u.path[1]);
|
||||
|
||||
std::string title, description, styleHeaderShade;
|
||||
if (feedReader->content.get_object().contains("title")) title = feedReader->content["title"].get_string();
|
||||
if (feedReader->content.get_object().contains("description")) description = feedReader->content["description"].get_string();
|
||||
|
||||
std::string feedPath;
|
||||
if (u.path[1] == "homepage") feedPath = "/";
|
||||
else {
|
||||
feedPath = "/f/";
|
||||
feedPath += u.path[1];
|
||||
}
|
||||
|
||||
if (feedReader->found) {
|
||||
struct {
|
||||
const std::optional<FeedReader> &feedReader;
|
||||
const User &curator;
|
||||
const std::string &title;
|
||||
const std::string &description;
|
||||
const std::string &feedPath;
|
||||
} ctx = {
|
||||
feedReader,
|
||||
*userCache.getUser(txn, decomp, feedReader->pubkey),
|
||||
title,
|
||||
description,
|
||||
feedPath,
|
||||
};
|
||||
|
||||
body = tmpl::feed::info(ctx);
|
||||
|
@ -283,6 +283,22 @@ table.vert {
|
||||
margin-left: 40px;
|
||||
}
|
||||
|
||||
.feed-info {
|
||||
.feed-id {
|
||||
background-color: #dfdfdf;
|
||||
font-family: monospace;
|
||||
font-size: 90%;
|
||||
display: inline;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.feed-description {
|
||||
padding-left: 20px;
|
||||
border-left: 2px solid blue;
|
||||
white-space: pre;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* voting */
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
<div class="feed-info-page">
|
||||
<p>
|
||||
Feed: $(ctx.feedReader->feedName)
|
||||
<div class="info-page feed-info">
|
||||
<h2>Feed: <a href="$(ctx.feedPath)">$(ctx.title)</a></h2>
|
||||
|
||||
<pre class="feed-id">$(ctx.feedReader->feedId)</pre>
|
||||
|
||||
<p class="feed-curator">
|
||||
Curator: <a href="/u/$(ctx.curator.npubId)">$(ctx.curator.username)</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
ID: $(ctx.feedReader->feedId)
|
||||
<p class="feed-description">
|
||||
$(ctx.description)
|
||||
</p>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user