Page MenuHomeSoftware Heritage

D8837.diff
No OneTemporary

D8837.diff

diff --git a/swh/web/api/templates/api-endpoints.html b/swh/web/api/templates/api-endpoints.html
--- a/swh/web/api/templates/api-endpoints.html
+++ b/swh/web/api/templates/api-endpoints.html
@@ -36,11 +36,21 @@
</p>
</div>
+<div>
+ <ul class="list-inline">
+ {% for category, _ in doc_routes %}
+ <li class="list-inline-item">
+ <a href="#{{ category | slugify }}">{{ category }}</a>
+ </li>
+ {% endfor %}
+ </ul>
+</div>
+
{% for category, routes in doc_routes %}
- <h2>{{ category }}</h2>
+ <h2 id="{{ category | slugify }}">{{ category }}</h2>
<table class="table table-striped search-res swh-table" width="100%">
- <col width="200">
+ <col width="320">
<thead class="thead-default">
<th>Endpoint</th>
<th class="d-none d-sm-table-cell">Description</th>
diff --git a/swh/web/api/templates/api.html b/swh/web/api/templates/api.html
--- a/swh/web/api/templates/api.html
+++ b/swh/web/api/templates/api.html
@@ -294,7 +294,7 @@
<p>
The following shows how to perform an authenticated request to the Web API using <code>curl</code>.
<pre>export TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJhMTMxYTQ1My1hM2IyLTQwMTUtO...
- curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}api/...</pre>
+ curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}/api/...</pre>
</p>
<p>
Authenticated requests can be used to lift rate limiting if the user account has the adequate
diff --git a/swh/web/api/templates/apidoc.html b/swh/web/api/templates/apidoc.html
--- a/swh/web/api/templates/apidoc.html
+++ b/swh/web/api/templates/apidoc.html
@@ -71,7 +71,7 @@
<tbody>
{% for url in urls %}
<tr>
- <td>{{ url.rule | docstring_display | safe }}</td>
+ <td>{{ site_base_url|add:url.rule | docstring_display | safe }}</td>
<td>{{ url.methods | dictsort:0 | join:', ' }}</td>
</tr>
{% endfor %}
diff --git a/swh/web/auth/templates/profile.html b/swh/web/auth/templates/profile.html
--- a/swh/web/auth/templates/profile.html
+++ b/swh/web/auth/templates/profile.html
@@ -75,7 +75,7 @@
</p>
<p>
For instance when using <code>curl</code> proceed as follows:
- <pre>curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}api/...</pre>
+ <pre>curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}/api/...</pre>
</p>
<p>
Please not that a bearer token will automatically expire after 30 days of inactivity.
diff --git a/swh/web/utils/__init__.py b/swh/web/utils/__init__.py
--- a/swh/web/utils/__init__.py
+++ b/swh/web/utils/__init__.py
@@ -305,7 +305,7 @@
"oidc_enabled": bool(config["keycloak"]["server_url"]),
"browsers_supported_image_mimes": browsers_supported_image_mimes,
"keycloak": config["keycloak"],
- "site_base_url": request.build_absolute_uri("/"),
+ "site_base_url": request.build_absolute_uri("/")[:-1],
"DJANGO_SETTINGS_MODULE": os.environ["DJANGO_SETTINGS_MODULE"],
"status": config["status"],
"swh_web_dev": is_swh_web_development(request),

File Metadata

Mime Type
text/plain
Expires
Sun, Aug 17, 9:32 PM (4 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3218490

Event Timeline