From a625df07e294866398385548501656eb8645e610 Mon Sep 17 00:00:00 2001 From: Steven Guikal Date: Thu, 10 Jun 2021 14:46:24 -0400 Subject: [PATCH 1/5] Source valid ssh prefixes from config Signed-off-by: Eli Schwartz --- web/lib/acctfuncs.inc.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index df016c6d..0d021f99 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -875,10 +875,7 @@ function valid_pgp_fingerprint($fingerprint) { * @return bool True if the SSH public key is valid, otherwise false */ function valid_ssh_pubkey($pubkey) { - $valid_prefixes = array( - "ssh-rsa", "ssh-dss", "ecdsa-sha2-nistp256", - "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521", "ssh-ed25519" - ); + $valid_prefixes = explode(' ', config_get('auth', 'valid-keytypes')); $has_valid_prefix = false; foreach ($valid_prefixes as $prefix) { From b32022a176ede116068a405c928cf25e23ffb691 Mon Sep 17 00:00:00 2001 From: Steven Guikal Date: Thu, 10 Jun 2021 14:35:13 -0400 Subject: [PATCH 2/5] Add FIDO/U2F ssh keytypes to default config Signed-off-by: Eli Schwartz --- conf/config.defaults | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/config.defaults b/conf/config.defaults index 98e033b7..e6961520 100644 --- a/conf/config.defaults +++ b/conf/config.defaults @@ -62,7 +62,7 @@ ECDSA = SHA256:L71Q91yHwmHPYYkJMDgj0xmUuw16qFOhJbBr1mzsiOI RSA = SHA256:Ju+yWiMb/2O+gKQ9RJCDqvRg7l+Q95KFAeqM5sr6l2s [auth] -valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 +valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 sk-ssh-ecdsa@openssh.com sk-ssh-ed25519@openssh.com username-regex = [a-zA-Z0-9]+[.\-_]?[a-zA-Z0-9]+$ git-serve-cmd = /usr/local/bin/aurweb-git-serve ssh-options = restrict From e7db894eb716132411bd88c094bc8df8b5f378de Mon Sep 17 00:00:00 2001 From: Justin Kromlinger Date: Fri, 20 Nov 2020 00:19:15 +0100 Subject: [PATCH 3/5] RSS: Add ability to specify isPermaLink="false" for GUID --- web/lib/feedcreator.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/lib/feedcreator.class.php b/web/lib/feedcreator.class.php index a1fe24c9..bfc29b20 100644 --- a/web/lib/feedcreator.class.php +++ b/web/lib/feedcreator.class.php @@ -183,7 +183,7 @@ class FeedItem extends HtmlDescribable { /** * Optional attributes of an item. */ - var $author, $authorEmail, $image, $category, $comments, $guid, $source, $creator; + var $author, $authorEmail, $image, $category, $comments, $guid, $guidIsPermaLink, $source, $creator; /** * Publishing date of an item. May be in one of the following formats: @@ -995,7 +995,11 @@ class RSSCreator091 extends FeedCreator { $feed.= " ".htmlspecialchars($itemDate->rfc822())."\n"; } if ($this->items[$i]->guid!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->guid)."\n"; + $feed.= " items[$i]->guidIsPermaLink == false) { + $feed.= " isPermaLink=\"false\""; + } + $feed.= ">".htmlspecialchars($this->items[$i]->guid)."\n"; } $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " "); $feed.= " \n"; From 4330fe4f335a2c1b3b68743337576501dc1f6c92 Mon Sep 17 00:00:00 2001 From: Justin Kromlinger Date: Fri, 20 Nov 2020 00:19:54 +0100 Subject: [PATCH 4/5] Add RSS feed for modified packages --- web/html/modified-rss.php | 62 +++++++++++++++++++++++++++++++++++++++ web/lib/pkgfuncs.inc.php | 17 +++++++++-- web/lib/routing.inc.php | 1 + 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 web/html/modified-rss.php diff --git a/web/html/modified-rss.php b/web/html/modified-rss.php new file mode 100644 index 00000000..4c5c47e0 --- /dev/null +++ b/web/html/modified-rss.php @@ -0,0 +1,62 @@ +cssStyleSheet = false; +$rss->xslStyleSheet = false; + +# Use UTF-8 (fixes FS#10706). +$rss->encoding = "UTF-8"; + +#All the general RSS setup +$rss->title = "AUR Latest Modified Packages"; +$rss->description = "The latest modified packages in the AUR"; +$rss->link = "${protocol}://{$host}"; +$rss->syndicationURL = "{$protocol}://{$host}" . get_uri('/rss/'); +$image = new FeedImage(); +$image->title = "AUR Latest Modified Packages"; +$image->url = "{$protocol}://{$host}/css/archnavbar/aurlogo.png"; +$image->link = $rss->link; +$image->description = "AUR Latest Modified Packages Feed"; +$rss->image = $image; + +#Get the latest packages and add items for them +$packages = latest_modified_pkgs(100); + +foreach ($packages as $indx => $row) { + $item = new FeedItem(); + $item->title = $row["Name"]; + $item->link = "{$protocol}://{$host}" . get_pkg_uri($row["Name"]); + $item->description = $row["Description"]; + $item->date = intval($row["ModifiedTS"]); + $item->source = "{$protocol}://{$host}"; + $item->author = username_from_id($row["MaintainerUID"]); + $item->guidIsPermaLink = true; + $item->guid = $row["Name"] . "-" . $row["ModifiedTS"]; + $rss->addItem($item); +} + +#save it so that useCached() can find it +$feedContent = $rss->createFeed(); +set_cache_value($feed_key, $feedContent, 600); +echo $feedContent; +?> diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index eb3afab6..140c7ec1 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -925,13 +925,13 @@ function sanitize_ids($ids) { * * @return array $packages Package info for the specified number of recent packages */ -function latest_pkgs($numpkgs) { +function latest_pkgs($numpkgs, $orderBy='SubmittedTS') { $dbh = DB::connect(); - $q = "SELECT Packages.*, MaintainerUID, SubmittedTS "; + $q = "SELECT Packages.*, MaintainerUID, SubmittedTS, ModifiedTS "; $q.= "FROM Packages LEFT JOIN PackageBases ON "; $q.= "PackageBases.ID = Packages.PackageBaseID "; - $q.= "ORDER BY SubmittedTS DESC "; + $q.= "ORDER BY " . $orderBy . " DESC "; $q.= "LIMIT " . intval($numpkgs); $result = $dbh->query($q); @@ -944,3 +944,14 @@ function latest_pkgs($numpkgs) { return $packages; } + +/** + * Determine package information for latest modified packages + * + * @param int $numpkgs Number of packages to get information on + * + * @return array $packages Package info for the specified number of recently modified packages + */ +function latest_modified_pkgs($numpkgs) { + return latest_pkgs($numpkgs, 'ModifiedTS'); +} diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php index 7d9750a0..73c667d2 100644 --- a/web/lib/routing.inc.php +++ b/web/lib/routing.inc.php @@ -15,6 +15,7 @@ $ROUTES = array( '/logout' => 'logout.php', '/passreset' => 'passreset.php', '/rpc' => 'rpc.php', + '/rss/modified' => 'modified-rss.php', '/rss' => 'rss.php', '/tos' => 'tos.php', '/tu' => 'tu.php', From 8d9f20939c864800a45fc6f8994ad9af8e8fe837 Mon Sep 17 00:00:00 2001 From: Justin Kromlinger Date: Fri, 20 Nov 2020 00:20:26 +0100 Subject: [PATCH 5/5] Add modified packages RSS feed to frontend --- web/html/css/archweb.css | 4 ++++ web/template/header.php | 1 + web/template/stats/updates_table.php | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/web/html/css/archweb.css b/web/html/css/archweb.css index f95e3843..b935d7db 100644 --- a/web/html/css/archweb.css +++ b/web/html/css/archweb.css @@ -556,6 +556,10 @@ h3 span.arrow { margin: -2em 0 0 0; } + #pkg-updates .rss-icon.latest { + margin-right: 1em; + } + #pkg-updates table { margin: 0; } diff --git a/web/template/header.php b/web/template/header.php index f7409400..afe7a9b6 100644 --- a/web/template/header.php +++ b/web/template/header.php @@ -9,6 +9,7 @@ ' /> + ' /> diff --git a/web/template/stats/updates_table.php b/web/template/stats/updates_table.php index b4c6215f..23a86288 100644 --- a/web/template/stats/updates_table.php +++ b/web/template/stats/updates_table.php @@ -1,6 +1,7 @@

()

-RSS Feed +RSS Feed +RSS Feed