aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/mod-package-details.cxx3
-rw-r--r--mod/mod-package-version-details.cxx8
-rw-r--r--mod/page.cxx52
-rw-r--r--mod/page.hxx11
-rw-r--r--tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gzbin340 -> 353 bytes
-rw-r--r--tests/load/1/stable/libfoo-1.2.3+4.tar.gzbin291 -> 301 bytes
-rw-r--r--tests/load/1/stable/packages.manifest6
-rw-r--r--tests/load/1/stable/signature.manifest20
-rw-r--r--tests/load/driver.cxx8
-rw-r--r--www/package-details-body.css20
-rw-r--r--www/package-version-details-body.css20
11 files changed, 113 insertions, 35 deletions
diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx
index 7b75e62..74b3840 100644
--- a/mod/mod-package-details.cxx
+++ b/mod/mod-package-details.cxx
@@ -255,9 +255,6 @@ handle (request& rq, response& rs)
s << TABLE(CLASS="proplist version")
<< TBODY
<< TR_VERSION (name, p->version, root, tenant, p->upstream_version)
-
- // @@ Shouldn't we skip low priority row ? Don't think so, why?
- //
<< TR_PRIORITY (p->priority);
// Comparing objects of the license_alternatives class as being of the
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index 437bff4..d147449 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -221,7 +221,9 @@ handle (request& rq, response& rs)
{
assert (pkg->location);
- s << TR_DOWNLOAD (rl.url ().string () + "/" + pkg->location->string ());
+ s << TR_LINK (rl.url ().string () + "/" + pkg->location->string (),
+ pkg->location->leaf ().string (),
+ "download");
}
if (pkg->fragment)
@@ -268,7 +270,7 @@ handle (request& rq, response& rs)
const auto& ds (pkg->dependencies);
if (!ds.empty ())
{
- s << H3 << "Depends" << ~H3
+ s << H3 << "Depends (" << ds.size () << ")" << ~H3
<< TABLE(CLASS="proplist", ID="depends")
<< TBODY;
@@ -361,7 +363,7 @@ handle (request& rq, response& rs)
const auto& rm (pkg->requirements);
if (!rm.empty ())
{
- s << H3 << "Requires" << ~H3
+ s << H3 << "Requires (" << rm.size () << ")" << ~H3
<< TABLE(CLASS="proplist", ID="requires")
<< TBODY;
diff --git a/mod/page.cxx b/mod/page.cxx
index 0c4c257..e03ee4b 100644
--- a/mod/page.cxx
+++ b/mod/page.cxx
@@ -15,6 +15,8 @@
#include <libstudxml/serializer.hxx>
+#include <libbutl/url.mxx>
+
#include <web/xhtml.hxx>
#include <web/xhtml-fragment.hxx>
#include <web/mime-url-encoding.hxx>
@@ -575,10 +577,32 @@ namespace brep
void TR_URL::
operator() (serializer& s) const
{
+ // Strip the URL prefix for the link text.
+ //
+ // Note that it may not be a valid URL (see bpkg::url).
+ //
+ // @@ We should probably inherit bpkg::url from butl::url and make sure
+ // that it is "rootfull" and the authority is present. Should we also
+ // white-list the schema for security reasons? Then the offset will
+ // always be: url_.string ().find ("://") + 3.
+ //
+ size_t p (string::npos);
+
+ if (butl::url::traits::find (url_) == 0) // Is it a "rootfull" URL ?
+ {
+ size_t n (url_.find (":/") + 2);
+ if (url_[n] == '/' && url_[n + 1] != '\0') // Has authority?
+ p = n + 1;
+ }
+
s << TR(CLASS=label_)
<< TH << label_ << ~TH
<< TD
- << SPAN(CLASS="value") << A(HREF=url_) << url_ << ~A << ~SPAN
+ << SPAN(CLASS="value")
+ << A(HREF=url_)
+ << (p != string::npos ? url_.c_str () + p : url_.c_str ())
+ << ~A
+ << ~SPAN
<< SPAN_COMMENT (url_.comment)
<< ~TD
<< ~TR;
@@ -602,16 +626,26 @@ namespace brep
// TR_PRIORITY
//
+ static const strings priority_names ({"medium", "high", "security"});
+
void TR_PRIORITY::
operator() (serializer& s) const
{
- static const strings priority_names ({"low", "medium", "high", "security"});
- assert (priority_ < priority_names.size ());
+ // Omit the element for low priority.
+ //
+ if (priority_ == priority::low)
+ return;
+
+ size_t p (priority_ - 1);
+
+ assert (p < priority_names.size ());
+
+ const string& pn (priority_names[p]);
s << TR(CLASS="priority")
<< TH << "priority" << ~TH
<< TD
- << SPAN(CLASS="value") << priority_names[priority_] << ~SPAN
+ << SPAN(CLASS="value " + pn) << pn << ~SPAN
<< SPAN_COMMENT (priority_.comment)
<< ~TD
<< ~TR;
@@ -649,15 +683,15 @@ namespace brep
<< ~TR;
}
- // TR_DOWNLOAD
+ // TR_LINK
//
- void TR_DOWNLOAD::
+ void TR_LINK::
operator() (serializer& s) const
{
- s << TR(CLASS="download")
- << TH << "download" << ~TH
+ s << TR(CLASS=label_)
+ << TH << label_ << ~TH
<< TD
- << SPAN(CLASS="value") << A(HREF=url_) << url_ << ~A << ~SPAN
+ << SPAN(CLASS="value") << A(HREF=url_) << text_ << ~A << ~SPAN
<< ~TD
<< ~TR;
}
diff --git a/mod/page.hxx b/mod/page.hxx
index 28257c1..cd2048e 100644
--- a/mod/page.hxx
+++ b/mod/page.hxx
@@ -384,7 +384,7 @@ namespace brep
const requirements& requirements_;
};
- // Generate url element.
+ // Generate url element. Strip the `<scheme>://` prefix from the link text.
//
class TR_URL
{
@@ -460,18 +460,21 @@ namespace brep
const repository_location& location_;
};
- // Generate package download URL element.
+ // Generate link element.
//
- class TR_DOWNLOAD
+ class TR_LINK
{
public:
- TR_DOWNLOAD (const string& u): url_ (u) {}
+ TR_LINK (const string& u, const string& t, const char* l)
+ : url_ (u), text_ (t), label_ (l) {}
void
operator() (xml::serializer&) const;
private:
const string& url_;
+ const string& text_;
+ const char* label_;
};
// Generate sha256sum element.
diff --git a/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz b/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz
index fb0bfd6..cb50945 100644
--- a/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz
+++ b/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz
Binary files differ
diff --git a/tests/load/1/stable/libfoo-1.2.3+4.tar.gz b/tests/load/1/stable/libfoo-1.2.3+4.tar.gz
index 9ef7d64..254f355 100644
--- a/tests/load/1/stable/libfoo-1.2.3+4.tar.gz
+++ b/tests/load/1/stable/libfoo-1.2.3+4.tar.gz
Binary files differ
diff --git a/tests/load/1/stable/packages.manifest b/tests/load/1/stable/packages.manifest
index 9b9b242..2eb96eb 100644
--- a/tests/load/1/stable/packages.manifest
+++ b/tests/load/1/stable/packages.manifest
@@ -14,6 +14,7 @@ sha256sum: e89c6d746f8b1ea3ec58d294946d2f683d133438d2ac8c88549ba24c19627e76
:
name: libfoo
version: 1.2.2-alpha.1
+priority: security
summary: The Foo library
license: MIT
tags: c++, foo
@@ -23,7 +24,7 @@ depends: libmisc [0.1 2.0-) | libmisc [2.0 5.0]
depends: libgenx (0.2 3.0)
depends: libexpat < 5.2 | libexpat (1 5.1]
location: libfoo-1.2.2-alpha.1.tar.gz
-sha256sum: 34fc224087bfd9212de4acfbbf5275513ebc57678b5f029546918a62c57d15cb
+sha256sum: e769cc99fd58a433beb817882cbf9dc04ce0872fbe3f2d9b43d9f627e67a85ea
:
name: libfoo
version: 1.2.2
@@ -39,6 +40,7 @@ sha256sum: 088068ea3d69542a153f829cf836013374763148fba0a43d8047974f58b5efd7
:
name: libfoo
version: 1.2.3+4
+priority: medium
summary: The Foo library
license: MIT
tags: c++, foo
@@ -46,7 +48,7 @@ url: http://www.example.com/foo/
email: foo-users@example.com
depends: libmisc >= 2.0.0
location: libfoo-1.2.3+4.tar.gz
-sha256sum: 204fb25edf2404e9e88e1bef8b2a444281a807d9087093147a2cc80a1ffba79a
+sha256sum: f2ebecac6cac8addd7c623bc1becf055e76b13a0d2dd385832b92c38c58956d8
:
name: libfoo
version: 1.2.4
diff --git a/tests/load/1/stable/signature.manifest b/tests/load/1/stable/signature.manifest
index 861f9ea..d9cb1f8 100644
--- a/tests/load/1/stable/signature.manifest
+++ b/tests/load/1/stable/signature.manifest
@@ -1,13 +1,13 @@
: 1
-sha256sum: 31af43bc14d0fd99c623d3801a982a195f78690f1d3fd6fff24b26af774c2ebd
+sha256sum: 83677600921f649fb98cdc5eef918dc14759e380fcc52e06c471f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bQTyl1czm6Jg+VxGSTNZx++sGTSn02pVxyChkBEfp
+6Uq4CZOKcK7yTHOj9ZQokPxmImHbveYJMzo0sQXpIbR0MXAaxvpVpHCA+f9xy/iKv5xSnepBOlIu
+hivLHegNHD3fvbJpbrAoM+dtNHTaUXr0zhn38vXMrS5liQp4JDkFvF4JOw5ezv/Y509YytX6dEC7
+5arHHa/mu8BJmZd1OyXkl5f7+ZBEtfAV+tQAcSPs/PB7L7hCJTcNJ7sYm9FUH6KkyGiKetqqM7xZ
+itjiz3h8V+D6SrBnRskO0rKEF4FzjQgI/wUoWQhaFw8D/zE1mFeoO+xHFvhVwV4Uqkc00wogJbc=
\
diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx
index 18c601e..7012660 100644
--- a/tests/load/driver.cxx
+++ b/tests/load/driver.cxx
@@ -467,7 +467,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv2a->internal_repository.load () == sr);
assert (fpv2a->other_repositories.empty ());
- assert (fpv2a->priority == priority::low);
+ assert (fpv2a->priority == priority::security);
assert (fpv2a->changes.empty ());
assert (fpv2a->license_alternatives.size () == 1);
@@ -509,7 +509,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (check_location (fpv2a));
assert (fpv2a->sha256sum && *fpv2a->sha256sum ==
- "34fc224087bfd9212de4acfbbf5275513ebc57678b5f029546918a62c57d15cb");
+ "e769cc99fd58a433beb817882cbf9dc04ce0872fbe3f2d9b43d9f627e67a85ea");
// libfoo-1.2.3-4
//
@@ -527,7 +527,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv3->internal_repository.load () == sr);
assert (fpv3->other_repositories.empty ());
- assert (fpv3->priority == priority::low);
+ assert (fpv3->priority == priority::medium);
assert (fpv3->changes.empty ());
@@ -545,7 +545,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (check_location (fpv3));
assert (fpv3->sha256sum && *fpv3->sha256sum ==
- "204fb25edf2404e9e88e1bef8b2a444281a807d9087093147a2cc80a1ffba79a");
+ "f2ebecac6cac8addd7c623bc1becf055e76b13a0d2dd385832b92c38c58956d8");
// libfoo-1.2.4
//
diff --git a/www/package-details-body.css b/www/package-details-body.css
index a69a939..1a407a8 100644
--- a/www/package-details-body.css
+++ b/www/package-details-body.css
@@ -118,6 +118,22 @@ h1, h2
}
#package th {width: 7.6em;}
+#package tr.tags td a,
+#package tr.project td a
+{
+ background-color: #f1f8ff;
+ border-radius: 0.2em;
+ padding: .2em .6em .18em .6em;
+ margin: 0 0.15em 0 0;
+}
+
+#package tr.tags td a:hover,
+#package tr.project td a:hover
+{
+ text-decoration: none;
+ background-color: #def;
+}
+
/*
* Search form (based on form-table)
*/
@@ -162,3 +178,7 @@ table.version tr.requires td .value
font-family: monospace;
font-size: 0.94em;
}
+
+table.version tr.priority td .security {color: #ff0000; font-weight: bold;}
+table.version tr.priority td .high {color: #ff0000;}
+table.version tr.priority td .medium {color: #fe7c04;}
diff --git a/www/package-version-details-body.css b/www/package-version-details-body.css
index d8c5e9d..6c9cf1c 100644
--- a/www/package-version-details-body.css
+++ b/www/package-version-details-body.css
@@ -152,6 +152,10 @@ h1, h2, h3
font-size: 0.94em;
}
+#version tr.priority td .security {color: #ff0000; font-weight: bold;}
+#version tr.priority td .high {color: #ff0000;}
+#version tr.priority td .medium {color: #fe7c04;}
+
#version tr.sha256 td .value
{
/* Increase the chances of 64-char value not to be truncated. */
@@ -168,6 +172,22 @@ h1, h2, h3
}
#package th {width: 9.5em;}
+#package tr.tags td a,
+#package tr.project td a
+{
+ background-color: #f1f8ff;
+ border-radius: 0.2em;
+ padding: .2em .6em .18em .6em;
+ margin: 0 0.15em 0 0;
+}
+
+#package tr.tags td a:hover,
+#package tr.project td a:hover
+{
+ text-decoration: none;
+ background-color: #def;
+}
+
/*
* Dependencies and requirements tables.
*/