first commit

This commit is contained in:
libroot 2026-11-19 04:40:59 +02:00
commit 8c4dcae475
Signed by: libroot
GPG key ID: 2AC68C029EBE9ACE
89 changed files with 24623 additions and 0 deletions

14
templates/404.html Normal file
View file

@ -0,0 +1,14 @@
{{ define "title" }}Page not found - Snowden Archive{{ end }}
{{ define "content" }}
<div class="notfound">
<h1>404 - Page not found</h1>
<p class="muted">Nothing lives at <code>{{ .Path }}</code>. It may have been moved, removed, or mistyped.</p>
<form action="/search" method="GET" class="home-search-form" role="search">
<input type="text" name="q" class="home-search" placeholder="Search the archive... (Enter to search)" aria-label="Search the archive">
</form>
<p><a href="/">&larr; Home</a> &middot; <a href="/browse">Browse the archive</a></p>
</div>
{{ end }}
{{ template "base.html" . }}

544
templates/about.html Normal file
View file

@ -0,0 +1,544 @@
{{ define "title" }}About - Snowden Archive{{ end }}
{{ define "content" }}
<div class="about-page">
<h1>About this archive</h1>
<p>This is a searchable archive of all published documents from the 2013
Snowden disclosures. The archive includes documents published alongside
news reporting, The Intercept's bulk SIDtoday release, and FOIA material
(official releases from FOIA litigation and FISC and ODNI
declassifications).</p>
<p>Every document carries its original PDF, page images, extracted text,
and curated metadata - agencies, programs, countries, classification
markings, people, and the journalists and articles that published it.</p>
<p>Use <a href="/browse">Browse</a> to explore by category,
<a href="/search">Search</a> for fielded boolean queries across text and
metadata, <a href="/articles">Articles</a> to follow the disclosures story
by story, the <a href="/glossary">Glossary</a> to decode codenames and
acronyms, and <a href="/explore">Explore</a> to dig deeper into ranked
views and lists.</p>
<nav class="toc" aria-label="Table of contents">
<strong>Contents</strong>
<ul>
<li><a href="#privacy">Privacy</a></li>
<li><a href="#whats-in">What's in this archive?</a></li>
<li><a href="#search">How to search</a></li>
{{ if .APIEnabled }}<li><a href="#api">Downloading data as JSON</a>
<ul><li><a href="#metadata">Metadata structure</a></li></ul>
</li>{{ else }}<li><a href="#metadata">Metadata structure</a></li>{{ end }}
<li><a href="#download-archive">Downloading the archive</a>
<ul>
<li><a href="#downloading-all-data">Downloading all data</a></li>
<li><a href="#downloading-texts">Downloading only extracted texts and metadata</a></li>
</ul>
</li>
<li><a href="#own-copy">Can I run my own copy or mirror this?</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#thanks">Thank you</a></li>
</ul>
</nav>
<section id="privacy">
<h2>Privacy</h2>
<p>By default, the server keeps no state about its visitors. Pins and
history live only in your own browser's cookies, and history features
are off unless you opt in via <a href="/preferences">Preferences</a>.
Anonymous page views set no cookies at all. All core features on this
website work without JavaScript.</p>
<p>Note that you can't verify that this server doesn't log and analyze
your visits. Use Tor to hide your real IP address, or
<a href="#own-copy">set up</a> your own instance on your machine to
browse fully offline.</p>
</section>
<section id="whats-in">
<h2>What's in this archive?</h2>
<p>By default, two collections are shown as tabs on the
<a href="/browse">Browse</a> page: <strong>Reported</strong> documents
(leaked files as the outlets that broke the stories presented them) and
the <strong>SIDtoday Archive</strong> (The Intercept's bulk release of
the NSA's internal SIDtoday newsletters). The third collection,
<strong>FOIA</strong> (official releases from FOIA litigation and FISC
and ODNI declassifications), can be included via
<a href="/preferences">Preferences</a>.</p>
<p>The metadata and many of the extracted texts are curated by hand and
may contain errors or omissions, so treat them as a guide to the
documents rather than as established fact, and check the original
documents and reporting before relying on them.</p>
</section>
<section id="search">
<h2>How to search</h2>
<p>The <a href="/search">Search</a> page supports fielded boolean
queries. Restrict a term to a field (title, full text, programs,
countries, journalists, and so on), combine clauses with AND/OR, quote
<code>"text"</code> to find it anywhere, match exact whole words with
<code>=...</code> (<code>publisher:="The Guardian"</code> matches the
whole value), and use <code>*</code> wildcards (<code>tap*</code>,
<code>*apping</code>).</p>
<p>Ways to write a value, in any row or after any operator:</p>
<ul>
<li><code>cable tapping</code> finds both words anywhere, in their other forms too (<em>tapping</em> also finds <em>tapped</em>).</li>
<li><code>"apping"</code> finds that text anywhere, even inside a word, like <code>grep -i</code> (it finds, for example, <em>mapping</em> and <em>tapping</em>).</li>
<li><code>=tap</code> or <code>="cable tapping"</code> finds exactly those whole words, so <code>=tap</code> skips <em>taps</em> and <em>strap</em>. On a metadata field it matches one whole value, so <code>agency:=NSA</code> finds documents whose agency is NSA but not <em>NSA, GCHQ</em>.</li>
<li>The <code>*</code> wildcard finds part of a word: <code>tap*</code> finds words starting with <em>tap</em>, <code>*land</code> words ending in <em>land</em>, and <code>*keys*</code> words containing <em>keys</em>. A leading <code>*</code> needs at least three letters after it.</li>
<li><code>"upstream collection"~10</code> finds the words within 10 words of each other (in any order, common stopwords ignored).</li>
<li>A leading <code>-</code> excludes within its row: <code>xkeyscore -tempora</code> finds <em>xkeyscore</em> without <em>tempora</em>, and the row keeps that meaning under OR and NOT.</li>
</ul>
<p>The simple search box (on the home page, on the 404 page, and via
the URL parameter <code>?q=</code>) understands field operators:</p>
<ul>
<li><code>program:XKEYSCORE country:Germany cable</code> or <code>journalist:="Poitras, Laura"</code>.</li>
<li>A leading <code>-</code> negates (<code>-tag:=junk</code>, <code>-draft</code>).</li>
<li><code>date:2013</code>, <code>date:2013..2015</code> and <code>published:2014-06</code> filter by date.</li>
<li>Operators: text, title, content, description, agency, journalist, publisher, classification, program, dissemination, banner, genre, series, country, people, tag, type.</li>
<li>Bare words search all fields.</li>
</ul>
</section>
<section id="api">
{{ if .APIEnabled }}
<h2>Downloading data as JSON</h2>
<p>API endpoints:</p>
<div class="table-scroll">
<table class="data-table about-table">
<thead><tr><th>Endpoint</th><th>Returns</th></tr></thead>
<tbody>
<tr><td><a href="/api/docs"><code>/api/docs</code></a></td><td>Metadata for every document in the archive, with pagination.</td></tr>
<tr><td><code>/api/doc/{id}</code></td><td>A single document's metadata and extracted text, where <code>{id}</code> is the document's identifier.</td></tr>
<tr><td><a href="/api/search?q=xkeyscore"><code>/api/search?q=xkeyscore</code></a></td><td>Search results for term xkeyscore. It accepts the same parameters as the Search page, so you can also pass <code>fqf</code>/<code>fqv</code>/<code>fqc</code> clause parameters for fielded queries.</td></tr>
<tr><td><a href="/api/facets"><code>/api/facets</code></a></td><td>Counts for every browsable category (programs, agencies, countries, people, and so on).</td></tr>
</tbody>
</table>
</div>
<p>Responses are plain JSON. For paginated responses, use the URL
parameter <code>p</code> to navigate pages (e.g.
<a href="/api/docs?p=2"><code>/api/docs?p=2</code></a>).</p>
<p>See the <a href="#download-archive">Downloading the archive</a>
section on how to download the whole archive.</p>
<p><strong>Important if you are a crawler, robot or AI trying to
download large amounts of data from this website:</strong> please use
the downloadable datasets from the
<a href="#download-archive">Downloading the archive</a> section. The
information on this website is identical to the datasets, so you gain
nothing by crawling this website.</p>
{{ end }}
<details class="about-collapse">
<summary>{{ if .APIEnabled }}<h3 id="metadata">Metadata structure</h3>{{ else }}<h2 id="metadata">Metadata structure</h2>{{ end }}</summary>
<p>Every document ships a curated <code>metadata.json</code>:</p>
<h4>The document record</h4>
<dl class="field-dict">
<dt><code>id</code></dt>
<dd>The document's stable identifier: the name of its directory
and the last part of its URL (<code>/doc/{id}</code>). It is not
written inside <code>metadata.json</code> - the directory name is
the id.</dd>
<dt><code>aka_id</code></dt>
<dd>Other names the same document was released under, most often
the file name another publisher or a mirror gave its PDF. A list
of entries, each described below.</dd>
<dt><code>aka_id[].id</code></dt>
<dd>The other name itself. Searchable, so a document can be found
by a file name it circulated under elsewhere.</dd>
<dt><code>aka_id[].doc_source</code></dt>
<dd>The web page where the document was released under that name,
linked as &ldquo;page&rdquo; next to the alias.</dd>
<dt><code>aka_id[].doc_url</code></dt>
<dd>The direct link to the PDF released under that name, linked
as &ldquo;PDF&rdquo; next to the alias.</dd>
<dt><code>title</code></dt>
<dd>The document's title, written by the curators - usually the
title the document gives itself or the one its publisher used.</dd>
<dt><code>description</code></dt>
<dd>A short summary of what the document is and says, shown under
the publication list and in search results and cards.
Descriptions are the work of archivists without inside knowledge -
corrections welcome.</dd>
<dt><code>long_description</code></dt>
<dd>A longer account of the contents where one has been written,
behind &ldquo;Show more info&rdquo; on the document page; often
empty. A <code>description:</code> search looks in both
descriptions.</dd>
<dt><code>tags</code></dt>
<dd>Free-text subjects added by the curators. Unlike the other
lists they are not necessarily taken from the document's own
vocabulary, so they are the loosest thing to browse or search by.
</dd>
<dt><code>type</code></dt>
<dd>The kind of release: <code>REPORTED</code> (a leaked document
as an outlet published it), <code>SIDTODAY</code> (an article of
the NSA's internal SIDtoday newsletter from The Intercept's bulk
release) or <code>FOIA</code> (obtained through a public-records
request). When it is empty, a document filed in the SIDtoday or FOIA
folder takes that type and any other is <code>REPORTED</code>.</dd>
<dt><code>collection</code></dt>
<dd>Which of the three collections - the tabs on
<a href="/browse">Browse</a> - the document belongs to:
<code>news</code> (Reported), <code>sidtoday-archive</code> or
<code>foia</code>. Documents filed under the SIDtoday and FOIA
folders belong to those collections whatever this says; elsewhere
an empty value means Reported, or FOIA for a document of type
<code>FOIA</code>. FOIA releases are left out of
browsing and search unless you include them in
<a href="/preferences">Preferences</a>.</dd>
<dt><code>pages</code></dt>
<dd>The page count of the PDF. When it is missing, the number of
page images is used instead.</dd>
<dt><code>pdf_sha256</code></dt>
<dd>The SHA-256 of the PDF as archived.</dd>
<dt><code>archive_comment</code></dt>
<dd>A note from the curators about this archive's copy - how it
was assembled, where it was found, what differs between releases,
or a known problem with it.</dd>
</dl>
<h4>The document itself: <code>document</code></h4>
<dl class="field-dict">
<dt><code>document.creator</code></dt>
<dd>The agency that <em>wrote</em> the document, in its short form
(<code>NSA</code>, <code>GCHQ</code>, <code>FISC</code>,
<code>DOJ</code>, <code>CSE</code> ...) - not the agency it is
about and not the one that published it. Empty when the author is
not known.</dd>
<dt><code>document.date_created</code></dt>
<dd>When the document was written, as precise as the document
allows: <code>2013-03-20</code>, <code>2013-03</code>,
<code>2013</code>, or empty when unknown. Nothing is invented to
fill the gaps, and nothing is guessed from the publication date.
</dd>
<dt><code>document.banner</code></dt>
<dd>The marking line <strong>verbatim</strong> - what the
document says about itself, qualifiers and all. Intranet pages
often carry a ceiling banner (&ldquo;DYNAMIC PAGE - HIGHEST
POSSIBLE CLASSIFICATION IS ...&rdquo;) while their content is
portion-marked unclassified; the banner records the claim, not an
assessment. Empty means the artifact has no marking line - nothing
is reconstructed from portion marks.</dd>
<dt><code>document.classification</code></dt>
<dd>The curator's <strong>assessment</strong> of the content's
classification, as component values: the level
(<code>TOP SECRET</code>, <code>SECRET</code>,
<code>CONFIDENTIAL</code>, <code>UNCLASSIFIED</code>) and any
control systems (<code>COMINT</code>, <code>SI</code>,
<code>TK</code>, <code>STRAP 1</code> ...), judged from portion
marks. If a document contains multiple classifications, highest is
used here.</dd>
<dt><code>document.dissemination</code></dt>
<dd>The curator's assessment of the handling controls, as
component values (<code>FOUO</code>, <code>NOFORN</code>,
<code>ORCON</code>, <code>REL TO ...</code>). Assessed the same
way as the classification.</dd>
<dt><code>document.genre</code></dt>
<dd>The document's form, from a fixed vocabulary:
<code>slides</code>, <code>report</code>, <code>wiki</code>,
<code>manual</code>, <code>guide</code>,
<code>newsletter</code>, <code>other</code>.</dd>
<dt><code>document.series.name</code></dt>
<dd>For a document that prints a series roster (currently only in
SIDtoday): the series name verbatim, as the document prints it.
Documents with the same name are listed together on the document
page and under <a href="/browse/series">Series</a>.</dd>
<dt><code>document.series.part</code></dt>
<dd>This document's 1-based position in the printed roster. Order
comes from the artifact; parts of a series not yet in the archive
show as gaps in the numbering, never renumbered away.</dd>
<dt><code>document.programs</code></dt>
<dd>The codenames and programs the document names
(<code>XKEYSCORE</code>, <code>PRISM</code>, ...), as curated
values for browsing and search; the
<a href="/glossary">Glossary</a> explains many of them.</dd>
<dt><code>document.countries</code></dt>
<dd>The countries the document mentions, by their English names.
A mention, not a claim that the country was a target or a partner.
</dd>
<dt><code>document.people</code></dt>
<dd>The people who appear in the document: named in its text, or
recognised in its images - for example
<a href="/doc/gchq-mobile-networks-in-my-noc-world">Mobile Networks
in My NOC World</a> lists King Charles and Queen Camilla,
who appear only in a photograph on one of its slides. Usually
written &ldquo;Surname, Given name&rdquo;. A person appearing in
these documents implies nothing about them beyond that appearance.
The journalists who published the document are under
<code>publication[].reporters</code>, not here.</dd>
</dl>
<h4>Where it was published: <code>publication[]</code></h4>
<p>One entry per story or book that published (or reported) the
document. Browse-by-publication-date counts a document under its
<em>oldest</em> dated entry; a publication-date search matches
<em>any</em> entry's date - or, combined with a journalist or
publisher, that entry's date.</p>
<dl class="field-dict">
<dt><code>publication[].publisher</code></dt>
<dd>Who published it: a news outlet, a book's publisher, or for a
FOIA release the organization that obtained and released it.
Browsable under <a href="/browse/publisher">Publishers</a> - except
entries marked <code>reporting_only</code>.</dd>
<dt><code>publication[].title</code></dt>
<dd>The headline of the article, or the book's title. Shown on the
document page and names the story on
<a href="/articles">Articles</a>.</dd>
<dt><code>publication[].link</code></dt>
<dd>The URL of the article. It is the story's identity: documents
whose entries share a link were published in the same report and
are listed together on its article page.</dd>
<dt><code>publication[].date_published</code></dt>
<dd>When this publication appeared, in the same
<code>YYYY-MM-DD</code> / <code>YYYY-MM</code> /
<code>YYYY</code> forms as the document date.</dd>
<dt><code>publication[].reporters</code></dt>
<dd>The journalists bylined on the story, written &ldquo;Surname,
Given name&rdquo;. Browsable under
<a href="/browse/journalist">Journalists</a> and searchable with
<code>journalist:</code>.</dd>
<dt><code>publication[].contributors</code></dt>
<dd>People credited on the story without a byline - additional
reporting, research, technical analysis. Shown on the document
page and found by an all-fields search, but not listed among the
journalists.</dd>
<dt><code>publication[].note</code></dt>
<dd>Anything particular to this publication: that it showed only
some of the pages, published them in a different order, redacted
differently, or printed them in a book appendix.</dd>
<dt><code>publication[].version</code></dt>
<dd>When this publication released a different copy from the one
shown on the document page, the name of that copy in the
document's <code>versions/</code> folder; its entry then links to
&ldquo;view this copy&rdquo;. Without it, the entry published the
copy shown on the page.</dd>
<dt><code>publication[].doc_source</code></dt>
<dd>The web page where this publication presented the document
(the outlet's own document page, a DocumentCloud page), linked as
&ldquo;document page&rdquo;. Where a copy came from is recorded
here, on the publication that released it, not on the
document.</dd>
<dt><code>publication[].doc_url</code></dt>
<dd>The direct link to the PDF file this publication released,
linked as &ldquo;original PDF&rdquo;.</dd>
<dt><code>publication[].reporting_only</code></dt>
<dd><code>true</code> when the outlet reported the story without
publishing the document - a reporting partner. The entry keeps its
byline and its article, but the outlet is not counted as one of
the document's publishers and no copy is linked from it.</dd>
</dl>
<h4>Other copies: <code>versions</code></h4>
<p>Other published copies of a document (e.g. less redacted, with extra
pages, or a different scan) are kept in its <code>versions/</code>
folder, one sub-folder per copy, each with its own PDF, text and page
images. The <code>versions</code> object adds details about them,
keyed by the copy's folder name.</p>
<dl class="field-dict">
<dt><code>versions.{name}.changed_pages</code></dt>
<dd>The pages of that copy, by its own page numbers, that differ
from the copy shown on the document page. They are linked as
&ldquo;changed pages&rdquo; next to the copy.</dd>
<dt><code>versions.{name}.pdf_sha256</code></dt>
<dd>The SHA-256 of that copy's PDF.</dd>
</dl>
</details>
</section>
<section id="download-archive">
<h2>Downloading the archive</h2>
<p>Each release comes in two packages:</p>
<ul>
<li><strong>full</strong>, ~18 GB: all the PDFs, page images (the
PDF pages as JPEG files), extracted texts, and metadata,</li>
<li><strong>pdfs</strong>, ~3.5 GB: the same without the page
images.</li>
</ul>
<p>Both extract to <code>data/</code> and <code>project/</code>, ready
to <a href="#own-copy">run your own copy</a>. Each release also
includes the source of the server version it was published with, and
the last six releases stay online. For only the extracted texts and
metadata (~58 MB), see <a href="#downloading-texts">below</a>.</p>
<h3 id="downloading-all-data">Downloading all data</h3>
<h4>HTTP</h4>
<p><a href="https://data.snowchive.org/files/">https://data.snowchive.org/files/</a></p>
<details>
<summary>See a curl example</summary>
<pre>
# download the latest release:
rel=$(curl -fsS https://data.snowchive.org/files/latest.txt)
base="https://data.snowchive.org/files/$rel"
curl -f -C - -O "$base/snowchive-$rel-full.tar" # "pdfs" instead of "full" for no page images
# verify (optional):
curl -fsS -O "$base/SHA256SUMS" -O "$base/SHA256SUMS.gpg"
curl -fsS -O "https://libroot.org/public/libroot.asc"
# "gpg --show-keys libroot.asc" should show 3B054BC2E7B2CC825FF23E94108F97B8FC5B2EBC
gpg --import libroot.asc
gpg --verify SHA256SUMS.gpg SHA256SUMS
sha256sum --check --ignore-missing SHA256SUMS
# extract to ./snowchive-data/:
mkdir -p snowchive-data &amp;&amp; tar -xf "snowchive-$rel-full.tar" -C snowchive-data
</pre>
</details>
<h4>Torrent</h4>
<p>Each release folder on
<a href="https://data.snowchive.org/files/">https://data.snowchive.org/files/</a>
has a <code>.torrent</code> for both packages.</p>
<h3 id="downloading-texts">Downloading only extracted texts and metadata</h3>
<p>Repository for the extracted texts and metadata:
<a href="https://git.disroot.org/libroot/snowchive-meta">https://git.disroot.org/libroot/snowchive-meta</a></p>
<pre>
git clone https://git.disroot.org/libroot/snowchive-meta
cd snowchive-meta/data
# grep only the extracted texts:
grep "fiber optic" -ri --include=*.md
# grep only the metadata:
grep "fiber optic" -ri --include=*.json
</pre>
</section>
<section id="own-copy">
<h2>Can I run my own copy or mirror this?</h2>
<p>Yes. The server software behind this archive is free software with
no database and no external dependencies, designed to run offline or,
for example, as a Tor hidden service.</p>
<p>First, get a <a href="#downloading-all-data">release package</a>
and extract it: <strong>full</strong> for everything, or
<strong>pdfs</strong> for a site that works the same but shows no page
images.</p>
<p>Then get the server (Go required). Each release folder has the
source of the server version it was published with,
<code>snowchive-server-&lt;commit&gt;.tar.gz</code>, covered by the same
<code>SHA256SUMS</code> - the version known to work with that data:</p>
<pre>
tar -xzf snowchive-server-&lt;commit&gt;.tar.gz
cd snowchive-server-&lt;commit&gt;
go run . -root=/path/to/snowchive-data/ -listen=127.0.0.1:8081
</pre>
<p>Or clone the latest version from the
<a href="https://git.disroot.org/libroot/snowchive-server">snowchive-server</a>
repository:</p>
<pre>
git clone https://git.disroot.org/libroot/snowchive-server
cd snowchive-server
go run . -root=/path/to/snowchive-data/ -listen=127.0.0.1:8081
</pre>
<p>Recommended minimal setup for production instances:</p>
<pre>
go build -ldflags "-X main.buildCommit=$(git rev-parse --short HEAD)" -o snowchive .
./snowchive -root=/path/to/snowchive-data/ -listen=127.0.0.1:8081 -base=https://archive.example.com
</pre>
<p>System requirements: at least 300 MB of RAM (1 GB or more
recommended for production).</p>
<p>The maintainers of this project do not endorse any public Snowchive
instance other than the official snowchive.org instance (unless you
are a reputable organization that wants to host a public
instance).</p>
<p>See the
<a href="https://git.disroot.org/libroot/snowchive-server">snowchive-server README</a>
for the full documentation.</p>
</section>
<section id="contact">
<h2>Contact</h2>
<p>If the archive is missing a document, or some metadata is wrong,
please submit an issue on the project repository:
<a href="https://git.disroot.org/libroot/snowchive-meta/issues">https://git.disroot.org/libroot/snowchive-meta/issues</a></p>
<p>You can also report issues and errors or give feedback directly to
the project maintainers via email:
<a href="https://libroot.org/about">https://libroot.org/about</a></p>
<p>Please submit server-related issues to the Snowchive server
repository:
<a href="https://git.disroot.org/libroot/snowchive-server/issues">https://git.disroot.org/libroot/snowchive-server/issues</a></p>
</section>
<section id="contributing">
<h2>Contributing</h2>
<p>We welcome anyone who wants to contribute to the project, for
example by fixing errors in the metadata or in the extracted texts.
Please see the <a href="#contact">Contact</a> section above.</p>
<p><small>Running this project doesn't cost much, but if you wish, you
can send a donation to:</small></p>
<dl class="field-dict">
<dt><small>XMR</small></dt>
<dd><small><code style="word-break:break-all;">85gTBgYuLB4Mvo1ZCGo62126hBQQ678UeESTuSi3L9SECHXr6S7mXE28yAKvURgdJneGKqbPDcBydFfTkK7H5bvh2WXE4oT</code></small></dd>
<dt><small>BTC</small></dt>
<dd><small><code style="word-break:break-all;">bc1q5f5mc4pytajrn2xrp3lsftx64fw6hsdxxvs3ha</code></small></dd>
</dl>
</section>
<section id="thanks">
<h2>Thank you</h2>
<p>We want to thank</p>
<ul>
<li>all the journalists, reporters, and other people who broke the
stories or helped bring them to light,</li>
<li>other archives and the people behind them, such as
<ul>
<li>University of Toronto's and Canadian Journalists for
Free Expression's The Snowden Surveillance Archive (shut
down in mid-2024),</li>
<li>Courage Foundation's Snowden Revelations (shut down in
early 2022),</li>
</ul>
</li>
<li>organizations, resources and blogs such as
<ul>
<li><a href="https://www.eff.org/nsa-spying/nsadocs">EFF's NSA document collection</a>,</li>
<li><a href="https://www.aclu.org/nsa-documents-released-to-the-public-since-june-2013">ACLU's NSA document collection</a>,</li>
<li><a href="https://christopher-parsons.com/resources/the-sigint-summaries/">Christopher Parsons' SIGINT Summaries</a>,</li>
<li><a href="https://electrospaces.net">Electrospaces</a>,</li>
<li><a href="https://github.com/iamcryptoki/snowden-archive">iamcryptoki/snowden-archive</a>,</li>
<li><a href="https://cryptome.org">Cryptome</a>,</li>
</ul>
</li>
<li>and of course, Edward Snowden himself.</li>
</ul>
</section>
</div>
{{ end }}
{{ template "base.html" . }}

25
templates/article.html Normal file
View file

@ -0,0 +1,25 @@
{{ define "title" }}{{ with .Article.Title }}{{ . }}{{ else }}{{ if .Article.Book }}Book{{ else }}Article{{ end }} at {{ .Article.Host }}{{ end }} - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header article-header">
<p class="muted article-kicker">{{ if .Article.Book }}Book{{ else }}Article{{ end }}</p>
<h1>{{ if .Article.Title }}{{ .Article.Title }}{{ else }}<span class="muted">[untitled]</span> {{ .Article.Host }}{{ end }}</h1>
<p class="article-byline muted">
{{ with .Article.Publisher }}{{ if $.PublisherURL }}<a href="{{ $.PublisherURL }}" class="meta-link-soft">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ end }}
{{ with .Article.Date }} &middot; {{ . }}{{ end }}
{{ if .Article.Journalists }} &middot;
{{ facetLinks (dict "Vals" .Article.Journalists "Cat" "journalist" "Class" "meta-link-soft" "QS" .BrowseQS) }}
{{ end }}
</p>
<p>
<a href="{{ .Article.Link }}" target="_blank" rel="noopener" class="doc-top-btn doc-pdf-link">{{ if .Article.Book }}About the book at{{ else }}Read the article at{{ end }} {{ .Article.Host }} &nearr;</a>
</p>
</header>
<h2>Documents published with this {{ if .Article.Book }}book{{ else }}article{{ end }} <small class="count-note">{{ .Total }}</small></h2>
{{ if .Cards.Docs }}
{{ template "doc-cards" .Cards }}
{{ else }}
<p class="muted">No documents found for this {{ if .Article.Book }}book{{ else }}article{{ end }}.</p>
{{ end }}
{{ end }}
{{ template "base.html" . }}

39
templates/articles.html Normal file
View file

@ -0,0 +1,39 @@
{{ define "title" }}Articles - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<h1>Articles
<small class="count-note">{{ .Total }} articles{{ with .Books }} and {{ . }} book{{ if ne . 1 }}s{{ end }}{{ end }}</small>
</h1>
</header>
<p class="muted tab-desc">
The news stories, and the few books, these documents were published with, newest first.
A document covered by several stories appears under each.
</p>
{{ if .Groups }}
{{ if .GroupsHTML }}{{ .GroupsHTML }}{{ else }}{{ template "article-groups" . }}{{ end }}{{ else }}
<p class="muted">No articles.</p>
{{ end }}
{{ end }}
{{ template "base.html" . }}
{{ define "article-groups" }}{{ range .Groups }}
<section class="article-year">
<h2>{{ .Year }} <small class="count-note">{{ len .Articles }}</small></h2>
<ul class="article-list">
{{ range .Articles }}
<li class="article-item">
<span class="article-date faint">{{ if .Date }}{{ .Date }}{{ else }}-{{ end }}</span>
<span class="article-main">
<a href="/article/{{ .Key }}" class="article-title">{{ if .Title }}{{ .Title }}{{ else }}<span class="muted">[untitled]</span> {{ .Host }}{{ end }}</a>
<span class="article-meta muted">
{{ if .Book }}<span class="article-kind">Book</span> &middot; {{ end }}{{ with .Publisher }}{{ . }}{{ end }}{{ if and .Publisher .Journalists }} &middot; {{ end }}{{ range $i, $j := .Journalists }}{{ if $i }}, {{ end }}{{ $j }}{{ end }}
&middot; {{ len .DocIDs }} doc{{ if ne (len .DocIDs) 1 }}s{{ end }}
</span>
</span>
</li>
{{ end }}
</ul>
</section>
{{ end }}
{{ end }}

32
templates/assemblies.html Normal file
View file

@ -0,0 +1,32 @@
{{ define "title" }}Assemblies - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<p class="crumb"><a href="/explore">&larr; Explore</a></p>
<h1>Assemblies
<small class="count-note">{{ len .Assemblies }}</small>
</h1>
</header>
<p class="muted tab-desc">
Sets of pages this archive put together from documents and copies published
separately, so they can be read in one place. An assembly is our own
arrangement, not a document that was leaked or published in this form.
</p>
{{ if .Assemblies }}
<ul class="assembly-list">
{{ range .Assemblies }}
<li>
{{ if not $.TextOnly }}<a href="/explore/assemblies/{{ .ID }}" class="assembly-thumb"><img src="{{ (index .Slides 0).Image }}"{{ (index .Slides 0).Size.Attr }} alt="" loading="lazy"></a>{{ end }}
<div>
<a href="/explore/assemblies/{{ .ID }}"><strong>{{ .Title }}</strong></a>
<div class="muted">{{ len .Slides }} slide{{ if ne (len .Slides) 1 }}s{{ end }} from {{ .Copies }} cop{{ if eq .Copies 1 }}y{{ else }}ies{{ end }}</div>
{{ with .Note }}<p class="assembly-note">{{ . }}</p>{{ end }}
</div>
</li>
{{ end }}
</ul>
{{ else }}
<p class="muted">No assemblies yet.</p>
{{ end }}
{{ end }}
{{ template "base.html" . }}

60
templates/assembly.html Normal file
View file

@ -0,0 +1,60 @@
{{ define "title" }}{{ .Assembly.Title }} - Snowden Archive{{ end }}
{{ define "assembly-credit" }}{{ with .Source }}{{ . }} &middot; {{ end }}<a href="{{ .Path }}">{{ .DocTitle }}</a>{{ with .Version }} (copy: {{ . }}){{ end }}, p. {{ .Page }}{{ end }}
{{ define "content" }}
{{ $a := .Assembly }}{{ $n := len $a.Slides }}
<header class="list-header">
<p class="crumb"><a href="/explore/assemblies">&larr; Assemblies</a></p>
<h1>{{ $a.Title }} <small class="count-note">{{ $n }} slide{{ if ne $n 1 }}s{{ end }}</small></h1>
<p class="muted">Put together by this archive from {{ $a.Copies }} separately published cop{{ if eq $a.Copies 1 }}y{{ else }}ies{{ end }}. This is our arrangement, not a document in its own right.</p>
{{ with $a.Note }}<p class="assembly-note">{{ . }}</p>{{ end }}
</header>
{{ if .TextOnly }}
<p class="muted textonly-note">Text-only mode is on - page images are not loaded. <a href="/preferences">Preferences</a></p>
<ul class="page-link-list">
{{ range $a.Slides }}
<li><a href="{{ .Image }}" target="_blank" rel="noopener">Slide {{ .Pos }}</a> <span class="muted">{{ template "assembly-credit" . }}</span>
{{- with .Note }} <span class="muted">- {{ . }}</span>{{ end }}
{{- range .Alts }}<br><a href="{{ .Image }}" target="_blank" rel="noopener">Other copy</a> <span class="muted">{{ template "assembly-credit" . }}</span>{{ end }}
</li>
{{ end }}
</ul>
{{ else }}
<ul class="page-sheet assembly-sheet">
{{ range $s := $a.Slides }}
<li>
<a href="#lb-{{ $s.Pos }}" title="Open slide {{ $s.Pos }} full screen">
<img src="{{ $s.Image }}"{{ $s.Size.Attr }} alt="Slide {{ $s.Pos }}" loading="lazy">
<span class="page-num faint">{{ $s.Pos }}</span>
</a>
<p class="assembly-cap">{{ template "assembly-credit" $s }}
{{- range $k, $alt := $s.Alts }}<br><a href="#lb-a{{ $s.Pos }}-{{ add $k 1 }}">Other copy{{ with $alt.Source }}: {{ . }}{{ end }}</a>{{ end }}
</p>
</li>
{{ end }}
</ul>
{{ range $i, $s := $a.Slides }}
<div class="lightbox" id="lb-{{ $s.Pos }}" aria-label="Slide {{ $s.Pos }} of {{ $n }}">
<a class="lb-backdrop" href="#lb-closed" tabindex="-1" aria-hidden="true"></a>
<a class="lb-close" href="#lb-closed" title="Close">&times;</a>
{{ if $i }}<a class="lb-prev" href="#lb-{{ $i }}" title="Previous slide">&lsaquo;</a>{{ end }}
{{ if lt $s.Pos $n }}<a class="lb-next" href="#lb-{{ add $s.Pos 1 }}" title="Next slide">&rsaquo;</a>{{ end }}
<img src="{{ $s.Image }}"{{ $s.Size.Attr }} alt="Slide {{ $s.Pos }} of {{ $n }}" loading="lazy" decoding="async">
<span class="lb-counter lb-caption">{{ $s.Pos }} / {{ $n }} &middot; {{ template "assembly-credit" $s }}{{ with $s.Note }} &middot; {{ . }}{{ end }}{{ range $k, $alt := $s.Alts }} &middot; <a href="#lb-a{{ $s.Pos }}-{{ add $k 1 }}">Other copy{{ with $alt.Source }}: {{ . }}{{ end }}</a>{{ end }}</span>
</div>
{{ range $k, $alt := $s.Alts }}
<div class="lightbox lb-alt" id="lb-a{{ $s.Pos }}-{{ add $k 1 }}" aria-label="Other copy of slide {{ $s.Pos }}">
<a class="lb-backdrop" href="#lb-closed" tabindex="-1" aria-hidden="true"></a>
<a class="lb-close" href="#lb-closed" title="Close">&times;</a>
<img src="{{ $alt.Image }}"{{ $alt.Size.Attr }} alt="Other copy of slide {{ $s.Pos }}" loading="lazy" decoding="async">
<span class="lb-counter lb-caption">Other copy of slide {{ $s.Pos }} &middot; {{ template "assembly-credit" $alt }} &middot; <a href="#lb-{{ $s.Pos }}">Back to slide {{ $s.Pos }}</a></span>
</div>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ template "base.html" . }}

35
templates/base.html Normal file
View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en"{{ if .Theme }} data-theme="{{ .Theme }}"{{ end }}>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ block "title" . }}Snowden Archive{{ end }}</title>
<link rel="stylesheet" href="{{ asset "style.css" }}">
<script src="{{ asset "main.js" }}" defer></script>
{{ block "head" . }}{{ end }}
</head>
<body>
<a class="skip-link" href="#main">Skip to main content</a>
<nav class="site-nav">
<a href="/" class="{{ if eq .Nav "home" }}active{{ end }}">Home</a>
<a href="/browse" class="{{ if eq .Nav "browse" }}active{{ end }}">Browse</a>
<a href="/search" class="{{ if eq .Nav "search" }}active{{ end }}">Search</a>
<a href="/articles" class="{{ if eq .Nav "articles" }}active{{ end }}">Articles</a>
<a href="/glossary" class="{{ if eq .Nav "glossary" }}active{{ end }}">Glossary</a>
<a href="/random">Random</a>
<a href="/about" class="{{ if eq .Nav "about" }}active{{ end }}">About</a>
<a href="/pinned" class="nav-right{{ if eq .Nav "pinned" }} active{{ end }}">Pinned</a>
<a href="/preferences" class="{{ if eq .Nav "preferences" }}active{{ end }}">Preferences</a>
</nav>
{{ if .ShowCatBoxes }}{{ template "cat-boxes" . }}{{ end }}
<main id="main" tabindex="-1">
{{ block "content" . }}{{ end }}
</main>
<footer>
{{ $b := buildInfo }}
<p>Snowden Archive &middot; <a href="/changelog">changelog</a>
<span class="build-info faint">&middot; rev {{ $b.Commit }}</span>
</p>
</footer>
</body>
</html>

155
templates/browse.html Normal file
View file

@ -0,0 +1,155 @@
{{ define "title" }}{{ if eq .Collection "foia" }}FOIA{{ else if eq .Collection "sidtoday-archive" }}SIDtoday Archive{{ else }}Reported{{ end }} documents - Snowden Archive{{ end }}
{{ define "content" }}
<hr class="section-rule">
<nav class="collection-tabs" aria-label="Collections">
<a href="/browse"
class="collection-tab {{ if eq .Collection "news" }}active-tab{{ end }}"
{{ if eq .Collection "news" }}aria-current="page"{{ end }}>
Reported <span class="tab-count">{{ index .CollectionCounts "news" }}</span>
</a>
<a href="/browse?collection=sidtoday-archive"
class="collection-tab {{ if eq .Collection "sidtoday-archive" }}active-tab{{ end }}"
{{ if eq .Collection "sidtoday-archive" }}aria-current="page"{{ end }}>
SIDtoday Archive <span class="tab-count">{{ .SIDTodayCount }}</span>
</a>
{{ if or .Prefs.IncludeFOIA (eq .Collection "foia") }}
<a href="/browse?collection=foia"
class="collection-tab {{ if eq .Collection "foia" }}active-tab{{ end }}"
{{ if eq .Collection "foia" }}aria-current="page"{{ end }}>
FOIA <span class="tab-count">{{ index .CollectionCounts "foia" }}</span>
</a>
{{ end }}
</nav>
{{ if eq .Collection "sidtoday-archive" }}
<header class="tab-header">
<h1 class="tab-title">SIDtoday Archive <small>({{ .Total }} issues)</small></h1>
<p class="tab-desc">
All NSA SIDtoday newsletters in chronological order. This section
includes The Intercept's bulk release plus issues that were individually
reported by media (marked <span class="issue-reported">reported</span>; those
also appear in the <a href="/browse">Reported</a> collection).
</p>
{{ with .SeriesList }}
<details class="series-index">
<summary>Series <span class="count">{{ len . }}</span> <span class="muted pref-note">- recurring columns and multi-part runs</span></summary>
<ul class="series-index-list">
{{ range . }}<li><a href="{{ .URL }}">{{ .Name }}</a> <span class="count">{{ .Count }}</span></li>{{ end }}
</ul>
<p class="muted pref-note"><a href="/browse/series">Full series table</a> - sortable, with per-collection counts.</p>
</details>
{{ end }}
<div class="browse-controls{{ if eq .View "table" }} browse-controls-spaced{{ end }}">
<div class="view-toggle">
<a href="/browse?collection=sidtoday-archive" class="{{ if and (ne .View "card") (ne .View "table") }}active-toggle{{ end }}">Timeline</a>
<a href="/browse?collection=sidtoday-archive&amp;view=card" class="{{ if eq .View "card" }}active-toggle{{ end }}">Card View</a>
<a href="/browse?collection=sidtoday-archive&amp;view=table" class="{{ if eq .View "table" }}active-toggle{{ end }}">Table View</a>
</div>
</div>
</header>
{{ if eq .View "card" }}
<div class="sort-bar-spaced">{{ template "sort-bar" (dict "SortURL" .BaseURL "SortBy" .Sort "Order" .Order "ShowRelevance" false "DefaultSort" .DefaultSort) }}</div>
<h2 class="sr-only">Documents</h2>
{{ template "doc-cards" .Cards }}
{{ template "pagination" . }}
{{ else if eq .View "table" }}
{{ template "doc-table" . }}
{{ else }}
{{ if .ArchiveYears }}
{{ if .TimelineHTML }}{{ .TimelineHTML }}{{ else }}{{ template "archive-timeline" . }}{{ end }}{{ else }}
<p class="muted">No documents in this collection yet.</p>
{{ end }}
{{ end }}
{{ else }}
<header class="browse-header">
<h1 class="browse-title">
{{ if eq .Collection "foia" }}FOIA Documents{{ else }}Reported Documents{{ end }}
<small class="count-note">({{ .Total }} total)</small>
</h1>
{{ $cardURL := .SortURL }}
{{ $tableURL := print .SortURL "view=table" }}
{{ if .Sort }}
{{ $cardURL = print $cardURL "sort=" .Sort }}
{{ $tableURL = print $tableURL "&sort=" .Sort }}
{{ if .Order }}
{{ $cardURL = print $cardURL "&order=" .Order }}
{{ $tableURL = print $tableURL "&order=" .Order }}
{{ end }}
{{ end }}
<div class="browse-controls">
<div class="view-toggle">
<a href="{{ $cardURL }}" class="{{ if ne .View "table" }}active-toggle{{ end }}">Card View</a>
<a href="{{ $tableURL }}" class="{{ if eq .View "table" }}active-toggle{{ end }}">Table View</a>
</div>
</div>
</header>
<p class="tab-desc collection-desc">
{{ if eq .Collection "foia" }}
Documents released by government agencies under Freedom of Information Act
requests, rather than through the Snowden disclosures - obtained by
journalists, researchers, and transparency organizations and added here
for context.
{{ else }}
Documents published alongside news reporting on the Snowden disclosures.
{{ end }}
</p>
{{ if ne .View "table" }}
{{ template "sort-bar" (dict "SortURL" .SortURL "SortBy" .Sort "Order" .Order "ShowRelevance" false "DefaultSort" .DefaultSort) }}
{{ end }}
{{ if eq .Collection "news" }}
{{ template "type-filter" (dict
"Action" "/browse"
"Params" .Params
"AllTypes" .AllTypes
"SelectedTypes" .SelectedTypes
) }}
{{ end }}
{{ if eq .View "table" }}
{{ template "doc-table" . }}
{{ else }}
<h2 class="sr-only">Documents</h2>
{{ template "doc-cards" .Cards }}
{{ template "pagination" . }}
{{ end }}
{{ end }}
{{ end }}
{{ template "base.html" . }}
{{ define "archive-timeline" }}<nav class="year-nav" aria-label="Jump to year">
<span class="year-nav-label">Jump to year:</span>
{{ range .ArchiveYears }}<a href="#y{{ .Year }}">{{ .Year }}</a>{{ end }}
</nav>
{{ range .ArchiveYears }}
<section class="archive-year" id="y{{ .Year }}">
<h2>{{ .Year }} <small>({{ .Count }} issue{{ if ne .Count 1 }}s{{ end }})</small></h2>
{{ range .Months }}
<div class="archive-month">
{{ with .Name }}<h3>{{ . }}</h3>{{ end }}
<ul class="archive-issues">
{{ range .Docs }}
<li>
<span class="issue-date">{{ with .DocMeta.DateCreated }}{{ . }}{{ else }}-{{ end }}</span>
<a href="/doc/{{ .ID }}">{{ .Title }}</a>
<a href="/files/{{ .ID }}/{{ pathEscape .PDFFile }}" target="_blank" rel="noopener" class="doc-pdf" title="Open PDF">[pdf]</a>
{{ if .ReportedIssue }}<span class="issue-reported" title="Individually reported - also in the Reported collection">reported</span>{{ end }}
</li>
{{ end }}
</ul>
</div>
{{ end }}
</section>
{{ end }}
{{ end }}

59
templates/category.html Normal file
View file

@ -0,0 +1,59 @@
{{ define "title" }}Browse by {{ .Title }} - Snowden Archive{{ end }}
{{ define "content" }}
<h1>Browse by {{ .Title }}</h1>
{{ with .Blurb }}<p class="tab-desc cat-blurb">{{ . }}</p>{{ end }}
{{ if .SeeAlso }}
<p class="muted see-also">See also: {{ range $i, $l := .SeeAlso }}{{ if $i }} &middot; {{ end }}<a href="{{ $l.URL }}">{{ $l.Text }}</a>{{ end }}.</p>
{{ end }}
{{ if .ShowAZ }}
<nav class="az-nav" aria-label="Jump to letter">
<span class="az-label">Jump to:</span>
{{ range .Letters }}<a href="#{{ azID . }}">{{ . }}</a>{{ end }}
</nav>
{{ end }}
{{ if .CollCols }}
<input type="checkbox" id="coll-cols" class="coll-cols-checkbox"{{ if .ShowCollCols }} checked{{ end }}>
<label for="coll-cols" class="coll-cols-label">
<span class="collapsed-text">[+] Show per-type counts</span>
<span class="expanded-text">[&minus;] Hide per-type counts</span>
<span class="sr-only">Toggle the per-type count columns</span>
</label>
{{ end }}
<div class="table-scroll">
<table class="cat-table cat-table-colls">
<thead>
<tr>{{ range .Heads }}{{ template "sort-th" . }}{{ end }}</tr>
</thead>
<tbody>
{{ if .RowsHTML }}{{ .RowsHTML }}{{ else }}{{ template "category-rows" . }}{{ end }} </tbody>
</table>
</div>
{{ end }}
{{ template "base.html" . }}
{{ define "category-row" }}
<tr>
<td>
<a href="{{ .URL }}">
{{ .Name }}
</a>
{{- with .Note }} <small class="muted cat-note">{{ . }}</small>{{ end }}
</td>
<td class="num-col">{{ .Count }}</td>
<td class="num-col coll-col">{{ if .News }}{{ .News }}{{ else }}<span class="faint">-</span>{{ end }}</td>
<td class="num-col coll-col">{{ if .Archive }}{{ .Archive }}{{ else }}<span class="faint">-</span>{{ end }}</td>
{{- if not .NoFOIA }}
<td class="num-col coll-col">{{ if .FOIA }}{{ .FOIA }}{{ else }}<span class="faint">-</span>{{ end }}</td>
{{- end }}
</tr>
{{ end }}
{{ define "category-az-row" }}
<tr class="az-row"><th id="{{ azID . }}" colspan="5">{{ . }}</th></tr>
{{ end }}
{{ define "category-rows" }}{{ $prevL := "" }}{{ range .Entries }}{{ if $.ShowAZ }}{{ if ne .FirstLetter $prevL }}{{ template "category-az-row" .FirstLetter }}{{ $prevL = .FirstLetter }}{{ end }}{{ end }}{{ template "category-row" . }}{{ end }}{{ end }}

25
templates/changelog.html Normal file
View file

@ -0,0 +1,25 @@
{{ define "title" }}Changelog - Snowden Archive{{ end }}
{{ define "content" }}
<h1>Changelog
{{ if .Total }}<small class="count-note">{{ .Total }} entries</small>{{ end }}
</h1>
{{ if .Entries }}
<ul class="changelog-list">
{{ range .Entries }}
<li class="changelog-entry">
<span class="changelog-date faint">{{ if ge (len .Date) 10 }}{{ slice .Date 0 10 }}{{ else }}{{ .Date }}{{ end }}</span>
<span class="changelog-type changelog-type-{{ .Type }}">{{ .Type }}</span>
{{ if and .ID (ne .Type "removed") }}
<a href="{{ .DocURL }}">{{ .Headline }}</a>
{{ else }}
{{ .Headline }}
{{ end }}
</li>
{{ end }}
</ul>
{{ else }}
<p class="muted">No changes recorded.</p>
{{ end }}
{{ end }}
{{ template "base.html" . }}

View file

@ -0,0 +1,50 @@
{{ define "title" }}Classification patterns - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<p class="crumb"><a href="/explore">&larr; Explore</a></p>
<h1>Classification patterns</h1>
</header>
<p class="muted">Two views of the marking metadata. Every number counts the
documents carrying that exact classification component. A document carrying
several markings counts once per marking.</p>
<h2>Mix by document year</h2>
<div class="cls-legend">
{{ range $i, $v := .Levels }}<span class="cls-key"><span class="cls-swatch seg-{{ $i }}"></span>{{ $v }}</span>{{ end }}
</div>
{{ range .Strips }}
<div class="cls-row">
<a class="cls-year" href="{{ .URL }}">{{ .Year }}</a>
<span class="cls-strip">
{{ range .Segs }}
<a class="cls-seg {{ .Class }}" href="{{ .URL }}" style="width: {{ .Pct }}%" title="{{ .Value }}: {{ .Count }}"></a>
{{ end }}
</span>
<span class="cls-total faint">{{ .Total }}</span>
</div>
{{ end }}
{{ with .Sparse }}<p class="muted"><small>Not shown, with fewer than {{ $.MinMarks }} markings each:
{{ range $i, $y := . }}{{ if $i }}, {{ end }}<a href="{{ $y.URL }}">{{ $y.Year }}</a> ({{ $y.Total }}){{ end }}.</small></p>{{ end }}
<h2>Agency &times; classification</h2>
<div class="table-scroll">
<table class="data-table heat-table">
<thead>
<tr><th>Agency</th>{{ range .Cols }}<th><a href="{{ .URL }}">{{ .Name }}</a></th>{{ end }}</tr>
</thead>
<tbody>
{{ range .HeatRows }}
<tr>
<td><a href="{{ .URL }}">{{ .Name }}</a></td>
{{ range .Cells }}
<td class="heat-cell">{{ if .URL }}<a href="{{ .URL }}">{{ .Count }}</a>{{ else }}<span class="faint">-</span>{{ end }}</td>
{{ end }}
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ end }}
{{ template "base.html" . }}

38
templates/codewords.html Normal file
View file

@ -0,0 +1,38 @@
{{ define "title" }}Acronyms & codewords - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<p class="crumb"><a href="/explore">&larr; Explore</a></p>
<h1>Acronyms &amp; codewords</h1>
</header>
<p class="muted">ALL-CAPS tokens (3+ letters) extracted automatically from titles and
transcripts - acronyms, program names, compartments, org designators. This is a
text statistic, not curated metadata. A token links to a search for the word in any
letter case, across the metadata too, so the search can find more documents than the
capitals counted here.</p>
<div class="table-scroll">
<table class="data-table codeword-table">
<thead>
<tr>{{ range .Heads }}{{ template "sort-th" . }}{{ end }}</tr>
</thead>
<tbody>
{{ if .RowsHTML }}{{ .RowsHTML }}{{ else }}{{ template "codeword-rows" . }}{{ end }} </tbody>
</table>
</div>
{{ end }}
{{ template "base.html" . }}
{{ define "codeword-rows" }} {{ range .Rows }}
<tr>
<td><a href="{{ .SearchURL }}">{{ .Token }}</a>{{ if .ProgURL }} <a class="faint cw-prog" href="{{ .ProgURL }}" title="Also a curated program - its page tracks metadata mentions, including descriptions">program &rarr;</a>{{ end }}</td>
<td>{{ .Count }}</td>
<td>{{ .Docs }}</td>
<td>{{ if .First }}<a href="{{ .FirstURL }}">{{ .First }}</a>{{ else }}<span class="faint">-</span>{{ end }}</td>
<td>{{ if .Last }}<a href="{{ .LastURL }}">{{ .Last }}</a>{{ else }}<span class="faint">-</span>{{ end }}</td>
<td>{{ if .Gloss }}<a href="{{ .GlossURL }}">defined</a>{{ else }}<span class="faint">-</span>{{ end }}</td>
</tr>
{{ end }}
{{ end }}

272
templates/doc.html Normal file
View file

@ -0,0 +1,272 @@
{{ define "title" }}{{ .Doc.Title }} - Snowden Archive{{ end }}
{{ define "head" }}
<meta name="description" content="{{ .Doc.Description }}">
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<meta name="DC.title" content="{{ .Doc.Title }}">
{{ if .Doc.DocMeta.Creator }}<meta name="DC.creator" content="{{ .Doc.DocMeta.Creator }}">{{ end }}
{{ if .Doc.DocMeta.DateCreated }}<meta name="DC.date" content="{{ .Doc.DocMeta.DateCreated }}">{{ end }}
{{ if .Doc.Description }}<meta name="DC.description" content="{{ .Doc.Description }}">{{ end }}
{{ range .Doc.DocMeta.Programs }}<meta name="DC.subject" content="{{ . }}">{{ end }}
{{ range .Doc.Tags }}<meta name="DC.subject" content="{{ . }}">{{ end }}
<meta name="DC.type" content="Text">
<meta name="DC.format" content="application/pdf">
<meta name="DC.identifier" content="{{ .DocAbsURL }}">
<meta name="DC.language" content="en">
<meta name="DC.publisher" content="Snowden Archive">
<meta property="og:type" content="article">
<meta property="og:site_name" content="Snowden Archive">
<meta property="og:title" content="{{ .Doc.Title }}">
{{ if .Doc.Description }}<meta property="og:description" content="{{ .Doc.Description }}">{{ end }}
<meta property="og:url" content="{{ .DocAbsURL }}">
{{ with .OGImageURL }}<meta property="og:image" content="{{ . }}">{{ end }}
<meta name="twitter:card" content="summary">
{{ if .APIEnabled }}<link rel="alternate" type="application/json" href="/api/doc/{{ .Doc.ID }}">{{ end }}
{{ .Embeds.JSONLDTag }}
{{ end }}
{{ define "content" }}
{{ $sidebar := .Prefs.InfoSidebar }}
<div class="doc-layout{{ if $sidebar }} info-sidebar{{ end }}">
{{ if $sidebar }}
<input type="checkbox" id="info-collapse" class="info-collapse-checkbox">
{{ end }}
<header class="doc-header">
<div class="header-main">
<div>
<h1>{{ .Doc.Title }}</h1>
<a href="/files/{{ .Doc.ID }}/{{ pathEscape .Doc.PDFFile }}" target="_blank" rel="noopener"
class="doc-top-btn doc-pdf-link" title="Open original PDF">Open PDF</a>
{{ with .Doc.Versions }}<a href="#publications" class="doc-top-btn" title="Other published copies of this document: less redacted, extra pages or a different scan">+{{ len . }} other cop{{ if eq (len .) 1 }}y{{ else }}ies{{ end }}</a>{{ end }}
<form method="POST" action="/pin/{{ .Doc.ID }}" class="inline-form">
{{ $back := print "/doc/" .Doc.ID }}
<input type="hidden" name="back" value="{{ $back }}">
<button type="submit" class="doc-top-btn pin-btn">{{ if .Pinned }}&#9733; Unpin{{ else }}&#9734; Pin{{ end }}</button>
</form>
{{ if or .SerialPrev .SerialNext }}
<nav class="serial-nav" aria-label="SIDtoday issues">
{{ with .SerialPrev }}<a href="/doc/{{ .ID }}" class="serial-prev" title="{{ .Title }}">&larr; Previous issue{{ with .DocMeta.DateCreated }} ({{ . }}){{ end }}</a>{{ end }}
{{ with .SerialNext }}<a href="/doc/{{ .ID }}" class="serial-next" title="{{ .Title }}">Next issue{{ with .DocMeta.DateCreated }} ({{ . }}){{ end }} &rarr;</a>{{ end }}
</nav>
{{ end }}
<div class="doc-info">
<strong>Creating agency:</strong> {{ with .Doc.DocMeta.Creator }}<a href="/browse/agency/{{ pathEscape . }}{{ $.BrowseQS }}">{{ . }}</a>{{ with agencyName . }} <small class="muted">{{ . }}</small>{{ end }}{{ else }}-{{ end }}<br>
<strong>Document date:</strong> {{ with .Doc.DocMeta.DateCreated }}{{ . }}{{ else }}-{{ end }}<br>
{{ if or (eq .Doc.Type "FOIA") (eq .Doc.Type "SIDTODAY") }}<strong>Type:</strong> {{ template "type-badge" .Doc.Type }}<br>{{ end }}
{{ if .Doc.Pages }}<strong>Pages:</strong> <a href="/doc/{{ .Doc.ID }}/pages">{{ .Doc.Pages }}</a><br>{{ end }}
{{ with .Doc.DocMeta.Genre }}<strong>Genre:</strong> <a href="/browse/genre/{{ pathEscape . }}{{ $.BrowseQS }}">{{ . }}</a><br>{{ end }}
{{ with .Doc.DocMeta.Banner }}<strong>Banner:</strong> <a href="/browse/banner/{{ pathEscape . }}{{ $.BrowseQS }}" class="doc-banner-link banner">{{ . }}</a><br>{{ end }}
<strong>Classification: </strong>
{{- facetLinks (dict "Vals" .Doc.DocMeta.Classification "Cat" "classification" "Sep" "space" "Class" "tag classification" "QS" $.BrowseQS) -}}
<br>
<strong>Dissemination: </strong>
{{- facetLinks (dict "Vals" .Doc.DocMeta.Dissemination "Cat" "dissemination" "Class" "doc-banner-link dissemination" "QS" $.BrowseQS) -}}
</div>
{{ with .SeriesGroup }}
<div class="rule-top series-box">
<strong>Series:</strong>
<a href="/browse/series/{{ pathEscape .Name }}{{ $.BrowseQS }}">{{ .Name }}</a>
<ol class="series-list">
{{ range .Docs }}
<li{{ if gt .DocMeta.Series.Part 0 }} value="{{ .DocMeta.Series.Part }}"{{ end }}>
{{ if eq .ID $.Doc.ID }}<strong aria-current="page">{{ .Title }}</strong>
{{ else }}<a href="/doc/{{ .ID }}">{{ .Title }}</a>{{ end }}
</li>
{{ end }}
</ol>
</div>
{{ end }}
{{ with .Assemblies }}
<div class="rule-top series-box">
<strong>Part of {{ if gt (len .) 1 }}assemblies{{ else }}an assembly{{ end }}:</strong>
{{ range $i, $a := . }}{{ if $i }}, {{ end }}<a href="/explore/assemblies/{{ $a.ID }}">{{ $a.Title }}</a>{{ end }}
</div>
{{ end }}
<div class="rule-top pub-block" id="publications">
{{- range $i, $pub := .Doc.Publication }}
<div class="pub-entry{{ if $i }} pub-sep{{ end }}">
{{- if or $pub.Link $pub.Publisher $pub.DatePublished }}
<div class="pub-head">
{{- if $pub.Link }}<a href="{{ $pub.Link }}" target="_blank" rel="noopener" class="pub-original">{{ with $pub.Publisher }}{{ . }}{{ else }}Read the original{{ end }} &nearr;</a>
{{- else }}{{ with $pub.Publisher }}<span class="pub-outlet">{{ . }}</span>{{ end }}{{ end -}}
{{- with $pub.DatePublished }}<span class="pub-date muted">{{ . }}</span>{{ end -}}
</div>
{{- end -}}
{{- if $pub.Title -}}
{{ $ak := articleKey $pub.Link }}
<div class="pub-title">{{ if $ak }}<a href="/article/{{ $ak }}"><em>{{ $pub.Title }}</em></a>{{ else }}<em>{{ $pub.Title }}</em>{{ end }}</div>
{{- end -}}
{{- if or $pub.Journalists $pub.Contributors }}
<div class="pub-people muted">
{{- range $j, $name := $pub.Journalists -}}
{{- if $j }} <span class="doc-dot">&middot;</span> {{ end -}}
<a href="/browse/journalist/{{ pathEscape $name }}{{ $.BrowseQS }}" class="meta-link">{{ $name }}</a>
{{- end -}}
{{- range $j, $name := $pub.Contributors -}}
{{- if or $j $pub.Journalists }} <span class="doc-dot">&middot;</span> {{ end -}}
<span class="meta-link">{{ $name }}</span>
{{- end -}}
</div>
{{- end -}}
{{- if $pub.ReportingOnly }}
<div class="pub-reporting-only muted">Reporting partner - published this story, not the document</div>
{{- end -}}
{{- with $pub.Note }}
<div class="pub-note">{{ . }}</div>
{{- end -}}
{{- $copy := $.Doc.VersionFor $pub.Version -}}
{{- $shown := and (not $pub.ReportingOnly) (not $pub.Version) $.Doc.Versions -}}
{{- if and (not $pub.ReportingOnly) (or $copy $pub.DocSource $pub.DocURL $shown) }}
<div class="pub-copy muted">
{{- if $shown }}<span class="pub-shown">the copy shown on this page</span>{{ end -}}
{{- with $copy }}<a href="/doc/{{ $.Doc.ID }}/versions/{{ .Slug }}">view this copy &rarr;</a>{{ if .ChangedPages }}<span class="changed-pages">changed pages: {{ template "changed-page-links" . }}</span>{{ end }}{{ end -}}
{{- with $pub.DocSource }}<a href="{{ . }}" target="_blank" rel="noopener">document page &nearr;</a>{{ end -}}
{{- with $pub.DocURL }}<a href="{{ . }}" target="_blank" rel="noopener">original PDF &nearr;</a>{{ end -}}
</div>
{{- end -}}
</div>
{{- end }}
{{- with .Doc.UnlinkedVersions }}
<div class="pub-entry pub-sep">
<div class="pub-title">Other copies</div>
<div class="pub-copy muted">
{{- range . }}<span><a href="/doc/{{ $.Doc.ID }}/versions/{{ .Slug }}">{{ .Slug }} &rarr;</a>{{ if .ChangedPages }} (changed pages: {{ template "changed-page-links" . }}){{ end }}</span>{{ end -}}
</div>
</div>
{{- end }}
</div>
<div class="rule-top">
<p>{{ .Doc.Description }}</p>
<div class="meta-expand">
<input type="checkbox" id="meta-toggle" class="meta-checkbox"{{ if .Prefs.OpenInfo }} checked{{ end }}>
<label for="meta-toggle" class="meta-label">
<span class="collapsed-text">[+] Show more info</span>
<span class="expanded-text">[-] Show less info</span>
<span class="sr-only">Toggle extended document metadata</span>
</label>
<div class="meta-content">
<div class="meta-grid">
<div class="meta-wide long-desc-container">
<strong>Long Description:</strong>
<div class="long-description-text">
{{- with .Doc.LongDescription }}{{ . }}{{ else }}<em>No extended description available.</em>{{ end -}}
</div>
</div>
<div>
<strong>Programs:</strong><br>
{{- facetLinks (dict "Vals" .Doc.DocMeta.Programs "Cat" "program" "Class" "tag" "AsList" .Prefs.ProgramsAsList "QS" $.BrowseQS) -}}
{{- if not (and .Doc.DocMeta.Programs .Prefs.ProgramsAsList) }}<br>{{ end -}}
<br>
<strong>People mentioned:</strong><br>
{{- facetLinks (dict "Vals" .Doc.DocMeta.People "Cat" "people" "Class" "meta-link" "QS" $.BrowseQS) -}}
<br><br>
<strong>Countries:</strong><br>
{{- facetLinks (dict "Vals" .Doc.DocMeta.Countries "Cat" "country" "Class" "meta-link" "QS" $.BrowseQS) -}}
<br><br>
<strong>Tags:</strong><br>
{{- facetLinks (dict "Vals" .Doc.Tags "Cat" "tag" "Class" "meta-link" "AsList" .Prefs.TagsAsList "QS" $.BrowseQS) -}}
<br><br>
<strong>Identifier:</strong><br>
<code class="checksum">{{ .Doc.ID }}</code>
{{ with .Doc.AkaID }}
<br><strong>Also known as:</strong><br>
{{ range $i, $aka := . }}{{ if $i }}<br>{{ end }}<code class="checksum">{{ $aka.ID }}</code>{{ with $aka.DocSource }} <a href="{{ . }}" target="_blank" rel="noopener">page &nearr;</a>{{ end }}{{ with $aka.DocURL }} <a href="{{ . }}" target="_blank" rel="noopener">PDF &nearr;</a>{{ end }}{{ end }}
{{ end }}
{{ with .Doc.PDFSha256 }}
<br><br>
<strong>PDF SHA-256:</strong><br>
<code class="checksum">{{ . }}</code>
{{ end }}
</div>
</div>
</div>
</div>
<details class="note-box note-subtle" id="note-box" hidden data-doc-id="{{ .Doc.ID }}" data-doc-title="{{ .Doc.Title }}">
<summary>My notes <span class="note-status faint" id="note-status"></span></summary>
<textarea id="note-text" rows="4" placeholder="Private notes about this document - stored only in this browser (localStorage). See all your notes on the Pinned page."></textarea>
</details>
</div>
</div>
</div>
</header>
{{ if $sidebar }}
<label for="info-collapse" class="info-toggle-label" title="Show/hide document info">
<span class="sr-only">Toggle the document info sidebar</span>
</label>
{{ end }}
<div class="doc-container">
{{ template "doc-viewport" . }}
</div>
</div>{{/* /.doc-layout */}}
{{ if and .Images (not .Prefs.TextOnly) }}
{{ template "lightbox-overlays" . }}
{{ end }}
<div class="doc-extra">
{{ with .Doc.ArchiveComment }}
<div class="archive-note">
<strong>Archive note:</strong> {{ . }}
</div>
{{ end }}
<span class="Z3988" title="{{ .Embeds.COinS }}"></span>
</div>
{{ if or .PublishedTogether .RelatedDocs }}
<div class="related-section">
{{ if .PublishedTogether }}
<details class="collapse-section"{{ if not $.Prefs.CollapsePubTogether }} open{{ end }}>
<summary>
<span class="collapse-ind" aria-hidden="true"></span>
<h2>Published in the Same Report
<small>{{ if .PublishedMore }}({{ .PublishedShown }} of {{ len .PublishedTogether }} documents){{ else }}({{ len .PublishedTogether }} documents){{ end }}</small>
</h2>
</summary>
{{ template "doc-cards" .PublishedCards }}
{{ with .PublishedMore }}{{ $one := eq (len .) 1 }}
{{ range . }}
<p class="pub-more"><a class="see-all" href="/article/{{ .Key }}">See all {{ len .DocIDs }} documents published with {{ if $one }}this article{{ else if .Title }}&ldquo;{{ .Title }}&rdquo;{{ else }}the article at {{ .Host }}{{ end }} &rarr;</a></p>
{{ end }}
{{ end }}
</details>
{{ end }}
{{ if .RelatedDocs }}
<details class="collapse-section"{{ if not $.Prefs.CollapseRelated }} open{{ end }}>
<summary>
<span class="collapse-ind" aria-hidden="true"></span>
<h2>Related Documents</h2>
</summary>
{{ template "doc-cards" .RelatedCards }}
</details>
{{ end }}
</div>
{{ end }}
{{ end }}
{{ template "base.html" . }}

50
templates/explore.html Normal file
View file

@ -0,0 +1,50 @@
{{ define "title" }}Explore - Snowden Archive{{ end }}
{{ define "content" }}
<h1>Explore the archive</h1>
<p class="tab-desc">
Ranked views and lists across the whole archive, which the
<a href="/browse">/browse</a> doesn't include.
</p>
<ul class="explore-list">
{{ range .Metrics }}
<li>
<a href="/explore/{{ .Slug }}">{{ .Title }}</a>
<span class="muted">- {{ .Blurb }}</span>
</li>
{{ end }}
<li>
<a href="/explore/portions">Portion markings</a>
<span class="muted">- The marking on each classified portion, read out of the OCRs (levels, compartments, and how often).</span>
</li>
<li>
<a href="/explore/classification">Classification patterns</a>
<span class="muted">- The marking mix across document years, and an agency x classification heat table.</span>
</li>
<li>
<a href="/explore/outlets">Publishers by year</a>
<span class="muted">- When each publisher released documents, and how much (i.e. documents and stories per publisher and year).</span>
</li>
<li>
<a href="/explore/ids">Technical IDs</a>
<span class="muted">- Every document id, PDF filename, size and SHA-256 checksum.</span>
</li>
<li>
<a href="/browse/genre">Genres</a>
<span class="muted">- How many documents of each kind the archive holds (slides, reports, wikis, manuals, guides, newsletters).</span>
</li>
{{ if $.HasAssemblies }}
<li>
<a href="/explore/assemblies">Assemblies</a>
<span class="muted">- Sets of pages this archive put together from documents and copies published separately, so they can be read in one place.</span>
</li>
{{ end }}
<li>
<a href="/explore/terms">Acronyms &amp; codewords</a>
<span class="muted">- Every ALL-CAPS token across the corpus, auto-extracted (e.g. acronyms, program names, compartments, org designators).</span>
</li>
</ul>
{{ end }}
{{ template "base.html" . }}

View file

@ -0,0 +1,35 @@
{{ define "title" }}{{ .Metric.Title }} - Snowden Archive{{ end }}
{{ define "content" }}
<p class="crumb"><a href="/explore">&larr; Explore</a></p>
<h1>{{ .Metric.Title }}</h1>
<p class="tab-desc">{{ .Metric.Blurb }}</p>
<p class="muted">Top {{ .Shown }} of {{ .Total }} documents.</p>
<div class="table-scroll">
<table class="cat-table explore-table">
<thead>
<tr>{{ range .Heads }}{{ template "sort-th" . }}{{ end }}</tr>
</thead>
<tbody>
{{ if .RowsHTML }}{{ .RowsHTML }}{{ else }}{{ template "explore-rows" . }}{{ end }} </tbody>
</table>
</div>
{{ end }}
{{ template "base.html" . }}
{{ define "explore-rows" }} {{ range .Rows }}
<tr>
<td class="num-col faint">{{ .Rank }}</td>
<td>
<a href="/doc/{{ .Doc.ID }}">{{ .Doc.Title }}</a>
{{ template "type-badge" .Doc.Type }}
</td>
<td class="explore-date">{{ with .Doc.DocMeta.DateCreated }}{{ . }}{{ else }}<span class="faint">-</span>{{ end }}</td>
{{ range .Vals }}
<td class="num-col">{{ . }}</td>
{{ end }}
</tr>
{{ end }}
{{ end }}

36
templates/glossary.html Normal file
View file

@ -0,0 +1,36 @@
{{ define "title" }}Glossary - Snowden Archive{{ end }}
{{ define "content" }}
<h1>Glossary {{ if .Total }}<small class="muted">({{ .Total }} terms)</small>{{ end }}</h1>
{{ if .Groups }}
<nav class="letter-nav" aria-label="Jump to letter">
{{ range .Groups }}<a href="#g{{ .Letter }}">{{ .Letter }}</a>{{ end }}
</nav>
{{ if .GroupsHTML }}{{ .GroupsHTML }}{{ else }}{{ template "glossary-groups" . }}{{ end }}{{ else }}
<p class="muted">No glossary entries.</p>
{{ end }}
{{ end }}
{{ template "base.html" . }}
{{ define "glossary-groups" }}{{ range .Groups }}
<section class="glossary-group" id="g{{ .Letter }}">
<h2>{{ .Letter }}</h2>
<dl class="glossary-list">
{{ range .Entries }}
<dt id="term-{{ pathEscape .Term }}">
{{ .Term }}
{{ if .Aka }}<span class="muted glossary-aka">(a.k.a. {{ range $i, $a := .Aka }}{{ if $i }}, {{ end }}{{ $a }}{{ end }})</span>{{ end }}
<a class="glossary-search" href="{{ .SearchURL }}"{{ if .Aka }} title="Searches the term and its aliases"{{ end }}>search &rarr;</a>
</dt>
<dd>
{{ .DefinitionHTML }}
{{ if .SeeLinks }}<div class="glossary-see muted">See also:
{{ range $i, $s := .SeeLinks }}{{ if $i }}, {{ end }}{{ if $s.Term }}<a href="#term-{{ pathEscape $s.Term }}">{{ $s.Name }}</a>{{ else }}{{ $s.Name }}{{ end }}{{ end }}
</div>{{ end }}
</dd>
{{ end }}
</dl>
</section>
{{ end }}
{{ end }}

63
templates/ids.html Normal file
View file

@ -0,0 +1,63 @@
{{ define "title" }}Technical IDs - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<p class="crumb"><a href="/explore">&larr; Explore</a></p>
<h1>Technical IDs <small class="count-note">{{ .Shown }} document{{ if ne .Shown 1 }}s{{ end }}</small></h1>
</header>
<p class="muted">
<a href="/explore/ids.txt">Checksums as plain text</a>
<span class="faint">(<code>sha256sum -c</code> in the corpus root)</span>
</p>
<div class="table-scroll">
<table class="data-table id-table">
<colgroup>
<col class="c-id"><col class="c-coll"><col class="c-pages">
<col class="c-pdf"><col class="c-size"><col class="c-sha">
</colgroup>
<thead>
<tr>
<th>Document</th>
<th>Collection</th>
<th class="num">Pages</th>
<th>PDF</th>
<th class="num">Size</th>
<th>SHA-256</th>
</tr>
</thead>
<tbody>
{{ if .RowsHTML }}{{ .RowsHTML }}{{ else }}{{ template "id-rows" . }}{{ end }}
</tbody>
</table>
</div>
{{ end }}
{{ template "base.html" . }}
{{ define "id-rows" }}{{ range .Rows }}
<tr>
<td><a href="/doc/{{ .ID }}">{{ .ID }}</a>
{{- range .Aka }}<br><span class="faint">also published as</span> <code>{{ .ID }}</code>{{ end -}}
</td>
<td>{{ .Collection }}</td>
<td class="num">{{ if .Pages }}{{ .Pages }}{{ end }}</td>
<td><a href="{{ .PDFURL }}" target="_blank" rel="noopener"><code>{{ .PDFFile }}</code></a></td>
<td class="num">{{ .Size }}</td>
<td>{{ with .SHA }}<code class="checksum">{{ . }}</code>{{ else }}<span class="faint">-</span>{{ end }}</td>
</tr>
{{ $id := .ID }}
{{ range .Versions }}
<tr class="id-version">
<td><span class="faint">&#8627;</span> <a href="/doc/{{ $id }}/versions/{{ .Slug }}">versions/{{ .Slug }}</a></td>
<td class="faint">copy</td>
<td class="num">{{ if .Pages }}{{ .Pages }}{{ end }}</td>
<td><a href="{{ .PDFURL }}" target="_blank" rel="noopener"><code>{{ .PDFFile }}</code></a></td>
<td class="num">{{ .Size }}</td>
<td>{{ if .SHA }}<code class="checksum">{{ .SHA }}</code>{{ else }}<span class="faint">-</span>{{ end }}</td>
</tr>
{{ end }}
{{ else }}
<tr><td colspan="6" class="muted">No documents.</td></tr>
{{ end }}{{ end }}

150
templates/index.html Normal file
View file

@ -0,0 +1,150 @@
{{ define "content" }}
<h1>Snowden Archive</h1>
<p class="muted home-intro">
This archive holds {{ .SnowdenTotal }} published Snowden documents. {{ .ReportedTotal }} documents are
published with news reporting, and {{ .ArchiveTotal }} documents are the NSA newsletter SIDtoday
issues, from The Intercept's bulk release.{{ if .FOIATotal }} This archive also holds {{ .FOIATotal }}
FOIA documents related to the Snowden disclosures (FOIA litigation, FISC and ODNI declassifications),
which {{ if .IncludeFOIA }}you have included via <a href="/preferences">Preferences</a>{{ else }}are left out by default but can be included via <a href="/preferences">Preferences</a>{{ end }}.{{ end }}
</p>
<form action="/search" method="GET" class="home-search-form" role="search">
<input type="text" name="q" class="home-search" placeholder="Search the archive... (Enter to search)" aria-label="Search the archive">
</form>
<div class="home-actions">
<a class="home-action" href="/browse">Browse the archive &rarr;</a>
</div>
{{ if and .TrackRecent .RecentDocs }}
<section class="home-section">
<h2>Recently viewed
<button type="submit" form="clear-recent-docs" class="link-btn faint">clear</button>
</h2>
<form method="POST" action="/history/clear" id="clear-recent-docs" class="inline-form">
<input type="hidden" name="which" value="docs">
<input type="hidden" name="back" value="/">
</form>
<ul class="stat-list">
{{ range .RecentDocs }}
<li><a href="/doc/{{ .ID }}">{{ .Title }}</a> <span class="muted">{{ .DocMeta.Creator }}</span></li>
{{ end }}
</ul>
</section>
{{ end }}
<p class="home-stats-note muted">{{ if .WithSIDtoday }}The statistics below include SIDtoday archive documents (<a href="/">exclude them</a>).{{ else }}The statistics below exclude SIDtoday archive documents (<a href="/?sidtoday=1">include them</a>).{{ end }}</p>
{{ if .DocHist }}
<section class="home-section">
<h2>When the documents were written</h2>
<div class="date-hist">
{{ range .DocHist }}
<a class="hist-col" href="{{ .URL }}" title="{{ .Count }} documents dated {{ .Year }}">
<span class="hist-count">{{ .Count }}</span>
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
<span class="hist-year">{{ .Year }}</span>
</a>
{{ end }}
</div>
</section>
{{ end }}
{{ if .PubHist }}
<section class="home-section">
<h2>When they were published</h2>
<div class="date-hist">
{{ range .PubHist }}
<a class="hist-col" href="{{ .URL }}" title="{{ .Count }} documents first published in {{ .Year }}">
<span class="hist-count">{{ .Count }}</span>
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
<span class="hist-year">{{ .Year }}</span>
</a>
{{ end }}
</div>
</section>
{{ end }}
{{ if .TopPrograms }}
<section class="home-section">
<h2>Top programs <a class="see-all" href="/browse/program">all &rarr;</a></h2>
<div class="pill-list">
{{ range .TopPrograms }}
<a class="pill" href="{{ .URL }}">{{ .Name }} <span class="pill-count">{{ .Count }}</span></a>
{{ end }}
</div>
</section>
{{ end }}
<div class="home-grid">
{{ if .TopAgencies }}
<section class="home-section">
<h2>Agencies <a class="see-all" href="/browse/agency">all &rarr;</a></h2>
<ul class="stat-list">
{{ range .TopAgencies }}
<li><a href="{{ .URL }}">{{ .Name }}</a> <span class="muted">{{ .Count }}</span></li>
{{ end }}
</ul>
</section>
{{ end }}
{{ if .TopCountries }}
<section class="home-section">
<h2>Countries <a class="see-all" href="/browse/country">all &rarr;</a></h2>
<ul class="stat-list">
{{ range .TopCountries }}
<li><a href="{{ .URL }}">{{ .Name }}</a> <span class="muted">{{ .Count }}</span></li>
{{ end }}
</ul>
</section>
{{ end }}
{{ if .TopPeople }}
<section class="home-section">
<h2>People <a class="see-all" href="/browse/people">all &rarr;</a></h2>
<ul class="stat-list">
{{ range .TopPeople }}
<li><a href="{{ .URL }}">{{ .Name }}</a> <span class="muted">{{ .Count }}</span></li>
{{ end }}
</ul>
</section>
{{ end }}
{{ if .TopJournalists }}
<section class="home-section">
<h2>Journalists <a class="see-all" href="/browse/journalist">all &rarr;</a></h2>
<ul class="stat-list">
{{ range .TopJournalists }}
<li><a href="{{ .URL }}">{{ .Name }}</a> <span class="muted">{{ .Count }}</span></li>
{{ end }}
</ul>
</section>
{{ end }}
{{ if .TopPublishers }}
<section class="home-section">
<h2>Publishers <a class="see-all" href="/browse/publisher">all &rarr;</a></h2>
<ul class="stat-list">
{{ range .TopPublishers }}
<li><a href="{{ .URL }}">{{ .Name }}</a> <span class="muted">{{ .Count }}</span></li>
{{ end }}
</ul>
</section>
{{ end }}
</div>
{{ if .TopTags }}
<section class="home-section">
<h2>Top tags <a class="see-all" href="/browse/tag">all &rarr;</a></h2>
<div class="pill-list">
{{ range .TopTags }}
<a class="pill" href="{{ .URL }}">{{ .Name }} <span class="pill-count">{{ .Count }}</span></a>
{{ end }}
</div>
</section>
{{ end }}
<p class="explore-link">Digging deeper? <a href="/explore">Explore the archive</a> for ranked views and lists.
{{ end }}
{{ template "base.html" . }}

95
templates/list.html Normal file
View file

@ -0,0 +1,95 @@
{{ define "title" }}{{ with .CatLabel }}{{ . }}{{ else }}Category{{ end }}: {{ .Title }} - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<h1>{{ with .CatLabel }}{{ . }}{{ else }}Category{{ end }}: {{ .Title }}
{{- if eq .ActiveCategory "agency" }}{{ with agencyName .Title }} <small class="muted cat-note">{{ . }}</small>{{ end }}{{ end }}
<small class="count-note">{{ .Total }} document{{ if ne .Total 1 }}s{{ end }}</small>
</h1>
{{ if .SearchLink }}
<a href="{{ .SearchLink }}" class="faint search-link">Search documents matching &ldquo;{{ .Title }}&rdquo; &rarr;</a>
{{ end }}
{{ with .Blurb }}<p class="muted cat-blurb">{{ . }}</p>{{ end }}
{{ with .YearScope }}
<p class="muted coll-scope">Showing the documents {{ $.Title }} itself published in <strong>{{ . }}</strong> -
<a href="{{ $.YearScopeAllURL }}">all years</a>.</p>
{{ end }}
</header>
{{ if .MonthNav }}
<nav class="month-nav" aria-label="Months in {{ .MonthNavYear }}">
<a href="{{ .MonthNavYearURL }}"{{ if .MonthNavYearActive }} class="active"{{ end }}>All {{ .MonthNavYear }}</a>
{{ range .MonthNav }}<a href="{{ .URL }}"{{ if .Active }} class="active"{{ end }}>{{ .Label }} <span class="facet-count">{{ .Count }}</span></a>
{{ end }}
{{ if .MonthlessCount }}<span class="faint month-nav-note">+{{ .MonthlessCount }} in {{ .MonthNavYear }} with year-only dates</span>{{ end }}
</nav>
{{ end }}
{{ with .GlossaryEntry }}
<div class="glossary-box">
<strong>{{ .Term }}</strong>
{{ if .Aka }}<span class="muted glossary-aka">(a.k.a. {{ range $i, $a := .Aka }}{{ if $i }}, {{ end }}{{ $a }}{{ end }})</span>{{ end }}
- {{ .DefinitionHTML }}
<a href="/glossary#term-{{ pathEscape .Term }}" class="glossary-search">glossary &rarr;</a>
</div>
{{ end }}
{{ if or .Timeline .PubTimeline .Breakdowns }}
<details class="entity-timeline">
<summary>Graphs</summary>
{{ if .Timeline }}{{ template "timeline-hist" (dict "Bars" .Timeline "Label" "By document date" "Verb" "dated") }}{{ end }}
{{ if .PubTimeline }}{{ template "timeline-hist" (dict "Bars" .PubTimeline "Label" "By published date" "Verb" "published") }}{{ end }}
{{ range .Breakdowns }}
<div class="timeline-block">
<h2 class="timeline-label">By {{ .Label }}</h2>
<div class="breakdown-bars">
{{ range .Values }}
<a class="bd-row" href="{{ .URL }}" title="{{ .Count }} documents - open as a search">
<span class="bd-name">{{ .Value }}</span>
<span class="bd-track"><span class="bd-bar" style="width: {{ .Pct }}%"></span></span>
<span class="bd-count">{{ .Count }}</span>
</a>
{{ end }}
</div>
</div>
{{ end }}
</details>
{{ end }}
{{ if .Refinements }}
<details class="search-facets">
<summary>Refine <span class="faint">(combine with another filter, via search)</span></summary>
<div class="facets-body">
{{ range .Refinements }}
<div class="facet-group">
<span class="facet-label">{{ .Label }}</span>
<span class="facet-values">{{ range .Values }}<a class="facet-link" href="{{ .URL }}">{{ .Name }}<span class="facet-count">{{ .Count }}</span></a>{{ end }}</span>
</div>
{{ end }}
</div>
</details>
{{ end }}
<div class="list-controls">
{{ if ne .View "table" }}
{{ template "sort-bar" (dict "SortURL" .SortURL "SortBy" .Sort "Order" .Order "ShowRelevance" false "DefaultSort" .DefaultSort) }}
{{ end }}
{{ template "type-filter" (dict
"Action" (print "/browse/" .ActiveCategory "/" (pathEscape .Title))
"Params" .Params
"AllTypes" .AllTypes
"SelectedTypes" .SelectedTypes
) }}
</div>
{{ if eq .View "table" }}
{{ template "doc-table" . }}
{{ else }}
<h2 class="sr-only">Documents</h2>
{{ template "doc-cards" .Cards }}
{{ template "pagination" . }}
{{ end }}
{{ end }}
{{ template "base.html" . }}

54
templates/outlets.html Normal file
View file

@ -0,0 +1,54 @@
{{ define "title" }}Publishers by year - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<p class="crumb"><a href="/explore">&larr; Explore</a></p>
<h1>Publishers by year</h1>
</header>
<p class="muted">When each publisher released documents, and how much. The number of
distinct stories are after the slash.</p>
<p class="hist-toggles faint">Showing:
{{ if .NewsOnly }}<a href="/explore/outlets">all collections</a> &middot; <strong>reported only</strong>
{{ else }}<strong>all collections</strong> &middot; <a href="/explore/outlets?coll=news">reported only</a>{{ end }}
</p>
{{ with .Table }}
{{ if .Rows }}
<div class="table-scroll">
<table class="data-table heat-table outlet-table">
<thead>
<tr>
<th>Outlet</th>
{{ range .YearLinks }}<th class="num"><a href="{{ .URL }}">{{ .Name }}</a></th>{{ end }}
<th class="num-col">Total</th>
</tr>
</thead>
<tbody>
{{ range .Rows }}
<tr>
<td><a href="{{ .URL }}">{{ .Name }}</a></td>
{{ range .Cells }}
<td class="heat-cell">{{ if .Docs }}<a href="{{ .URL }}" title="{{ .Docs }} documents, {{ .Articles }} stories">{{ .Docs }}{{ if .Articles }}<small class="faint">/{{ .Articles }}</small>{{ end }}</a>{{ else }}<span class="faint">-</span>{{ end }}</td>
{{ end }}
<td class="num-col">{{ .Total }}</td>
</tr>
{{ end }}
</tbody>
<tfoot>
<tr>
<th>All outlets</th>
{{ range .Totals }}<th class="num-col">{{ if . }}{{ . }}{{ else }}<span class="faint">-</span>{{ end }}</th>{{ end }}
<th></th>
</tr>
</tfoot>
</table>
</div>
{{ else }}
<p class="muted">No dated publications in the corpus yet.</p>
{{ end }}
{{ end }}
{{ end }}
{{ template "base.html" . }}

40
templates/pages.html Normal file
View file

@ -0,0 +1,40 @@
{{ define "title" }}Pages - {{ .Doc.Title }}{{ with .Version }} ({{ .Slug }}){{ end }} - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<p class="crumb">{{ with .Version }}<a href="/doc/{{ $.Doc.ID }}/versions/{{ .Slug }}">&larr; {{ $.Doc.Title }} (copy: {{ .Slug }})</a>{{ else }}<a href="/doc/{{ .Doc.ID }}">&larr; {{ .Doc.Title }}</a>{{ end }}</p>
<h1>All pages <small class="count-note">{{ len .Images }} page{{ if ne (len .Images) 1 }}s{{ end }}</small></h1>
{{ with .Version }}{{ if .ChangedPages }}<p class="changed-pages-note">Pages that differ from the main document: {{ template "changed-page-links" . }}</p>{{ end }}{{ end }}
</header>
{{ if and .Images .TextOnly }}
<p class="muted textonly-note">Text-only mode is on - page images are not loaded. <a href="/preferences">Preferences</a></p>
<ul class="page-link-list">
{{ $id := .Doc.ID }}
{{ range $i, $img := .Images }}
<li><a href="{{ $.ImageBase }}{{ pathEscape $img }}" target="_blank" rel="noopener">Page {{ add $i 1 }}</a>{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} <span class="muted">(differs from the main document)</span>{{ end }}</li>
{{ end }}
</ul>
{{ else if .Images }}
<ul class="page-sheet">
{{ $id := .Doc.ID }}
{{ range $i, $img := .Images }}
<li{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} class="page-changed"{{ end }}>
<a href="#lb-{{ add $i 1 }}" title="Open page {{ add $i 1 }} full screen">
<img src="{{ $.ImageBase }}{{ pathEscape $img }}"{{ $.ImageSize $i }}
alt="Page {{ add $i 1 }}" loading="lazy">
<span class="page-num faint">{{ add $i 1 }}</span>{{ if and $.Version ($.Version.PageChanged (add $i 1)) }}<span class="page-changed-badge">differs</span>{{ end }}
</a>
</li>
{{ end }}
</ul>
{{ template "lightbox-overlays" . }}
{{ else }}
<p class="muted">This document has no page images.</p>
{{ end }}
{{ end }}
{{ template "base.html" . }}

412
templates/partials.html Normal file
View file

@ -0,0 +1,412 @@
{{ define "cat-boxes" }}
{{ $a := .ActiveCategory }}{{ if not $a }}{{ $a = "" }}{{ end }}
<nav id="cat-boxes" aria-label="Browse categories">
<a href="/browse/program" class="cat-box{{ if eq $a "program" }} cat-box-active{{ end }}"><strong>Programs</strong><span class="count">{{ index .CatCounts "program" }}</span></a>
<a href="/browse/journalist" class="cat-box{{ if eq $a "journalist" }} cat-box-active{{ end }}"><strong>Journalists</strong><span class="count">{{ index .CatCounts "journalist" }}</span></a>
<a href="/browse/agency" class="cat-box{{ if eq $a "agency" }} cat-box-active{{ end }}"><strong>Agencies</strong><span class="count">{{ index .CatCounts "agency" }}</span></a>
<a href="/browse/publisher" class="cat-box{{ if eq $a "publisher" }} cat-box-active{{ end }}"><strong>Publishers</strong><span class="count">{{ index .CatCounts "publisher" }}</span></a>
<a href="/browse/country" class="cat-box{{ if eq $a "country" }} cat-box-active{{ end }}"><strong>Countries</strong><span class="count">{{ index .CatCounts "country" }}</span></a>
<a href="/browse/people" class="cat-box{{ if eq $a "people" }} cat-box-active{{ end }}"><strong>People</strong><span class="count">{{ index .CatCounts "people" }}</span></a>
<a href="/browse/classification" class="cat-box{{ if eq $a "classification" }} cat-box-active{{ end }}"><strong>Classification</strong><span class="count">{{ index .CatCounts "classification" }}</span></a>
<a href="/browse/dissemination" class="cat-box{{ if eq $a "dissemination" }} cat-box-active{{ end }}"><strong>Dissemination</strong><span class="count">{{ index .CatCounts "dissemination" }}</span></a>
<a href="/browse/published" class="cat-box{{ if eq $a "published" }} cat-box-active{{ end }}"><strong>Pub Year</strong><span class="count">{{ index .CatCounts "published" }}</span></a>
<a href="/browse/docdate" class="cat-box{{ if eq $a "docdate" }} cat-box-active{{ end }}"><strong>Doc Date</strong><span class="count">{{ index .CatCounts "docdate" }}</span></a>
<a href="/browse/tag" class="cat-box{{ if eq $a "tag" }} cat-box-active{{ end }}"><strong>Tags</strong><span class="count">{{ index .CatCounts "tag" }}</span></a>
</nav>
{{ end }}
{{/* pub-publisher is a publication entry's outlet: a link to the story where
the entry has one, else to the outlet's page - which a partner that only
reported has none of. */}}
{{ define "pub-publisher" -}}
{{ if .Pub.Link }}<a href="{{ .Pub.Link }}" target="_blank" rel="noopener"{{ if or .LinkClass .On }} class="{{ .LinkClass }}{{ if and .LinkClass .On }} {{ end }}{{ if .On }}active{{ end }}"{{ end }}>{{ .Pub.Publisher }} &nearr;</a>
{{- else if .Pub.ReportingOnly }}{{ .Pub.Publisher }}
{{- else }}<a href="/browse/publisher/{{ pathEscape .Pub.Publisher }}{{ with .QS }}{{ . }}{{ end }}"{{ if or .PageClass .On }} class="{{ .PageClass }}{{ if and .PageClass .On }} {{ end }}{{ if .On }}active{{ end }}"{{ end }}>{{ .Pub.Publisher }}</a>{{ end }}
{{- end }}
{{ define "sort-th" }}{{ if .URL }}<th{{ with .Class }} class="{{ . }}"{{ end }}><a href="{{ .URL }}">{{ .Label }} {{ if .Active }}{{ if .Desc }}&#9660;{{ else }}&#9650;{{ end }}{{ else }}<span class="sort-hint">&#8597;</span>{{ end }}</a></th>{{ else }}<th{{ with .Class }} class="{{ . }}"{{ end }}>{{ .Label }}</th>{{ end }}{{ end }}
{{ define "doc-table" }}
<div class="table-scroll">
<table class="data-table">
<thead>
<tr>{{ range .TableHeads }}{{ template "sort-th" . }}{{ end }}</tr>
</thead>
<tbody>
{{ if .RowsHTML }}{{ .RowsHTML }}{{ else }}{{ range .TableRows }}{{ template "doc-table-row" . }}{{ end }}{{ end }} </tbody>
</table>
</div>
{{ end }}
{{/* The rows are rendered once for every reader, so a FOIA release's links
always name every collection: they must list the release itself. */}}
{{ define "doc-table-row" }}{{ $qs := "" }}{{ if eq .Collection "foia" }}{{ $qs = wholeArchiveQS }}{{ end }}
<tr>
<td>
<a href="/doc/{{ .ID }}"><strong>{{ .Title }}</strong></a>
[<a href="/files/{{ .ID }}/{{ pathEscape .PDFFile }}" target="_blank" rel="noopener">pdf</a>]
</td>
<td>
{{ if .DocMeta.Creator }}<a href="/browse/agency/{{ pathEscape .DocMeta.Creator }}{{ $qs }}">{{ .DocMeta.Creator }}</a>{{ else }}-{{ end }}
</td>
<td>
{{ with .DocMeta.DateCreated }}{{ . }}{{ else }}-{{ end }}
</td>
<td>
{{- $first := true -}}
{{- range .Publication -}}
{{- if .DatePublished -}}
{{- if not $first -}}, {{ end -}}
{{ .DatePublished }}
{{- $first = false -}}
{{- end -}}
{{- end -}}
{{- if $first -}}-{{- end -}}
</td>
<td>{{ facetLinks (dict "Vals" .DocMeta.Classification "Cat" "classification" "QS" $qs) }}</td>
<td>{{ facetLinks (dict "Vals" .DocMeta.Dissemination "Cat" "dissemination" "QS" $qs) }}</td>
<td>{{ facetLinks (dict "Vals" .DocMeta.Programs "Cat" "program" "QS" $qs) }}</td>
<td>{{ facetLinks (dict "Vals" .DocMeta.Countries "Cat" "country" "QS" $qs) }}</td>
<td>{{ facetLinks (dict "Vals" .DocMeta.People "Cat" "people" "QS" $qs) }}</td>
<td>{{ facetLinks (dict "Vals" .JournalistsDeduped "Cat" "journalist" "QS" $qs) }}</td>
<td>
{{- $first = true -}}
{{- range .Publication -}}
{{- if .Publisher -}}
{{- if not $first -}}, {{ end -}}
{{ template "pub-publisher" (dict "Pub" . "QS" $qs) }}
{{- $first = false -}}
{{- end -}}
{{- end -}}
{{- if $first -}}-{{- end -}}
</td>
<td>
{{ template "type-badge" .Type }}
{{ if and .MarkReported .ReportedIssue }}<span class="issue-reported" title="Individually reported - also in the Reported collection">reported</span>{{ end }}
</td>
</tr>
{{ end }}
{{ define "doc-cards" }}
<ul class="doc-grid">
{{ range .Docs }}
<li class="doc-card">
{{ if $.ShowThumbs }}
<div class="thumb-container"{{ if and $.CardPagePreview .Images }} data-pp-id="{{ .ID }}" data-pp-imgs="{{ range $i, $im := .Images }}{{ if $i }} {{ end }}{{ pathEscape $im }}{{ end }}"{{ end }}>
<a href="/doc/{{ .ID }}" class="thumb" tabindex="-1" aria-hidden="true">
{{ if .HasThumb }}
<img src="/files/{{ .ID }}/thumb.jpg"
{{ if .HasGifThumb }}data-gif="/files/{{ .ID }}/thumb.gif"{{ end }}
class="doc-img"
alt="" loading="lazy">
{{ end }}
</a>
</div>
{{ end }}
<div class="doc-body">
{{ $cat := $.ActiveCategory }}{{ $val := $.ActiveValue }}
{{/* A FOIA release's links name every collection for a reader who
leaves FOIA out: the pages they open must list the release. */}}
{{ $qs := "" }}{{ if eq .Collection "foia" }}{{ $qs = $.FOIAQS }}{{ end }}
<h3>
<a href="/doc/{{ .ID }}" class="doc-title">{{ if .Title }}{{ .Title }}{{ else }}<span class="doc-untitled">(untitled)</span>{{ end }}</a>
{{ template "type-badge" .Type }}
{{ if and $.MarkReported .ReportedIssue }}<span class="issue-reported" title="Individually reported - also in the Reported collection">reported</span>{{ end }}
<a href="/files/{{ .ID }}/{{ pathEscape .PDFFile }}" target="_blank" rel="noopener" class="doc-pdf" title="Open PDF">[pdf]</a>
{{ if $.ShowUnpin }}
<button type="submit" form="unpin-{{ .ID }}" class="link-btn unpin-btn" title="Remove from pinned">&#9733; unpin</button>
{{ end }}
</h3>
{{ if $.ShowUnpin }}
<form method="POST" action="/pin/{{ .ID }}" id="unpin-{{ .ID }}" class="inline-form">
<input type="hidden" name="back" value="/pinned">
</form>
{{ end }}
<div class="doc-content">
<div>
{{ if .DocMeta.Creator }}
<a href="/browse/agency/{{ pathEscape .DocMeta.Creator }}{{ $qs }}"
class="doc-creator{{ if and (eq $cat "agency") (eqFold .DocMeta.Creator $val) }} active{{ end }}">{{ .DocMeta.Creator }}</a>
{{ end }}
{{ if and .DocMeta.Creator .DocMeta.DateCreated }}
<span class="doc-dot">&middot;</span>
{{ end }}
{{ if .DocMeta.DateCreated }}
{{ if ge (len .DocMeta.DateCreated) 4 }}
{{ $year := slice .DocMeta.DateCreated 0 4 }}
<a href="/browse/docdate/{{ $year }}{{ $qs }}"
class="doc-created{{ if and (eq $cat "docdate") (eq $year $val) }} active{{ end }}">{{ .DocMeta.DateCreated }}</a>
{{ else }}
<span class="doc-created">{{ .DocMeta.DateCreated }}</span>
{{ end }}
{{ end }}
{{ if .Pages }}
{{ if or .DocMeta.Creator .DocMeta.DateCreated }}
<span class="doc-dot">&middot;</span>
{{ end }}
<span class="doc-pages">{{ .Pages }} p.</span>
{{ end }}
</div>
{{ if and .Description (not $.HideSummary) }}
<p class="card-summary">{{ .Description }}</p>
{{ end }}
{{ if and (or .DocMeta.Classification .DocMeta.Dissemination) (not $.HideClassification) }}
<div>
<span class="doc-classification">Marking:</span>
{{ with .DocMeta.Classification }}{{ facetLinks (dict "Vals" . "Cat" "classification" "Sep" "dot" "Active" (and (eq $cat "classification") $val) "QS" $qs) }}{{ end }}
{{ if and .DocMeta.Classification .DocMeta.Dissemination }}<span class="doc-dot">&middot;</span>{{ end }}
{{ with .DocMeta.Dissemination }}{{ facetLinks (dict "Vals" . "Cat" "dissemination" "Sep" "dot" "Active" (and (eq $cat "dissemination") $val) "QS" $qs) }}{{ end }}
</div>
{{ end }}
{{ if and .DocMeta.Programs (not $.HidePrograms) }}
<div>
<span class="doc-programs">Programs:</span>
{{ facetLinks (dict "Vals" .DocMeta.Programs "Cat" "program" "Sep" "dot" "Active" (and (eq $cat "program") $val) "QS" $qs) }}
</div>
{{ end }}
{{ if and .DocMeta.People (not $.HidePeople) }}
<div>
<span class="doc-people">People:</span>
{{ facetLinks (dict "Vals" .DocMeta.People "Cat" "people" "Sep" "dot" "Active" (and (eq $cat "people") $val) "QS" $qs) }}
</div>
{{ end }}
<div class="doc-publication">
{{ $shown := false }}
{{ range $pub := .Publication }}
{{ if or $pub.Title $pub.Link $pub.Publisher $pub.DatePublished }}
{{ if $shown }}<span class="doc-dot">&middot;</span>{{ end }}{{ $shown = true }}
{{ if $pub.Title }}
{{ $ak := articleKey $pub.Link }}
{{ if $ak }}<a href="/article/{{ $ak }}" class="pub-article-title">&ldquo;{{ $pub.Title }}&rdquo;</a>{{ else }}<span class="pub-article-title">&ldquo;{{ $pub.Title }}&rdquo;</span>{{ end }}
-
{{ end }}
{{ if or $pub.Link $pub.Publisher }}
{{ template "pub-publisher" (dict "Pub" $pub "QS" $qs "LinkClass" "pub-link" "PageClass" "pub-source" "On" (and (eq $cat "publisher") (eqFold $pub.Publisher $val))) }}
{{ end }}
{{ if $pub.DatePublished }}
<span class="doc-published">({{ $pub.DatePublished }})</span>
{{ end }}
{{ end }}
{{ end }}
{{ $journos := .JournalistsDeduped }}
{{ if and $journos (not $.HideJournalists) }}
<span class="doc-dot">&middot;</span>
{{ range $i, $j := $journos }}
{{ if $i }}<span class="doc-dot">&middot;</span>{{ end }}
<a href="/browse/journalist/{{ pathEscape $j }}{{ $qs }}"
class="doc-journalist{{ if and (eq $cat "journalist") (eqFold $j $val) }} active{{ end }}">{{ $j }}</a>
{{ end }}
{{ end }}
</div>
</div>
</div>
</li>
{{ end }}
</ul>
{{ end }}
{{ define "type-filter" }}
<form method="GET" action="{{ .Action }}" class="type-filter">
{{ range $k, $vals := .Params }}
{{ if and (ne $k "type") (ne $k "p") (ne $k "action") }}
{{ range $vals }}
<input type="hidden" name="{{ $k }}" value="{{ . }}">
{{ end }}
{{ end }}
{{ end }}
<span class="muted">Show:</span>
{{ range $type, $count := .AllTypes }}
<label class="type-filter-option">
<input type="checkbox" name="type" value="{{ $type }}"
{{ if index $.SelectedTypes $type }}checked{{ end }}>
{{ template "type-badge" $type }}
{{ if eq $type "REPORTED" }}<span class="type-filter-leak">Reported</span>{{ end }}
<span class="faint type-filter-count">({{ $count }})</span>
</label>
{{ end }}
<button type="submit" class="ctl">Apply</button>
</form>
{{ end }}
{{ define "pagination" }}
{{ if gt .TotalPages 1 }}
{{ $sortParam := "" }}{{ if .Sort }}{{ $sortParam = print "&sort=" .Sort }}{{ end }}
{{ $orderParam := "" }}{{ if .Order }}{{ $orderParam = print "&order=" .Order }}{{ end }}
<nav class="pagination" aria-label="Pagination">
{{ if gt .Page 1 }}
<a href="{{ .BaseURL }}p={{ add .Page -1 }}{{ $sortParam }}{{ $orderParam }}" class="pag-btn" rel="prev">&laquo; Prev</a>
{{ end }}
{{ range pages .Page .TotalPages }}
{{ if eq . 0 }}
<span class="pag-ellipsis" aria-hidden="true">...</span>
{{ else if eq . $.Page }}
<span class="pag-btn pag-current" aria-current="page">{{ . }}</span>
{{ else }}
<a href="{{ $.BaseURL }}p={{ . }}{{ $sortParam }}{{ $orderParam }}" class="pag-btn">{{ . }}</a>
{{ end }}
{{ end }}
{{ if lt .Page .TotalPages }}
<a href="{{ .BaseURL }}p={{ add .Page 1 }}{{ $sortParam }}{{ $orderParam }}" class="pag-btn" rel="next">Next &raquo;</a>
{{ end }}
</nav>
{{ end }}
{{ end }}
{{ define "timeline-hist" }}
<div class="timeline-block">
<h2 class="timeline-label">{{ .Label }} <span class="faint">({{ len .Bars }} years)</span></h2>
<div class="date-hist entity-timeline-hist">
{{ range .Bars }}
{{ if .URL }}
<a class="hist-col" href="{{ .URL }}" title="{{ .Count }} documents {{ $.Verb }} {{ .Year }}">
<span class="hist-count">{{ .Count }}</span>
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
<span class="hist-year">{{ .Year }}</span>
</a>
{{ else }}
<span class="hist-col" title="{{ .Count }} documents {{ $.Verb }} {{ .Year }}">
<span class="hist-count">{{ .Count }}</span>
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
<span class="hist-year">{{ .Year }}</span>
</span>
{{ end }}
{{ end }}
</div>
</div>
{{ end }}
{{ define "sort-bar" }}
{{ $base := .SortURL }}
{{ $order := .Order }}
{{ $showRelevance := .ShowRelevance }}
{{ $cur := .SortBy }}
{{ if eq $cur "" }}{{ $cur = .DefaultSort }}{{ end }}
{{ $activeLabel := sortLabel $cur }}
{{ $directed := ne $cur "relevance" }}
{{ $orderLabel := "↑" }}{{ if eq $order "desc" }}{{ $orderLabel = "↓" }}{{ end }}
<details class="sort-dropdown">
<summary
aria-label="Sort documents, currently sorted by {{ $activeLabel }}{{ if $directed }} {{ if eq $order "desc" }}descending{{ else }}ascending{{ end }}{{ end }}">
Sort: <strong>{{ $activeLabel }}</strong>
{{ if $directed }}<span aria-hidden="true">{{ $orderLabel }}</span>{{ end }}
</summary>
<div role="navigation" aria-label="Sort options" class="sort-options">
{{ range sortOptions }}
{{ if or (ne .Key "relevance") $showRelevance }}
{{ $active := eq .Key $cur }}
{{ $flips := and $active (ne .Key "relevance") }}
{{ $href := print $base "sort=" .Key }}
{{ if and $flips (ne $order "desc") }}{{ $href = print $href "&order=desc" }}{{ end }}
<a href="{{ $href }}" class="{{ if $active }}active{{ end }}" {{ if $active }}aria-current="true"{{ end }}>
{{ .Label }}
{{ if $flips }}
<span aria-hidden="true">{{ $orderLabel }}</span>
<span class="sr-only">{{ if eq $order "desc" }}descending, click for ascending{{ else }}ascending, click for descending{{ end }}</span>
{{ end }}
</a>
{{ end }}
{{ end }}
</div>
</details>
{{ end }}
{{ define "type-badge" }}
{{ if eq . "FOIA" }}
<span class="type-badge type-badge--foia">FOIA</span>
{{ else if eq . "SIDTODAY" }}
<span class="type-badge type-badge--sidtoday" title="This document is part of SIDtoday">SIDtoday</span>
{{ end }}
{{ end }}
{{ define "lightbox-overlays" }}
{{ $lbBase := .ImageBase }}{{ $lbN := len .Images }}
{{ range $i, $img := .Images }}
<div class="lightbox" id="lb-{{ add $i 1 }}" aria-label="Page {{ add $i 1 }} of {{ $lbN }}">
<a class="lb-backdrop" href="#lb-closed" tabindex="-1" aria-hidden="true"></a>
<a class="lb-close" href="#lb-closed" title="Close">&times;</a>
{{ if $i }}<a class="lb-prev" href="#lb-{{ $i }}" title="Previous page">&lsaquo;</a>{{ end }}
{{ if lt (add $i 1) $lbN }}<a class="lb-next" href="#lb-{{ add $i 2 }}" title="Next page">&rsaquo;</a>{{ end }}
<img src="{{ $lbBase }}{{ pathEscape $img }}"{{ $.ImageSize $i }} alt="Page {{ add $i 1 }} of {{ $lbN }}" loading="lazy" decoding="async">
<span class="lb-counter">{{ add $i 1 }} / {{ $lbN }}{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} &middot; differs from the main document{{ end }}</span>
</div>
{{ end }}
{{ end }}
{{ define "changed-page-links" }}
{{- $v := . -}}
{{- range $k, $p := .ChangedPages -}}
{{- if $k }}, {{ end -}}
{{- if $p.Pos }}<a href="/doc/{{ $v.DocID }}/versions/{{ $v.Slug }}/pages#lb-{{ $p.Pos }}" title="Open page {{ $p.Page }} of this copy">{{ $p.Page }}</a>{{ else }}{{ $p.Page }}{{ end -}}
{{- end -}}
{{ end }}
{{ define "doc-viewport" }}
<input type="radio" name="view-control" id="view-images" aria-controls="doc-viewport" {{ if eq .Prefs.DocView "images" }}checked{{ end }}>
<input type="radio" name="view-control" id="view-split" aria-controls="doc-viewport" {{ if eq .Prefs.DocView "split" }}checked{{ end }}>
<input type="radio" name="view-control" id="view-text" aria-controls="doc-viewport" {{ if eq .Prefs.DocView "text" }}checked{{ end }}>
<div class="view-picker" role="radiogroup" aria-label="Document display mode">
<label for="view-images" class="btn-img">Images Only</label>
<label for="view-split" class="btn-split">Split View</label>
<label for="view-text" class="btn-txt">Text Only</label>
</div>
<div id="doc-viewport" class="content-wrapper{{ if .Prefs.ScrollDoc }} scroll-panes{{ end }}">
<div class="pane images-pane">
{{ if gt (len .Images) 1 }}
<nav class="page-jump" aria-label="Jump to page">
<span class="faint">Page:</span>
{{ range $i, $img := .Images }}<a href="#page-{{ add $i 1 }}"{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} class="page-changed-jump" title="Differs from the main document"{{ end }}>{{ add $i 1 }}</a>{{ end }}
</nav>
{{ end }}
<div class="image-list">
{{ if .Prefs.TextOnly }}
<p class="muted textonly-note">Text-only mode is on - page images are not loaded. <a href="/preferences">Preferences</a></p>
<ul class="page-link-list">
{{ range $i, $img := .Images }}
<li id="page-{{ add $i 1 }}"><a href="{{ $.ImageBase }}{{ pathEscape $img }}" target="_blank" rel="noopener">Page {{ add $i 1 }}</a>{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} <span class="muted">(differs from the main document)</span>{{ end }}</li>
{{ end }}
</ul>
{{ else }}
{{ range $i, $img := .Images }}
<a href="#lb-{{ add $i 1 }}" id="page-{{ add $i 1 }}" class="page-open{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} page-changed{{ end }}" title="Open page {{ add $i 1 }} full screen">
<img src="{{ $.ImageBase }}{{ pathEscape $img }}"{{ $.ImageSize $i }}
alt="Page {{ add $i 1 }}"
loading="lazy">
{{- if and $.Version ($.Version.PageChanged (add $i 1)) }}<span class="page-changed-badge">differs</span>{{ end }}
</a>
{{ end }}
{{ end }}
</div>
</div>
<div class="pane text-pane">
<div class="prose">
{{ .Content }}
</div>
</div>
</div>
{{ end }}

46
templates/pinned.html Normal file
View file

@ -0,0 +1,46 @@
{{ define "title" }}Pinned - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<h1>Pinned documents
<small class="count-note">{{ .Total }} pinned</small>
{{ if .Total }}<a href="/pinned/export" class="export-link" title="Download your pinned list as JSON">export JSON</a>{{ end }}
</h1>
</header>
<p class="muted">Pins are stored only in this browser's cookies.</p>
{{ if .Full }}
<p class="muted" role="status"><strong>Your pinned list is full.</strong> A browser cookie holds only so much, so that pin was not added. Unpin a document or a search below to make room.</p>
{{ end }}
{{ if .Cards.Docs }}
<h2 class="sr-only">Documents</h2>
{{ template "doc-cards" .Cards }}
{{ else }}
<p class="muted">Nothing pinned yet. Open a document and press <strong>&#9734; Pin</strong> to start a reading list.</p>
{{ end }}
{{ if .Searches }}
<h2 class="pinned-searches-heading">Pinned searches</h2>
<ul class="pinned-searches">
{{ range .Searches }}
<li class="pinned-search-item">
<a class="pill" href="{{ .URL }}">{{ .Label }}</a>
<form method="POST" action="/pinsearch" class="inline-form">
<input type="hidden" name="qs" value="{{ .QS }}">
<input type="hidden" name="back" value="/pinned">
<button type="submit" class="link-btn unpin-btn" title="Remove this search">&#9733; unpin</button>
</form>
</li>
{{ end }}
</ul>
{{ end }}
<section class="note-list-box" id="note-list-box" hidden>
<h2>My notes
<button type="button" class="export-link" id="note-export" title="Download all notes as JSON">export JSON</button>
</h2>
<p class="muted">Stored only in this browser (localStorage).</p>
<ul class="note-list" id="note-list"></ul>
</section>
{{ end }}
{{ template "base.html" . }}

82
templates/portions.html Normal file
View file

@ -0,0 +1,82 @@
{{ define "title" }}Portion markings - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<p class="crumb"><a href="/explore">&larr; Explore</a></p>
<h1>Portion markings</h1>
</header>
<p class="muted">The marking each classified portion of a document carries at the
start of its own line (for example "<code>(U//FOUO)</code>", "<code>(TS//SI//NF)</code>").</p>
<h2>By level</h2>
<div class="table-scroll">
<table class="cat-table explore-table">
<thead><tr><th>Level</th><th></th><th class="num">Markings</th><th class="num">Documents</th></tr></thead>
<tbody>
{{ range .Stats.Levels }}
<tr>
<td><a href="{{ .SearchURL }}"><code>{{ .Name }}</code></a></td>
<td class="faint">{{ .Label }}</td>
<td class="num">{{ .Marks }}</td>
<td class="num">{{ .Docs }}</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
<h2>Markings</h2>
<p class="muted">Every distinct marking, most used first.
{{ if gt .Stats.Distinct .RowLimit }}Top {{ .RowLimit }} of {{ .Stats.Distinct }}.{{ end }}</p>
<div class="table-scroll">
<table class="cat-table explore-table">
<thead><tr><th>Marking</th><th class="num">Markings</th><th class="num">Documents</th></tr></thead>
<tbody>
{{ range .Stats.Markings }}
<tr>
<td><a href="{{ .SearchURL }}"><code>{{ .Name }}</code></a></td>
<td class="num">{{ .Marks }}</td>
<td class="num">{{ .Docs }}</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
<h2>Control markings</h2>
<p class="muted">The compartments and dissemination controls appearing inside
those markings.</p>
<div class="table-scroll">
<table class="cat-table explore-table">
<thead><tr><th>Control</th><th class="num">Markings</th><th class="num">Documents</th></tr></thead>
<tbody>
{{ range .Stats.Controls }}
<tr>
<td><a href="{{ .SearchURL }}"><code>{{ .Name }}</code></a></td>
<td class="num">{{ .Marks }}</td>
<td class="num">{{ .Docs }}</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ if .Stats.UnrecogEg }}
<h2>Not recognised</h2>
<p class="muted">{{ .Stats.Unrecog }} markings open a line with a classification
level but carry a part this server has no rule for.</p>
<div class="table-scroll">
<table class="cat-table explore-table">
<thead><tr><th>As the transcript writes it</th><th class="num">Occurrences</th></tr></thead>
<tbody>
{{ range .Stats.UnrecogEg }}
<tr><td><code>({{ .Name }})</code></td><td class="num">{{ .Marks }}</td></tr>
{{ end }}
</tbody>
</table>
</div>
{{ end }}
{{ end }}
{{ template "base.html" . }}

View file

@ -0,0 +1,97 @@
{{ define "title" }}Preferences - Snowden Archive{{ end }}
{{ define "content" }}
<h1>Preferences</h1>
<p class="muted">Preferences are saved in browser cookies.</p>
{{ if .Saved }}<p class="pref-saved">Settings saved.</p>{{ end }}
{{ if .Reset }}<p class="pref-saved">Preferences reset to defaults.</p>{{ end }}
<form action="/preferences/save" method="POST" class="pref-form">
<fieldset>
<legend>Theme</legend>
<label><input type="radio" name="theme" value="auto" {{ if eq .Prefs.Theme "auto" }}checked{{ end }}> Auto (follow browser)</label>
<label><input type="radio" name="theme" value="light" {{ if eq .Prefs.Theme "light" }}checked{{ end }}> Light</label>
<label><input type="radio" name="theme" value="dark" {{ if eq .Prefs.Theme "dark" }}checked{{ end }}> Dark</label>
<label><input type="checkbox" name="text_only" value="1" {{ if .Prefs.TextOnly }}checked{{ end }}> Text-only mode - no thumbnails or page images, links instead</label>
</fieldset>
<fieldset>
<legend>Browse lists</legend>
<label>Documents per page:
<select name="per_page">
<option value="10" {{ if eq .Prefs.PerPage 10 }}selected{{ end }}>10</option>
<option value="20" {{ if eq .Prefs.PerPage 20 }}selected{{ end }}>20</option>
<option value="50" {{ if eq .Prefs.PerPage 50 }}selected{{ end }}>50</option>
<option value="100" {{ if eq .Prefs.PerPage 100 }}selected{{ end }}>100</option>
<option value="all" {{ if eq .Prefs.PerPage 0 }}selected{{ end }}>All (up to {{ .MaxCards }} a page)</option>
</select>
</label>
<label><input type="checkbox" name="hide_classification" value="1" {{ if not .Prefs.ShowClassification }}checked{{ end }}> Hide classification and dissemination markings on document cards</label>
<label><input type="checkbox" name="hide_journalists" value="1" {{ if not .Prefs.ShowJournalists }}checked{{ end }}> Hide journalist names on document cards</label>
<label><input type="checkbox" name="hide_people" value="1" {{ if not .Prefs.ShowPeople }}checked{{ end }}> Hide the people line on document cards</label>
<label><input type="checkbox" name="hide_programs" value="1" {{ if not .Prefs.ShowPrograms }}checked{{ end }}> Hide program names on document cards</label>
<label><input type="checkbox" name="hide_summary" value="1" {{ if not .Prefs.ShowSummary }}checked{{ end }}> Hide short summaries on document cards</label>
<label><input type="checkbox" name="hide_thumbs" value="1" {{ if not .Prefs.ShowThumbs }}checked{{ end }}> Hide thumbnails on search results and document cards</label>
<label><input type="checkbox" name="show_coll_cols" value="1" {{ if .Prefs.ShowCollCols }}checked{{ end }}> Always show the per-type count columns on category tables <span class="muted pref-note">(Reported / SIDtoday / FOIA breakdown - otherwise behind a toggle on each table)</span></label>
<label><input type="checkbox" name="page_preview" value="1" {{ if .Prefs.CardPagePreview }}checked{{ end }}> Page preview on card-thumbnail hover <span class="muted pref-note">(desktop only - hover a thumbnail to preview the full pages; press h / l or the arrow keys to flip pages.)</span></label>
</fieldset>
<fieldset>
<legend>FOIA releases</legend>
<label><input type="checkbox" name="include_foia" value="1" {{ if .Prefs.IncludeFOIA }}checked{{ end }}> Include FOIA releases <span class="muted pref-note">(official releases from FOIA litigation and FISC and ODNI declassifications, not Snowden documents)</span></label>
</fieldset>
<fieldset>
<legend>Document layout</legend>
<label>Default view:
<select name="doc_view">
<option value="images" {{ if eq .Prefs.DocView "images" }}selected{{ end }}>Images only</option>
<option value="split" {{ if eq .Prefs.DocView "split" }}selected{{ end }}>Split view (images + text)</option>
<option value="text" {{ if eq .Prefs.DocView "text" }}selected{{ end }}>Text only</option>
</select>
</label>
<label>Document info:
<select name="info_position">
<option value="above" {{ if not .Prefs.InfoSidebar }}selected{{ end }}>Above the document</option>
<option value="beside" {{ if .Prefs.InfoSidebar }}selected{{ end }}>Beside the document (sidebar)</option>
</select>
<span class="muted pref-note">(desktop only)</span>
</label>
<label><input type="checkbox" name="scroll_doc" value="1" {{ if .Prefs.ScrollDoc }}checked{{ end }}> Scroll within the document panes <span class="muted pref-note">(cap the image/text area height instead of letting a long document stretch the page; ignored when the info sidebar is on)</span></label>
</fieldset>
<fieldset>
<legend>Document details</legend>
<label><input type="checkbox" name="open_info" value="1" {{ if .Prefs.OpenInfo }}checked{{ end }}> Expand &ldquo;More info&rdquo; by default</label>
<label><input type="checkbox" name="collapse_pub" value="1" {{ if .Prefs.CollapsePubTogether }}checked{{ end }}> Collapse &ldquo;Published in the same report&rdquo; by default</label>
<label><input type="checkbox" name="collapse_related" value="1" {{ if .Prefs.CollapseRelated }}checked{{ end }}> Collapse &ldquo;Related documents&rdquo; by default</label>
<label><input type="checkbox" name="programs_list" value="1" {{ if .Prefs.ProgramsAsList }}checked{{ end }}> Show programs one per line <span class="muted pref-note">(instead of comma-separated)</span></label>
<label><input type="checkbox" name="tags_list" value="1" {{ if .Prefs.TagsAsList }}checked{{ end }}> Show tags one per line <span class="muted pref-note">(instead of comma-separated)</span></label>
</fieldset>
<fieldset>
<legend>History <span class="muted pref-note">(off by default - nothing is recorded unless you opt in; saved in this browser's cookies; turning this off deletes the history)</span></legend>
<label><input type="checkbox" name="track_recent" value="1" {{ if .Prefs.TrackRecent }}checked{{ end }}> Remember recently viewed documents (shown on the home page)</label>
<label><input type="checkbox" name="track_searches" value="1" {{ if .Prefs.TrackSearches }}checked{{ end }}> Remember recent searches (shown on the search page)</label>
</fieldset>
<div class="pref-actions">
<button type="submit" class="pref-save">Save preferences</button>
<button type="submit" name="reset" value="1" class="pref-reset">Reset to defaults</button>
</div>
</form>
<details id="custom-css-details" class="custom-css-details" hidden>
<summary>Custom CSS <span class="muted pref-note">(for advanced users)</span></summary>
<p class="muted pref-note">Stored only in the localStorage and applied on every page. To turn it off, empty the box and save. If a bad rule ever makes the site unusable, open any page with <code>?nocss=1</code> (e.g. <code>/preferences?nocss=1</code>).</p>
<textarea id="custom-css" rows="8" spellcheck="false" placeholder="/* e.g. */
.prose { font-size: 1.05rem; line-height: 1.8; }
.doc-card { border-width: 2px; }"></textarea>
<div class="custom-css-actions">
<button type="button" id="custom-css-save" class="ctl">Save CSS</button>
<span class="custom-css-status faint" id="custom-css-status"></span>
</div>
</details>
{{ end }}
{{ template "base.html" . }}

280
templates/search.html Normal file
View file

@ -0,0 +1,280 @@
{{ define "title" }}{{ with .QueryLabel }}{{ . }} - {{ end }}Search - Snowden Archive{{ end }}
{{ define "search-result-item" }}
{{ $r := .Result }}{{ $d := $r.Doc }}
{{ $qs := "" }}{{ if eq $d.Collection "foia" }}{{ $qs = .FOIAQS }}{{ end }}
<li class="doc-card search-result">
{{ if .ShowThumbs }}
<a href="/doc/{{ $d.ID }}" class="result-thumb" tabindex="-1" aria-hidden="true"{{ if and .CardPagePreview $d.Images }} data-pp-id="{{ $d.ID }}" data-pp-imgs="{{ range $i, $im := $d.Images }}{{ if $i }} {{ end }}{{ pathEscape $im }}{{ end }}"{{ end }}>
{{ if $d.HasThumb }}
<img src="/files/{{ $d.ID }}/thumb.jpg"{{ if $d.HasGifThumb }} data-gif="/files/{{ $d.ID }}/thumb.gif"{{ end }}
class="doc-img" alt="" loading="lazy">
{{ end }}
</a>
{{ end }}
<div class="result-body">
<h3 class="result-title">
<a href="/doc/{{ $d.ID }}" class="result-title-link">{{ $r.Title }}</a>
<a href="/files/{{ $d.ID }}/{{ pathEscape $d.PDFFile }}" target="_blank" rel="noopener" class="doc-pdf">[pdf]</a>
</h3>
<span class="doc-type">{{ template "type-badge" $d.Type }}</span>
{{ if $d.Publication }}
{{/* A year links to its publication-year page only when that page
lists the document: the year of its FIRST publication. */}}
<div class="result-pubs">
{{- $shown := false -}}
{{- range $pub := $d.Publication -}}
{{- if $pub.Publisher -}}
{{- if $shown }} &middot; {{ end }}{{ $shown = true -}}
{{ template "pub-publisher" (dict "Pub" $pub "QS" $qs) }}
{{- if ge (len $pub.DatePublished) 4 }}{{ $y := slice $pub.DatePublished 0 4 }} {{ if eq $y $d.FirstPubYear }}<a href="/browse/published/{{ $y }}{{ $qs }}" class="meta-link-softer">{{ $y }}</a>{{ else }}<span class="meta-link-softer">{{ $y }}</span>{{ end }}{{ end -}}
{{- range $j, $r := $pub.Journalists }}{{ if $j }}, {{ else }} - {{ end }}<a href="/browse/journalist/{{ pathEscape $r }}{{ $qs }}">{{ $r }}</a>{{ end -}}
{{- end -}}
{{- end }}
</div>
{{ end }}
<div class="result-meta">
{{ if $d.DocMeta.Creator }}
<a href="/browse/agency/{{ pathEscape $d.DocMeta.Creator }}{{ $qs }}" class="meta-link-soft">{{ $d.DocMeta.Creator }}</a>
{{ end }}
{{ if and $d.DocMeta.Creator $d.DocMeta.DateCreated }}
<span class="doc-dot">·</span>
{{ end }}
{{ if $d.DocMeta.DateCreated }}
{{ if ge (len $d.DocMeta.DateCreated) 4 }}
<a href="/browse/docdate/{{ slice $d.DocMeta.DateCreated 0 4 }}{{ $qs }}" class="meta-link-softer">{{ $d.DocMeta.DateCreated }}</a>
{{ else }}
<span class="meta-link-softer">{{ $d.DocMeta.DateCreated }}</span>
{{ end }}
{{ end }}
{{ if $d.DocMeta.Programs }}
<span class="doc-dot">·</span>
{{ $progs := $d.DocMeta.Programs }}
{{ $shown := $progs }}{{ if gt (len $progs) 8 }}{{ $shown = slice $progs 0 8 }}{{ end }}
{{ facetLinks (dict "Vals" $shown "Cat" "program" "Sep" "dot" "Class" "meta-link-soft" "QS" $qs) }}
{{ if gt (len $progs) 8 }}<span class="faint">+{{ add (len $progs) -8 }} more</span>{{ end }}
{{ end }}
</div>
<div class="result-desc">{{ $r.Desc }}</div>
{{ range $r.Snippets }}
<div class="search-result-snippet">{{ . }}</div>
{{ end }}
{{ range $r.VersionSnippets }}
<div class="search-result-snippet version-snippet"><a href="/doc/{{ $d.ID }}/versions/{{ .Slug }}" class="snippet-source">Copy: {{ .Label }}</a> {{ .HTML }}</div>
{{ end }}
{{ with $r.MatchesIn }}
<div class="result-matches-in muted">Matches in:
{{- range $i, $v := . }}{{ if $i }},{{ end }} <a href="/doc/{{ $d.ID }}/versions/{{ $v.Slug }}">{{ $v.Label }}</a>{{ end }}
</div>
{{ end }}
</div>
</li>
{{ end }}
{{ define "content" }}
<h1 class="search-title">Search</h1>
<details class="search-ops-hint">
<summary>Search syntax help</summary>
<p>
Ways to write a value, in any row or after any operator:
<ul>
<li><code>cable tapping</code> finds both words anywhere, in their other forms too (<em>tapping</em> also finds <em>tapped</em>);</li>
<li><code>"apping"</code> finds that text anywhere, even inside a word, like <code>grep -i</code> (it finds for example <em>mapping</em> and <em>tapping</em>);</li>
<li><code>=tap</code> or <code>="cable tapping"</code> finds exactly those whole words, so <code>=tap</code> skips <em>taps</em> and <em>strap</em>, and on a metadata field it matches one whole value, so <code>agency:=NSA</code> finds documents whose agency is NSA but not <em>NSA, GCHQ</em>;</li>
<li><code>*</code> wildcard finds part of a word: <code>tap*</code> finds words starting with <em>tap</em>, <code>*land</code> words ending in <em>land</em> and <code>*keys*</code> words containing <em>keys</em>. A leading <code>*</code> needs at least three letters after it.</li>
<li><code>"upstream collection"~10</code> finds the words within 10 words of each other (in any order, common stopwords ignored).</li>
<li>A leading <code>-</code> excludes within its row: <code>xkeyscore -tempora</code> finds <em>xkeyscore</em> without <em>tempora</em>, and the row keeps that meaning under OR and NOT.</li>
</ul>
</p>
<p>
The simple search box (on home page, on 404 page, and via URL <code>?q=</code>) understands field operators:
<ul>
<li><code>program:XKEYSCORE country:Germany cable</code> or <code>journalist:="Poitras, Laura"</code>.</li>
<li>A leading <code>-</code> negates (<code>-tag:=junk</code>, <code>-draft</code>);</li>
<li><code>date:2013</code>, <code>date:2013..2015</code>, and <code>published:2014-06</code> filter by date.</li>
<li>Operators: text, title, content, description, agency, journalist, publisher, classification, program, dissemination, banner, genre, series, country, people, tag, type.</li>
<li>Bare words search all fields.</li>
</ul>
</p>
</details>
<form method="GET" action="/search" class="search-form search-panel">
<input type="hidden" name="do_search" value="1">
<button type="submit" name="action" value="search" aria-hidden="true" tabindex="-1" class="sr-only">Search</button>
<div class="query-rows">
{{ range $i, $val := .Queries }}
<div class="query-row">
<div class="qr-conj">
{{ if eq $i 0 }}
<span class="faint">Find</span>
<input type="hidden" name="fqc" value="and">
{{ else }}
<select name="fqc" aria-label="How row {{ add $i 1 }} combines with the rows above">
<option value="and" {{ if eq (index $.Conjs $i) "and" }}selected{{ end }}>and</option>
<option value="or" {{ if eq (index $.Conjs $i) "or" }}selected{{ end }}>or</option>
<option value="not" {{ if eq (index $.Conjs $i) "not" }}selected{{ end }}>and not</option>
</select>
{{ end }}
</div>
<input type="text" name="fqv" value="{{ $val }}" class="qr-term" aria-label="Search terms, row {{ add $i 1 }}"
placeholder='word, "text", =exact or *part*'>
<div class="qr-field">
<span class="faint qr-in">in</span>
{{ $fi := index $.Fields $i }}
<select name="fqf" aria-label="Field to search, row {{ add $i 1 }}">
{{ range $.FieldOptions }}
<option value="{{ .Code }}" {{ if eq $fi .Code }}selected{{ end }}>{{ .Label }}</option>
{{ end }}
</select>
</div>
{{ if ne $i 0 }}
<button type="submit" name="action" value="remove-{{ $i }}"
class="remove-row-btn" title="Remove this row">&times;</button>
{{ else }}
<span class="remove-row-spacer"></span>
{{ end }}
</div>
{{ end }}
<div class="query-row query-row-add">
<div class="qr-conj"></div>
{{ if lt (len .Queries) .ClauseLimit }}
<button type="submit" name="action" value="add" class="add-row-btn">+ Add row</button>
{{ else }}
<span class="faint">{{ .ClauseLimit }} rows is the most a search can have</span>
{{ end }}
</div>
</div>
{{ $hasDates := or .DateDocStart .DateDocEnd .DatePubStart .DatePubEnd }}
{{ $hasFilters := or $hasDates .CollFiltered }}
<details class="date-filters"{{ if $hasFilters }} open{{ end }}>
<summary>Filters{{ if $hasFilters }} <span class="faint">(active)</span>{{ end }}</summary>
<div class="coll-filter-row">
<span class="faint df-label">Collections</span>
<label class="coll-check"><input type="checkbox" name="coll" value="news"{{ if index .SelColl "news" }} checked{{ end }}> Reported</label>
<label class="coll-check"><input type="checkbox" name="coll" value="sidtoday-archive"{{ if index .SelColl "sidtoday-archive" }} checked{{ end }}> SIDtoday archive</label>
<label class="coll-check"><input type="checkbox" name="coll" value="foia"{{ if index .SelColl "foia" }} checked{{ end }}> FOIA</label>
</div>
<div class="date-filter-rows">
<div class="date-filter-row">
<span class="faint df-label">Doc date</span>
<input type="text" name="date_doc_start" value="{{ .DateDocStart }}" aria-label="Document date from" placeholder="yyyy-mm-dd">
<span class="faint">to</span>
<input type="text" name="date_doc_end" value="{{ .DateDocEnd }}" aria-label="Document date to" placeholder="yyyy-mm-dd">
</div>
<div class="date-filter-row">
<span class="faint df-label">Published</span>
<input type="text" name="date_pub_start" value="{{ .DatePubStart }}" aria-label="Published from" placeholder="yyyy-mm-dd">
<span class="faint">to</span>
<input type="text" name="date_pub_end" value="{{ .DatePubEnd }}" aria-label="Published to" placeholder="yyyy-mm-dd">
</div>
</div>
</details>
<div class="search-actions">
<button type="submit" name="action" value="search" class="search-btn">Search</button>
<a href="/search" class="faint reset-link">Reset</a>
</div>
</form>
{{ if .RecentSearches }}
<details class="recent-searches">
<summary>Recent searches <span class="faint">({{ len .RecentSearches }})</span></summary>
<div class="recent-list">
{{ range .RecentSearches }}<a class="pill" href="{{ .URL }}">{{ .Label }}</a>{{ end }}
<form method="POST" action="/history/clear" class="inline-form">
<input type="hidden" name="which" value="searches">
<input type="hidden" name="back" value="/search">
<button type="submit" class="link-btn faint">clear</button>
</form>
</div>
</details>
{{ end }}
<hr class="hr-soft">
{{ if .OverClauses }}
<p class="muted"><strong>Search not run:</strong> it has {{ .OverClauses }} parts - rows, or the
<code>field:</code>, &ldquo;quoted&rdquo; and <code>-excluded</code> terms of a typed query -
and a search can have at most {{ .ClauseLimit }}. The form above keeps the first {{ .ClauseLimit }};
the rest, including any exclusions at the end, were left out. Check the rows and search again.</p>
{{ else if .OverWords }}
<p class="muted"><strong>Search not run:</strong> it has {{ .OverWords }} words, counting the words of
&ldquo;quoted&rdquo; phrases and <code>-excluded</code> terms, and a search can have at most
{{ .WordLimit }}. Shorten it and search again.</p>
{{ end }}
{{ if .Searched }}
{{ if gt (len .SearchTypeCounts) 1 }}{{ template "type-filter" (dict "Action" "/search" "Params" .FormParams "AllTypes" .SearchTypeCounts "SelectedTypes" .SelTypeSet) }}{{ end }}
<div class="results-bar">
<h2 class="results-heading">{{ .Total }} result{{ if ne .Total 1 }}s{{ end }}</h2>
{{ template "sort-bar" (dict "SortURL" .SearchBaseURL "SortBy" .Sort "Order" .Order "ShowRelevance" true "DefaultSort" "relevance") }}
{{ if .Savable }}
<form method="POST" action="/pinsearch" class="inline-form">
<input type="hidden" name="qs" value="{{ .CanonicalQS }}">
<input type="hidden" name="back" value="{{ .SearchBaseURL }}">
<button type="submit" class="export-link pin-search-btn" title="{{ if .SearchPinned }}Remove this search from your pinned list{{ else }}Pin this search to your pinned list{{ end }}">{{ if .SearchPinned }}&#9733; unpin search{{ else }}&#9734; pin search{{ end }}</button>
</form>
{{ end }}
</div>
{{ if gt (len .DateHist) 1 }}
<div class="date-hist" aria-label="Matches per document year">
{{ range .DateHist }}
{{ if .URL }}
<a class="hist-col" href="{{ .URL }}" title="{{ .Count }} matches dated {{ .Year }}">
<span class="hist-count">{{ .Count }}</span>
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
<span class="hist-year">{{ .Year }}</span>
</a>
{{ else }}
<span class="hist-col hist-col-undated" title="{{ .Count }} matches with no document date">
<span class="hist-count">{{ .Count }}</span>
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
<span class="hist-year">{{ .Year }}</span>
</span>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ if .Results }}
{{ if .Facets }}
<details class="search-facets">
<summary>Refine results</summary>
<div class="facets-body">
{{ range .Facets }}
<div class="facet-group">
<span class="facet-label">{{ .Label }}</span>
<span class="facet-values">{{ range .Values }}<a class="facet-link" href="{{ .URL }}">{{ .Name }}<span class="facet-count">{{ .Count }}</span></a>{{ end }}</span>
</div>
{{ end }}
</div>
</details>
{{ end }}
<ul class="search-results{{ if .ShowThumbs }} has-thumbs{{ end }}">
{{ $showThumbs := .ShowThumbs }}
{{ range .Results }}{{ template "search-result-item" (dict "Result" . "ShowThumbs" $showThumbs "CardPagePreview" $.CardPagePreview "FOIAQS" $.FOIAQS) }}{{ end }}
</ul>
{{ if .SnippetsCapped }}
<p class="muted">Text snippets are shown for the first {{ .SnippetLimit }} results on this page -
choose a page size in <a href="/preferences">preferences</a>, or narrow the search, to see
snippets for the rest.</p>
{{ end }}
{{ template "pagination" (dict "Page" .Page "TotalPages" .TotalPages "BaseURL" .SearchBaseURL "Sort" .Sort "Order" .Order) }}
{{ else }}
<p class="muted">No matches found.</p>
{{ end }}
{{ end }}
{{ end }}
{{ template "base.html" . }}

59
templates/version.html Normal file
View file

@ -0,0 +1,59 @@
{{ define "title" }}{{ .Doc.Title }} ({{ .Version.Slug }}) - Snowden Archive{{ end }}
{{ define "content" }}
<header class="list-header">
<p class="crumb"><a href="/doc/{{ .Doc.ID }}">&larr; {{ .Doc.Title }}</a></p>
<h1>{{ .Doc.Title }} <small class="count-note">copy: {{ .Version.Slug }}</small></h1>
<p class="muted">Another published copy of this document that differs from the one on the
<a href="/doc/{{ .Doc.ID }}">document page</a> - for example less redacted, with extra pages, or a different scan.</p>
</header>
<div class="version-actions">
<a href="{{ .PDFURL }}" target="_blank" rel="noopener" class="doc-top-btn doc-pdf-link">Download this copy (PDF)</a>
{{ with .Version.Images }}<a href="/doc/{{ $.Doc.ID }}/versions/{{ $.Version.Slug }}/pages" class="doc-top-btn">All pages ({{ len . }})</a>{{ end }}
</div>
{{ if .Version.ChangedPages }}
<p class="changed-pages-note">Pages that differ from the main document: {{ template "changed-page-links" .Version }}</p>
{{ end }}
<div class="rule-top pub-block">
{{- range $i, $pub := .Publications }}
<div class="pub-entry{{ if $i }} pub-sep{{ end }}">
<div class="pub-title">
{{- with $pub.Publisher }}{{ . }}{{ else }}Unknown publisher{{ end -}}
{{- with $pub.DatePublished }} <span class="muted">{{ . }}</span>{{ end -}}
</div>
{{- if $pub.Title }}
<div class="pub-people"><em>{{ $pub.Title }}</em>{{ with $pub.Link }} <a href="{{ . }}" target="_blank" rel="noopener" class="pub-original">article &nearr;</a>{{ end }}</div>
{{- else if $pub.Link }}
<div class="pub-people"><a href="{{ $pub.Link }}" target="_blank" rel="noopener" class="pub-original">article &nearr;</a></div>
{{- end }}
{{- with $pub.Note }}
<div class="pub-note">{{ . }}</div>
{{- end }}
{{- if or $pub.DocSource $pub.DocURL }}
<div class="pub-copy muted">
{{- with $pub.DocSource }}<a href="{{ . }}" target="_blank" rel="noopener">document page &nearr;</a>{{ end -}}
{{- with $pub.DocURL }}<a href="{{ . }}" target="_blank" rel="noopener">original PDF &nearr;</a>{{ end -}}
</div>
{{- end }}
</div>
{{- else }}
<p class="muted">No publication record points at this copy.</p>
{{- end }}
</div>
{{ if or .Images .Version.HTMLContent }}
<div class="doc-container">
{{ template "doc-viewport" . }}
</div>
{{ else }}
<p class="muted rule-top">This copy has no transcript and no page images - only the PDF above.</p>
{{ end }}
{{ if and .Images (not .Prefs.TextOnly) }}
{{ template "lightbox-overlays" . }}
{{ end }}
{{ end }}
{{ template "base.html" . }}