<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Provenance summary for {{url}}</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    
    <style>
    * {
      padding: 0px;
      margin: 0px;
      box-sizing: border-box;
    }

    html {
      font-size: 16px;
    }

    video {
      max-width: 100%;
    }

    main {
      width: 100%;
      padding: 1rem;
      margin: auto;
      max-width: 90ch;
    }

    section {
      margin-bottom: 1rem;
      padding-top: 1rem;
      border-top: 1px solid gray;
    }

    h1, h2 {
      margin-bottom: 0.5rem;
    }

    p {
      font-size: 1rem;
      line-height: 1.5rem;
      margin-bottom: 0.5rem;
    }

    p span {
      display: inline-block;
      background-color: antiquewhite;
      padding: 0.2rem;
      padding-left: 0.35rem;
      padding-right: 0.35rem;
      border-radius: 0.25rem;
    }

    ul {
      list-style-position: inside;
    }

    table {
      table-layout: fixed;
      border-collapse: collapse;
      width: 100%;
      text-align: left;
    }

    table * {
      word-break: break-word;
    }

    table tr {
      border-bottom: 1px solid lightgray;
    }
    
    table tr td, table tr th {
      padding: 0.75rem 0.25rem;
    }

    table tr td:first-of-type {
      min-width: 34ch;
    }

    table tr:last-of-type {
      border-bottom: 0px;
    }
    </style>

  </head>

  <body>
    
    <main>

      <header>
        <h1>Provenance Summary</h1>
        <p>The data present in this capture was extracted from the url {{ url }} on {{ now }} using {{ software }} {{ version }} running on {{ osType }} {{ osName }} {{ osVersion }} {{ cpuArchitecture }}.</p>
        <p>The client's public IP address was {{ captureIp }}, according to {{ options.publicIpResolverEndpoint }}.<p>
        <p>The capture browser used the following user agent string:<br>{{ userAgent}}.</p>
      </header>
        
      <section>
        <h2>Capture options</h2>

        <p>The following options were passed to the capture software.</p>

        <table>
          {% for key, value in options %}
          <tr>
            <td>{{ key }}</td>
            <td>{{ value }}</td>
          </tr>
          {% endfor %}

          {% if ytDlpHash %}
          <tr>
            <td>ytDlpPath (redacted)<br>Replaced by executable checksum</td>
            <td>{{ ytDlpHash }}</td>
          </tr>
          {% endif %}

          {% if cripHash %}
          <tr>
            <td>cripPath (redacted)<br>Replaced by executable checksum</td>
            <td>{{ cripHash }}</td>
          </tr>
          {% endif %}
        </table>
      </section>

      {% if blockedRequests.length %}
      <section>
        <h2>Blocked requests</h2>

        <p>The following requests were blocked.</p>
        <table>
          <thead>
            <tr>
              <th>Match</th>
              <th>Blocklist Rule</th>
            </tr>
          </thead>
          <tbody>
            {% for block in blockedRequests %}
            <tr>
              <td>{{ block.match }}</td>
              <td>{{ block.rule }}</td>
            </tr>
            {% endfor %}
          </tbody>
        </table>
      </section>
      {% endif %}

      {% if certificates.length %}
      <section>
        <h2>SSL/TLS Certificates</h2>

        <p>The following certificates were pulled by <em>crip</em> from the different origins encountered during capture.</p>

        {% for cert in certificates %}
        <li><a href="{{cert.host}}.pem">{{ cert.host }}</a></li>
        {% endfor %}

      </section>
      {% endif %}

    </main>

  </body>

</html>

