functions.php,distroquery.php: change distroquery API base dir from distroquery-api to rpms

This commit is contained in:
Silvan Calarco 2024-06-29 12:52:20 +02:00
parent 8c206bae0d
commit 1b656fa4bb
2 changed files with 20 additions and 7 deletions

View File

@ -17,7 +17,7 @@ if ( !defined( 'ABSPATH' ) ) {
exit;
}
$url_prefix = home_url() . "/distroquery-api/";
$url_prefix = home_url() . "/rpms/";
?>
<?php get_header(); ?>
@ -100,7 +100,7 @@ $url_prefix = home_url() . "/distroquery-api/";
<tr><td width="15%">Size:</td><td><?php echo $j["size"] ?></td></tr>
<tr><td width="15%">URL:</td><td><a href="<?php echo $j["url"] ?>" target=_blank><?php echo $j["url"] ?></a></td></tr>
<tr><td width="15%">Download:</td><td><a href="<?php echo $j["download_url"] ?>" target=_blank><?php echo basename($j["download_url"]) ?></a></td></tr>
<tr><td width="15%">Sources:</td><td><a href="<?php echo $j["source_url"] ?>" target=_blank><?php echo $j["source_url"] ?></a></td></tr>
<tr><td width="15%">Sources repository:</td><td><a href="<?php echo $j["source_url"] ?>" target=_blank><?php echo $j["source_url"] ?></a></td></tr>
<tr><td width="15%">Build time:</td><td><?php echo iso8601_to_datetime($j["buildtime"]) ?></td></tr>
<tr><td width="15%">Built RPMS:</td><td><?php
foreach ($j["children"] as $child) {
@ -152,7 +152,6 @@ $url_prefix = home_url() . "/distroquery-api/";
<tr><td width="15%">Source RPM:</td><td><?php
$sourcerpm_url = $url_prefix . $repo . "/" . $j["source"]["name"];
echo "<a href=\"". $sourcerpm_url . "\">". $j["source"]["name"] . "</a> "; ?>
<tr><td width="15%">Sources:</td><td><a href="<?php echo $j["source"]["source_url"] ?>" target=_blank><?php echo $j["source"]["source_url"] ?></a></td></tr>
<tr><td width="15%">Brothers:</td><td><?php
foreach ($j["brothers"] as $brother) {
$brother_url = $url_prefix . $repo . "/" . $brother . "/" . $arch;
@ -166,6 +165,20 @@ $url_prefix = home_url() . "/distroquery-api/";
echo " ";
} ?>
</td></tr>
<tr><td width="15%">Obsoletes:</td><td><?php
foreach ($j["obsoletes"] as $obsolete) {
echo $obsolete["name"];
if ($obsolete["flags"] != "") echo "[" . $obsolete["flags"] . $obsolete["version"] . "]";
echo " ";
} ?>
</td></tr>
<tr><td width="15%">Requires:</td><td><?php
foreach ($j["requires"] as $require) {
echo $require["name"];
if ($require["flags"] != "") echo "[" . $require["flags"] . $require["version"] . "]";
echo " ";
} ?>
</td></tr>
</table>
<?php

View File

@ -493,13 +493,13 @@ add_filter( 'query_vars', function( $query_vars ) {
} );
function distroquery_api_rewrite_rules ( ) {
add_rewrite_rule ( '^distroquery-api/([^/]*)/([^/]*)/([^/]*)/?',
add_rewrite_rule ( '^rpms/([^/]*)/([^/]*)/([^/]*)/?',
'index.php?distroquery=1&repo=$matches[1]&package=$matches[2]&arch=$matches[3]','top' );
add_rewrite_rule ( '^distroquery-api/([^/]*)/([^/]*)/?',
add_rewrite_rule ( '^rpms/([^/]*)/([^/]*)/?',
'index.php?distroquery=1&repo=$matches[1]&package=$matches[2]','top' );
add_rewrite_rule ( '^distroquery-api/([^/]*)/?',
add_rewrite_rule ( '^rpms/([^/]*)/?',
'index.php?distroquery=1&repo=$matches[1]','top' );
add_rewrite_rule ( '^distroquery-api/?',
add_rewrite_rule ( '^rpms/?',
'index.php?distroquery=1','top' );
}
add_action ( 'init', 'distroquery_api_rewrite_rules', 10, 0 ) ;