This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new d7c7e7e Display the curl download method on the download page
d7c7e7e is described below
commit d7c7e7e7ba8fc9c0491deef416f20517f6ed8d93
Author: Sean B. Palmer <[email protected]>
AuthorDate: Sat May 3 11:32:04 2025 +0100
Display the curl download method on the download page
---
atr/routes/__init__.py | 5 +++++
atr/routes/compose.py | 2 +-
atr/routes/download.py | 2 +-
atr/routes/finish.py | 2 +-
atr/routes/upload.py | 2 +-
atr/templates/download-all.html | 17 ++++++++++++++++-
6 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/atr/routes/__init__.py b/atr/routes/__init__.py
index 0654620..8e81a10 100644
--- a/atr/routes/__init__.py
+++ b/atr/routes/__init__.py
@@ -35,6 +35,7 @@ import atr.db as db
import atr.db.models as models
import atr.user as user
import atr.util as util
+from atr import config
if TYPE_CHECKING:
from collections.abc import Awaitable, Callable, Coroutine, Sequence
@@ -178,6 +179,10 @@ class CommitterSession:
if not any((p.name == project_name) for p in (await
self.user_projects)):
raise base.ASFQuartException("You do not have access to this
project", errorcode=403)
+ @property
+ def app_host(self) -> str:
+ return config.get().APP_HOST
+
@property
def host(self) -> str:
request_host = quart.request.host
diff --git a/atr/routes/compose.py b/atr/routes/compose.py
index 4fa423b..5673f5e 100644
--- a/atr/routes/compose.py
+++ b/atr/routes/compose.py
@@ -117,7 +117,7 @@ async def check(
delete_form=delete_draft_form,
delete_file_form=delete_file_form,
asf_id=session.uid,
- server_domain=session.host,
+ server_domain=session.app_host,
user_ssh_keys=user_ssh_keys,
format_datetime=util.format_datetime,
models=models,
diff --git a/atr/routes/download.py b/atr/routes/download.py
index 03160ec..de7237b 100644
--- a/atr/routes/download.py
+++ b/atr/routes/download.py
@@ -55,7 +55,7 @@ async def all_selected(
version_name=version_name,
release=release,
asf_id=session.uid,
- server_domain=session.host,
+ server_domain=session.app_host,
user_ssh_keys=user_ssh_keys,
back_url=back_url,
get_release_stats=util.get_release_stats,
diff --git a/atr/routes/finish.py b/atr/routes/finish.py
index 0814760..5aca999 100644
--- a/atr/routes/finish.py
+++ b/atr/routes/finish.py
@@ -92,7 +92,7 @@ async def selected(session: routes.CommitterSession,
project_name: str, version_
return await quart.render_template(
"finish-selected.html",
asf_id=session.uid,
- server_domain=session.host,
+ server_domain=session.app_host,
release=release,
file_paths=sorted(file_paths_rel),
form=form,
diff --git a/atr/routes/upload.py b/atr/routes/upload.py
index d74da4e..58e79a5 100644
--- a/atr/routes/upload.py
+++ b/atr/routes/upload.py
@@ -105,7 +105,7 @@ async def selected(session: routes.CommitterSession,
project_name: str, version_
return await quart.render_template(
"upload-selected.html",
asf_id=session.uid,
- server_domain=session.host,
+ server_domain=session.app_host,
release=release,
project_name=project_name,
version_name=version_name,
diff --git a/atr/templates/download-all.html b/atr/templates/download-all.html
index e366323..3c8f2ec 100644
--- a/atr/templates/download-all.html
+++ b/atr/templates/download-all.html
@@ -72,8 +72,11 @@
<p>If you prefer, you can download the files using other methods.</p>
<p>
<a href="#download-browser"
- class="btn btn-sm btn-outline-secondary"
+ class="btn btn-sm btn-outline-secondary me-2"
title="Download using your browser">Browser</a>
+ <a href="#download-curl"
+ class="btn btn-sm btn-outline-secondary me-2"
+ title="Download using curl">Curl</a>
<a href="#download-rsync"
class="btn btn-sm btn-outline-secondary me-2"
title="Download using rsync">Rsync</a>
@@ -81,10 +84,22 @@
class="btn btn-sm btn-outline-secondary me-2"
title="Download using wget">Wget</a>
</p>
+
<h3 id="download-browser" class="mt-4">Using your browser</h3>
<p>
You can download the files one by one using your browser from the <a
href="{{ as_url(routes.download.path_empty, project_name=release.project.name,
version_name=release.version) }}">download folder</a>. Clicking a link to any
file will download it, as it is served as <code>application/octet-stream</code>.
</p>
+
+ <h3 id="download-curl" class="mt-4">Using curl</h3>
+ <p>You can download all of the files in this release using curl with the
following command:</p>
+ <!-- TODO: Add a button to copy the command to the clipboard -->
+ <pre class="bg-light p-3 mb-3">
+curl -fsS "https://{{ server_domain }}{{ as_url(routes.download.sh_selected,
project_name=release.project.name, version_name=release.version) }}" | sh
+ </pre>
+ <p>
+ This downloads the files into the <em>current directory</em>. Ensure that
you create a new empty directory, and change to it, before running the command.
The script requires curl and POSIX compliant versions of printf and sh. It
works by downloading a POSIX complaint shell script straight into your shell.
You can of course download the script and audit it before running it.
+ </p>
+
<h3 id="download-rsync" class="mt-4">Using rsync</h3>
<p>You can download all of the files in this release using rsync with the
following command:</p>
<!-- TODO: Add a button to copy the command to the clipboard -->
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]