mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
modules/webhook: Add github url prefix stripping help function.
This commit is contained in:
parent
d0ad243860
commit
ebcac5e7ae
1 changed files with 12 additions and 2 deletions
|
@ -83,6 +83,9 @@ github_validate(const string_view &sig,
|
|||
const const_buffer &content,
|
||||
const string_view &secret);
|
||||
|
||||
static std::string
|
||||
github_url(const json::string &url);
|
||||
|
||||
static string_view
|
||||
github_find_commit_hash(const json::object &content);
|
||||
|
||||
|
@ -236,10 +239,10 @@ github_heading(std::ostream &out,
|
|||
{
|
||||
const auto url
|
||||
{
|
||||
lstrip(unquote(organization["url"]), "https://api.")
|
||||
github_url(organization["url"])
|
||||
};
|
||||
|
||||
out << "<a href=\"https://" << url << "\">"
|
||||
out << "<a href=\"" << url << "\">"
|
||||
<< unquote(organization["login"])
|
||||
<< "</a>";
|
||||
}
|
||||
|
@ -945,6 +948,13 @@ github_find_commit_hash(const json::object &content)
|
|||
return {};
|
||||
}
|
||||
|
||||
std::string
|
||||
github_url(const json::string &url)
|
||||
{
|
||||
std::string base("https://");
|
||||
return base + std::string(lstrip(url, "https://api."));
|
||||
}
|
||||
|
||||
bool
|
||||
github_validate(const string_view &sigheader,
|
||||
const const_buffer &content,
|
||||
|
|
Loading…
Reference in a new issue