michal/tit

Browse tree · Show commit · Download archive

Blob: templates/feed-tokens.html

Raw · Blame

{% extends "base.html" %}
{% block title %}Feed tokens · tit{% endblock %}
{% block content %}
  <h1>Feed tokens</h1>
  <p>Feed URLs are credentials. A person who has a URL can read its scoped feed.</p>

  <h2>Create token</h2>
  <form method="post" action="/feeds/tokens">
    <input type="hidden" name="csrf" value="{{ csrf }}">
    <input type="hidden" name="owner" value="">
    <input type="hidden" name="repository" value="">
    <div class="field">
      <label for="feed-scope">Scope</label>
      <select id="feed-scope" name="scope">
        <option value="watched">Watched activity</option>
        <option value="assignments">Assignments</option>
        <option value="mentions">Mentions</option>
      </select>
    </div>
    <button type="submit">Create feed token</button>
  </form>

  <h2>Create a repository token</h2>
  <form method="post" action="/feeds/tokens">
    <input type="hidden" name="csrf" value="{{ csrf }}">
    <input type="hidden" name="scope" value="repository">
    <div class="field">
      <label for="feed-owner">Repository owner</label>
      <input id="feed-owner" name="owner" autocomplete="off" autocapitalize="none" spellcheck="false">
    </div>
    <div class="field">
      <label for="feed-repository">Repository name</label>
      <input id="feed-repository" name="repository" autocomplete="off" autocapitalize="none" spellcheck="false">
    </div>
    <button type="submit">Create repository token</button>
  </form>

  <h2>Existing tokens</h2>
{% if tokens.is_empty() %}
  <p>You do not have a feed token.</p>
{% else %}
  <ul>
{% for token in tokens %}
    <li>
      <strong>{{ token.scope }}</strong> for {{ token.target }}, created at <time datetime="{{ token.created_at }}">{{ token.created_at|human_time }}</time>.
{% if token.active %}
      <form method="post" action="/feeds/tokens/{{ token.id }}/rotate">
        <input type="hidden" name="csrf" value="{{ csrf }}">
        <fieldset class="confirmation">
          <legend>Rotate this token?</legend>
          <label><input type="radio" name="confirm" value="no" checked> No</label>
          <label><input type="radio" name="confirm" value="yes"> Yes</label>
        </fieldset>
        <button type="submit">Rotate</button>
      </form>
      <form method="post" action="/feeds/tokens/{{ token.id }}/revoke">
        <input type="hidden" name="csrf" value="{{ csrf }}">
        <fieldset class="confirmation">
          <legend>Revoke this token?</legend>
          <label><input type="radio" name="confirm" value="no" checked> No</label>
          <label><input type="radio" name="confirm" value="yes"> Yes</label>
        </fieldset>
        <button type="submit">Revoke</button>
      </form>
{% else %}
      Revoked.
{% endif %}
    </li>
{% endfor %}
  </ul>
{% endif %}
{% endblock %}