aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-12 17:26:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-14 18:07:18 +0300
commite60108713590ccee83da7e2581a43fd5fda5c8ce (patch)
tree59650cce83b69e527040560482bba7c8513ab17e /mod
parent8701276b3d98b5c6f927e2865ee6a915296033c1 (diff)
Add repository certificate info to the About page
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-repository-details.cxx38
1 files changed, 30 insertions, 8 deletions
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 ();