mirror of
https://github.com/matrix-construct/construct
synced 2025-03-14 05:20:17 +01:00
modules/web_hook: Improve alt-text for dockerhub shots.
This commit is contained in:
parent
561a956b2c
commit
5bafcce20a
1 changed files with 24 additions and 7 deletions
|
@ -1845,6 +1845,7 @@ appveyor_handle(client &client,
|
|||
|
||||
static void
|
||||
dockerhub_handle_push(std::ostream &out,
|
||||
std::ostream &alt,
|
||||
client &client,
|
||||
const resource::request &request);
|
||||
|
||||
|
@ -1864,16 +1865,18 @@ try
|
|||
request["callback_url"]
|
||||
};
|
||||
|
||||
const unique_buffer<mutable_buffer> buf
|
||||
const unique_buffer<mutable_buffer> buf[2]
|
||||
{
|
||||
48_KiB
|
||||
{ 48_KiB },
|
||||
{ 4_KiB },
|
||||
};
|
||||
|
||||
std::stringstream out;
|
||||
pubsetbuf(out, buf);
|
||||
std::stringstream out, alt;
|
||||
pubsetbuf(out, buf[0]);
|
||||
pubsetbuf(alt, buf[1]);
|
||||
|
||||
if(request.has("push_data"))
|
||||
dockerhub_handle_push(out, client, request);
|
||||
dockerhub_handle_push(out, alt, client, request);
|
||||
|
||||
const auto room_id
|
||||
{
|
||||
|
@ -1887,12 +1890,17 @@ try
|
|||
|
||||
const auto msg
|
||||
{
|
||||
view(out, buf)
|
||||
view(out, buf[0])
|
||||
};
|
||||
|
||||
const auto alt_msg
|
||||
{
|
||||
view(alt, buf[1])
|
||||
};
|
||||
|
||||
const auto evid
|
||||
{
|
||||
m::msghtml(room_id, user_id, msg, "dockerhub shot", "m.notice")
|
||||
m::msghtml(room_id, user_id, msg, alt_msg, "m.notice")
|
||||
};
|
||||
|
||||
log::info
|
||||
|
@ -1916,6 +1924,7 @@ catch(const std::exception &e)
|
|||
|
||||
void
|
||||
dockerhub_handle_push(std::ostream &out,
|
||||
std::ostream &alt,
|
||||
client &client,
|
||||
const resource::request &request)
|
||||
{
|
||||
|
@ -1958,4 +1967,12 @@ dockerhub_handle_push(std::ostream &out,
|
|||
<< tag
|
||||
<< "</b>"
|
||||
;
|
||||
|
||||
alt
|
||||
<< json::string(repository["repo_name"])
|
||||
<< " push by "
|
||||
<< pusher
|
||||
<< " to "
|
||||
<< tag
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue