mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-19 17:37:43 +00:00
wip
This commit is contained in:
@ -694,39 +694,3 @@ struct UserEvents {
|
|||||||
return tmpl::user::comments(ctx);
|
return tmpl::user::comments(ctx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct CommunitySpec {
|
|
||||||
tao::json::value raw;
|
|
||||||
std::string adminNpub;
|
|
||||||
std::string adminTopic;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline CommunitySpec lookupCommunitySpec(lmdb::txn &txn, Decompressor &decomp, UserCache &userCache, std::string_view descriptor) {
|
|
||||||
CommunitySpec spec;
|
|
||||||
|
|
||||||
size_t pos = descriptor.find("/");
|
|
||||||
if (pos == std::string_view::npos) throw herr("bad descriptor");
|
|
||||||
spec.adminNpub = std::string(descriptor.substr(0, pos));
|
|
||||||
std::string authorPubkey = decodeBech32Simple(spec.adminNpub);
|
|
||||||
spec.adminTopic = descriptor.substr(pos + 1);
|
|
||||||
|
|
||||||
tao::json::value filter = tao::json::value({
|
|
||||||
{ "authors", tao::json::value::array({ to_hex(authorPubkey) }) },
|
|
||||||
{ "kinds", tao::json::value::array({ uint64_t(33700) }) },
|
|
||||||
{ "#d", tao::json::value::array({ spec.adminTopic }) },
|
|
||||||
});
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
foreachByFilter(txn, filter, [&](uint64_t levId){
|
|
||||||
spec.raw = tao::json::from_string(getEventJson(txn, decomp, levId));
|
|
||||||
found = true;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!found) throw herr("unable to find community");
|
|
||||||
|
|
||||||
return spec;
|
|
||||||
}
|
|
||||||
|
@ -76,12 +76,6 @@ h2 {
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.community-rules {
|
|
||||||
font-size: 70%;
|
|
||||||
color: darkmagenta;
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.new-post-link {
|
.new-post-link {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
@ -258,9 +252,9 @@ table.vert {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* communities */
|
/* feeds */
|
||||||
|
|
||||||
.community-item {
|
.feed-item {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
@ -284,31 +278,6 @@ table.vert {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.community-info {
|
|
||||||
h2 {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-size: 110%;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
> div {
|
|
||||||
padding-left: 5px;
|
|
||||||
margin-bottom: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desc {
|
|
||||||
white-space: pre-line;
|
|
||||||
}
|
|
||||||
|
|
||||||
.algo {
|
|
||||||
white-space: pre;
|
|
||||||
font-family: monospace;
|
|
||||||
margin-top: 25px;
|
|
||||||
padding: 10px 10px 10px 10px;
|
|
||||||
background-color: lightgoldenrodyellow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* voting */
|
/* voting */
|
||||||
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
<div class="community-info">
|
|
||||||
<h2>Community: $(ctx.communitySpec.name)</h2>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
Admin: <a href='/u/$(ctx.communitySpec.adminNpub)'>$(ctx.communitySpec.adminUsername)</a> ($(ctx.communitySpec.adminTopic))
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Description</h2>
|
|
||||||
|
|
||||||
<div class="desc">$(ctx.communitySpec.desc)</div>
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Algo</h2>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<pre class="algo">$(ctx.communitySpec.algo)</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||||||
<div class="community-item vote-context" data-note="$(ctx.ev.getNoteId())">
|
<div class="feed-item vote-context" data-note="$(ctx.ev.getNoteId())">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div>$(ctx.n).</div>
|
<div>$(ctx.n).</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,12 +16,7 @@
|
|||||||
<span>
|
<span>
|
||||||
<a href="/" class="sitename">
|
<a href="/" class="sitename">
|
||||||
<span class="oddbean-name">Oddbean</span>
|
<span class="oddbean-name">Oddbean</span>
|
||||||
<> ?(ctx.communitySpec)
|
|
||||||
/ $(ctx.communitySpec->name)
|
|
||||||
</>
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="/algo" class="community-rules">(algo)</a> ?(ctx.communitySpec)
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<a href="/post" class="new-post-link">new post</a>
|
<a href="/post" class="new-post-link">new post</a>
|
||||||
|
Reference in New Issue
Block a user