From 8c206bae0d6ecb6398ccf594384fb2e2fbe8cd06 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 2 Jun 2024 12:19:32 +0200 Subject: [PATCH] distroquery.php: improvements in rest client results data and navigation --- distroquery.php | 104 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 13 deletions(-) diff --git a/distroquery.php b/distroquery.php index 7d81b89..55244c1 100644 --- a/distroquery.php +++ b/distroquery.php @@ -22,11 +22,11 @@ $url_prefix = home_url() . "/distroquery-api/"; ?> -
+
repositories]"; - + // Navigation bar + echo "Home"; $repo=get_query_var('repo'); $package=get_query_var('package'); @@ -36,9 +36,11 @@ $url_prefix = home_url() . "/distroquery-api/"; // // Repositories // - echo "

Available repositories:

"; + echo " > Repositories"; + + echo "

Available repositories:

"; $request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/repositories'); - $j = json_decode($request["body"],true); + $j = json_decode($request["body"], true); foreach ($j as $repository) { $repository_url = $url_prefix . $repository["tag"]; echo "". $repository["tag"] . ": " . $repository["description"] . "
"; @@ -48,20 +50,93 @@ $url_prefix = home_url() . "/distroquery-api/"; // // Repository // - echo "

List of packages:

"; - $request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/repository/' . $repo); - $j = json_decode($request["body"],true); + echo " > Repositories"; - } else if ($package != "") { + $request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/repository/' . $repo); + $j = json_decode($request["body"], true); + + if ($j["error"] != "") { + echo "

ERROR: " . $j["error"] . "

"; + } else { + + echo " > " . $repo; + echo "

List of packages:

"; + + foreach ($j as $package) { + $package_url = $url_prefix . $repo . "/" . $package["name"]; + echo "". $package["name"] . ": " . $package["summary"] . "
"; + } + + } + + } else if ($arch == "") { +// +// Source package +// + echo " > Repositories"; + + $request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/package/'. $repo . "/" . $package); + $j = json_decode($request["body"], true); + + if ($j["error"] != "") { + echo "

ERROR: " . $j["error"] . "

"; + } else { + echo " > $repo > " . $package; + +?> + +

" width="24" height="24"> +:

+ + + + + + + + + + + + + + + + +
Name:
Release: +
Group:
Maintainer:
Description:
License:
Size:
URL:" target=_blank>
Download:" target=_blank>
Sources:" target=_blank>
Build time:
Built RPMS:" . $child["name"] . "(" . $child["arch"] . ") "; + } ?> +
Build requirements: +
+ + Repositories"; + $request = wp_remote_get('https://push.openmamba.org/openmamba/distroquery/api/v1/package/'. $repo . "/" . $package . "/" . $arch); $j = json_decode($request["body"],true); + if ($j["error"] != "") { + echo "

ERROR: " . $j["error"] . "

"; + } else { + echo " > $repo > " . $package . " (" . $arch . ")"; + ?> -

" width="24" height="24"> -:

+

" width="24" height="24"> +:

@@ -74,6 +149,9 @@ $url_prefix = home_url() . "/distroquery-api/"; + -
Name:
Size:
URL:" target=_blank>
Download:" target=_blank>
Source RPM:". $j["source"]["name"] . " "; ?>
Sources:" target=_blank>
Brothers:
-
+