Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/discovery/adding-a-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ end
that refuses to start rather than a `KeyError` on the first page that reaches
you (#144 Phase 0). It checks, per registered module: the five registration
callbacks; a `source_attrs/0` the catalog can seed (slug, name, attribution,
tier); a `capabilities/0` with the six documented keys at the documented types,
tier, and a `logo` under `priv/static/images/sources/` for the badge — or none,
and the badge is a monogram; see `docs/discovery/source-marks.md`); a `capabilities/0` with the six documented keys at the documented types,
at least one operation and one content type, every content type one
`ContentTypes` can present; pacing keys that are non-negative integers **where
declared** (absent is legal and means unpaced); and, for a module claiming
Expand Down
44 changes: 44 additions & 0 deletions docs/discovery/source-marks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Source marks

The mark a source's badge draws (#152 Phase 4): one file per source under
`priv/static/images/sources/`, named by slug, referenced from the row's `logo`
and declared in the provider's `source_attrs/0` (or the catalog's entry). A
local asset and never a hotlink, for the reason the licence marks are: a
provider's server does not decide what our page shows, and every reader's
address in their logs to draw our own chrome is a cost we do not pay.

Each is the mark the source itself publishes to identify itself — the touch
icon its own site ships, or its logo as Wikimedia Commons holds it — used
nominatively, to say whose content sits beside it, at a size (20–28 px) no
guideline reads as an endorsement. Rasters are fitted into a 128 px square and
padded white (`sips`), which is what a round badge crops; the two authors are
portraits, since a 1755 lexicographer has no brand kit. Fetched 2026-09-22.

| Slug | File | Taken from | Terms |
|---|---|---|---|
| `wikipedia` | `wikipedia.png` | Commons `File:Wikipedia-logo-v2.svg`, rendered at 128 px | CC BY-SA 3.0; Wikimedia trademark, used to refer to and link to the site (Trademark Policy §3) |
| `wiktionary` | `wiktionary.png` | Commons `File:Wiktionary-logo.svg` | CC BY-SA 3.0; as above |
| `wikidata` | `wikidata.png` | Commons `File:Wikidata-logo.svg` | Public domain; Wikimedia trademark, as above |
| `commons` | `commons.png` | Commons `File:Commons-logo.svg` | CC BY-SA 3.0; as above |
| `johnson` | `johnson.png` | Commons `File:Samuel Johnson by Joshua Reynolds.jpg`, cropped to the face | Public domain (Reynolds, c. 1772) |
| `bierce` | `bierce.png` | Commons `File:Ambrose Bierce portre.jpg` | Public domain |
| `wordnet` | `wordnet.png` | `https://en-word.net/assets/favicon-*.ico`, 64 px frame | Open English WordNet's own site icon; project CC BY 4.0 |
| `met` | `met.png` | Commons `File:The Metropolitan Museum of Art Logo.svg` | Public domain (text logo); Met trademark, nominative |
| `pexels` | `pexels.png` | Commons `File:Pexels logo (2024).svg` | Public domain (text logo); Pexels trademark, nominative — their icon file returns 403 to non-browsers |
| `unsplash` | `unsplash.png` | `https://unsplash.com/apple-touch-icon.png` | Unsplash trademark, nominative; the credit link the API terms require is per item and unchanged |
| `openverse` | `openverse.svg` | `https://openverse.org/openverse-logo.svg` | Openverse (WordPress) mark, nominative |
| `open-library` | `open-library.png` | `https://openlibrary.org/static/images/openlibrary-192x192.png` | Internet Archive mark, nominative |
| `guardian` | `guardian.png` | `https://assets.guim.co.uk/static/frontend/icons/homescreen/apple-touch-icon-512.png` | Guardian mark, nominative. The *Powered by* lockup clause 6(b)(vi) requires is a separate obligation and stays on the shelf |
| `giphy` | `giphy.png` | `https://giphy.com/static/img/icons/apple-touch-icon-180px.png` | GIPHY mark, nominative; the *Powered by GIPHY* lockup stays on the shelf |
| `spotify` | `spotify.svg` | The icon path of the shipped `spotify-full-logo-black.svg` (Spotify's own file, #143), alone and unaltered | Spotify Branding Guidelines allow the icon on its own; it is drawn black on white at the badge's size. The full logo the Developer Policy asks for stays on the shelf |
| `bing-news` | `bing-news.svg` | `https://www.bing.com/sa/simg/favicon-trans-bg-blue-mg.svg` | Microsoft mark, nominative |
| `urban-dictionary` | `urban-dictionary.png` | `https://www.urbandictionary.com/apple-touch-icon.png` | Urban Dictionary mark, nominative, under the permission the source row records |
| `artsy` | `artsy.png` | `https://d1s2w0upia4e9w.cloudfront.net/images/apple-touch-icon.png` (artsy.net) | Artsy mark, nominative; the source is retired and the badge is for its record |
| `cinegraph` | `cinegraph.svg` | `https://cinegraph.org/favicon.ico` (a white glyph on transparency), embedded in an SVG on its own dark disc so it reads on the light badge | The sibling project's own icon |
| `poetrydb` | — | poetrydb.org publishes no icon (its `favicon.ico` is a JSON error) | Monogram |

A source with no file draws its monogram; a `logo` that is not a local path
draws nothing (`SourceBadge.logo/1`). Dark mode shows the same file on the
badge's white disc, the way a favicon shows in a dark browser tab: none of
these marks has a dark variant a badge could honour, and inverting one would
alter it, which every guideline above forbids.
3 changes: 3 additions & 0 deletions lib/devils_dictionary/discovery.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,9 @@ defmodule DevilsDictionary.Discovery do
# from the source row, which is where tier lives; the provider's own
# declaration is what seeded it.
tier: if(source, do: source.tier, else: attrs[:tier]),
# The mark the badge draws beside the name (#152), from the row like the
# tier, with the declaration as the fallback a fresh database reads.
logo: if(source, do: source.logo, else: attrs[:logo]),
# The one-line qualifier a provider wants beside its name on the shelf
# ("keywords: TMDb"). The reader renders whatever is here and knows no
# provider by name.
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/bing_news.ex
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ defmodule DevilsDictionary.Discovery.Providers.BingNews do
"restricts these results to rendering Bing results within an RSS aggregator " <>
"for personal, non-commercial use — see docs/integrations/bing-news.md",
homepage: "https://www.bing.com/news",
logo: "/images/sources/bing-news.svg",
# A news item has no id to put in a template, and its page is the
# publisher's rather than Bing's. The card links to `source_url`.
url_template: nil,
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/cine_graph.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ defmodule DevilsDictionary.Discovery.Providers.CineGraph do
license: "TMDb API terms; metadata served by CineGraph",
license_url: "https://developer.themoviedb.org/docs/faq",
homepage: "https://cinegraph.org/",
logo: "/images/sources/cinegraph.svg",
url_template: "https://cinegraph.org/",
attribution: "Film metadata and keywords: TMDb; discovery served by CineGraph",
active: true,
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/commons.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ defmodule DevilsDictionary.Discovery.Providers.Commons do
license: "Per file; only CC0, CC BY, CC BY-SA and public-domain files are shown",
license_url: "https://commons.wikimedia.org/wiki/Commons:Licensing",
homepage: "https://commons.wikimedia.org/",
logo: "/images/sources/commons.png",
url_template: "https://commons.wikimedia.org/?curid={external_id}",
attribution: "Wikimedia Commons contributors; each file carries its own author and licence",
active: true,
Expand Down
2 changes: 2 additions & 0 deletions lib/devils_dictionary/discovery/providers/giphy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defmodule DevilsDictionary.Discovery.Providers.Giphy do
license_url:
"https://support.giphy.com/hc/en-us/articles/360028134111-GIPHY-API-Terms-of-Service",
homepage: "https://giphy.com/",
logo: "/images/sources/giphy.png",
url_template: "https://giphy.com/gifs/{id}",
attribution: "Powered by GIPHY",
active: true,
Expand Down Expand Up @@ -73,6 +74,7 @@ defmodule DevilsDictionary.Discovery.Providers.Giphy do
# From the row, as a server state's is: the badge's ring and the
# stack's order read it (#152).
tier: source.tier,
logo: source.logo,
content_type: :gif,
hook: "GiphyShelf",
term: target.term,
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/guardian.ex
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ defmodule DevilsDictionary.Discovery.Providers.Guardian do
"docs/integrations/guardian.md",
license_url: "https://www.theguardian.com/open-platform/terms-and-conditions",
homepage: "https://www.theguardian.com/open-platform",
logo: "/images/sources/guardian.png",
url_template: "https://www.theguardian.com/{id}",
attribution: "The Guardian",
active: true,
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/met.ex
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ defmodule DevilsDictionary.Discovery.Providers.Met do
license: "CC0 metadata; images only where the object is public domain",
license_url: "https://www.metmuseum.org/information/terms-and-conditions",
homepage: "https://www.metmuseum.org/",
logo: "/images/sources/met.png",
url_template: "https://www.metmuseum.org/art/collection/search/{external_id}",
active: true,
attribution: "The Metropolitan Museum of Art Open Access",
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/open_library.ex
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ defmodule DevilsDictionary.Discovery.Providers.OpenLibrary do
"and only a snippet, a cover URL and a link are stored",
license_url: "https://openlibrary.org/developers/licensing",
homepage: "https://openlibrary.org/",
logo: "/images/sources/open-library.png",
url_template: "https://openlibrary.org/works/{external_id}",
attribution: "Open Library · Internet Archive",
active: true,
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/openverse.ex
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ defmodule DevilsDictionary.Discovery.Providers.Openverse do
license: "Per item; only CC0, CC BY, CC BY-SA and public-domain items are shown",
license_url: "https://openverse.org/search-help",
homepage: "https://openverse.org/",
logo: "/images/sources/openverse.svg",
url_template: "https://openverse.org/image/{external_id}",
attribution: "Openverse; each item carries its own creator, licence and attribution line",
active: true,
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/pexels.ex
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ defmodule DevilsDictionary.Discovery.Providers.Pexels do
license: "Pexels License; free to use, credit requested",
license_url: @license_url,
homepage: "https://www.pexels.com/",
logo: "/images/sources/pexels.png",
url_template: "https://www.pexels.com/photo/{external_id}/",
attribution: "Photos from Pexels; each carries its photographer's name and a link",
active: true,
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/spotify.ex
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ defmodule DevilsDictionary.Discovery.Providers.Spotify do
"displayed with the Spotify mark and a link back",
license_url: "https://developer.spotify.com/policy",
homepage: "https://open.spotify.com/",
logo: "/images/sources/spotify.svg",
url_template: "https://open.spotify.com/track/{external_id}",
attribution: "Spotify",
active: true,
Expand Down
1 change: 1 addition & 0 deletions lib/devils_dictionary/discovery/providers/unsplash.ex
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ defmodule DevilsDictionary.Discovery.Providers.Unsplash do
license: "Unsplash License; free to use, credit required",
license_url: @license_page,
homepage: "https://unsplash.com/",
logo: "/images/sources/unsplash.png",
url_template: "https://unsplash.com/photos/{external_id}",
attribution: "Photos from Unsplash; each carries its photographer's name and a link",
active: true,
Expand Down
7 changes: 7 additions & 0 deletions lib/devils_dictionary/sources/catalog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ defmodule DevilsDictionary.Sources.Catalog do
license: "CC BY 4.0",
license_url: "https://creativecommons.org/licenses/by/4.0/",
homepage: "https://en-word.net/",
logo: "/images/sources/wordnet.png",
url_template: "https://en-word.net/id/{external_id}",
attribution: "Open English WordNet 2025 (CC BY 4.0)",
config: %{
Expand All @@ -71,6 +72,7 @@ defmodule DevilsDictionary.Sources.Catalog do
license: "CC BY-SA 4.0",
license_url: "https://creativecommons.org/licenses/by-sa/4.0/",
homepage: "https://en.wiktionary.org/",
logo: "/images/sources/wiktionary.png",
url_template: "https://en.wiktionary.org/wiki/{lemma}#English",
attribution: "Wiktionary contributors (CC BY-SA 4.0), extracted by kaikki.org",
config: %{
Expand All @@ -96,6 +98,7 @@ defmodule DevilsDictionary.Sources.Catalog do
license: "CC0 1.0",
license_url: "https://creativecommons.org/publicdomain/zero/1.0/",
homepage: "https://www.wikidata.org/",
logo: "/images/sources/wikidata.png",
url_template: "https://www.wikidata.org/wiki/{external_id}",
attribution: "Wikidata (CC0)",
config: %{
Expand All @@ -120,6 +123,7 @@ defmodule DevilsDictionary.Sources.Catalog do
license: "CC BY-SA 4.0",
license_url: "https://creativecommons.org/licenses/by-sa/4.0/",
homepage: "https://en.wikipedia.org/",
logo: "/images/sources/wikipedia.png",
url_template: "https://en.wikipedia.org/wiki/{title}",
attribution: "Wikipedia contributors (CC BY-SA 4.0)",
config: %{
Expand All @@ -143,6 +147,7 @@ defmodule DevilsDictionary.Sources.Catalog do
license: "Public domain",
license_url: "https://www.gutenberg.org/policy/permission.html",
homepage: "https://www.gutenberg.org/ebooks/972",
logo: "/images/sources/bierce.png",
# Gutenberg gives the text no per-entry anchors — only one `id` per
# letter chapter — so each record carries its own anchored url and this
# template is the whole-document fallback A9 asks every source for.
Expand All @@ -169,6 +174,7 @@ defmodule DevilsDictionary.Sources.Catalog do
license: "CC BY 4.0 (LEME transcription); the 1755 text is public domain",
license_url: "https://creativecommons.org/licenses/by/4.0/",
homepage: "https://leme.library.utoronto.ca/lexicons/1345/",
logo: "/images/sources/johnson.png",
# LEME gives the lexicon one page and no per-entry anchors, so this is
# the whole-document fallback A9 asks every source for — the same
# bargain the Bierce row strikes with Gutenberg's letter chapters.
Expand Down Expand Up @@ -231,6 +237,7 @@ defmodule DevilsDictionary.Sources.Catalog do
license: "Artsy Public API Terms; removable cache, no permanent archive grant",
license_url: "https://developers.artsy.net/v2/terms",
homepage: "https://www.artsy.net/",
logo: "/images/sources/artsy.png",
url_template: "https://www.artsy.net/artwork/{external_id}",
attribution: "Artwork discovery and source metadata: Artsy",
config: %{
Expand Down
5 changes: 5 additions & 0 deletions lib/devils_dictionary/sources/source.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ defmodule DevilsDictionary.Sources.Source do
field :license, :string
field :license_url, :string
field :homepage, :string
# The source's mark for the badge (#152): a path under `priv/static`, or nil
# for a monogram. Never a URL — a hotlink is a provider deciding what our
# page shows.
field :logo, :string
field :url_template, :string
field :attribution, :string
field :active, :boolean, default: true
Expand All @@ -57,6 +61,7 @@ defmodule DevilsDictionary.Sources.Source do
:license,
:license_url,
:homepage,
:logo,
:url_template,
:attribution,
:active,
Expand Down
3 changes: 2 additions & 1 deletion lib/devils_dictionary/sources/urban_dictionary.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ defmodule DevilsDictionary.Sources.UrbanDictionary do
license: "Urban Dictionary Terms of Service; API access by permission",
license_url: "https://urbandictionary.help/tos/",
homepage: "https://www.urbandictionary.com/",
logo: "/images/sources/urban-dictionary.png",
url_template: "https://www.urbandictionary.com/define.php?term={term}",
attribution: "Urban Dictionary",
active: true,
Expand Down Expand Up @@ -110,7 +111,7 @@ defmodule DevilsDictionary.Sources.UrbanDictionary do
permalink_host: "www.urbandictionary.com",
# Who the card is, from the row and not from the component (#152):
# the header's badge and name, and the rail's stack, read these.
source: %{slug: source.slug, name: source.name, tier: source.tier}
source: %{slug: source.slug, name: source.name, tier: source.tier, logo: source.logo}
}
end
end
Expand Down
6 changes: 6 additions & 0 deletions lib/devils_dictionary_web/live/word_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,14 @@ defmodule DevilsDictionaryWeb.WordLive do
)
end

# One read of the rows for the marks: a shelf state carries its own, but a
# catalog corpus is named by its items and a browser config by what it
# chose to send, and the row is where the logo lives (#152 Phase 4).
logos = Map.new(DevilsDictionary.Sources.list_sources(), &{&1.slug, &1.logo})

(definitions ++ thing ++ crowd ++ shelves ++ browser)
|> Enum.reject(&is_nil/1)
|> Enum.map(&%{&1 | logo: &1.logo || logos[&1.slug]})
|> SourceBadge.compose()
end

Expand Down
51 changes: 51 additions & 0 deletions priv/repo/migrations/20260922175206_add_logo_to_sources.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
defmodule DevilsDictionary.Repo.Migrations.AddLogoToSources do
use Ecto.Migration

@moduledoc """
A source's mark, for the badge every card header and the rail's stack draw
(#152 Phase 4): a path under `priv/static` and never a URL, the same rule
as a licence mark. Backfilled by slug, because `Discovery.ensure_source/1`
inserts `on_conflict: :nothing` and a row that exists would otherwise keep
drawing a monogram until somebody remembered the psql line.
"""

@logos %{
"wordnet" => "/images/sources/wordnet.png",
"wiktionary" => "/images/sources/wiktionary.png",
"wikidata" => "/images/sources/wikidata.png",
"wikipedia" => "/images/sources/wikipedia.png",
"bierce" => "/images/sources/bierce.png",
"johnson" => "/images/sources/johnson.png",
"artsy" => "/images/sources/artsy.png",
"urban-dictionary" => "/images/sources/urban-dictionary.png",
"cinegraph" => "/images/sources/cinegraph.svg",
"commons" => "/images/sources/commons.png",
"bing-news" => "/images/sources/bing-news.svg",
"giphy" => "/images/sources/giphy.png",
"guardian" => "/images/sources/guardian.png",
"met" => "/images/sources/met.png",
"open-library" => "/images/sources/open-library.png",
"openverse" => "/images/sources/openverse.svg",
"pexels" => "/images/sources/pexels.png",
"spotify" => "/images/sources/spotify.svg",
"unsplash" => "/images/sources/unsplash.png"
}

def up do
alter table(:sources) do
add :logo, :string
end

flush()

for {slug, path} <- @logos do
execute("UPDATE sources SET logo = '#{path}' WHERE slug = '#{slug}' AND logo IS NULL")
end
end

def down do
alter table(:sources) do
remove :logo
end
end
end
Binary file added priv/static/images/sources/artsy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/sources/bierce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions priv/static/images/sources/bing-news.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions priv/static/images/sources/cinegraph.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/sources/commons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/sources/giphy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/sources/guardian.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/sources/johnson.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/sources/met.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/sources/open-library.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading