diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-12-29 11:56:47 +0100 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-12-29 13:22:05 +0100 |
commit | 176014a5d7bc17dc9528a01df1280b09a3505a8d (patch) | |
tree | 2b7ffa2405f04ecb8074847ae4d59d1f6b4df5bc | |
parent | ada3a8eab37090c9583d5ef34342fdf06ac40b74 (diff) | |
download | aur-176014a5d7bc17dc9528a01df1280b09a3505a8d.tar.gz aur-176014a5d7bc17dc9528a01df1280b09a3505a8d.tar.xz |
Add links to public and private clone URLs
Show a public clone URL (using Git over HTTP) by default and only show
the private clone URL to the package maintainer.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
-rw-r--r-- | conf/cgitrc.proto | 2 | ||||
-rw-r--r-- | conf/config.proto | 3 | ||||
-rw-r--r-- | web/template/pkg_details.php | 10 | ||||
-rw-r--r-- | web/template/pkgbase_details.php | 10 |
4 files changed, 19 insertions, 6 deletions
diff --git a/conf/cgitrc.proto b/conf/cgitrc.proto index fdc280b5..e2b68922 100644 --- a/conf/cgitrc.proto +++ b/conf/cgitrc.proto @@ -24,6 +24,6 @@ footer=/srv/http/aur/web/template/cgit/footer.html max-repodesc-length=50 max-blob-size=2048 max-stats=year -enable-http-clone=0 +enable-http-clone=1 scan-path=/srv/http/aur/repos/ diff --git a/conf/config.proto b/conf/config.proto index 788f38d7..ea6c063e 100644 --- a/conf/config.proto +++ b/conf/config.proto @@ -19,7 +19,8 @@ max_filesize_uncompressed = 8388608 disable_http_login = 1 aur_location = https://aur.archlinux.org cgit_uri = https://aur.archlinux.org/cgit/ -git_clone_uri = ssh+git://aur@aur.archlinux.org:2222/%s.git/ +git_clone_uri_anon = https://aur.archlinux.org/cgit/%s.git/ +git_clone_uri_priv = ssh+git://aur@aur.archlinux.org:2222/%s.git/ max_rpc_results = 5000 aur_request_ml = aur-requests@archlinux.org request_idle_time = 1209600 diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 90360769..ecb081c1 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -1,7 +1,8 @@ <?php $cgit_uri = config_get('options', 'cgit_uri'); -$git_clone_uri = config_get('options', 'git_clone_uri'); +$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'])); $uid = uid_from_sid($SID); @@ -160,7 +161,12 @@ $sources = pkg_sources($row["ID"]); <table id="pkginfo"> <tr> <th><?= __('Git Clone URL') . ': ' ?></th> - <td><?= sprintf($git_clone_uri, htmlspecialchars($row['BaseName'])) ?></td> + <td> + <a href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a> + <?php if ($uid == $row["MaintainerUID"]): ?> + <br /> <a href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a> + <?php endif; ?> + </td> </tr> <tr> <th><?= __('Package Base') . ': ' ?></th> diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index 3f8f4a5f..e698fb0a 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -1,7 +1,8 @@ <?php $cgit_uri = config_get('options', 'cgit_uri'); -$git_clone_uri = config_get('options', 'git_clone_uri'); +$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'])); $uid = uid_from_sid($SID); @@ -111,7 +112,12 @@ $pkgs = pkgbase_get_pkgnames($base_id); <table id="pkginfo"> <tr> <th><?= __('Git Clone URL') . ': ' ?></th> - <td><?= sprintf($git_clone_uri, htmlspecialchars($row['Name'])) ?></td> + <td> + <a href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a> + <?php if ($uid == $row["MaintainerUID"]): ?> + <br /> <a href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a> + <?php endif; ?> + </td> </tr> <tr> <th><?= __('Category') . ': ' ?></th> |