fix: add some pages that "sapper export" missed (#1000)

Unfortunately it looks like `sapper export` works by crawling the
non-logged-in site, which means that any pages that are inaccessible
when you're not logged in don't get generated, including "pinned,"
"muted," "blocked," "requests," and "share."

Normally this isn't a problem, but it is in browsers that don't
have Service Worker; you get a 404 when you try to refresh those pages.

My fix is to just add a hidden div that links to these pages. It's not
pretty, but it works.
This commit is contained in:
Nolan Lawson 2019-02-16 00:48:45 -08:00 committed by GitHub
parent 839e8e35c4
commit 2debddaaf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 14 deletions

View file

@ -1,5 +1,7 @@
<DynamicPageBanner title="Blocked users" icon="#fa-ban" />
<AccountsListPage {accountsFetcher} {accountActions} />
{#if $isUserLoggedIn }
<AccountsListPage {accountsFetcher} {accountActions} />
{/if}
<script>
import AccountsListPage from '../_components/AccountsListPage.html'
import { store } from '../_store/store'

View file

@ -1,5 +1,7 @@
<DynamicPageBanner title="Muted users" icon="#fa-volume-off" />
<AccountsListPage {accountsFetcher} {accountActions} />
{#if $isUserLoggedIn }
<AccountsListPage {accountsFetcher} {accountActions} />
{/if}
<script>
import AccountsListPage from '../_components/AccountsListPage.html'
import { store } from '../_store/store'

View file

@ -1,15 +1,17 @@
<DynamicPageBanner title="Pinned toots" icon="#fa-thumb-tack" />
<div class="pinned-toots-page">
{#if loading}
<LoadingPage />
{:elseif statuses && statuses.length}
<ul class="pinned-toots-results">
{#each statuses as status, index}
<StatusSearchResult {status} {index} length={statuses.length} />
{/each}
</ul>
{/if}
</div>
{#if $isUserLoggedIn }
<div class="pinned-toots-page">
{#if loading}
<LoadingPage />
{:elseif statuses && statuses.length}
<ul class="pinned-toots-results">
{#each statuses as status, index}
<StatusSearchResult {status} {index} length={statuses.length} />
{/each}
</ul>
{/if}
</div>
{/if}
<style>
.pinned-toots-page {
padding: 20px 20px;

View file

@ -1,5 +1,7 @@
<DynamicPageBanner title="Follow requests" icon="#fa-user-plus" />
<AccountsListPage {accountsFetcher} {accountActions} />
{#if $isUserLoggedIn }
<AccountsListPage {accountsFetcher} {accountActions} />
{/if}
<script>
import AccountsListPage from '../_components/AccountsListPage.html'
import { store } from '../_store/store'

View file

@ -12,6 +12,15 @@
<p>Icons provided by <ExternalLink href="http://fontawesome.io/">Font Awesome</ExternalLink>.</p>
<p>Logo thanks to "sailboat" by Gregor Cresnar from <ExternalLink href="https://thenounproject.com/">the Noun Project</ExternalLink>.</p>
<div style="display: none">
<!-- TODO: this is just a hack so that `sapper export` knows to crawl these files -->
<a href="/muted">Muted</a>
<a href="/blocked">Blocked</a>
<a href="/pinned">Pinned</a>
<a href="/requests">Requests</a>
<a href="/share">Share</a>
</div>
</SettingsLayout>
<script>
import SettingsLayout from '../../_components/settings/SettingsLayout.html'