From 3afcbce64bf07edad668da8c94b2fc7eb035cef9 Mon Sep 17 00:00:00 2001 From: Francois Kritzinger Date: Wed, 28 Feb 2024 16:59:00 +0200 Subject: Clean up/fixes --- mod/jwt.hxx | 3 --- mod/mod-ci-github.cxx | 17 +++++++++++------ mod/mod-ci-github.hxx | 12 +++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/mod/jwt.hxx b/mod/jwt.hxx index 97be0e9..b0df714 100644 --- a/mod/jwt.hxx +++ b/mod/jwt.hxx @@ -24,9 +24,6 @@ namespace brep // the "issued at" time in order to combat potential clock drift (which can // cause the token to be not valid yet). // - // @@ TODO Is there a standard term? "drift" or "drift value" seems to be - // used quite often. - // // Return the token or throw std::system_error in case of an error. // string diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index cb781e3..e19a41b 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -10,7 +10,7 @@ #include #include -#include +#include // @@ TODO Remove once debug output has been removed. // @@ TODO // @@ -22,6 +22,7 @@ // // Webhooks: // https://docs.github.com/en/webhooks/using-webhooks/best-practices-for-using-webhooks +// https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries // // REST API: // https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2022-11-28 @@ -85,6 +86,8 @@ namespace brep for (const name_value& h: rq.headers ()) { + // This event's UUID. + // if (icasecmp (h.name, "x-github-delivery") == 0) { // @@ TODO Check that delivery UUID has not been received before @@ -104,6 +107,8 @@ namespace brep content_type = true; } + // The webhook event. + // else if (icasecmp (h.name, "x-github-event") == 0) { if (!h.value) @@ -513,7 +518,7 @@ namespace brep if (!at) missing_member (p, "check_suite", "after"); } - static ostream& + ostream& gh::operator<< (ostream& os, const check_suite& cs) { os << "id: " << cs.id << endl @@ -554,7 +559,7 @@ namespace brep if (!db) missing_member (p, "repository", "default_branch"); } - static ostream& + ostream& gh::operator<< (ostream& os, const repository& rep) { os << "name: " << rep.name << endl @@ -589,7 +594,7 @@ namespace brep if (!i) missing_member (p, "installation", "id"); } - static ostream& + ostream& gh::operator<< (ostream& os, const installation& i) { os << "id: " << i.id << endl; @@ -628,7 +633,7 @@ namespace brep if (!in) missing_member (p, "check_suite_event", "installation"); } - static ostream& + ostream& gh::operator<< (ostream& os, const check_suite_event& cs) { os << "action: " << cs.action << endl; @@ -678,7 +683,7 @@ namespace brep if (!ea) missing_member (p, "installation_access_token", "expires_at"); } - static ostream& + ostream& gh::operator<< (ostream& os, const installation_access_token& t) { os << "token: " << t.token << endl; diff --git a/mod/mod-ci-github.hxx b/mod/mod-ci-github.hxx index ca6c7bf..9731881 100644 --- a/mod/mod-ci-github.hxx +++ b/mod/mod-ci-github.hxx @@ -4,8 +4,6 @@ #ifndef MOD_MOD_CI_GITHUB_HXX #define MOD_MOD_CI_GITHUB_HXX -#include - #include #include @@ -95,19 +93,19 @@ namespace brep installation_access_token () = default; }; - static ostream& + ostream& operator<< (ostream&, const check_suite&); - static ostream& + ostream& operator<< (ostream&, const repository&); - static ostream& + ostream& operator<< (ostream&, const installation&); - static ostream& + ostream& operator<< (ostream&, const check_suite_event&); - static ostream& + ostream& operator<< (ostream&, const installation_access_token&); } -- cgit v1.1