Skip to content
Open
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
2 changes: 1 addition & 1 deletion openlibrary/macros/CoverImage.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
$if cover_url:
<img src="$cover_url" height="58" title="$title" alt="$title"/>
$else:
<img src="/images/icons/avatar_book-sm.png" alt="$title"/>
<img src="/static/images/icons/avatar_book-sm.png" alt="$title"/>
2 changes: 1 addition & 1 deletion openlibrary/macros/FulltextSearchSuggestionItem.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="fsi" itemscope itemtype="https://schema.org/Book" $:attrs>
<div class="fsi__main">
<span class="fsi__book-cover">
$ cover = get_cover_url(selected_ed) or "/images/icons/avatar_book-sm.png"
$ cover = get_cover_url(selected_ed) or "/static/images/icons/avatar_book-sm.png"
<a data-ol-link-track="SearchInsideSuggestion|BookClick" href="$work_edition_url">
<img class="fsi__book-cover-img $blur_cover"
itemprop="image"
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/macros/LoadingIndicator.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="$hidden loadingIndicator $additional_classes">
<figure>
<img src="/images/ajax-loader-bar.gif" alt="$_('Loading indicator')" loading="lazy">
<img src="/static/images/ajax-loader-bar.gif" alt="$_('Loading indicator')" loading="lazy">
<figcaption style="
justify-content: center;
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/macros/SearchResultsWork.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</div>
<div class="sri__main">
<span class="bookcover $blur_cover">
$ cover = get_cover_url(selected_ed) or "/images/icons/avatar_book-sm.png"
$ cover = get_cover_url(selected_ed) or "/static/images/icons/avatar_book-sm.png"
<a href="$work_edition_url">
<img
itemprop="image"
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/openlibrary/js/covers.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function initCoversSaved() {
cover_url = `${coverstore_url}/a/id/${image}-M.jpg`;
}
else {
cover_url = '/images/icons/avatar_author-lg.png';
cover_url = '/static/images/icons/avatar_author-lg.png';
}
parent.$(cover_selector).attr('src', cover_url);
}
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/openlibrary/js/lists/ShowcaseItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class ShowcaseItem {
*/
let i18nStrings;

const DEFAULT_COVER_URL = '/images/icons/avatar_book-sm.png';
const DEFAULT_COVER_URL = '/static/images/icons/avatar_book-sm.png';

/**
* Returns the inferred type of the given seed key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { addItem, removeItem } from '../../lists/ListService';
import { attachNewActiveShowcaseItem, toggleActiveShowcaseItems } from '../../lists/ShowcaseItem';
import { FadingToast } from '../../Toast';

const DEFAULT_COVER_URL = '/images/icons/avatar_book-sm.png';
const DEFAULT_COVER_URL = '/static/images/icons/avatar_book-sm.png';

/**
* Represents a single My Books dropper's list affordances, and defines their
Expand Down
4 changes: 2 additions & 2 deletions openlibrary/plugins/openlibrary/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ def get_list_data(list, seed, include_cover_url=True):
)
if include_cover_url:
cover = list.get_cover() or list.get_default_cover()
d["cover_url"] = (cover and cover.url("S")) or "/images/icons/avatar_book-sm.png"
d["cover_url"] = (cover and cover.url("S")) or "/static/images/icons/avatar_book-sm.png"
if "None" in d["cover_url"]:
d["cover_url"] = "/images/icons/avatar_book-sm.png"
d["cover_url"] = "/static/images/icons/avatar_book-sm.png"

d["owner"] = None
if owner := list.get_owner():
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/upstream/addbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def make_work(doc: dict[str, str | list]) -> web.Storage:
for key, name in zip(doc.get('author_key', []), doc.get('author_name', []))
]

w.cover_url = "/images/icons/avatar_book-sm.png"
w.cover_url = "/static/images/icons/avatar_book-sm.png"
w.setdefault('ia', [])
w.setdefault('first_publish_year', None)
return w
Expand Down
9 changes: 0 additions & 9 deletions openlibrary/plugins/upstream/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@
logger = logging.getLogger('openlibrary.plugins.upstream.code')


# Note: This is done in web_nginx.conf on production ; this endpoint is
# only used in development environments.
class static(delegate.page):
path = "/images/.*"

def GET(self):
return web.seeother(f'/static{web.ctx.path}')


class history(delegate.mode):
"""Overwrite ?m=history to remove IP"""

Expand Down
4 changes: 2 additions & 2 deletions openlibrary/plugins/upstream/tests/test_addbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def test_make_work_does_indeed_make_a_work(self):
"language": ["eng"],
"title": "The Celebrated Jumping Frog of Calaveras County",
"authors": [author],
"cover_url": "/images/icons/avatar_book-sm.png",
"cover_url": "/static/images/icons/avatar_book-sm.png",
"ia": [],
"first_publish_year": None,
}
Expand All @@ -548,7 +548,7 @@ def test_make_work_handles_no_author(self):
"language": ["eng"],
"title": "The Celebrated Jumping Frog of Calaveras County",
"authors": [],
"cover_url": "/images/icons/avatar_book-sm.png",
"cover_url": "/static/images/icons/avatar_book-sm.png",
"ia": [],
"first_publish_year": None,
}
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/account/not_verified.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<style>
div.alert {
background: url("/images/icons/icon_alert-gold.png") no-repeat scroll 15px 50% #FFFDCD !important;
background: url("/static/images/icons/icon_alert-gold.png") no-repeat scroll 15px 50% #FFFDCD !important;
padding: 10px 10px 10px 50px;
}
</style>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/books/edit/edition.html
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@
<table cellpadding="1">
<tbody>
<tr>
<td rowspan="3"><img src="/images/dimensions.png" alt="$_('dimensions')" width="107" height="69" align="left"/></td>
<td rowspan="3"><img src="/static/images/dimensions.png" alt="$_('dimensions')" width="107" height="69" align="left"/></td>
<td><span class="tip"><label for="dimensions-height">$_("Height:")</label> </span></td>
<td><input name="edition--physical_dimensions--height" type="number" step="any" min="0.001"
id="dimensions-height" size="6" value="$dimensions.height"/></td>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/books/edition-sort.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$ isbn = isbn_10 or isbn_13
$ asin = isbn_10 or None

$ url = book.get_cover_url("S") or "/images/icons/avatar_book-sm.png"
$ url = book.get_cover_url("S") or "/static/images/icons/avatar_book-sm.png"

<td class="book">
<span class="hidden sort-key">$edition_sort_key</span>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/covers/author_photo.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ <h2>$truncate(author.name or "", 60)</h2>
$else:
<div class="author coverMagic">
<div class="SRPCover bookCover">
<img src="/images/icons/avatar_author-lg.png" class="cover" alt="$_('We need a photo of %(author)s', author=author.name)"/>
<img src="/static/images/icons/avatar_author-lg.png" class="cover" alt="$_('We need a photo of %(author)s', author=author.name)"/>
</div>
</div>
4 changes: 2 additions & 2 deletions openlibrary/templates/covers/book_cover.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
$ cover_aspect_ratio = book.get_cover_aspect_ratio()
$ cover_aspect_ratio_str = 'aspect-ratio: ' + str(cover_aspect_ratio) if cover_aspect_ratio else ""

$ src = cover_url or '/images/icons/avatar_book.png'
$ srcset = '%s 2x' % (cover_lg or '/images/icons/avatar_book-lg.png')
$ src = cover_url or '/static/images/icons/avatar_book.png'
$ srcset = '%s 2x' % (cover_lg or '/static/images/icons/avatar_book-lg.png')

$if preload:
$add_metatag(tag="link", **{'rel': 'preload', 'as': 'image', 'href': src, 'imagesrcset': srcset, 'fetchpriority': 'high'})
Expand Down
4 changes: 2 additions & 2 deletions openlibrary/templates/covers/book_cover_small.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<a href="$book.key" title="$_('Go to the main page for %(title)s', title=title)"><img src="$cover_url" class="cover" alt="$_('Cover of: %(title)s by %(authors)s', title=title, authors=author_names)"/></a>
</div>
<div class="SRPCoverBlank" style="display: $cond(not cover_url, 'block', 'none');clear:left;">
<a href="$book.key" title="$_('Go to the main page for %(title)s', title=title)"><img src="/images/icons/avatar_book-sm.png" height="58" alt="$_('We need a book cover for: %(title)s', title=title)"/></a>
<a href="$book.key" title="$_('Go to the main page for %(title)s', title=title)"><img src="/static/images/icons/avatar_book-sm.png" height="58" alt="$_('We need a book cover for: %(title)s', title=title)"/></a>
</div>
</div>
$else:
<img src="$(cover_url or '/images/icons/avatar_book-sm.png')" height="58" title="$_('Go to the main page for %(title)s', title=title)" alt="$title"/>
<img src="$(cover_url or '/static/images/icons/avatar_book-sm.png')" height="58" title="$_('Go to the main page for %(title)s', title=title)" alt="$title"/>
2 changes: 1 addition & 1 deletion openlibrary/templates/lists/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h2>$_('Active Lists')</h2>
<a href="$list.key" class="title results">
<div class="cover">
$ cover = list.get_cover() or list.get_default_cover()
$ cover_url = cover and cover.url("S") or "/images/icons/avatar_book-sm.png"
$ cover_url = cover and cover.url("S") or "/static/images/icons/avatar_book-sm.png"
<img src="$cover_url" alt=""/>
</div>
$list.name
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/lists/list_follow.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$if img_url:
$ img_url = img_url.replace("-S.jpg", "-M.jpg")
$else:
$ img_url = '/images/icons/avatar_book-sm.png'
$ img_url = '/static/images/icons/avatar_book-sm.png'
<img src="$img_url" alt="$_('Cover of book')" loading="lazy" width="80"/>
</a>

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/lists/preview.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$def with (list)
<span class="imageLg">
$ cover = list.get_cover() or list.get_default_cover()
$ cover_url = cover and cover.url("M") or "/images/icons/avatar_book-sm.png"
$ cover_url = cover and cover.url("M") or "/static/images/icons/avatar_book-sm.png"
<a href="$list.key"><img src="$cover_url" alt="$_('Cover of: %(title)s', title=list.name)" title="$_('Cover of: %(title)s', title=list.name)"/></a>
</span>
<span class="details">
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/lists/showcase.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$if img_url:
$ img_url = img_url.replace("-S.jpg", "-M.jpg")
$else:
$ img_url = '/images/icons/avatar_book-sm.png'
$ img_url = '/static/images/icons/avatar_book-sm.png'
<img src="$img_url" loading="lazy" width="80">
</div>
<div class="list-card__name-tag">
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/lists/snippet.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$def with (list)
<span class="imageLg">
$ cover = list.get_cover() or list.get_default_cover()
$ cover_url = cover and cover.url("S") or "/images/icons/avatar_book-sm.png"
$ cover_url = cover and cover.url("S") or "/static/images/icons/avatar_book-sm.png"
$ title = _("Cover of: %(title)s", title=list.name)
<a href="$list.key"><img src="$cover_url" height="58" alt="$title" title="$title"/></a>
</span>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/search/sort_options.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
selected_sort_option = get_selected_sort_option(sort_options, selected_sort) or get_selected_sort_option(sort_options, default_sort)
<details class="sort-dropper">
<summary class="tool-button">
<img src="/images/icons/icon_sort.png" alt="$_('Sorting by')" width="9" height="11" />
<img src="/static/images/icons/icon_sort.png" alt="$_('Sorting by')" width="9" height="11" />
$selected_sort_option['name']
</summary>
<span class="sort-content">
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/author/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h1>$_("Edit Author")</h1>
<textarea name="author--alternate_names" id="alternate_names" rows="6">$"\n".join(page.alternate_names)</textarea>
</div>
</div>
<div class="label">$_("Identifiers") <a href="/help/faq/editing.en#author-identifiers-purpose"><img src="/images/icons/icon_help.png" alt="$_('Author Identifiers Purpose')"/></a> </div>
<div class="label">$_("Identifiers") <a href="/help/faq/editing.en#author-identifiers-purpose"><img src="/static/images/icons/icon_help.png" alt="$_('Author Identifiers Purpose')"/></a> </div>
<div id="id-errors-author" class="note" style="display: none"></div>
<div id="hiddenAuthorIdentifiers"></div>
<div id="identifiers-display">
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/author/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ <h2 class="author collapse">
<div class="message" style="display: none;">
<div id="preMerge" style="display: none;" data-keys="$dumps(data)">
<p class="larger collapse"><strong>$_('Merging Authors...')</strong></p>
<p class="collapse adjust"><img src="/images/ajax-loader-bar.gif" width="220" height="19" alt="$_('In progress...')"/></p>
<p class="collapse adjust"><img src="/static/images/ajax-loader-bar.gif" width="220" height="19" alt="$_('In progress...')"/></p>
<p class="smaller lightgreen collapse">$_('Duplicates')</p>
<p class="small collapse">
<ul>
Expand Down
4 changes: 2 additions & 2 deletions openlibrary/templates/type/list/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<div id="contentHead" style="margin-bottom:0;">
<div class="superNav">
<a href="/" title="$_('Visit Open Library')"><img src="/images/logo_OL-sm.png" width="90" height="71" alt="$_('Open Library logo')" class="right"/></a>
<a href="/" title="$_('Visit Open Library')"><img src="/static/images/logo_OL-sm.png" width="90" height="71" alt="$_('Open Library logo')" class="right"/></a>

$ owner = list.get_owner()
$if owner:
Expand Down Expand Up @@ -43,7 +43,7 @@ <h1>
$for seed in list.get_seeds(sort=True)[page*page_size:page*page_size+page_size]:
<li id="seed-$loop.index" class="searchResultItem">
$ cover = seed.get_cover()
$ cover_url = cover and cover.url("M") or "/images/icons/avatar_book-sm.png"
$ cover_url = cover and cover.url("M") or "/static/images/icons/avatar_book-sm.png"
<span class="image">
<a href="$seed.url"><img src="$cover_url" height="70"/></a>
</span>
Expand Down
22 changes: 11 additions & 11 deletions static/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,77 +40,77 @@
},
"screenshots": [
{
"src": "/images/screenshots/desktop/MainPageDesktop.png",
"src": "/static/images/screenshots/desktop/MainPageDesktop.png",
"sizes": "1280x720",
"type": "image/png",
"form_factor": "wide",
"label": "Main Page - Desktop"
},
{
"src": "/images/screenshots/desktop/SearchBooksDesktop.png",
"src": "/static/images/screenshots/desktop/SearchBooksDesktop.png",
"sizes": "1280x720",
"type": "image/png",
"form_factor": "wide",
"label": "Search Books - Desktop"
},
{
"src": "/images/screenshots/desktop/StudentLibraryDesktop.png",
"src": "/static/images/screenshots/desktop/StudentLibraryDesktop.png",
"sizes": "1280x720",
"type": "image/png",
"form_factor": "wide",
"label": "Student Library - Desktop"
},
{
"src": "/images/screenshots/desktop/TrendingDesktop.png",
"src": "/static/images/screenshots/desktop/TrendingDesktop.png",
"sizes": "1280x720",
"type": "image/png",
"form_factor": "wide",
"label": "Trending - Desktop"
},
{
"src": "/images/screenshots/desktop/ListsDesktop.png",
"src": "/static/images/screenshots/desktop/ListsDesktop.png",
"sizes": "1280x720",
"type": "image/png",
"form_factor": "wide",
"label": "Lists - Desktop"
},
{
"src": "/images/screenshots/mobile/MainPageMobile.png",
"src": "/static/images/screenshots/mobile/MainPageMobile.png",
"sizes": "1080x2160",
"type": "image/png",
"form_factor": "narrow",
"label": "Main Page - Mobile"
},
{
"src": "/images/screenshots/mobile/BorrowMobile.png",
"src": "/static/images/screenshots/mobile/BorrowMobile.png",
"sizes": "1080x2160",
"type": "image/png",
"form_factor": "narrow",
"label": "Borrow - Mobile"
},
{
"src": "/images/screenshots/mobile/ExplorerMobile.png",
"src": "/static/images/screenshots/mobile/ExplorerMobile.png",
"sizes": "1080x2160",
"type": "image/png",
"form_factor": "narrow",
"label": "Explorer - Mobile"
},
{
"src": "/images/screenshots/mobile/SearchMobile.png",
"src": "/static/images/screenshots/mobile/SearchMobile.png",
"sizes": "1080x2160",
"type": "image/png",
"form_factor": "narrow",
"label": "Search Books - Mobile"
},
{
"src": "/images/screenshots/mobile/StudentLibraryMobile.png",
"src": "/static/images/screenshots/mobile/StudentLibraryMobile.png",
"sizes": "1080x2160",
"type": "image/png",
"form_factor": "narrow",
"label": "Student Library - Mobile"
},
{
"src": "/images/screenshots/mobile/ListsMobile.png",
"src": "/static/images/screenshots/mobile/ListsMobile.png",
"sizes": "1080x2160",
"type": "image/png",
"form_factor": "narrow",
Expand Down
2 changes: 1 addition & 1 deletion static/status-500.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</style>
</head>
<body>
<div id="logo"><img src="/images/logo_OL-err.png" alt="The Open Library is closed!" width="219" height="131"/></div>
<div id="logo"><img src="/static/images/logo_OL-err.png" alt="The Open Library is closed!" width="219" height="131"/></div>
<p><strong>Open Library is temporarily offline.</strong><br/>Please <a href="https://blog.openlibrary.org/">visit our blog</a> for updates about site status.</p>
</body>
</html>
6 changes: 3 additions & 3 deletions tests/unit/js/lists.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('createActiveShowcaseItem() tests', () => {
const listKey = '/people/openlibrary/lists/OL1L';
const seedKey = '/books/OL3421846M';
const listTitle = 'My First List';
const coverUrl = '/images/icons/avatar_book-sm.png';
const coverUrl = '/static/images/icons/avatar_book-sm.png';

const li = createActiveShowcaseItem(listKey, seedKey, listTitle, coverUrl);
const anchors = li.querySelectorAll('a');
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('createActiveShowcaseItem() tests', () => {
test('createActiveShowcaseItem() sets the correct seed type', () => {
const listKey = '/people/openlibrary/lists/OL1L';
const listTitle = 'My First List';
const coverUrl = '/images/icons/avatar_book-sm.png';
const coverUrl = '/static/images/icons/avatar_book-sm.png';

const editionKey = '/books/OL3421846M';
const workKey = '/works/OL54120W';
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('createActiveShowcaseItem() tests', () => {
const li = createActiveShowcaseItem(listKey, seedKey, listTitle);
const coverImage = li.querySelector('img');

const expectedCoverUrl = '/images/icons/avatar_book-sm.png';
const expectedCoverUrl = '/static/images/icons/avatar_book-sm.png';
expect(coverImage.src.endsWith(expectedCoverUrl)).toBe(true);
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/js/sample-html/lists-test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const filledListCreationForm = createListFormMarkup(true);

export const showcaseI18nInput = '<input type="hidden" name="list-i18n-strings" value="{&quot;cover_of&quot;: &quot;Cover of: &quot;, &quot;see_this_list&quot;: &quot;See this list&quot;, &quot;remove_from_list&quot;: &quot;Remove from your list?&quot;, &quot;from&quot;: &quot;from&quot;, &quot;you&quot;: &quot;You&quot;}"></input>';

const DEFAULT_COVER_URL = '/images/icons/avatar_book-sm.png';
const DEFAULT_COVER_URL = '/static/images/icons/avatar_book-sm.png';

/**
* @typedef {Object} ShowcaseDetails
Expand Down
Loading