~fnux/meta.sr.ht

97e0f47f935224dfb40fa2762f8d263e936addf5 — Drew DeVault 8 months ago a3a131f 0.49.1
Reorganize & retheme to match modern sr.ht design
3 files changed, 243 insertions(+), 233 deletions(-)

M metasrht/templates/keys.html
M metasrht/templates/oauth.html
M scss/main.scss
M metasrht/templates/keys.html => metasrht/templates/keys.html +124 -120
@@ 4,125 4,129 @@
{% endblock %}
{% block content %}
<div class="row">
  <section class="col-md-12">
    <h3>SSH Keys</h3>
    {% if any(current_user.ssh_keys) %}
    <p>The following SSH keys are associated with your account:</p>
    <table class="table">
      <thead>
        <tr>
          <th>Name</th>
          <th>Fingerprint</th>
          <th>Authorized</th>
          <th>Last Used</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        {% for key in current_user.ssh_keys %}
        <tr>
          <td>{{key.comment}}</td>
          <td>{{key.fingerprint}}</td>
          <td>{{key.created|date}}</td>
          <td>{{key.last_used|date}}</td>
          <td style="width: 6rem">
            <form method="POST" action="/keys/delete-ssh/{{key.id}}">
              {{csrf_token()}}
              <button type="submit" class="btn btn-danger btn-fill">
                Delete
              </a>
            </form>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
    {% endif %}
  </section>
  <form class="col-lg-6" method="POST" action="/keys/ssh-keys">
    {{csrf_token()}}
    <div class="form-group">
      <label for="ssh-key">SSH Public Key:</label>
      <textarea
        class="form-control {{valid.cls("ssh-key")}}"
        id="ssh-key"
        name="ssh-key"
        rows="2"
        aria-describedBy="sshkey-details">{{ssh_key or ""}}</textarea>
      <small id="sshkey-details" class="form-text text-muted">
        A list of your SSH public keys is available to the public via
        <a
          href="{{url_for("profile.user_keys_GET",
            username=current_user.username)}}"
        >{{current_user.canonical_name}}.keys</a>
      </small>
      {{valid.summary("ssh-key")}}
    </div>
    <button type="submit" class="btn btn-primary pull-right">
      Add key {{icon("caret-right")}}
    </button>
  </form>
  <section class="col-md-12">
    <h3>PGP Keys</h3>
    {% if any(current_user.pgp_keys) %}
    <p>The following PGP keys are associated with your account:</p>
    <table class="table">
      <thead>
        <tr>
          <th>Email</th>
          <th>Key ID</th>
          <th>Authorized</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        {% for key in current_user.pgp_keys %}
        <tr>
          <td>{{key.email}}</td>
          <td>{{key.key_id}}</td>
          <td>{{key.created|date}}</td>
          <td style="width: 6rem">
            <form method="POST" action="/keys/delete-pgp/{{key.id}}">
              {{csrf_token()}}
              <button type="submit" class="btn btn-danger btn-fill">Delete</a>
            </form>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
    {% endif %}
    {% if tried_to_delete_key_in_use %}
    <div class="alert alert-danger">This key is currently selected to encrypt
        e-mails. Please either select a different key or disable e-mail
        encryption in the <a href="/privacy">privacy section</a> before
        deleting this key.</div>
    {% endif %}
  </section>
  <form class="col-lg-6" method="POST" action="/keys/pgp-keys">
    {{csrf_token()}}
    <div class="form-group">
      <label for="pgp-key">PGP Public Key:</label>
      <textarea
        class="form-control {{valid.cls("pgp-key")}}"
        id="pgp-key"
        name="pgp-key"
        style="font-family: monospace"
        rows="5"
        placeholder="gpg --armor --export-options export-minimal --export fingerprint…"
      >{{pgp_key or ""}}</textarea>
      <small id="sshkey-details" class="form-text text-muted">
        A list of your PGP public keys is available to the public via
        <a
          href="{{url_for("profile.user_pgp_keys_GET",
            username=current_user.username)}}"
        >{{current_user.canonical_name}}.pgp</a>
      </small>
      {{valid.summary("pgp-key")}}
    </div>
    <button type="submit" class="btn btn-primary pull-right">
      Add key {{icon("caret-right")}}
    </button>
  </form>
  <div class="col-md-12 event-list">
    <section class="event">
      <h3>SSH Keys</h3>
      {% if any(current_user.ssh_keys) %}
      <p>The following SSH keys are associated with your account:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Name</th>
            <th>Fingerprint</th>
            <th>Authorized</th>
            <th>Last Used</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for key in current_user.ssh_keys %}
          <tr>
            <td>{{key.comment}}</td>
            <td>{{key.fingerprint}}</td>
            <td>{{key.created|date}}</td>
            <td>{{key.last_used|date}}</td>
            <td style="width: 6rem">
              <form method="POST" action="/keys/delete-ssh/{{key.id}}">
                {{csrf_token()}}
                <button type="submit" class="btn btn-danger btn-fill">
                  Delete
                </a>
              </form>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% endif %}
      <form method="POST" action="/keys/ssh-keys">
        {{csrf_token()}}
        <div class="form-group">
          <label for="ssh-key">SSH Public Key:</label>
          <input
            type="text"
            class="form-control {{valid.cls("ssh-key")}}"
            id="ssh-key"
            name="ssh-key"
            aria-describedBy="sshkey-details"
            value="{{ssh_key or ""}}"
            placeholder="ssh-ed25519 bWFyYmxlY2FrZQo= ..." />
          <small id="sshkey-details" class="form-text text-muted">
            A list of your SSH public keys is available to the public via
            <a
              href="{{url_for("profile.user_keys_GET",
                username=current_user.username)}}"
            >{{current_user.canonical_name}}.keys</a>
          </small>
          {{valid.summary("ssh-key")}}
        </div>
        <button type="submit" class="btn btn-primary pull-right">
          Add key {{icon("caret-right")}}
        </button>
      </form>
    </section>
    <section class="event">
      <h3>PGP Keys</h3>
      {% if any(current_user.pgp_keys) %}
      <p>The following PGP keys are associated with your account:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Email</th>
            <th>Key ID</th>
            <th>Authorized</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for key in current_user.pgp_keys %}
          <tr>
            <td>{{key.email}}</td>
            <td>{{key.key_id}}</td>
            <td>{{key.created|date}}</td>
            <td style="width: 6rem">
              <form method="POST" action="/keys/delete-pgp/{{key.id}}">
                {{csrf_token()}}
                <button type="submit" class="btn btn-danger btn-fill">Delete</a>
              </form>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% endif %}
      {% if tried_to_delete_key_in_use %}
      <div class="alert alert-danger">This key is currently selected to encrypt
          e-mails. Please either select a different key or disable e-mail
          encryption in the <a href="/privacy">privacy section</a> before
          deleting this key.</div>
      {% endif %}
      <form method="POST" action="/keys/pgp-keys">
        {{csrf_token()}}
        <div class="form-group">
          <label for="pgp-key">PGP Public Key:</label>
          <textarea
            class="form-control {{valid.cls("pgp-key")}}"
            id="pgp-key"
            name="pgp-key"
            style="font-family: monospace"
            rows="5"
            placeholder="gpg --armor --export-options export-minimal --export 616C736F207468652067616D650A"
          >{{pgp_key or ""}}</textarea>
          <small id="sshkey-details" class="form-text text-muted">
            A list of your PGP public keys is available to the public via
            <a
              href="{{url_for("profile.user_pgp_keys_GET",
                username=current_user.username)}}"
            >{{current_user.canonical_name}}.pgp</a>
          </small>
          {{valid.summary("pgp-key")}}
        </div>
        <button type="submit" class="btn btn-primary pull-right">
          Add key {{icon("caret-right")}}
        </button>
      </form>
    </section>
  </div>
</div>
{% endblock %}

M metasrht/templates/oauth.html => metasrht/templates/oauth.html +115 -113
@@ 4,118 4,120 @@
{% endblock %}
{% block content %}
<div class="row">
  <section class="col-md-12">
    <h3>Authorized Clients</h3>
    {% if any(client_authorizations) %}
    <p>The following third party clients have access to your account:</p>
    <table class="table">
      <thead>
        <tr>
          <th>Name</th>
          <th>Owner</th>
          <th>First Authorized</th>
          <th>Last Used</th>
          <th>Expires</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        {% for token in client_authorizations %}
        <tr>
          <td>{{ token.client.client_name }}</td>
          <td>{{ token.client.user.username }}</td>
          <td>{{ token.created | date }}</td>
          <td>{{ token.updated | date }}</td>
          <td>{{ token.expires | date }}</td>
          <td style="width: 6rem">
            <a
              href="/oauth/revoke-token/{{ token.id }}"
              class="btn btn-danger btn-fill"
            >Revoke</a>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
    {% else %}
    <p>You have not granted any third party clients access to your account.</p>
    {% endif %}
  </section>
  <section class="col-md-12">
    <h3>Registered Clients</h3>
    {% if any(current_user.oauth_clients) %}
    <p>You have registered the following OAuth clients:</p>
    <table class="table">
      <thead>
        <tr>
          <th>Name</th>
          <th>Client ID</th>
          <th>Active users</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        {% for client in current_user.oauth_clients %}
        <tr>
          <td>{{ client.client_name }}</td>
          <td>{{ client.client_id }}</td>
          <td>{{ client_tokens(client) }}</td>
          <td style="width: 6rem">
            <a
              href="/oauth/client/{{client.client_id}}/settings"
              class="btn btn-default btn-fill"
            >Manage</a>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
    {% else %}
    <p>You have not registered any OAuth clients yet.</p>
    {% endif %}
    <a class="btn btn-primary" href="/oauth/register">
      Register new client {{icon("caret-right")}}
    </a>
  </section>
  <section class="col-md-12">
    <h3>Personal Access Tokens</h3>
    {% if any(personal_tokens) %}
    <p>You have obtained the following personal access tokens:</p>
    <table class="table">
      <thead>
        <tr>
          <th>Access token</th>
          <th>Comment</th>
          <th>Date issued</th>
          <th>Last Used</th>
          <th>Expires</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        {% for token in personal_tokens %}
        <tr>
          <td>{{ token.token_partial }}…</td>
          <td>{{ token.comment }}</td>
          <td>{{ token.created | date }}</td>
          <td>{{ token.updated | date }}</td>
          <td>{{ token.expires | date }}</td>
          <td style="width: 6rem">
            <a
              href="/oauth/revoke-token/{{ token.id }}"
              class="btn btn-danger btn-fill"
            >Revoke</a>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
    {% else %}
    <p>You have not created any personal access tokens.</p>
    {% endif %}
    <a class="btn btn-primary" href="/oauth/personal-token">
      Generate new token {{icon("caret-right")}}
    </a>
  </section>
  <div class="col-md-12 event-list">
    <section class="event">
      <h3>Personal Access Tokens</h3>
      {% if any(personal_tokens) %}
      <p>You have obtained the following personal access tokens:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Access token</th>
            <th>Comment</th>
            <th>Date issued</th>
            <th>Last Used</th>
            <th>Expires</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for token in personal_tokens %}
          <tr>
            <td>{{ token.token_partial }}…</td>
            <td>{{ token.comment }}</td>
            <td>{{ token.created | date }}</td>
            <td>{{ token.updated | date }}</td>
            <td>{{ token.expires | date }}</td>
            <td style="width: 6rem">
              <a
                href="/oauth/revoke-token/{{ token.id }}"
                class="btn btn-danger btn-fill"
              >Revoke</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not created any personal access tokens.</p>
      {% endif %}
      <a class="btn btn-primary" href="/oauth/personal-token">
        Generate new token {{icon("caret-right")}}
      </a>
    </section>
    <section class="event">
      <h3>Authorized Clients</h3>
      {% if any(client_authorizations) %}
      <p>The following third party clients have access to your account:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Name</th>
            <th>Owner</th>
            <th>First Authorized</th>
            <th>Last Used</th>
            <th>Expires</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for token in client_authorizations %}
          <tr>
            <td>{{ token.client.client_name }}</td>
            <td>{{ token.client.user.username }}</td>
            <td>{{ token.created | date }}</td>
            <td>{{ token.updated | date }}</td>
            <td>{{ token.expires | date }}</td>
            <td style="width: 6rem">
              <a
                href="/oauth/revoke-token/{{ token.id }}"
                class="btn btn-danger btn-fill"
              >Revoke</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not granted any third party clients access to your account.</p>
      {% endif %}
    </section>
    <section class="event">
      <h3>Registered Clients</h3>
      {% if any(current_user.oauth_clients) %}
      <p>You have registered the following OAuth clients:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Name</th>
            <th>Client ID</th>
            <th>Active users</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for client in current_user.oauth_clients %}
          <tr>
            <td>{{ client.client_name }}</td>
            <td>{{ client.client_id }}</td>
            <td>{{ client_tokens(client) }}</td>
            <td style="width: 6rem">
              <a
                href="/oauth/client/{{client.client_id}}/settings"
                class="btn btn-default btn-fill"
              >Manage</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not registered any OAuth clients yet.</p>
      {% endif %}
      <a class="btn btn-primary" href="/oauth/register">
        Register new client {{icon("caret-right")}}
      </a>
    </section>
  </div>
</div>
{% endblock %}

M scss/main.scss => scss/main.scss +4 -0
@@ 49,3 49,7 @@ input[type="date"], input[type="number"] {
.event h4 {
  margin: 1rem 0;
}

.table td {
  background: $white;
}