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;
|
bool found = false;
|
||||||
tao::json::value feedJson;
|
tao::json::value feedJson;
|
||||||
|
tao::json::value content;
|
||||||
std::string pubkey;
|
std::string pubkey;
|
||||||
std::string feedName;
|
std::string feedName;
|
||||||
|
|
||||||
@ -39,6 +40,12 @@ struct FeedReader {
|
|||||||
found = true;
|
found = true;
|
||||||
return false;
|
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 {
|
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") {
|
} else if (u.path.size() == 3 && u.path[2] == "info") {
|
||||||
feedReader.emplace(txn, decomp, u.path[1]);
|
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) {
|
if (feedReader->found) {
|
||||||
struct {
|
struct {
|
||||||
const std::optional<FeedReader> &feedReader;
|
const std::optional<FeedReader> &feedReader;
|
||||||
|
const User &curator;
|
||||||
|
const std::string &title;
|
||||||
|
const std::string &description;
|
||||||
|
const std::string &feedPath;
|
||||||
} ctx = {
|
} ctx = {
|
||||||
feedReader,
|
feedReader,
|
||||||
|
*userCache.getUser(txn, decomp, feedReader->pubkey),
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
feedPath,
|
||||||
};
|
};
|
||||||
|
|
||||||
body = tmpl::feed::info(ctx);
|
body = tmpl::feed::info(ctx);
|
||||||
|
@ -283,6 +283,22 @@ table.vert {
|
|||||||
margin-left: 40px;
|
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 */
|
/* voting */
|
||||||
|
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
<div class="feed-info-page">
|
<div class="info-page feed-info">
|
||||||
<p>
|
<h2>Feed: <a href="$(ctx.feedPath)">$(ctx.title)</a></h2>
|
||||||
Feed: $(ctx.feedReader->feedName)
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<p>
|
<p class="feed-description">
|
||||||
ID: $(ctx.feedReader->feedId)
|
$(ctx.description)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user