---
On Thu, Oct 25, 2018 at 3:26 PM Guillaume Benoit
If you point me to the relevant code, I can try to provide a patch.
Not an aurweb developer, but since I looked at it recently and it was fresh on my mind, here's a draft, only-cursorily-tested patch. web/lib/aurjson.class.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index c51e9c2..5de6533 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -18,11 +18,15 @@ class AurJSON { ); private static $exposed_fields = array( 'name', 'name-desc', 'maintainer', - 'depends', 'makedepends', 'checkdepends', 'optdepends' + 'depends', 'makedepends', 'checkdepends', 'optdepends', + 'conflicts', 'provides', 'replaces' ); private static $exposed_depfields = array( 'depends', 'makedepends', 'checkdepends', 'optdepends' ); + private static $exposed_relfields = array( + 'conflicts', 'provides', 'replaces' + ); private static $fields_v1 = array( 'Packages.ID', 'Packages.Name', 'PackageBases.ID AS PackageBaseID', @@ -510,6 +514,19 @@ class AurJSON { $subquery .= "AND DependencyTypes.Name = $search_by"; $where_condition = "$keyword_string IN ($subquery)"; } + } else if (in_array($search_by, self::$exposed_relfields)) { + if (empty($keyword_string)) { + return $this->json_error('Query arg is empty.'); + } else { + $keyword_string = $this->dbh->quote($keyword_string); + $search_by = $this->dbh->quote($search_by); + $subquery = "SELECT PackageRelations.RelName FROM PackageRelations "; + $subquery .= "LEFT JOIN RelationTypes "; + $subquery .= "ON PackageRelations.RelTypeID = RelationTypes.ID "; + $subquery .= "WHERE PackageRelations.PackageID = Packages.ID "; + $subquery .= "AND RelationTypes.Name = $search_by"; + $where_condition = "$keyword_string IN ($subquery)"; + } } return $this->process_query('search', $where_condition); -- 2.19.1