From e60108713590ccee83da7e2581a43fd5fda5c8ce Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 12 Jul 2016 17:26:45 +0300 Subject: Add repository certificate info to the About page --- mod/mod-repository-details.cxx | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/mod-repository-details.cxx b/mod/mod-repository-details.cxx index dffd0df..42e59cb 100644 --- a/mod/mod-repository-details.cxx +++ b/mod/mod-repository-details.cxx @@ -111,24 +111,21 @@ handle (request& rq, response& rs) if (r.summary) s << H2 << *r.summary << ~H2; - if (r.description) - s << P_DESCRIPTION (*r.description); + s << P + << A(HREF=r.location.string ()) << r.location << ~A << *BR; if (r.email) { const email& e (*r.email); - s << P - << A(HREF="mailto:" + e) << e << ~A; + s << A(HREF="mailto:" + e) << e << ~A; if (!e.comment.empty ()) s << " (" << e.comment << ")"; - s << ~P; + s << *BR; } - s << P << A(HREF=r.location.string ()) << r.location << ~A << ~P; - ostringstream o; butl::to_stream (o, max (r.packages_timestamp, r.repositories_timestamp), @@ -136,7 +133,32 @@ handle (request& rq, response& rs) true, true); - s << P << o.str () << ~P; + s << o.str () + << ~P; + + if (r.description) + s << P_DESCRIPTION (*r.description); + + if (r.certificate) + { + const certificate& cert (*r.certificate); + + size_t np (cert.name.find (':')); + assert (np != string::npos); // Naming scheme should always be present. + + // Mimic the suggested format of the repository description so that the + // certificate info looks like just another section. Inside use the + // format similar to the bpkg rep-info output. + // + s << P << "REPOSITORY CERTIFICATE" << ~P + << P + << "CN=" << cert.name.c_str () + np + 1 << *BR + << "O=" << cert.organization << *BR + << email (cert.email) + << ~P + << P(CLASS="certfp") << cert.fingerprint << ~P + << PRE(CLASS="certpem") << cert.pem << ~PRE; + } } t.commit (); -- cgit v1.1