[aur-dev] [PATCH] Make URIs to the individual cgit pages configurable

Lukas Fleischer lfleischer at archlinux.org
Thu Jun 11 11:37:02 UTC 2015


Make the locations of the PKGBUILD preview, the log and the snapshot
tarball configurable. This increases flexibility and simplifies the code
a bit.

Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 conf/config.proto                |  4 +++-
 web/template/pkg_details.php     | 10 ++++++----
 web/template/pkgbase_details.php | 10 ++++++----
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/conf/config.proto b/conf/config.proto
index 94ef8e6..1d3e329 100644
--- a/conf/config.proto
+++ b/conf/config.proto
@@ -18,7 +18,6 @@ persistent_cookie_timeout = 2592000
 max_filesize_uncompressed = 8388608
 disable_http_login = 1
 aur_location = https://aur.archlinux.org
-cgit_uri = https://aur.archlinux.org/cgit/aur.git
 git_clone_uri_anon = https://aur.archlinux.org/%s.git/
 git_clone_uri_priv = ssh+git://aur@aur.archlinux.org/%s.git/
 max_rpc_results = 5000
@@ -26,6 +25,9 @@ aur_request_ml = aur-requests at archlinux.org
 request_idle_time = 1209600
 auto_orphan_age = 15552000
 auto_delete_age = 86400
+pkgbuild_uri = https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=%s
+log_uri = https://aur.archlinux.org/cgit/aur.git/log/?h=%s
+snapshot_uri = https://aur.archlinux.org/cgit/aur.git/snapshot/%s.tar.gz
 
 [auth]
 valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index 7c68c30..e50f029 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -1,6 +1,8 @@
 <?php
 
-$cgit_uri = config_get('options', 'cgit_uri');
+$pkgbuild_uri = sprintf(config_get('options', 'pkgbuild_uri'), urlencode($row['BaseName']));
+$log_uri = sprintf(config_get('options', 'log_uri'), urlencode($row['BaseName']));
+$snapshot_uri = sprintf(config_get('options', 'snapshot_uri'), urlencode($row['BaseName']));
 $git_clone_uri_anon = sprintf(config_get('options', 'git_clone_uri_anon'), htmlspecialchars($row['BaseName']));
 $git_clone_uri_priv = sprintf(config_get('options', 'git_clone_uri_priv'), htmlspecialchars($row['BaseName']));
 
@@ -82,10 +84,10 @@ $sources = pkg_sources($row["ID"]);
 			<h4><?= __('Package Actions') ?></h4>
 			<ul class="small">
 				<li>
-					<a href="<?= $cgit_uri . '/tree/PKGBUILD?h=' . urlencode($row['BaseName']) ?>"><?= __('View PKGBUILD') ?></a> /
-					<a href="<?= $cgit_uri . '/log/?h=' . urlencode($row['BaseName']) ?>"><?= __('View Changes') ?></a>
+					<a href="<?= $pkgbuild_uri ?>"><?= __('View PKGBUILD') ?></a> /
+					<a href="<?= $log_uri ?>"><?= __('View Changes') ?></a>
 				</li>
-				<li><a href="<?= $cgit_uri . '/snapshot/' . urlencode($row['BaseName']) . '.tar.gz' ?>"><?= __('Download snapshot') ?></a>
+				<li><a href="<?= $snapshot_uri ?>"><?= __('Download snapshot') ?></a>
 				<li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li>
 				<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
 				<?php if ($uid): ?>
diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php
index a425c4c..2ef8788 100644
--- a/web/template/pkgbase_details.php
+++ b/web/template/pkgbase_details.php
@@ -1,6 +1,8 @@
 <?php
 
-$cgit_uri = config_get('options', 'cgit_uri');
+$pkgbuild_uri = sprintf(config_get('options', 'pkgbuild_uri'), urlencode($row['Name']));
+$log_uri = sprintf(config_get('options', 'log_uri'), urlencode($row['Name']));
+$snapshot_uri = sprintf(config_get('options', 'snapshot_uri'), urlencode($row['Name']));
 $git_clone_uri_anon = sprintf(config_get('options', 'git_clone_uri_anon'), htmlspecialchars($row['Name']));
 $git_clone_uri_priv = sprintf(config_get('options', 'git_clone_uri_priv'), htmlspecialchars($row['Name']));
 
@@ -33,10 +35,10 @@ $pkgs = pkgbase_get_pkgnames($base_id);
 			<h4><?= __('Package Actions') ?></h4>
 			<ul class="small">
 				<li>
-					<a href="<?= $cgit_uri . '/tree/PKGBUILD?h=' . urlencode($row['Name']) ?>"><?= __('View PKGBUILD') ?></a> /
-					<a href="<?= $cgit_uri . '/log/?h=' . urlencode($row['Name']) ?>"><?= __('View Changes') ?></a>
+					<a href="<?= $pkgbuild_uri ?>"><?= __('View PKGBUILD') ?></a> /
+					<a href="<?= $log_uri ?>"><?= __('View Changes') ?></a>
 				</li>
-				<li><a href="<?= $cgit_uri . '/snapshot/' . urlencode($row['Name']) . '.tar.gz' ?>"><?= __('Download snapshot') ?></a>
+				<li><a href="<?= $snapshot_uri ?>"><?= __('Download snapshot') ?></a>
 				<li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li>
 				<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
 				<?php if ($uid): ?>
-- 
2.4.2


More information about the aur-dev mailing list