fix(ci): strip 'build' from .dockerignore before docker-ui build
When PREBUILT=1 the pre-built artifact is downloaded into ui/build/ but
.dockerignore excludes 'build', so Docker never sees it and /app/build
doesn't exist in the builder stage — causing the runtime COPY to fail.
Fix: rewrite ui/.dockerignore on the CI runner (grep -v '^build$') so the
pre-built directory is included in the Docker context.
Also in this commit:
- book page: gate EPUB download on isPro (UI upsell + server 403 guard)
- book page: chapter names default pattern changed to '{scene}'
This commit is contained in:
@@ -239,6 +239,11 @@ jobs:
|
||||
name: ui-build-injected
|
||||
path: ui/build
|
||||
|
||||
- name: Allow build/ into Docker context (override .dockerignore)
|
||||
run: |
|
||||
grep -v '^build$' ui/.dockerignore > ui/.dockerignore.tmp
|
||||
mv ui/.dockerignore.tmp ui/.dockerignore
|
||||
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
|
||||
@@ -2,7 +2,11 @@ import { error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const GET: RequestHandler = async ({ params, url }) => {
|
||||
export const GET: RequestHandler = async ({ params, url, locals }) => {
|
||||
if (!locals.isPro) {
|
||||
error(403, 'EPUB download requires a Pro subscription');
|
||||
}
|
||||
|
||||
const { slug } = params;
|
||||
const from = url.searchParams.get('from');
|
||||
const to = url.searchParams.get('to');
|
||||
|
||||
@@ -64,8 +64,9 @@ export const load: PageServerLoad = async ({ params, locals }) => {
|
||||
lastChapter: null,
|
||||
userRating: 0,
|
||||
ratingAvg: { avg: 0, count: 0 },
|
||||
isAdmin: locals.user?.role === 'admin',
|
||||
isLoggedIn: !!locals.user,
|
||||
isAdmin: locals.user?.role === 'admin',
|
||||
isPro: locals.isPro,
|
||||
isLoggedIn: !!locals.user,
|
||||
currentUserId: locals.user?.id ?? '',
|
||||
scraping: true,
|
||||
taskId: body.task_id
|
||||
|
||||
@@ -326,7 +326,7 @@
|
||||
let chapNamesPreview = $state<{ number: number; old_title: string; new_title: string; edited: string }[]>([]);
|
||||
let chapNamesApplying = $state(false);
|
||||
let chapNamesResult = $state<'applied' | 'error' | ''>('');
|
||||
let chapNamesPattern = $state('Chapter {n}: {scene}');
|
||||
let chapNamesPattern = $state('{scene}');
|
||||
let chapNamesBatchProgress = $state('');
|
||||
let chapNamesBatchWarnings = $state<string[]>([]);
|
||||
|
||||
@@ -342,7 +342,7 @@
|
||||
const res = await fetch('/api/admin/text-gen/chapter-names', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug, pattern: chapNamesPattern.trim() || 'Chapter {n}: {scene}' })
|
||||
body: JSON.stringify({ slug, pattern: chapNamesPattern.trim() || '{scene}' })
|
||||
});
|
||||
if (!res.ok) {
|
||||
chapNamesResult = 'error';
|
||||
@@ -835,13 +835,22 @@
|
||||
<p class="text-sm font-medium text-(--color-text)">Download</p>
|
||||
<p class="text-xs text-(--color-muted)">All {chapterList.length} chapters as EPUB</p>
|
||||
</div>
|
||||
<a
|
||||
href="/api/export/{book.slug}"
|
||||
download="{book.slug}.epub"
|
||||
class="px-3 py-1.5 rounded-lg bg-(--color-surface-2) border border-(--color-border) text-sm font-medium text-(--color-muted) hover:text-(--color-text) hover:border-zinc-500 transition-colors flex-shrink-0"
|
||||
>
|
||||
.epub
|
||||
</a>
|
||||
{#if data.isPro}
|
||||
<a
|
||||
href="/api/export/{book.slug}"
|
||||
download="{book.slug}.epub"
|
||||
class="px-3 py-1.5 rounded-lg bg-(--color-surface-2) border border-(--color-border) text-sm font-medium text-(--color-muted) hover:text-(--color-text) hover:border-zinc-500 transition-colors flex-shrink-0"
|
||||
>
|
||||
.epub
|
||||
</a>
|
||||
{:else}
|
||||
<a
|
||||
href="/profile"
|
||||
class="px-3 py-1.5 rounded-lg bg-(--color-brand)/15 border border-(--color-brand)/30 text-sm font-medium text-(--color-brand) hover:bg-(--color-brand)/25 transition-colors flex-shrink-0"
|
||||
>
|
||||
Pro
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1135,7 +1144,7 @@
|
||||
<input
|
||||
type="text"
|
||||
bind:value={chapNamesPattern}
|
||||
placeholder="Chapter {'{n}'}: {'{scene}'}"
|
||||
placeholder="{'{scene}'}"
|
||||
class="w-full px-2 py-1.5 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
/>
|
||||
<div class="flex items-center gap-3 flex-wrap">
|
||||
|
||||
Reference in New Issue
Block a user