|
|
@ -75,86 +75,124 @@ |
|
|
|
{% endif %} |
|
|
|
</div> |
|
|
|
|
|
|
|
{% if rw %} |
|
|
|
<div class="panel panel-{{ api_status|default:'default' }}"> |
|
|
|
<div class="panel-body settings-block"> |
|
|
|
<h2>API Access</h2> |
|
|
|
{% if project.api_key %} |
|
|
|
{% if show_api_keys %} |
|
|
|
<p> |
|
|
|
API key: <br /> |
|
|
|
<pre>{{ project.api_key }}</pre> |
|
|
|
</p> |
|
|
|
{% if project.api_key_readonly %} |
|
|
|
<p> |
|
|
|
API key (read-only): <br /> |
|
|
|
<pre>{{ project.api_key_readonly }}</pre> |
|
|
|
</p> |
|
|
|
{% endif %} |
|
|
|
{% if project.ping_key %} |
|
|
|
<p> |
|
|
|
Ping key: <br /> |
|
|
|
<pre>{{ project.ping_key }}</pre> |
|
|
|
</p> |
|
|
|
{% endif %} |
|
|
|
<p>See also:</p> |
|
|
|
<ul> |
|
|
|
<li><a href="{% url 'hc-serve-doc' 'api' %}">API documentation</a></li> |
|
|
|
<table id="api-keys" class="table"> |
|
|
|
<tr> |
|
|
|
<td>API key</td> |
|
|
|
<td> |
|
|
|
{% if project.api_key %} |
|
|
|
{% if show_keys %} |
|
|
|
<code>{{ project.api_key }}</code> |
|
|
|
{% else %} |
|
|
|
<code>{{ project.api_key|mask_key }}</code> |
|
|
|
{% endif %} |
|
|
|
{% else %} |
|
|
|
<span class="not-set">not set</span> |
|
|
|
{% endif %} |
|
|
|
</td> |
|
|
|
<td class="text-right"> |
|
|
|
{% if project.api_key %} |
|
|
|
<a href="#" |
|
|
|
data-revoke-key="api_key" |
|
|
|
data-name="API key">Revoke</a> |
|
|
|
{% else %} |
|
|
|
<a href="#" data-create-key="api_key">Create</a> |
|
|
|
{% endif %} |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td>API key (read-only)</td> |
|
|
|
<td> |
|
|
|
{% if project.api_key_readonly %} |
|
|
|
{% if enable_prometheus %} |
|
|
|
<li> |
|
|
|
<a href="{% url 'hc-metrics' project.code project.api_key_readonly %}">Prometheus metrics endpoint</a> |
|
|
|
</li> |
|
|
|
{% if show_keys %} |
|
|
|
<code>{{ project.api_key_readonly }}</code> |
|
|
|
{% else %} |
|
|
|
<code>{{ project.api_key_readonly|mask_key }}</code> |
|
|
|
{% endif %} |
|
|
|
<li> |
|
|
|
<a href="{{ project.dashboard_url }}">Read-only dashboard</a> |
|
|
|
(<a href="https://github.com/healthchecks/dashboard/#security">security considerations</a>) |
|
|
|
</li> |
|
|
|
{% else %} |
|
|
|
<span class="not-set">not set</span> |
|
|
|
{% endif %} |
|
|
|
</ul> |
|
|
|
<button |
|
|
|
data-toggle="modal" |
|
|
|
data-target="#revoke-api-key-modal" |
|
|
|
class="btn btn-danger pull-right">Revoke</button> |
|
|
|
|
|
|
|
{% else %} |
|
|
|
<form method="post"> |
|
|
|
<span class="ic-ok"></span> |
|
|
|
API access is enabled. |
|
|
|
{% csrf_token %} |
|
|
|
|
|
|
|
{% if rw %} |
|
|
|
<button |
|
|
|
type="submit" |
|
|
|
name="show_api_keys" |
|
|
|
class="btn btn-default pull-right">Show API Keys</button> |
|
|
|
</td> |
|
|
|
<td class="text-right"> |
|
|
|
{% if project.api_key_readonly %} |
|
|
|
<a href="#" |
|
|
|
data-revoke-key="api_key_readonly" |
|
|
|
data-name="read-only API key">Revoke</a> |
|
|
|
{% else %} |
|
|
|
<a href="#" data-create-key="api_key_readonly">Create</a> |
|
|
|
{% endif %} |
|
|
|
</form> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td>Ping key</td> |
|
|
|
<td> |
|
|
|
{% if project.ping_key %} |
|
|
|
{% if show_keys %} |
|
|
|
<code>{{ project.ping_key }}</code> |
|
|
|
{% else %} |
|
|
|
<code>{{ project.ping_key|mask_key }}</code> |
|
|
|
{% endif %} |
|
|
|
{% else %} |
|
|
|
<span class="not-set">not set</span> |
|
|
|
{% endif %} |
|
|
|
</td> |
|
|
|
<td class="text-right"> |
|
|
|
{% if project.ping_key %} |
|
|
|
<a href="#" |
|
|
|
data-revoke-key="ping_key" |
|
|
|
data-name="Ping key">Revoke</a> |
|
|
|
{% else %} |
|
|
|
<a href="#" data-create-key="ping_key">Create</a> |
|
|
|
{% endif %} |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
|
|
|
|
<p>See also:</p> |
|
|
|
<ul> |
|
|
|
<li><a href="{% url 'hc-serve-doc' 'api' %}">API documentation</a></li> |
|
|
|
{% if project.api_key_readonly and show_keys %} |
|
|
|
{% if enable_prometheus %} |
|
|
|
<li> |
|
|
|
<a href="{% url 'hc-metrics' project.code project.api_key_readonly %}">Prometheus metrics endpoint</a> |
|
|
|
</li> |
|
|
|
{% endif %} |
|
|
|
{% else %} |
|
|
|
<span class="ic-cancel"></span> |
|
|
|
API access is disabled. |
|
|
|
<form method="post"> |
|
|
|
{% csrf_token %} |
|
|
|
<button |
|
|
|
type="submit" |
|
|
|
name="create_api_keys" |
|
|
|
class="btn btn-default pull-right">Create API Keys</button> |
|
|
|
</form> |
|
|
|
<li> |
|
|
|
<a href="{{ project.dashboard_url }}">Read-only dashboard</a> |
|
|
|
(<a href="https://github.com/healthchecks/dashboard/#security">security considerations</a>) |
|
|
|
</li> |
|
|
|
{% endif %} |
|
|
|
</ul> |
|
|
|
|
|
|
|
{% if not show_keys %} |
|
|
|
{% if project.api_key or project.api_key_readonly or project.ping_key %} |
|
|
|
<form method="post"> |
|
|
|
{% csrf_token %} |
|
|
|
<button |
|
|
|
type="submit" |
|
|
|
name="show_keys" |
|
|
|
class="btn btn-default pull-right">Show Keys</button> |
|
|
|
</form> |
|
|
|
{% endif %} |
|
|
|
{% endif %} |
|
|
|
</div> |
|
|
|
|
|
|
|
{% if api_keys_created %} |
|
|
|
{% if key_created %} |
|
|
|
<div class="panel-footer"> |
|
|
|
API keys created |
|
|
|
Key created |
|
|
|
</div> |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{% if api_keys_revoked %} |
|
|
|
{% if key_revoked %} |
|
|
|
<div class="panel-footer"> |
|
|
|
API keys revoked |
|
|
|
Key revoked |
|
|
|
</div> |
|
|
|
{% endif %} |
|
|
|
</div> |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{% with invite_suggestions=project.invite_suggestions %} |
|
|
|
<div class="panel panel-{{ team_status|default:'default' }}"> |
|
|
@ -320,29 +358,37 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div id="revoke-api-key-modal" class="modal"> |
|
|
|
<form id="create-key-form" method="post"> |
|
|
|
{% csrf_token %} |
|
|
|
<input id="create-key-type" type="hidden" name="create_key"> |
|
|
|
</form> |
|
|
|
|
|
|
|
<div id="revoke-key-modal" class="modal"> |
|
|
|
<div class="modal-dialog"> |
|
|
|
<form id="revoke-api-key-form" method="post"> |
|
|
|
<form id="revoke-key-form" method="post"> |
|
|
|
{% csrf_token %} |
|
|
|
<input id="revoke-key-type" type="hidden" name="revoke_key"> |
|
|
|
<div class="modal-content"> |
|
|
|
<div class="modal-header"> |
|
|
|
<button type="button" class="close" data-dismiss="modal">×</button> |
|
|
|
<h4>Revoke API Keys?</h4> |
|
|
|
<h4>Revoke <span class="name"></span>?</h4> |
|
|
|
</div> |
|
|
|
<div class="modal-body"> |
|
|
|
<p>You are about to revoke your current API keys.</p> |
|
|
|
<p>Afterwards, you can create new API keys, but there will |
|
|
|
be <strong>no way of getting the current API |
|
|
|
keys back</strong>. |
|
|
|
<p> |
|
|
|
You are about to revoke your current |
|
|
|
<span class="name"></span>. |
|
|
|
</p> |
|
|
|
<p> |
|
|
|
Afterwards, you can generate a new key, but there will |
|
|
|
be <strong>no way of getting the key's current value back</strong>. |
|
|
|
</p> |
|
|
|
<p>Are you sure?</p> |
|
|
|
</div> |
|
|
|
<div class="modal-footer"> |
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> |
|
|
|
<button |
|
|
|
type="submit" |
|
|
|
name="revoke_api_keys" |
|
|
|
class="btn btn-danger">Revoke API Keys</button> |
|
|
|
<button type="submit" class="btn btn-danger"> |
|
|
|
Revoke <span class="name"></span> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|