[aur-dev] [PATCH] Remove hostname from URLPath in JSON RPC
Prior to aur4 URLPath in the JSON RPC didn't include the hostname, only the path. This removes the hostname and make aur4 compatible with programs expecting the old (and documented) semantics (e.i. cower) Fixes FS#45333 --- conf/config.proto | 2 +- web/template/pkg_details.php | 2 +- web/template/pkgbase_details.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/config.proto b/conf/config.proto index 25c8830..2fbc27a 100644 --- a/conf/config.proto +++ b/conf/config.proto @@ -27,7 +27,7 @@ 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 +snapshot_uri = /cgit/aur.git/snapshot/%s.tar.gz enable-maintenance = 1 maintenance-exceptions = 127.0.0.1 diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 90e5729..eafccbe 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -2,7 +2,7 @@ $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'])); +$snapshot_uri = config_get('options', 'aur_location') . 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'])); diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index 9989369..b008677 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -2,7 +2,7 @@ $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'])); +$snapshot_uri = config_get('options', 'aur_location') . 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'])); -- 2.4.4
On Thu, 18 Jun 2015 at 14:24:01, Mikkel Oscar Lyderik wrote:
Prior to aur4 URLPath in the JSON RPC didn't include the hostname, only the path.
This removes the hostname and make aur4 compatible with programs expecting the old (and documented) semantics (e.i. cower)
Fixes FS#45333
Thanks for looking into this!
--- conf/config.proto | 2 +- web/template/pkg_details.php | 2 +- web/template/pkgbase_details.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/config.proto b/conf/config.proto index 25c8830..2fbc27a 100644 --- a/conf/config.proto +++ b/conf/config.proto @@ -27,7 +27,7 @@ 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 +snapshot_uri = /cgit/aur.git/snapshot/%s.tar.gz enable-maintenance = 1 maintenance-exceptions = 127.0.0.1
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 90e5729..eafccbe 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -2,7 +2,7 @@
$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'])); +$snapshot_uri = config_get('options', 'aur_location') . sprintf(config_get('options', 'snapshot_uri'), urlencode($row['BaseName']));
This change makes it impossible to host the snapshots under a different domain. However, shouldn't it be sufficient to just change the default value and use relative URIs (with absolute paths) on the package details pages as well?
$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']));
diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index 9989369..b008677 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -2,7 +2,7 @@
$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'])); +$snapshot_uri = config_get('options', 'aur_location') . 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']));
-- 2.4.4
On Thu, Jun 18, 2015 at 3:14 PM, Lukas Fleischer <lfleischer@archlinux.org> wrote:
On Thu, 18 Jun 2015 at 14:24:01, Mikkel Oscar Lyderik wrote:
Prior to aur4 URLPath in the JSON RPC didn't include the hostname, only the path.
This removes the hostname and make aur4 compatible with programs expecting the old (and documented) semantics (e.i. cower)
Fixes FS#45333
Thanks for looking into this!
--- conf/config.proto | 2 +- web/template/pkg_details.php | 2 +- web/template/pkgbase_details.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/config.proto b/conf/config.proto index 25c8830..2fbc27a 100644 --- a/conf/config.proto +++ b/conf/config.proto @@ -27,7 +27,7 @@ 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 +snapshot_uri = /cgit/aur.git/snapshot/%s.tar.gz enable-maintenance = 1 maintenance-exceptions = 127.0.0.1
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 90e5729..eafccbe 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -2,7 +2,7 @@
$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'])); +$snapshot_uri = config_get('options', 'aur_location') . sprintf(config_get('options', 'snapshot_uri'), urlencode($row['BaseName']));
This change makes it impossible to host the snapshots under a different domain.
If it is intentional that it should be possible to use a different domain then we can just drop this. However, then the documentation for the JSON RPC should be updated instead to reflect this change, I don't know what the best approach is but I assume it will break a bunch of aur tools if it is left as it is now
However, shouldn't it be sufficient to just change the default value and use relative URIs (with absolute paths) on the package details pages as well?
I agree. I'll correct this if the patch is relevant at all.
$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']));
diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index 9989369..b008677 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -2,7 +2,7 @@
$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'])); +$snapshot_uri = config_get('options', 'aur_location') . 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']));
-- 2.4.4
On Thu, 18 Jun 2015 at 22:46:45, Mikkel Oscar Lyderik wrote:
[...] If it is intentional that it should be possible to use a different domain then we can just drop this. However, then the documentation for the JSON RPC should be updated instead to reflect this change, I don't know what the best approach is but I assume it will break a bunch of aur tools if it is left as it is now
As far as I know, there is no (official) documentation of this field. Only its name which indicates that the field contains a URL. It does not imply that the URL is relative, though.
However, shouldn't it be sufficient to just change the default value and use relative URIs (with absolute paths) on the package details pages as well?
I agree. I'll correct this if the patch is relevant at all. [...]
Yeah, I don't see any disadvantage in dropping the domain name from the default value. If it fixes some AUR helpers, let's do that. Regards, Lukas
participants (2)
-
Lukas Fleischer
-
Mikkel Oscar Lyderik