lib.itmens/common/templates/console.html

97 lines
3.1 KiB
HTML
Raw Normal View History

2023-06-27 23:11:20 -04:00
{% load i18n %}
<!DOCTYPE html>
2023-07-01 10:14:03 -04:00
<html lang="en">
<head>
<link rel="stylesheet"
2025-01-19 16:04:22 -05:00
href="{{ cdn_url }}/npm/swagger-ui-dist@5.18.2/swagger-ui.min.css">
<title>{{ api.title }} Developer Console</title>
2024-01-07 17:24:34 -05:00
{% include "common_libs.html" %}
<style type="text/css">
.information-container, #operations-tag-default {
display: none;
}
.scheme-container {
margin: 0 !important;
background: none !important;
box-shadow: none !important;
}
button svg {
fill: var(--pico-primary);
}
2023-07-01 10:14:03 -04:00
#swagger-ui>div>div>.wrapper {
background-color: white;
padding: 0;
}
2024-01-28 07:57:39 -05:00
#swagger-ui>div>div>.wrapper button {
background-color: unset;
}
#swagger-ui>div>div>.wrapper button.btn.execute {
background-color: #4990e2;
}
2025-01-19 16:04:22 -05:00
button {
:first-letter {
text-transform: none;
}
}
</style>
</head>
<body>
{% include "_header.html" %}
<main class="container">
2024-06-10 17:28:20 -04:00
<h3>Developer Console</h3>
<p>
<li class="empty">
By using our APIs, you agree to our <a href="/pages/terms">Terms of Service</a>.
</li>
<li class="empty">
In additional to APIs below, {{ site_name }} also supports a subset of <a href="https://docs.joinmastodon.org/client/intro/">Mastodon APIs</a>.
</li>
2023-06-27 23:11:20 -04:00
</p>
<details {% if token %}open{% endif %}>
<summary>
2023-06-28 19:48:05 -04:00
<a>Test Access Token</a>
</summary>
<form method="post" role="group">
{% csrf_token %}
<input type="text"
readonly
2023-06-03 01:22:19 -04:00
value="{{ token | default:'Once generated, token will only be shown once here, previous tokens will be revoked.' }}">
2024-06-10 17:28:20 -04:00
<input type="submit"
2024-06-11 15:17:35 -04:00
{% if request.user.is_authenticated %}value="Generate"{% else %}value="Login to generate" disabled{% endif %} />
</form>
<p>
Click <code>Authorize</code> button below, input your token there to invoke APIs with your account, which is required for APIs like <code>/api/me</code>
<br>
Or use it in command line, like
<code>curl -H "Authorization: Bearer YOUR_TOKEN" {{ site_url }}/api/me</code>
</p>
</details>
2023-06-28 19:48:05 -04:00
<br>
<details>
<summary>
<a>How to authorize</a>
</summary>
2024-06-10 17:28:20 -04:00
Please check <a href="https://neodb.net/api/">NeoDB documentation</a> for details.
2023-06-28 19:48:05 -04:00
</details>
2023-07-01 10:14:03 -04:00
<div id="swagger-ui" data-theme="light"></div>
2024-04-06 22:52:35 -04:00
<script src="{{ cdn_url }}/npm/swagger-ui-dist@5.13.0/swagger-ui-bundle.min.js"></script>
<script>
const ui = SwaggerUIBundle({
url: '{{ openapi_json_url }}',
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
layout: "BaseLayout",
{% if api.csrf and csrf_token %}
requestInterceptor: (req) => {req.headers['X-CSRFToken'] = "{{csrf_token}}"; return req;},
{% endif %}
deepLinking: true
})
</script>
</main>
2023-06-09 03:01:17 -04:00
{% include "_footer.html" %}
</body>
</html>