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" /> <DynamicPageBanner title="Blocked users" icon="#fa-ban" />
<AccountsListPage {accountsFetcher} {accountActions} /> {#if $isUserLoggedIn }
<AccountsListPage {accountsFetcher} {accountActions} />
{/if}
<script> <script>
import AccountsListPage from '../_components/AccountsListPage.html' import AccountsListPage from '../_components/AccountsListPage.html'
import { store } from '../_store/store' import { store } from '../_store/store'

View file

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

View file

@ -1,5 +1,6 @@
<DynamicPageBanner title="Pinned toots" icon="#fa-thumb-tack" /> <DynamicPageBanner title="Pinned toots" icon="#fa-thumb-tack" />
<div class="pinned-toots-page"> {#if $isUserLoggedIn }
<div class="pinned-toots-page">
{#if loading} {#if loading}
<LoadingPage /> <LoadingPage />
{:elseif statuses && statuses.length} {:elseif statuses && statuses.length}
@ -9,7 +10,8 @@
{/each} {/each}
</ul> </ul>
{/if} {/if}
</div> </div>
{/if}
<style> <style>
.pinned-toots-page { .pinned-toots-page {
padding: 20px 20px; padding: 20px 20px;

View file

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