mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 16:46:50 +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 const_buffer &content,
|
||||||
const string_view &secret);
|
const string_view &secret);
|
||||||
|
|
||||||
|
static std::string
|
||||||
|
github_url(const json::string &url);
|
||||||
|
|
||||||
static string_view
|
static string_view
|
||||||
github_find_commit_hash(const json::object &content);
|
github_find_commit_hash(const json::object &content);
|
||||||
|
|
||||||
|
@ -236,10 +239,10 @@ github_heading(std::ostream &out,
|
||||||
{
|
{
|
||||||
const auto url
|
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"])
|
<< unquote(organization["login"])
|
||||||
<< "</a>";
|
<< "</a>";
|
||||||
}
|
}
|
||||||
|
@ -945,6 +948,13 @@ github_find_commit_hash(const json::object &content)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
github_url(const json::string &url)
|
||||||
|
{
|
||||||
|
std::string base("https://");
|
||||||
|
return base + std::string(lstrip(url, "https://api."));
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
github_validate(const string_view &sigheader,
|
github_validate(const string_view &sigheader,
|
||||||
const const_buffer &content,
|
const const_buffer &content,
|
||||||
|
|
Loading…
Reference in a new issue