Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b7fcf432b | ||
|
|
c4a0256f6e | ||
|
|
18f490f790 | ||
|
|
6456e8cf5d | ||
|
|
25150c2284 | ||
|
|
0e0a70a786 | ||
|
|
bdbe48ce1a | ||
|
|
87c541b178 | ||
|
|
0b82d96798 | ||
|
|
a2dd0681d2 | ||
|
|
ad50bd21ea | ||
|
|
6572e7c849 |
14
.githooks/pre-commit
Executable file
14
.githooks/pre-commit
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Auto-recompile paraglide messages when ui/messages/*.json files are staged.
|
||||
# Prevents svelte-check / CI failures caused by stale generated JS files.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
STAGED=$(git diff --cached --name-only)
|
||||
|
||||
if echo "$STAGED" | grep -q '^ui/messages/'; then
|
||||
echo "[pre-commit] ui/messages/*.json changed — recompiling paraglide..."
|
||||
(cd ui && npm run paraglide --silent)
|
||||
git add -f ui/src/lib/paraglide/messages/
|
||||
echo "[pre-commit] paraglide output re-staged."
|
||||
fi
|
||||
@@ -133,6 +133,15 @@ func run() error {
|
||||
log.Info("CFAI_ACCOUNT_ID/CFAI_API_TOKEN not set — image generation unavailable")
|
||||
}
|
||||
|
||||
// ── Cloudflare Workers AI Text Generation ─────────────────────────────────
|
||||
var textGenClient cfai.TextGenClient
|
||||
if cfg.CFAI.AccountID != "" && cfg.CFAI.APIToken != "" {
|
||||
textGenClient = cfai.NewTextGen(cfg.CFAI.AccountID, cfg.CFAI.APIToken)
|
||||
log.Info("cloudflare AI text generation enabled")
|
||||
} else {
|
||||
log.Info("CFAI_ACCOUNT_ID/CFAI_API_TOKEN not set — text generation unavailable")
|
||||
}
|
||||
|
||||
// ── Meilisearch (search reads only; indexing is the runner's job) ────────
|
||||
var searchIndex meili.Client
|
||||
if cfg.Meilisearch.URL != "" {
|
||||
@@ -184,6 +193,8 @@ func run() error {
|
||||
PocketTTS: pocketTTSClient,
|
||||
CFAI: cfaiClient,
|
||||
ImageGen: imageGenClient,
|
||||
TextGen: textGenClient,
|
||||
BookWriter: store,
|
||||
Log: log,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -195,7 +195,7 @@ func (s *Server) handleAdminImageGen(w http.ResponseWriter, r *http.Request) {
|
||||
// Non-fatal: still return the image
|
||||
} else {
|
||||
saved = true
|
||||
coverURL = fmt.Sprintf("/api/cover/local/%s", req.Slug)
|
||||
coverURL = fmt.Sprintf("/api/cover/novelfire.net/%s", req.Slug)
|
||||
s.deps.Log.Info("admin: generated cover saved", "slug", req.Slug, "bytes", len(imgData))
|
||||
}
|
||||
}
|
||||
@@ -213,6 +213,62 @@ func (s *Server) handleAdminImageGen(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
// saveCoverRequest is the JSON body for POST /api/admin/image-gen/save-cover.
|
||||
type saveCoverRequest struct {
|
||||
// Slug is the book slug whose cover should be overwritten.
|
||||
Slug string `json:"slug"`
|
||||
// ImageB64 is the base64-encoded image bytes (PNG or JPEG).
|
||||
ImageB64 string `json:"image_b64"`
|
||||
}
|
||||
|
||||
// handleAdminImageGenSaveCover handles POST /api/admin/image-gen/save-cover.
|
||||
//
|
||||
// Accepts a pre-generated image as base64 and stores it as the book cover in
|
||||
// MinIO, replacing the existing one. Does not call Cloudflare AI at all.
|
||||
func (s *Server) handleAdminImageGenSaveCover(w http.ResponseWriter, r *http.Request) {
|
||||
if s.deps.CoverStore == nil {
|
||||
jsonError(w, http.StatusServiceUnavailable, "cover store not configured")
|
||||
return
|
||||
}
|
||||
|
||||
var req saveCoverRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
jsonError(w, http.StatusBadRequest, "parse body: "+err.Error())
|
||||
return
|
||||
}
|
||||
if req.Slug == "" {
|
||||
jsonError(w, http.StatusBadRequest, "slug is required")
|
||||
return
|
||||
}
|
||||
if req.ImageB64 == "" {
|
||||
jsonError(w, http.StatusBadRequest, "image_b64 is required")
|
||||
return
|
||||
}
|
||||
|
||||
imgData, err := base64.StdEncoding.DecodeString(req.ImageB64)
|
||||
if err != nil {
|
||||
imgData, err = base64.RawStdEncoding.DecodeString(req.ImageB64)
|
||||
if err != nil {
|
||||
jsonError(w, http.StatusBadRequest, "decode image_b64: "+err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
contentType := sniffImageContentType(imgData)
|
||||
if err := s.deps.CoverStore.PutCover(r.Context(), req.Slug, imgData, contentType); err != nil {
|
||||
s.deps.Log.Error("admin: save-cover failed", "slug", req.Slug, "err", err)
|
||||
jsonError(w, http.StatusInternalServerError, "save cover: "+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
s.deps.Log.Info("admin: cover saved via image-gen", "slug", req.Slug, "bytes", len(imgData))
|
||||
writeJSON(w, 0, map[string]any{
|
||||
"saved": true,
|
||||
"cover_url": fmt.Sprintf("/api/cover/novelfire.net/%s", req.Slug),
|
||||
"bytes": len(imgData),
|
||||
})
|
||||
}
|
||||
|
||||
// sniffImageContentType returns the MIME type of the image bytes.
|
||||
func sniffImageContentType(data []byte) string {
|
||||
if len(data) >= 4 {
|
||||
|
||||
424
backend/internal/backend/handlers_textgen.go
Normal file
424
backend/internal/backend/handlers_textgen.go
Normal file
@@ -0,0 +1,424 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/libnovel/backend/internal/cfai"
|
||||
"github.com/libnovel/backend/internal/domain"
|
||||
)
|
||||
|
||||
// handleAdminTextGenModels handles GET /api/admin/text-gen/models.
|
||||
// Returns the list of supported Cloudflare AI text generation models.
|
||||
func (s *Server) handleAdminTextGenModels(w http.ResponseWriter, r *http.Request) {
|
||||
if s.deps.TextGen == nil {
|
||||
jsonError(w, http.StatusServiceUnavailable, "text generation not configured (CFAI_ACCOUNT_ID/CFAI_API_TOKEN missing)")
|
||||
return
|
||||
}
|
||||
models := s.deps.TextGen.Models()
|
||||
writeJSON(w, 0, map[string]any{"models": models})
|
||||
}
|
||||
|
||||
// ── Chapter names ─────────────────────────────────────────────────────────────
|
||||
|
||||
// textGenChapterNamesRequest is the JSON body for POST /api/admin/text-gen/chapter-names.
|
||||
type textGenChapterNamesRequest struct {
|
||||
// Slug is the book slug whose chapters to process.
|
||||
Slug string `json:"slug"`
|
||||
// Pattern is a free-text description of the desired naming convention,
|
||||
// e.g. "Chapter {n}: {brief scene description}".
|
||||
Pattern string `json:"pattern"`
|
||||
// Model is the CF Workers AI model ID. Defaults to the recommended model when empty.
|
||||
Model string `json:"model"`
|
||||
// MaxTokens limits response length (0 = model default).
|
||||
MaxTokens int `json:"max_tokens"`
|
||||
}
|
||||
|
||||
// textGenChapterNamesResponse is the JSON body returned by POST /api/admin/text-gen/chapter-names.
|
||||
type textGenChapterNamesResponse struct {
|
||||
// Chapters is the list of proposed chapter titles, indexed by chapter number.
|
||||
Chapters []proposedChapterTitle `json:"chapters"`
|
||||
// Model is the model that was used.
|
||||
Model string `json:"model"`
|
||||
// RawResponse is the raw model output for debugging / manual editing.
|
||||
RawResponse string `json:"raw_response"`
|
||||
}
|
||||
|
||||
// proposedChapterTitle is a single chapter with its AI-proposed title.
|
||||
type proposedChapterTitle struct {
|
||||
Number int `json:"number"`
|
||||
// OldTitle is the current title stored in the database.
|
||||
OldTitle string `json:"old_title"`
|
||||
// NewTitle is the AI-proposed replacement.
|
||||
NewTitle string `json:"new_title"`
|
||||
}
|
||||
|
||||
// handleAdminTextGenChapterNames handles POST /api/admin/text-gen/chapter-names.
|
||||
//
|
||||
// Reads all chapter titles for the given slug, sends them to the LLM with the
|
||||
// requested naming pattern, and returns proposed replacements. Does NOT persist
|
||||
// anything — the frontend shows a diff and the user must confirm via
|
||||
// POST /api/admin/text-gen/chapter-names/apply.
|
||||
func (s *Server) handleAdminTextGenChapterNames(w http.ResponseWriter, r *http.Request) {
|
||||
if s.deps.TextGen == nil {
|
||||
jsonError(w, http.StatusServiceUnavailable, "text generation not configured (CFAI_ACCOUNT_ID/CFAI_API_TOKEN missing)")
|
||||
return
|
||||
}
|
||||
|
||||
var req textGenChapterNamesRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
jsonError(w, http.StatusBadRequest, "parse body: "+err.Error())
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(req.Slug) == "" {
|
||||
jsonError(w, http.StatusBadRequest, "slug is required")
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(req.Pattern) == "" {
|
||||
jsonError(w, http.StatusBadRequest, "pattern is required")
|
||||
return
|
||||
}
|
||||
|
||||
// Load existing chapter list.
|
||||
chapters, err := s.deps.BookReader.ListChapters(r.Context(), req.Slug)
|
||||
if err != nil {
|
||||
jsonError(w, http.StatusInternalServerError, "list chapters: "+err.Error())
|
||||
return
|
||||
}
|
||||
if len(chapters) == 0 {
|
||||
jsonError(w, http.StatusNotFound, fmt.Sprintf("no chapters found for slug %q", req.Slug))
|
||||
return
|
||||
}
|
||||
|
||||
// Build the prompt.
|
||||
var chapterListSB strings.Builder
|
||||
for _, ch := range chapters {
|
||||
chapterListSB.WriteString(fmt.Sprintf("%d: %s\n", ch.Number, ch.Title))
|
||||
}
|
||||
|
||||
systemPrompt := `You are a chapter title editor for a web novel platform. ` +
|
||||
`The user provides a list of chapter numbers with their current titles, ` +
|
||||
`and a naming pattern template. ` +
|
||||
`Your job: produce one new title for every chapter, following the pattern exactly. ` +
|
||||
`Pattern placeholders: {n} = the chapter number (integer), {scene} = a very short (2–5 word) scene hint derived from the existing title. ` +
|
||||
`RULES: ` +
|
||||
`1. Do NOT include the chapter number inside the title text — the {n} placeholder is already in the pattern. ` +
|
||||
`2. Do NOT include any prefix like "Chapter X -" or "Chapter X:" inside the title field itself. ` +
|
||||
`3. The "title" field in your JSON must be the fully-rendered string (e.g. if pattern is "Chapter {n}: {scene}", output "Chapter 3: The Bet"). ` +
|
||||
`4. Respond ONLY with a raw JSON array — no prose, no markdown fences, no explanation. ` +
|
||||
`5. Each element: {"number": <int>, "title": <string>}. ` +
|
||||
`6. Output every chapter in the input list, in order. Do not skip any.`
|
||||
|
||||
userPrompt := fmt.Sprintf(
|
||||
"Naming pattern: %s\n\nChapters:\n%s",
|
||||
req.Pattern,
|
||||
chapterListSB.String(),
|
||||
)
|
||||
|
||||
model := cfai.TextModel(req.Model)
|
||||
if model == "" {
|
||||
model = cfai.DefaultTextModel
|
||||
}
|
||||
|
||||
// Default to 4096 tokens so large chapter lists are not truncated.
|
||||
maxTokens := req.MaxTokens
|
||||
if maxTokens <= 0 {
|
||||
maxTokens = 4096
|
||||
}
|
||||
|
||||
s.deps.Log.Info("admin: text-gen chapter-names requested",
|
||||
"slug", req.Slug, "chapters", len(chapters), "model", model, "max_tokens", maxTokens)
|
||||
|
||||
raw, genErr := s.deps.TextGen.Generate(r.Context(), cfai.TextRequest{
|
||||
Model: model,
|
||||
Messages: []cfai.TextMessage{
|
||||
{Role: "system", Content: systemPrompt},
|
||||
{Role: "user", Content: userPrompt},
|
||||
},
|
||||
MaxTokens: maxTokens,
|
||||
})
|
||||
if genErr != nil {
|
||||
s.deps.Log.Error("admin: text-gen chapter-names failed", "err", genErr)
|
||||
jsonError(w, http.StatusBadGateway, "text generation failed: "+genErr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Parse the JSON array from the model response.
|
||||
proposed := parseChapterTitlesJSON(raw)
|
||||
|
||||
// Build the response: merge proposed titles with old titles.
|
||||
// Index existing chapters by number for O(1) lookup.
|
||||
existing := make(map[int]string, len(chapters))
|
||||
for _, ch := range chapters {
|
||||
existing[ch.Number] = ch.Title
|
||||
}
|
||||
|
||||
result := make([]proposedChapterTitle, 0, len(proposed))
|
||||
for _, p := range proposed {
|
||||
result = append(result, proposedChapterTitle{
|
||||
Number: p.Number,
|
||||
OldTitle: existing[p.Number],
|
||||
NewTitle: p.Title,
|
||||
})
|
||||
}
|
||||
|
||||
writeJSON(w, 0, textGenChapterNamesResponse{
|
||||
Chapters: result,
|
||||
Model: string(model),
|
||||
RawResponse: raw,
|
||||
})
|
||||
}
|
||||
|
||||
// parseChapterTitlesJSON extracts the JSON array from a model response.
|
||||
// It tolerates markdown fences and surrounding prose.
|
||||
type rawChapterTitle struct {
|
||||
Number int `json:"number"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
func parseChapterTitlesJSON(raw string) []rawChapterTitle {
|
||||
// Strip markdown fences if present.
|
||||
s := raw
|
||||
if idx := strings.Index(s, "```json"); idx >= 0 {
|
||||
s = s[idx+7:]
|
||||
} else if idx := strings.Index(s, "```"); idx >= 0 {
|
||||
s = s[idx+3:]
|
||||
}
|
||||
if idx := strings.LastIndex(s, "```"); idx >= 0 {
|
||||
s = s[:idx]
|
||||
}
|
||||
// Find the JSON array boundaries.
|
||||
start := strings.Index(s, "[")
|
||||
end := strings.LastIndex(s, "]")
|
||||
if start < 0 || end <= start {
|
||||
return nil
|
||||
}
|
||||
s = s[start : end+1]
|
||||
var out []rawChapterTitle
|
||||
json.Unmarshal([]byte(s), &out) //nolint:errcheck
|
||||
return out
|
||||
}
|
||||
|
||||
// ── Apply chapter names ───────────────────────────────────────────────────────
|
||||
|
||||
// applyChapterNamesRequest is the JSON body for POST /api/admin/text-gen/chapter-names/apply.
|
||||
type applyChapterNamesRequest struct {
|
||||
// Slug is the book slug to update.
|
||||
Slug string `json:"slug"`
|
||||
// Chapters is the list of chapters to save (number + new_title pairs).
|
||||
// The UI may modify individual titles before confirming.
|
||||
Chapters []applyChapterEntry `json:"chapters"`
|
||||
}
|
||||
|
||||
type applyChapterEntry struct {
|
||||
Number int `json:"number"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
// handleAdminTextGenApplyChapterNames handles POST /api/admin/text-gen/chapter-names/apply.
|
||||
//
|
||||
// Persists the confirmed chapter titles to PocketBase chapters_idx.
|
||||
func (s *Server) handleAdminTextGenApplyChapterNames(w http.ResponseWriter, r *http.Request) {
|
||||
if s.deps.BookWriter == nil {
|
||||
jsonError(w, http.StatusServiceUnavailable, "book writer not configured")
|
||||
return
|
||||
}
|
||||
|
||||
var req applyChapterNamesRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
jsonError(w, http.StatusBadRequest, "parse body: "+err.Error())
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(req.Slug) == "" {
|
||||
jsonError(w, http.StatusBadRequest, "slug is required")
|
||||
return
|
||||
}
|
||||
if len(req.Chapters) == 0 {
|
||||
jsonError(w, http.StatusBadRequest, "chapters is required")
|
||||
return
|
||||
}
|
||||
|
||||
refs := make([]domain.ChapterRef, 0, len(req.Chapters))
|
||||
for _, ch := range req.Chapters {
|
||||
if ch.Number <= 0 {
|
||||
continue
|
||||
}
|
||||
refs = append(refs, domain.ChapterRef{
|
||||
Number: ch.Number,
|
||||
Title: strings.TrimSpace(ch.Title),
|
||||
})
|
||||
}
|
||||
|
||||
if err := s.deps.BookWriter.WriteChapterRefs(r.Context(), req.Slug, refs); err != nil {
|
||||
s.deps.Log.Error("admin: apply chapter names failed", "slug", req.Slug, "err", err)
|
||||
jsonError(w, http.StatusInternalServerError, "write chapter refs: "+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
s.deps.Log.Info("admin: chapter names applied", "slug", req.Slug, "count", len(refs))
|
||||
writeJSON(w, 0, map[string]any{"updated": len(refs)})
|
||||
}
|
||||
|
||||
// ── Book description ──────────────────────────────────────────────────────────
|
||||
|
||||
// textGenDescriptionRequest is the JSON body for POST /api/admin/text-gen/description.
|
||||
type textGenDescriptionRequest struct {
|
||||
// Slug is the book slug whose description to regenerate.
|
||||
Slug string `json:"slug"`
|
||||
// Instructions is an optional free-text hint for the AI,
|
||||
// e.g. "Write a 3-sentence blurb, avoid spoilers, dramatic tone."
|
||||
Instructions string `json:"instructions"`
|
||||
// Model is the CF Workers AI model ID. Defaults to recommended when empty.
|
||||
Model string `json:"model"`
|
||||
// MaxTokens limits response length (0 = model default).
|
||||
MaxTokens int `json:"max_tokens"`
|
||||
}
|
||||
|
||||
// textGenDescriptionResponse is the JSON body returned by POST /api/admin/text-gen/description.
|
||||
type textGenDescriptionResponse struct {
|
||||
// OldDescription is the current summary stored in the database.
|
||||
OldDescription string `json:"old_description"`
|
||||
// NewDescription is the AI-proposed replacement.
|
||||
NewDescription string `json:"new_description"`
|
||||
// Model is the model that was used.
|
||||
Model string `json:"model"`
|
||||
}
|
||||
|
||||
// handleAdminTextGenDescription handles POST /api/admin/text-gen/description.
|
||||
//
|
||||
// Reads the current book metadata, sends it to the LLM, and returns a proposed
|
||||
// new description. Does NOT persist anything — the user must confirm via
|
||||
// POST /api/admin/text-gen/description/apply.
|
||||
func (s *Server) handleAdminTextGenDescription(w http.ResponseWriter, r *http.Request) {
|
||||
if s.deps.TextGen == nil {
|
||||
jsonError(w, http.StatusServiceUnavailable, "text generation not configured (CFAI_ACCOUNT_ID/CFAI_API_TOKEN missing)")
|
||||
return
|
||||
}
|
||||
|
||||
var req textGenDescriptionRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
jsonError(w, http.StatusBadRequest, "parse body: "+err.Error())
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(req.Slug) == "" {
|
||||
jsonError(w, http.StatusBadRequest, "slug is required")
|
||||
return
|
||||
}
|
||||
|
||||
// Load current book metadata.
|
||||
meta, ok, err := s.deps.BookReader.ReadMetadata(r.Context(), req.Slug)
|
||||
if err != nil {
|
||||
jsonError(w, http.StatusInternalServerError, "read metadata: "+err.Error())
|
||||
return
|
||||
}
|
||||
if !ok {
|
||||
jsonError(w, http.StatusNotFound, fmt.Sprintf("book %q not found", req.Slug))
|
||||
return
|
||||
}
|
||||
|
||||
systemPrompt := `You are a book description writer for a web novel platform. ` +
|
||||
`Given a book's title, author, genres, and current description, write an improved ` +
|
||||
`description that accurately captures the story. ` +
|
||||
`Respond with ONLY the new description text — no title, no labels, no markdown, no quotes.`
|
||||
|
||||
instructions := strings.TrimSpace(req.Instructions)
|
||||
if instructions == "" {
|
||||
instructions = "Write a compelling 2–4 sentence description. Keep it spoiler-free and engaging."
|
||||
}
|
||||
|
||||
userPrompt := fmt.Sprintf(
|
||||
"Title: %s\nAuthor: %s\nGenres: %s\nStatus: %s\n\nCurrent description:\n%s\n\nInstructions: %s",
|
||||
meta.Title,
|
||||
meta.Author,
|
||||
strings.Join(meta.Genres, ", "),
|
||||
meta.Status,
|
||||
meta.Summary,
|
||||
instructions,
|
||||
)
|
||||
|
||||
model := cfai.TextModel(req.Model)
|
||||
if model == "" {
|
||||
model = cfai.DefaultTextModel
|
||||
}
|
||||
|
||||
s.deps.Log.Info("admin: text-gen description requested",
|
||||
"slug", req.Slug, "model", model)
|
||||
|
||||
newDesc, genErr := s.deps.TextGen.Generate(r.Context(), cfai.TextRequest{
|
||||
Model: model,
|
||||
Messages: []cfai.TextMessage{
|
||||
{Role: "system", Content: systemPrompt},
|
||||
{Role: "user", Content: userPrompt},
|
||||
},
|
||||
MaxTokens: req.MaxTokens,
|
||||
})
|
||||
if genErr != nil {
|
||||
s.deps.Log.Error("admin: text-gen description failed", "err", genErr)
|
||||
jsonError(w, http.StatusBadGateway, "text generation failed: "+genErr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
writeJSON(w, 0, textGenDescriptionResponse{
|
||||
OldDescription: meta.Summary,
|
||||
NewDescription: strings.TrimSpace(newDesc),
|
||||
Model: string(model),
|
||||
})
|
||||
}
|
||||
|
||||
// ── Apply description ─────────────────────────────────────────────────────────
|
||||
|
||||
// applyDescriptionRequest is the JSON body for POST /api/admin/text-gen/description/apply.
|
||||
type applyDescriptionRequest struct {
|
||||
// Slug is the book slug to update.
|
||||
Slug string `json:"slug"`
|
||||
// Description is the new summary text to persist.
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// handleAdminTextGenApplyDescription handles POST /api/admin/text-gen/description/apply.
|
||||
//
|
||||
// Updates only the summary field in PocketBase, leaving all other book metadata
|
||||
// unchanged.
|
||||
func (s *Server) handleAdminTextGenApplyDescription(w http.ResponseWriter, r *http.Request) {
|
||||
if s.deps.BookWriter == nil {
|
||||
jsonError(w, http.StatusServiceUnavailable, "book writer not configured")
|
||||
return
|
||||
}
|
||||
|
||||
var req applyDescriptionRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
jsonError(w, http.StatusBadRequest, "parse body: "+err.Error())
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(req.Slug) == "" {
|
||||
jsonError(w, http.StatusBadRequest, "slug is required")
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(req.Description) == "" {
|
||||
jsonError(w, http.StatusBadRequest, "description is required")
|
||||
return
|
||||
}
|
||||
|
||||
// Read existing metadata so we can write it back with only summary changed.
|
||||
meta, ok, err := s.deps.BookReader.ReadMetadata(r.Context(), req.Slug)
|
||||
if err != nil {
|
||||
jsonError(w, http.StatusInternalServerError, "read metadata: "+err.Error())
|
||||
return
|
||||
}
|
||||
if !ok {
|
||||
jsonError(w, http.StatusNotFound, fmt.Sprintf("book %q not found", req.Slug))
|
||||
return
|
||||
}
|
||||
|
||||
meta.Summary = strings.TrimSpace(req.Description)
|
||||
if err := s.deps.BookWriter.WriteMetadata(r.Context(), meta); err != nil {
|
||||
s.deps.Log.Error("admin: apply description failed", "slug", req.Slug, "err", err)
|
||||
jsonError(w, http.StatusInternalServerError, "write metadata: "+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
s.deps.Log.Info("admin: book description applied", "slug", req.Slug)
|
||||
writeJSON(w, 0, map[string]any{"updated": true})
|
||||
}
|
||||
@@ -76,6 +76,12 @@ type Dependencies struct {
|
||||
// ImageGen is the Cloudflare Workers AI image generation client.
|
||||
// If nil, image generation endpoints return 503.
|
||||
ImageGen cfai.ImageGenClient
|
||||
// TextGen is the Cloudflare Workers AI text generation client.
|
||||
// If nil, text generation endpoints return 503.
|
||||
TextGen cfai.TextGenClient
|
||||
// BookWriter writes book metadata and chapter refs to PocketBase.
|
||||
// Used by admin text-gen apply endpoints.
|
||||
BookWriter bookstore.BookWriter
|
||||
// Log is the structured logger.
|
||||
Log *slog.Logger
|
||||
}
|
||||
@@ -189,6 +195,14 @@ func (s *Server) ListenAndServe(ctx context.Context) error {
|
||||
// Admin image generation endpoints
|
||||
mux.HandleFunc("GET /api/admin/image-gen/models", s.handleAdminImageGenModels)
|
||||
mux.HandleFunc("POST /api/admin/image-gen", s.handleAdminImageGen)
|
||||
mux.HandleFunc("POST /api/admin/image-gen/save-cover", s.handleAdminImageGenSaveCover)
|
||||
|
||||
// Admin text generation endpoints (chapter names + book description)
|
||||
mux.HandleFunc("GET /api/admin/text-gen/models", s.handleAdminTextGenModels)
|
||||
mux.HandleFunc("POST /api/admin/text-gen/chapter-names", s.handleAdminTextGenChapterNames)
|
||||
mux.HandleFunc("POST /api/admin/text-gen/chapter-names/apply", s.handleAdminTextGenApplyChapterNames)
|
||||
mux.HandleFunc("POST /api/admin/text-gen/description", s.handleAdminTextGenDescription)
|
||||
mux.HandleFunc("POST /api/admin/text-gen/description/apply", s.handleAdminTextGenApplyDescription)
|
||||
|
||||
// Voices list
|
||||
mux.HandleFunc("GET /api/voices", s.handleVoices)
|
||||
|
||||
239
backend/internal/cfai/text.go
Normal file
239
backend/internal/cfai/text.go
Normal file
@@ -0,0 +1,239 @@
|
||||
// Text generation via Cloudflare Workers AI LLM models.
|
||||
//
|
||||
// API reference:
|
||||
//
|
||||
// POST https://api.cloudflare.com/client/v4/accounts/{accountID}/ai/run/{model}
|
||||
// Authorization: Bearer {apiToken}
|
||||
// Content-Type: application/json
|
||||
//
|
||||
// Request body (all models):
|
||||
//
|
||||
// { "messages": [{"role":"system","content":"..."},{"role":"user","content":"..."}] }
|
||||
//
|
||||
// Response (wrapped):
|
||||
//
|
||||
// { "result": { "response": "..." }, "success": true }
|
||||
package cfai
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TextModel identifies a Cloudflare Workers AI text generation model.
|
||||
type TextModel string
|
||||
|
||||
const (
|
||||
// TextModelGemma4 — Google Gemma 4, 256k context.
|
||||
TextModelGemma4 TextModel = "@cf/google/gemma-4-26b-a4b-it"
|
||||
// TextModelLlama4Scout — Meta Llama 4 Scout 17B, multimodal.
|
||||
TextModelLlama4Scout TextModel = "@cf/meta/llama-4-scout-17b-16e-instruct"
|
||||
// TextModelLlama33_70B — Meta Llama 3.3 70B, fast fp8.
|
||||
TextModelLlama33_70B TextModel = "@cf/meta/llama-3.3-70b-instruct-fp8-fast"
|
||||
// TextModelQwen3_30B — Qwen3 30B MoE, function calling.
|
||||
TextModelQwen3_30B TextModel = "@cf/qwen/qwen3-30b-a3b-fp8"
|
||||
// TextModelMistralSmall — Mistral Small 3.1 24B, 128k context.
|
||||
TextModelMistralSmall TextModel = "@cf/mistralai/mistral-small-3.1-24b-instruct"
|
||||
// TextModelQwQ32B — Qwen QwQ 32B reasoning model.
|
||||
TextModelQwQ32B TextModel = "@cf/qwen/qwq-32b"
|
||||
// TextModelDeepSeekR1 — DeepSeek R1 distill Qwen 32B.
|
||||
TextModelDeepSeekR1 TextModel = "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"
|
||||
// TextModelGemma3_12B — Google Gemma 3 12B, 80k context.
|
||||
TextModelGemma3_12B TextModel = "@cf/google/gemma-3-12b-it"
|
||||
// TextModelGPTOSS120B — OpenAI gpt-oss-120b, high reasoning.
|
||||
TextModelGPTOSS120B TextModel = "@cf/openai/gpt-oss-120b"
|
||||
// TextModelGPTOSS20B — OpenAI gpt-oss-20b, lower latency.
|
||||
TextModelGPTOSS20B TextModel = "@cf/openai/gpt-oss-20b"
|
||||
// TextModelNemotron3 — NVIDIA Nemotron 3 120B, agentic.
|
||||
TextModelNemotron3 TextModel = "@cf/nvidia/nemotron-3-120b-a12b"
|
||||
// TextModelLlama32_3B — Meta Llama 3.2 3B, lightweight.
|
||||
TextModelLlama32_3B TextModel = "@cf/meta/llama-3.2-3b-instruct"
|
||||
|
||||
// DefaultTextModel is the default model used when none is specified.
|
||||
DefaultTextModel = TextModelLlama4Scout
|
||||
)
|
||||
|
||||
// TextModelInfo describes a single text generation model.
|
||||
type TextModelInfo struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Provider string `json:"provider"`
|
||||
ContextSize int `json:"context_size"` // max context in tokens
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// AllTextModels returns metadata about every supported text generation model.
|
||||
func AllTextModels() []TextModelInfo {
|
||||
return []TextModelInfo{
|
||||
{
|
||||
ID: string(TextModelGemma4), Label: "Gemma 4 26B", Provider: "Google",
|
||||
ContextSize: 256000,
|
||||
Description: "Google's most intelligent open model family. 256k context, function calling.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelLlama4Scout), Label: "Llama 4 Scout 17B", Provider: "Meta",
|
||||
ContextSize: 131000,
|
||||
Description: "Natively multimodal, 16 experts. Good all-purpose model with function calling.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelLlama33_70B), Label: "Llama 3.3 70B (fp8 fast)", Provider: "Meta",
|
||||
ContextSize: 24000,
|
||||
Description: "Llama 3.3 70B quantized to fp8 for speed. Excellent instruction following.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelQwen3_30B), Label: "Qwen3 30B MoE", Provider: "Qwen",
|
||||
ContextSize: 32768,
|
||||
Description: "MoE architecture with strong reasoning and instruction following.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelMistralSmall), Label: "Mistral Small 3.1 24B", Provider: "MistralAI",
|
||||
ContextSize: 128000,
|
||||
Description: "Strong text performance with 128k context and function calling.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelQwQ32B), Label: "QwQ 32B (reasoning)", Provider: "Qwen",
|
||||
ContextSize: 24000,
|
||||
Description: "Reasoning model — thinks before answering. Slower but more accurate.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelDeepSeekR1), Label: "DeepSeek R1 32B", Provider: "DeepSeek",
|
||||
ContextSize: 80000,
|
||||
Description: "R1-distilled reasoning model. Outperforms o1-mini on many benchmarks.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelGemma3_12B), Label: "Gemma 3 12B", Provider: "Google",
|
||||
ContextSize: 80000,
|
||||
Description: "Multimodal, 128k context, multilingual (140+ languages).",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelGPTOSS120B), Label: "GPT-OSS 120B", Provider: "OpenAI",
|
||||
ContextSize: 128000,
|
||||
Description: "OpenAI open-weight model for production, general purpose, high reasoning.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelGPTOSS20B), Label: "GPT-OSS 20B", Provider: "OpenAI",
|
||||
ContextSize: 128000,
|
||||
Description: "OpenAI open-weight model for lower latency and specialized use cases.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelNemotron3), Label: "Nemotron 3 120B", Provider: "NVIDIA",
|
||||
ContextSize: 256000,
|
||||
Description: "Hybrid MoE with leading accuracy for multi-agent applications.",
|
||||
},
|
||||
{
|
||||
ID: string(TextModelLlama32_3B), Label: "Llama 3.2 3B", Provider: "Meta",
|
||||
ContextSize: 80000,
|
||||
Description: "Lightweight model for simple tasks. Fast and cheap.",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// TextMessage is a single message in a chat conversation.
|
||||
type TextMessage struct {
|
||||
Role string `json:"role"` // "system" or "user"
|
||||
Content string `json:"content"` // message text
|
||||
}
|
||||
|
||||
// TextRequest is the input to Generate.
|
||||
type TextRequest struct {
|
||||
// Model is the CF Workers AI model ID. Defaults to DefaultTextModel when empty.
|
||||
Model TextModel
|
||||
// Messages is the conversation history (system + user messages).
|
||||
Messages []TextMessage
|
||||
// MaxTokens limits the output length (0 = model default).
|
||||
MaxTokens int
|
||||
}
|
||||
|
||||
// TextGenClient generates text via Cloudflare Workers AI LLM models.
|
||||
type TextGenClient interface {
|
||||
// Generate sends a chat-style request and returns the model's response text.
|
||||
Generate(ctx context.Context, req TextRequest) (string, error)
|
||||
|
||||
// Models returns metadata about all supported text generation models.
|
||||
Models() []TextModelInfo
|
||||
}
|
||||
|
||||
// textGenHTTPClient is the concrete CF AI text generation client.
|
||||
type textGenHTTPClient struct {
|
||||
accountID string
|
||||
apiToken string
|
||||
http *http.Client
|
||||
}
|
||||
|
||||
// NewTextGen returns a TextGenClient for the given Cloudflare account.
|
||||
func NewTextGen(accountID, apiToken string) TextGenClient {
|
||||
return &textGenHTTPClient{
|
||||
accountID: accountID,
|
||||
apiToken: apiToken,
|
||||
http: &http.Client{Timeout: 5 * time.Minute},
|
||||
}
|
||||
}
|
||||
|
||||
// Generate sends messages to the model and returns the response text.
|
||||
func (c *textGenHTTPClient) Generate(ctx context.Context, req TextRequest) (string, error) {
|
||||
if req.Model == "" {
|
||||
req.Model = DefaultTextModel
|
||||
}
|
||||
|
||||
body := map[string]any{
|
||||
"messages": req.Messages,
|
||||
}
|
||||
if req.MaxTokens > 0 {
|
||||
body["max_tokens"] = req.MaxTokens
|
||||
}
|
||||
|
||||
encoded, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cfai/text: marshal: %w", err)
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("https://api.cloudflare.com/client/v4/accounts/%s/ai/run/%s",
|
||||
c.accountID, string(req.Model))
|
||||
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(encoded))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cfai/text: build request: %w", err)
|
||||
}
|
||||
httpReq.Header.Set("Authorization", "Bearer "+c.apiToken)
|
||||
httpReq.Header.Set("Content-Type", "application/json")
|
||||
|
||||
resp, err := c.http.Do(httpReq)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cfai/text: http: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
errBody, _ := io.ReadAll(resp.Body)
|
||||
msg := string(errBody)
|
||||
if len(msg) > 300 {
|
||||
msg = msg[:300]
|
||||
}
|
||||
return "", fmt.Errorf("cfai/text: model %s returned %d: %s", req.Model, resp.StatusCode, msg)
|
||||
}
|
||||
|
||||
// CF AI wraps responses: { "result": { "response": "..." }, "success": true }
|
||||
var wrapper struct {
|
||||
Result struct {
|
||||
Response string `json:"response"`
|
||||
} `json:"result"`
|
||||
Success bool `json:"success"`
|
||||
Errors []string `json:"errors"`
|
||||
}
|
||||
if err := json.NewDecoder(resp.Body).Decode(&wrapper); err != nil {
|
||||
return "", fmt.Errorf("cfai/text: decode response: %w", err)
|
||||
}
|
||||
if !wrapper.Success {
|
||||
return "", fmt.Errorf("cfai/text: model %s error: %v", req.Model, wrapper.Errors)
|
||||
}
|
||||
return wrapper.Result.Response, nil
|
||||
}
|
||||
|
||||
// Models returns all supported text generation model metadata.
|
||||
func (c *textGenHTTPClient) Models() []TextModelInfo {
|
||||
return AllTextModels()
|
||||
}
|
||||
@@ -19,6 +19,9 @@ x-infra-env: &infra-env
|
||||
MEILI_API_KEY: "${MEILI_MASTER_KEY}"
|
||||
# Valkey
|
||||
VALKEY_ADDR: "valkey:6379"
|
||||
# Cloudflare AI (TTS + image generation)
|
||||
CFAI_ACCOUNT_ID: "${CFAI_ACCOUNT_ID}"
|
||||
CFAI_API_TOKEN: "${CFAI_API_TOKEN}"
|
||||
|
||||
services:
|
||||
# ─── MinIO (object storage: chapters, audio, avatars, browse) ────────────────
|
||||
@@ -307,6 +310,9 @@ services:
|
||||
GOOGLE_CLIENT_SECRET: "${GOOGLE_CLIENT_SECRET}"
|
||||
GITHUB_CLIENT_ID: "${GITHUB_CLIENT_ID}"
|
||||
GITHUB_CLIENT_SECRET: "${GITHUB_CLIENT_SECRET}"
|
||||
# Polar (subscriptions)
|
||||
POLAR_API_TOKEN: "${POLAR_API_TOKEN}"
|
||||
POLAR_WEBHOOK_SECRET: "${POLAR_WEBHOOK_SECRET}"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/health"]
|
||||
interval: 15s
|
||||
|
||||
7
justfile
7
justfile
@@ -122,6 +122,13 @@ secrets-env:
|
||||
secrets-dashboard:
|
||||
doppler open dashboard
|
||||
|
||||
# ── Developer setup ───────────────────────────────────────────────────────────
|
||||
|
||||
# One-time dev setup: configure git to use committed hooks in .githooks/
|
||||
setup:
|
||||
git config core.hooksPath .githooks
|
||||
@echo "Git hooks configured (.githooks/pre-commit active)."
|
||||
|
||||
# ── Gitea CI ──────────────────────────────────────────────────────────────────
|
||||
|
||||
# Validate workflow files
|
||||
|
||||
@@ -302,6 +302,24 @@
|
||||
"book_detail_range_queuing": "Queuing\u2026",
|
||||
"book_detail_scrape_range": "Scrape range",
|
||||
"book_detail_admin": "Admin",
|
||||
"book_detail_admin_book_cover": "Book Cover",
|
||||
"book_detail_admin_chapter_cover": "Chapter Cover",
|
||||
"book_detail_admin_chapter_n": "Chapter #",
|
||||
"book_detail_admin_description": "Description",
|
||||
"book_detail_admin_chapter_names": "Chapter Names",
|
||||
"book_detail_admin_audio_tts": "Audio TTS",
|
||||
"book_detail_admin_voice": "Voice",
|
||||
"book_detail_admin_generate": "Generate",
|
||||
"book_detail_admin_save_cover": "Save Cover",
|
||||
"book_detail_admin_saving": "Saving…",
|
||||
"book_detail_admin_saved": "Saved",
|
||||
"book_detail_admin_apply": "Apply",
|
||||
"book_detail_admin_applying": "Applying…",
|
||||
"book_detail_admin_applied": "Applied",
|
||||
"book_detail_admin_discard": "Discard",
|
||||
"book_detail_admin_enqueue_audio": "Enqueue Audio",
|
||||
"book_detail_admin_cancel_audio": "Cancel",
|
||||
"book_detail_admin_enqueued": "Enqueued {enqueued}, skipped {skipped}",
|
||||
"book_detail_scraping_progress": "Fetching the first 20 chapters. This page will refresh automatically.",
|
||||
"book_detail_scraping_home": "\u2190 Home",
|
||||
"book_detail_rescrape_book": "Rescrape book",
|
||||
@@ -348,6 +366,26 @@
|
||||
"profile_upgrade_monthly": "Monthly \u2014 $6 / mo",
|
||||
"profile_upgrade_annual": "Annual \u2014 $48 / yr",
|
||||
"profile_free_limits": "Free plan: 3 audio chapters per day, English reading only.",
|
||||
"subscribe_page_title": "Go Pro \u2014 libnovel",
|
||||
"subscribe_heading": "Read more. Listen more.",
|
||||
"subscribe_subheading": "Upgrade to Pro and unlock the full libnovel experience.",
|
||||
"subscribe_monthly_label": "Monthly",
|
||||
"subscribe_monthly_price": "$6",
|
||||
"subscribe_monthly_period": "per month",
|
||||
"subscribe_annual_label": "Annual",
|
||||
"subscribe_annual_price": "$48",
|
||||
"subscribe_annual_period": "per year",
|
||||
"subscribe_annual_save": "Save 33%",
|
||||
"subscribe_cta_monthly": "Start monthly plan",
|
||||
"subscribe_cta_annual": "Start annual plan",
|
||||
"subscribe_already_pro": "You already have a Pro subscription.",
|
||||
"subscribe_manage": "Manage subscription",
|
||||
"subscribe_benefit_audio": "Unlimited audio chapters per day",
|
||||
"subscribe_benefit_voices": "Voice selection across all TTS engines",
|
||||
"subscribe_benefit_translation": "Read in French, Indonesian, Portuguese, and Russian",
|
||||
"subscribe_benefit_downloads": "Download chapters for offline listening",
|
||||
"subscribe_login_prompt": "Sign in to subscribe",
|
||||
"subscribe_login_cta": "Sign in",
|
||||
|
||||
"user_currently_reading": "Currently Reading",
|
||||
"user_library_count": "Library ({n})",
|
||||
@@ -363,6 +401,7 @@
|
||||
"admin_nav_translation": "Translation",
|
||||
"admin_nav_changelog": "Changelog",
|
||||
"admin_nav_image_gen": "Image Gen",
|
||||
"admin_nav_text_gen": "Text Gen",
|
||||
"admin_nav_feedback": "Feedback",
|
||||
"admin_nav_errors": "Errors",
|
||||
"admin_nav_analytics": "Analytics",
|
||||
|
||||
@@ -302,6 +302,24 @@
|
||||
"book_detail_range_queuing": "En file d'attente…",
|
||||
"book_detail_scrape_range": "Plage d'extraction",
|
||||
"book_detail_admin": "Admin",
|
||||
"book_detail_admin_book_cover": "Couverture du livre",
|
||||
"book_detail_admin_chapter_cover": "Couverture du chapitre",
|
||||
"book_detail_admin_chapter_n": "Chapitre n°",
|
||||
"book_detail_admin_description": "Description",
|
||||
"book_detail_admin_chapter_names": "Noms des chapitres",
|
||||
"book_detail_admin_audio_tts": "Audio TTS",
|
||||
"book_detail_admin_voice": "Voix",
|
||||
"book_detail_admin_generate": "Générer",
|
||||
"book_detail_admin_save_cover": "Enregistrer la couverture",
|
||||
"book_detail_admin_saving": "Enregistrement…",
|
||||
"book_detail_admin_saved": "Enregistré",
|
||||
"book_detail_admin_apply": "Appliquer",
|
||||
"book_detail_admin_applying": "Application…",
|
||||
"book_detail_admin_applied": "Appliqué",
|
||||
"book_detail_admin_discard": "Ignorer",
|
||||
"book_detail_admin_enqueue_audio": "Mettre en file audio",
|
||||
"book_detail_admin_cancel_audio": "Annuler",
|
||||
"book_detail_admin_enqueued": "{enqueued} en file, {skipped} ignorés",
|
||||
"book_detail_scraping_progress": "Récupération des 20 premiers chapitres. Cette page sera actualisée automatiquement.",
|
||||
"book_detail_scraping_home": "← Accueil",
|
||||
"book_detail_rescrape_book": "Réextraire le livre",
|
||||
@@ -348,6 +366,26 @@
|
||||
"profile_upgrade_monthly": "Mensuel — 6 $ / mois",
|
||||
"profile_upgrade_annual": "Annuel — 48 $ / an",
|
||||
"profile_free_limits": "Plan gratuit : 3 chapitres audio par jour, lecture en anglais uniquement.",
|
||||
"subscribe_page_title": "Passer Pro \u2014 libnovel",
|
||||
"subscribe_heading": "Lisez plus. Écoutez plus.",
|
||||
"subscribe_subheading": "Passez Pro et débloquez l'expérience libnovel complète.",
|
||||
"subscribe_monthly_label": "Mensuel",
|
||||
"subscribe_monthly_price": "6 $",
|
||||
"subscribe_monthly_period": "par mois",
|
||||
"subscribe_annual_label": "Annuel",
|
||||
"subscribe_annual_price": "48 $",
|
||||
"subscribe_annual_period": "par an",
|
||||
"subscribe_annual_save": "Économisez 33 %",
|
||||
"subscribe_cta_monthly": "Commencer le plan mensuel",
|
||||
"subscribe_cta_annual": "Commencer le plan annuel",
|
||||
"subscribe_already_pro": "Vous avez déjà un abonnement Pro.",
|
||||
"subscribe_manage": "Gérer l'abonnement",
|
||||
"subscribe_benefit_audio": "Chapitres audio illimités par jour",
|
||||
"subscribe_benefit_voices": "Sélection de voix pour tous les moteurs TTS",
|
||||
"subscribe_benefit_translation": "Lire en français, indonésien, portugais et russe",
|
||||
"subscribe_benefit_downloads": "Télécharger des chapitres pour une écoute hors ligne",
|
||||
"subscribe_login_prompt": "Connectez-vous pour vous abonner",
|
||||
"subscribe_login_cta": "Se connecter",
|
||||
|
||||
"user_currently_reading": "En cours de lecture",
|
||||
"user_library_count": "Bibliothèque ({n})",
|
||||
@@ -363,6 +401,7 @@
|
||||
"admin_nav_translation": "Traduction",
|
||||
"admin_nav_changelog": "Modifications",
|
||||
"admin_nav_image_gen": "Image Gen",
|
||||
"admin_nav_text_gen": "Text Gen",
|
||||
"admin_nav_feedback": "Retours",
|
||||
"admin_nav_errors": "Erreurs",
|
||||
"admin_nav_analytics": "Analytique",
|
||||
|
||||
@@ -302,6 +302,24 @@
|
||||
"book_detail_range_queuing": "Mengantri…",
|
||||
"book_detail_scrape_range": "Rentang scrape",
|
||||
"book_detail_admin": "Admin",
|
||||
"book_detail_admin_book_cover": "Sampul Buku",
|
||||
"book_detail_admin_chapter_cover": "Sampul Bab",
|
||||
"book_detail_admin_chapter_n": "Bab #",
|
||||
"book_detail_admin_description": "Deskripsi",
|
||||
"book_detail_admin_chapter_names": "Nama Bab",
|
||||
"book_detail_admin_audio_tts": "Audio TTS",
|
||||
"book_detail_admin_voice": "Suara",
|
||||
"book_detail_admin_generate": "Buat",
|
||||
"book_detail_admin_save_cover": "Simpan Sampul",
|
||||
"book_detail_admin_saving": "Menyimpan…",
|
||||
"book_detail_admin_saved": "Tersimpan",
|
||||
"book_detail_admin_apply": "Terapkan",
|
||||
"book_detail_admin_applying": "Menerapkan…",
|
||||
"book_detail_admin_applied": "Diterapkan",
|
||||
"book_detail_admin_discard": "Buang",
|
||||
"book_detail_admin_enqueue_audio": "Antre Audio",
|
||||
"book_detail_admin_cancel_audio": "Batal",
|
||||
"book_detail_admin_enqueued": "Diantre {enqueued}, dilewati {skipped}",
|
||||
"book_detail_scraping_progress": "Mengambil 20 bab pertama. Halaman ini akan dimuat ulang otomatis.",
|
||||
"book_detail_scraping_home": "← Beranda",
|
||||
"book_detail_rescrape_book": "Scrape ulang buku",
|
||||
@@ -348,6 +366,26 @@
|
||||
"profile_upgrade_monthly": "Bulanan — $6 / bln",
|
||||
"profile_upgrade_annual": "Tahunan — $48 / thn",
|
||||
"profile_free_limits": "Paket gratis: 3 bab audio per hari, hanya bahasa Inggris.",
|
||||
"subscribe_page_title": "Jadi Pro \u2014 libnovel",
|
||||
"subscribe_heading": "Baca lebih. Dengarkan lebih.",
|
||||
"subscribe_subheading": "Tingkatkan ke Pro dan buka pengalaman libnovel sepenuhnya.",
|
||||
"subscribe_monthly_label": "Bulanan",
|
||||
"subscribe_monthly_price": "$6",
|
||||
"subscribe_monthly_period": "per bulan",
|
||||
"subscribe_annual_label": "Tahunan",
|
||||
"subscribe_annual_price": "$48",
|
||||
"subscribe_annual_period": "per tahun",
|
||||
"subscribe_annual_save": "Hemat 33%",
|
||||
"subscribe_cta_monthly": "Mulai paket bulanan",
|
||||
"subscribe_cta_annual": "Mulai paket tahunan",
|
||||
"subscribe_already_pro": "Anda sudah berlangganan Pro.",
|
||||
"subscribe_manage": "Kelola langganan",
|
||||
"subscribe_benefit_audio": "Bab audio tak terbatas per hari",
|
||||
"subscribe_benefit_voices": "Pilihan suara untuk semua mesin TTS",
|
||||
"subscribe_benefit_translation": "Baca dalam bahasa Prancis, Indonesia, Portugis, dan Rusia",
|
||||
"subscribe_benefit_downloads": "Unduh bab untuk didengarkan secara offline",
|
||||
"subscribe_login_prompt": "Masuk untuk berlangganan",
|
||||
"subscribe_login_cta": "Masuk",
|
||||
|
||||
"user_currently_reading": "Sedang Dibaca",
|
||||
"user_library_count": "Perpustakaan ({n})",
|
||||
@@ -363,6 +401,7 @@
|
||||
"admin_nav_translation": "Terjemahan",
|
||||
"admin_nav_changelog": "Perubahan",
|
||||
"admin_nav_image_gen": "Image Gen",
|
||||
"admin_nav_text_gen": "Text Gen",
|
||||
"admin_nav_feedback": "Masukan",
|
||||
"admin_nav_errors": "Kesalahan",
|
||||
"admin_nav_analytics": "Analitik",
|
||||
|
||||
@@ -302,6 +302,24 @@
|
||||
"book_detail_range_queuing": "Na fila…",
|
||||
"book_detail_scrape_range": "Intervalo de extração",
|
||||
"book_detail_admin": "Admin",
|
||||
"book_detail_admin_book_cover": "Capa do Livro",
|
||||
"book_detail_admin_chapter_cover": "Capa do Capítulo",
|
||||
"book_detail_admin_chapter_n": "Capítulo nº",
|
||||
"book_detail_admin_description": "Descrição",
|
||||
"book_detail_admin_chapter_names": "Nomes dos Capítulos",
|
||||
"book_detail_admin_audio_tts": "Áudio TTS",
|
||||
"book_detail_admin_voice": "Voz",
|
||||
"book_detail_admin_generate": "Gerar",
|
||||
"book_detail_admin_save_cover": "Salvar Capa",
|
||||
"book_detail_admin_saving": "Salvando…",
|
||||
"book_detail_admin_saved": "Salvo",
|
||||
"book_detail_admin_apply": "Aplicar",
|
||||
"book_detail_admin_applying": "Aplicando…",
|
||||
"book_detail_admin_applied": "Aplicado",
|
||||
"book_detail_admin_discard": "Descartar",
|
||||
"book_detail_admin_enqueue_audio": "Enfileirar Áudio",
|
||||
"book_detail_admin_cancel_audio": "Cancelar",
|
||||
"book_detail_admin_enqueued": "{enqueued} enfileirados, {skipped} ignorados",
|
||||
"book_detail_scraping_progress": "Buscando os primeiros 20 capítulos. Esta página será atualizada automaticamente.",
|
||||
"book_detail_scraping_home": "← Início",
|
||||
"book_detail_rescrape_book": "Reextrair livro",
|
||||
@@ -348,6 +366,26 @@
|
||||
"profile_upgrade_monthly": "Mensal — $6 / mês",
|
||||
"profile_upgrade_annual": "Anual — $48 / ano",
|
||||
"profile_free_limits": "Plano gratuito: 3 capítulos de áudio por dia, somente inglês.",
|
||||
"subscribe_page_title": "Seja Pro \u2014 libnovel",
|
||||
"subscribe_heading": "Leia mais. Ouça mais.",
|
||||
"subscribe_subheading": "Torne-se Pro e desbloqueie a experiência completa do libnovel.",
|
||||
"subscribe_monthly_label": "Mensal",
|
||||
"subscribe_monthly_price": "$6",
|
||||
"subscribe_monthly_period": "por mês",
|
||||
"subscribe_annual_label": "Anual",
|
||||
"subscribe_annual_price": "$48",
|
||||
"subscribe_annual_period": "por ano",
|
||||
"subscribe_annual_save": "Economize 33%",
|
||||
"subscribe_cta_monthly": "Começar plano mensal",
|
||||
"subscribe_cta_annual": "Começar plano anual",
|
||||
"subscribe_already_pro": "Você já tem uma assinatura Pro.",
|
||||
"subscribe_manage": "Gerenciar assinatura",
|
||||
"subscribe_benefit_audio": "Capítulos de áudio ilimitados por dia",
|
||||
"subscribe_benefit_voices": "Seleção de voz para todos os mecanismos TTS",
|
||||
"subscribe_benefit_translation": "Leia em francês, indonésio, português e russo",
|
||||
"subscribe_benefit_downloads": "Baixe capítulos para ouvir offline",
|
||||
"subscribe_login_prompt": "Entre para assinar",
|
||||
"subscribe_login_cta": "Entrar",
|
||||
|
||||
"user_currently_reading": "Lendo Agora",
|
||||
"user_library_count": "Biblioteca ({n})",
|
||||
@@ -363,6 +401,7 @@
|
||||
"admin_nav_translation": "Tradução",
|
||||
"admin_nav_changelog": "Alterações",
|
||||
"admin_nav_image_gen": "Image Gen",
|
||||
"admin_nav_text_gen": "Text Gen",
|
||||
"admin_nav_feedback": "Feedback",
|
||||
"admin_nav_errors": "Erros",
|
||||
"admin_nav_analytics": "Análise",
|
||||
|
||||
@@ -302,6 +302,24 @@
|
||||
"book_detail_range_queuing": "В очереди…",
|
||||
"book_detail_scrape_range": "Диапазон глав",
|
||||
"book_detail_admin": "Администрирование",
|
||||
"book_detail_admin_book_cover": "Обложка книги",
|
||||
"book_detail_admin_chapter_cover": "Обложка главы",
|
||||
"book_detail_admin_chapter_n": "Глава №",
|
||||
"book_detail_admin_description": "Описание",
|
||||
"book_detail_admin_chapter_names": "Названия глав",
|
||||
"book_detail_admin_audio_tts": "Аудио TTS",
|
||||
"book_detail_admin_voice": "Голос",
|
||||
"book_detail_admin_generate": "Сгенерировать",
|
||||
"book_detail_admin_save_cover": "Сохранить обложку",
|
||||
"book_detail_admin_saving": "Сохранение…",
|
||||
"book_detail_admin_saved": "Сохранено",
|
||||
"book_detail_admin_apply": "Применить",
|
||||
"book_detail_admin_applying": "Применение…",
|
||||
"book_detail_admin_applied": "Применено",
|
||||
"book_detail_admin_discard": "Отменить",
|
||||
"book_detail_admin_enqueue_audio": "Поставить в очередь",
|
||||
"book_detail_admin_cancel_audio": "Отмена",
|
||||
"book_detail_admin_enqueued": "В очереди {enqueued}, пропущено {skipped}",
|
||||
"book_detail_scraping_progress": "Загружаются первые 20 глав. Страница обновится автоматически.",
|
||||
"book_detail_scraping_home": "← На главную",
|
||||
"book_detail_rescrape_book": "Перепарсить книгу",
|
||||
@@ -348,6 +366,26 @@
|
||||
"profile_upgrade_monthly": "Ежемесячно — $6 / мес",
|
||||
"profile_upgrade_annual": "Ежегодно — $48 / год",
|
||||
"profile_free_limits": "Бесплатный план: 3 аудиоглавы в день, только английский.",
|
||||
"subscribe_page_title": "Перейти на Pro \u2014 libnovel",
|
||||
"subscribe_heading": "Читайте больше. Слушайте больше.",
|
||||
"subscribe_subheading": "Перейдите на Pro и откройте полный опыт libnovel.",
|
||||
"subscribe_monthly_label": "Ежемесячно",
|
||||
"subscribe_monthly_price": "$6",
|
||||
"subscribe_monthly_period": "в месяц",
|
||||
"subscribe_annual_label": "Ежегодно",
|
||||
"subscribe_annual_price": "$48",
|
||||
"subscribe_annual_period": "в год",
|
||||
"subscribe_annual_save": "Сэкономьте 33%",
|
||||
"subscribe_cta_monthly": "Начать месячный план",
|
||||
"subscribe_cta_annual": "Начать годовой план",
|
||||
"subscribe_already_pro": "У вас уже есть подписка Pro.",
|
||||
"subscribe_manage": "Управление подпиской",
|
||||
"subscribe_benefit_audio": "Неограниченные аудиоглавы в день",
|
||||
"subscribe_benefit_voices": "Выбор голоса для всех TTS-движков",
|
||||
"subscribe_benefit_translation": "Читайте на французском, индонезийском, португальском и русском",
|
||||
"subscribe_benefit_downloads": "Скачивайте главы для прослушивания офлайн",
|
||||
"subscribe_login_prompt": "Войдите, чтобы оформить подписку",
|
||||
"subscribe_login_cta": "Войти",
|
||||
|
||||
"user_currently_reading": "Сейчас читает",
|
||||
"user_library_count": "Библиотека ({n})",
|
||||
@@ -363,6 +401,7 @@
|
||||
"admin_nav_translation": "Перевод",
|
||||
"admin_nav_changelog": "Изменения",
|
||||
"admin_nav_image_gen": "Image Gen",
|
||||
"admin_nav_text_gen": "Text Gen",
|
||||
"admin_nav_feedback": "Отзывы",
|
||||
"admin_nav_errors": "Ошибки",
|
||||
"admin_nav_analytics": "Аналитика",
|
||||
|
||||
@@ -69,6 +69,8 @@
|
||||
voices?: Voice[];
|
||||
/** Called when the server returns 402 (free daily limit reached). */
|
||||
onProRequired?: () => void;
|
||||
/** Visual style of the player card. 'standard' = full controls; 'compact' = slim seekable player. */
|
||||
playerStyle?: 'standard' | 'compact';
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -80,7 +82,8 @@
|
||||
nextChapter = null,
|
||||
chapters = [],
|
||||
voices = [],
|
||||
onProRequired = undefined
|
||||
onProRequired = undefined,
|
||||
playerStyle = 'standard'
|
||||
}: Props = $props();
|
||||
|
||||
// ── Derived: voices grouped by engine ──────────────────────────────────
|
||||
@@ -564,7 +567,35 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Slow path: trigger Kokoro generation (non-blocking POST), then poll.
|
||||
// Slow path: audio not yet in MinIO.
|
||||
//
|
||||
// For Kokoro / PocketTTS when presign has NOT already enqueued the runner:
|
||||
// use the streaming endpoint — audio starts playing within seconds while
|
||||
// generation runs and MinIO is populated concurrently.
|
||||
// Skip when enqueued=true to avoid double-generation with the async runner.
|
||||
if (!voice.startsWith('cfai:') && !presignResult.enqueued) {
|
||||
// PocketTTS outputs raw WAV — skip the ffmpeg transcode entirely.
|
||||
// WAV (PCM) is natively supported on all platforms including iOS Safari.
|
||||
// Kokoro and CF AI output MP3 natively, so keep mp3 for those.
|
||||
const isPocketTTS = voices.some((v) => v.id === voice && v.engine === 'pocket-tts');
|
||||
const format = isPocketTTS ? 'wav' : 'mp3';
|
||||
const qs = new URLSearchParams({ voice, format });
|
||||
const streamUrl = `/api/audio-stream/${slug}/${chapter}?${qs}`;
|
||||
// HEAD probe: check paywall without triggering generation.
|
||||
const headRes = await fetch(streamUrl, { method: 'HEAD' }).catch(() => null);
|
||||
if (headRes?.status === 402) {
|
||||
audioStore.status = 'idle';
|
||||
onProRequired?.();
|
||||
return;
|
||||
}
|
||||
audioStore.audioUrl = streamUrl;
|
||||
audioStore.status = 'ready';
|
||||
maybeStartPrefetch();
|
||||
return;
|
||||
}
|
||||
|
||||
// CF AI (batch-only) or already enqueued by presign: keep the traditional
|
||||
// POST → poll → presign flow. For enqueued, we skip the POST and poll.
|
||||
audioStore.status = 'generating';
|
||||
startProgress();
|
||||
|
||||
@@ -738,6 +769,24 @@
|
||||
if (m > 0) return `${m}m`;
|
||||
return `${s}s`;
|
||||
}
|
||||
|
||||
// ── Compact player helpers ─────────────────────────────────────────────────
|
||||
const playPct = $derived(
|
||||
audioStore.duration > 0 ? (audioStore.currentTime / audioStore.duration) * 100 : 0
|
||||
);
|
||||
|
||||
const SPEED_OPTIONS = [0.75, 1, 1.25, 1.5, 2] as const;
|
||||
function cycleSpeed() {
|
||||
const idx = SPEED_OPTIONS.indexOf(audioStore.speed as (typeof SPEED_OPTIONS)[number]);
|
||||
audioStore.speed = SPEED_OPTIONS[(idx + 1) % SPEED_OPTIONS.length];
|
||||
}
|
||||
|
||||
function seekFromCompactBar(e: MouseEvent) {
|
||||
if (audioStore.duration <= 0) return;
|
||||
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
||||
const pct = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
||||
audioStore.seekRequest = pct * audioStore.duration;
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window onkeydown={handleKeyDown} />
|
||||
@@ -788,6 +837,121 @@
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
{#if playerStyle === 'compact'}
|
||||
<!-- ── Compact player ──────────────────────────────────────────────────────── -->
|
||||
<div class="mt-4 p-3 rounded-lg bg-(--color-surface-2) border border-(--color-border)">
|
||||
{#if audioStore.isCurrentChapter(slug, chapter)}
|
||||
{#if audioStore.status === 'idle' || audioStore.status === 'error'}
|
||||
{#if audioStore.status === 'error'}
|
||||
<p class="text-(--color-danger) text-xs mb-2">{audioStore.errorMsg || 'Failed to load audio.'}</p>
|
||||
{/if}
|
||||
<Button variant="default" size="sm" onclick={handlePlay}>
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
|
||||
{m.reader_play_narration()}
|
||||
</Button>
|
||||
|
||||
{:else if audioStore.status === 'loading'}
|
||||
<div class="flex items-center gap-2 text-xs text-(--color-muted)">
|
||||
<svg class="w-3.5 h-3.5 animate-spin" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
|
||||
</svg>
|
||||
{m.player_loading()}
|
||||
</div>
|
||||
|
||||
{:else if audioStore.status === 'generating'}
|
||||
<div class="space-y-1.5">
|
||||
<div class="flex items-center justify-between text-xs text-(--color-muted)">
|
||||
<span>{m.reader_generating_narration()}</span>
|
||||
<span class="tabular-nums">{Math.round(audioStore.progress)}%</span>
|
||||
</div>
|
||||
<div class="w-full h-1 bg-(--color-surface-3) rounded-full overflow-hidden">
|
||||
<div class="h-full bg-(--color-brand) rounded-full transition-none" style="width: {audioStore.progress}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{:else if audioStore.status === 'ready'}
|
||||
<div class="space-y-2">
|
||||
<!-- Seekable progress bar -->
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="w-full h-1.5 bg-(--color-surface-3) rounded-full overflow-hidden cursor-pointer group"
|
||||
onclick={seekFromCompactBar}
|
||||
>
|
||||
<div class="h-full bg-(--color-brand) rounded-full transition-none" style="width: {playPct}%"></div>
|
||||
</div>
|
||||
<!-- Controls row -->
|
||||
<div class="flex items-center gap-2">
|
||||
<!-- Skip back 15s -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => { audioStore.seekRequest = Math.max(0, audioStore.currentTime - 15); }}
|
||||
class="text-(--color-muted) hover:text-(--color-text) transition-colors flex-shrink-0"
|
||||
title="-15s"
|
||||
>
|
||||
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M11.99 5V1l-5 5 5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/>
|
||||
</svg>
|
||||
</button>
|
||||
<!-- Play/pause -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => { audioStore.toggleRequest++; }}
|
||||
class="w-8 h-8 rounded-full bg-(--color-brand) text-(--color-surface) flex items-center justify-center hover:bg-(--color-brand-dim) transition-colors flex-shrink-0"
|
||||
>
|
||||
{#if audioStore.isPlaying}
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 24 24"><path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/></svg>
|
||||
{:else}
|
||||
<svg class="w-3.5 h-3.5 ml-0.5" fill="currentColor" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
|
||||
{/if}
|
||||
</button>
|
||||
<!-- Skip forward 30s -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => { audioStore.seekRequest = Math.min(audioStore.duration || 0, audioStore.currentTime + 30); }}
|
||||
class="text-(--color-muted) hover:text-(--color-text) transition-colors flex-shrink-0"
|
||||
title="+30s"
|
||||
>
|
||||
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M18 13c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6v4l5-5-5-5v4c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8h-2z"/>
|
||||
</svg>
|
||||
</button>
|
||||
<!-- Time display -->
|
||||
<span class="flex-1 text-xs text-center tabular-nums text-(--color-muted)">
|
||||
{formatTime(audioStore.currentTime)} / {formatTime(audioStore.duration)}
|
||||
</span>
|
||||
<!-- Speed cycle -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={cycleSpeed}
|
||||
class="text-xs font-medium text-(--color-muted) hover:text-(--color-text) flex-shrink-0 tabular-nums transition-colors"
|
||||
title="Playback speed"
|
||||
>
|
||||
{audioStore.speed}×
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{:else if audioStore.active}
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<p class="text-xs text-(--color-muted)">
|
||||
{m.reader_now_playing({ title: audioStore.chapterTitle || `Ch.${audioStore.chapter}` })}
|
||||
</p>
|
||||
<Button variant="secondary" size="sm" class="flex-shrink-0" onclick={startPlayback}>
|
||||
{m.reader_load_this_chapter()}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<Button variant="default" size="sm" onclick={handlePlay}>
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
|
||||
{m.reader_play_narration()}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<!-- ── Standard player ─────────────────────────────────────────────────────── -->
|
||||
<div class="mt-6 p-4 rounded-lg bg-(--color-surface-2) border border-(--color-border)">
|
||||
<div class="flex items-center justify-between gap-2 mb-3">
|
||||
<div class="flex items-center gap-2">
|
||||
@@ -1026,3 +1190,4 @@
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/* eslint-disable */
|
||||
export * from './messages/_index.js'
|
||||
export * from './messages/_index.js'
|
||||
// enabling auto-import by exposing all messages as m
|
||||
export * as m from './messages/_index.js'
|
||||
@@ -279,6 +279,24 @@ export * from './book_detail_to_chapter.js'
|
||||
export * from './book_detail_range_queuing.js'
|
||||
export * from './book_detail_scrape_range.js'
|
||||
export * from './book_detail_admin.js'
|
||||
export * from './book_detail_admin_book_cover.js'
|
||||
export * from './book_detail_admin_chapter_cover.js'
|
||||
export * from './book_detail_admin_chapter_n.js'
|
||||
export * from './book_detail_admin_description.js'
|
||||
export * from './book_detail_admin_chapter_names.js'
|
||||
export * from './book_detail_admin_audio_tts.js'
|
||||
export * from './book_detail_admin_voice.js'
|
||||
export * from './book_detail_admin_generate.js'
|
||||
export * from './book_detail_admin_save_cover.js'
|
||||
export * from './book_detail_admin_saving.js'
|
||||
export * from './book_detail_admin_saved.js'
|
||||
export * from './book_detail_admin_apply.js'
|
||||
export * from './book_detail_admin_applying.js'
|
||||
export * from './book_detail_admin_applied.js'
|
||||
export * from './book_detail_admin_discard.js'
|
||||
export * from './book_detail_admin_enqueue_audio.js'
|
||||
export * from './book_detail_admin_cancel_audio.js'
|
||||
export * from './book_detail_admin_enqueued.js'
|
||||
export * from './book_detail_scraping_progress.js'
|
||||
export * from './book_detail_scraping_home.js'
|
||||
export * from './book_detail_rescrape_book.js'
|
||||
@@ -321,6 +339,26 @@ export * from './profile_upgrade_desc.js'
|
||||
export * from './profile_upgrade_monthly.js'
|
||||
export * from './profile_upgrade_annual.js'
|
||||
export * from './profile_free_limits.js'
|
||||
export * from './subscribe_page_title.js'
|
||||
export * from './subscribe_heading.js'
|
||||
export * from './subscribe_subheading.js'
|
||||
export * from './subscribe_monthly_label.js'
|
||||
export * from './subscribe_monthly_price.js'
|
||||
export * from './subscribe_monthly_period.js'
|
||||
export * from './subscribe_annual_label.js'
|
||||
export * from './subscribe_annual_price.js'
|
||||
export * from './subscribe_annual_period.js'
|
||||
export * from './subscribe_annual_save.js'
|
||||
export * from './subscribe_cta_monthly.js'
|
||||
export * from './subscribe_cta_annual.js'
|
||||
export * from './subscribe_already_pro.js'
|
||||
export * from './subscribe_manage.js'
|
||||
export * from './subscribe_benefit_audio.js'
|
||||
export * from './subscribe_benefit_voices.js'
|
||||
export * from './subscribe_benefit_translation.js'
|
||||
export * from './subscribe_benefit_downloads.js'
|
||||
export * from './subscribe_login_prompt.js'
|
||||
export * from './subscribe_login_cta.js'
|
||||
export * from './user_currently_reading.js'
|
||||
export * from './user_library_count.js'
|
||||
export * from './user_joined.js'
|
||||
@@ -333,6 +371,8 @@ export * from './admin_nav_scrape.js'
|
||||
export * from './admin_nav_audio.js'
|
||||
export * from './admin_nav_translation.js'
|
||||
export * from './admin_nav_changelog.js'
|
||||
export * from './admin_nav_image_gen.js'
|
||||
export * from './admin_nav_text_gen.js'
|
||||
export * from './admin_nav_feedback.js'
|
||||
export * from './admin_nav_errors.js'
|
||||
export * from './admin_nav_analytics.js'
|
||||
|
||||
44
ui/src/lib/paraglide/messages/admin_nav_image_gen.js
Normal file
44
ui/src/lib/paraglide/messages/admin_nav_image_gen.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Admin_Nav_Image_GenInputs */
|
||||
|
||||
const en_admin_nav_image_gen = /** @type {(inputs: Admin_Nav_Image_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Image Gen`)
|
||||
};
|
||||
|
||||
const ru_admin_nav_image_gen = /** @type {(inputs: Admin_Nav_Image_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Image Gen`)
|
||||
};
|
||||
|
||||
const id_admin_nav_image_gen = /** @type {(inputs: Admin_Nav_Image_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Image Gen`)
|
||||
};
|
||||
|
||||
const pt_admin_nav_image_gen = /** @type {(inputs: Admin_Nav_Image_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Image Gen`)
|
||||
};
|
||||
|
||||
const fr_admin_nav_image_gen = /** @type {(inputs: Admin_Nav_Image_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Image Gen`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Image Gen" |
|
||||
*
|
||||
* @param {Admin_Nav_Image_GenInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const admin_nav_image_gen = /** @type {((inputs?: Admin_Nav_Image_GenInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Admin_Nav_Image_GenInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_admin_nav_image_gen(inputs)
|
||||
if (locale === "ru") return ru_admin_nav_image_gen(inputs)
|
||||
if (locale === "id") return id_admin_nav_image_gen(inputs)
|
||||
if (locale === "pt") return pt_admin_nav_image_gen(inputs)
|
||||
return fr_admin_nav_image_gen(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/admin_nav_text_gen.js
Normal file
44
ui/src/lib/paraglide/messages/admin_nav_text_gen.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Admin_Nav_Text_GenInputs */
|
||||
|
||||
const en_admin_nav_text_gen = /** @type {(inputs: Admin_Nav_Text_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Text Gen`)
|
||||
};
|
||||
|
||||
const ru_admin_nav_text_gen = /** @type {(inputs: Admin_Nav_Text_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Text Gen`)
|
||||
};
|
||||
|
||||
const id_admin_nav_text_gen = /** @type {(inputs: Admin_Nav_Text_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Text Gen`)
|
||||
};
|
||||
|
||||
const pt_admin_nav_text_gen = /** @type {(inputs: Admin_Nav_Text_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Text Gen`)
|
||||
};
|
||||
|
||||
const fr_admin_nav_text_gen = /** @type {(inputs: Admin_Nav_Text_GenInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Text Gen`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Text Gen" |
|
||||
*
|
||||
* @param {Admin_Nav_Text_GenInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const admin_nav_text_gen = /** @type {((inputs?: Admin_Nav_Text_GenInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Admin_Nav_Text_GenInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_admin_nav_text_gen(inputs)
|
||||
if (locale === "ru") return ru_admin_nav_text_gen(inputs)
|
||||
if (locale === "id") return id_admin_nav_text_gen(inputs)
|
||||
if (locale === "pt") return pt_admin_nav_text_gen(inputs)
|
||||
return fr_admin_nav_text_gen(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_applied.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_applied.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_AppliedInputs */
|
||||
|
||||
const en_book_detail_admin_applied = /** @type {(inputs: Book_Detail_Admin_AppliedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Applied`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_applied = /** @type {(inputs: Book_Detail_Admin_AppliedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Применено`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_applied = /** @type {(inputs: Book_Detail_Admin_AppliedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Diterapkan`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_applied = /** @type {(inputs: Book_Detail_Admin_AppliedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Aplicado`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_applied = /** @type {(inputs: Book_Detail_Admin_AppliedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Appliqué`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Applied" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_AppliedInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_applied = /** @type {((inputs?: Book_Detail_Admin_AppliedInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_AppliedInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_applied(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_applied(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_applied(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_applied(inputs)
|
||||
return fr_book_detail_admin_applied(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_apply.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_apply.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_ApplyInputs */
|
||||
|
||||
const en_book_detail_admin_apply = /** @type {(inputs: Book_Detail_Admin_ApplyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Apply`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_apply = /** @type {(inputs: Book_Detail_Admin_ApplyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Применить`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_apply = /** @type {(inputs: Book_Detail_Admin_ApplyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Terapkan`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_apply = /** @type {(inputs: Book_Detail_Admin_ApplyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Aplicar`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_apply = /** @type {(inputs: Book_Detail_Admin_ApplyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Appliquer`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Apply" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_ApplyInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_apply = /** @type {((inputs?: Book_Detail_Admin_ApplyInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_ApplyInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_apply(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_apply(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_apply(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_apply(inputs)
|
||||
return fr_book_detail_admin_apply(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_applying.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_applying.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_ApplyingInputs */
|
||||
|
||||
const en_book_detail_admin_applying = /** @type {(inputs: Book_Detail_Admin_ApplyingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Applying…`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_applying = /** @type {(inputs: Book_Detail_Admin_ApplyingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Применение…`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_applying = /** @type {(inputs: Book_Detail_Admin_ApplyingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Menerapkan…`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_applying = /** @type {(inputs: Book_Detail_Admin_ApplyingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Aplicando…`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_applying = /** @type {(inputs: Book_Detail_Admin_ApplyingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Application…`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Applying…" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_ApplyingInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_applying = /** @type {((inputs?: Book_Detail_Admin_ApplyingInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_ApplyingInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_applying(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_applying(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_applying(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_applying(inputs)
|
||||
return fr_book_detail_admin_applying(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_audio_tts.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_audio_tts.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_Audio_TtsInputs */
|
||||
|
||||
const en_book_detail_admin_audio_tts = /** @type {(inputs: Book_Detail_Admin_Audio_TtsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Audio TTS`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_audio_tts = /** @type {(inputs: Book_Detail_Admin_Audio_TtsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Аудио TTS`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_audio_tts = /** @type {(inputs: Book_Detail_Admin_Audio_TtsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Audio TTS`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_audio_tts = /** @type {(inputs: Book_Detail_Admin_Audio_TtsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Áudio TTS`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_audio_tts = /** @type {(inputs: Book_Detail_Admin_Audio_TtsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Audio TTS`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Audio TTS" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_Audio_TtsInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_audio_tts = /** @type {((inputs?: Book_Detail_Admin_Audio_TtsInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_Audio_TtsInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_audio_tts(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_audio_tts(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_audio_tts(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_audio_tts(inputs)
|
||||
return fr_book_detail_admin_audio_tts(inputs)
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_Book_CoverInputs */
|
||||
|
||||
const en_book_detail_admin_book_cover = /** @type {(inputs: Book_Detail_Admin_Book_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Book Cover`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_book_cover = /** @type {(inputs: Book_Detail_Admin_Book_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Обложка книги`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_book_cover = /** @type {(inputs: Book_Detail_Admin_Book_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sampul Buku`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_book_cover = /** @type {(inputs: Book_Detail_Admin_Book_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Capa do Livro`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_book_cover = /** @type {(inputs: Book_Detail_Admin_Book_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Couverture du livre`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Book Cover" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_Book_CoverInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_book_cover = /** @type {((inputs?: Book_Detail_Admin_Book_CoverInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_Book_CoverInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_book_cover(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_book_cover(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_book_cover(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_book_cover(inputs)
|
||||
return fr_book_detail_admin_book_cover(inputs)
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_Cancel_AudioInputs */
|
||||
|
||||
const en_book_detail_admin_cancel_audio = /** @type {(inputs: Book_Detail_Admin_Cancel_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Cancel`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_cancel_audio = /** @type {(inputs: Book_Detail_Admin_Cancel_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Отмена`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_cancel_audio = /** @type {(inputs: Book_Detail_Admin_Cancel_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Batal`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_cancel_audio = /** @type {(inputs: Book_Detail_Admin_Cancel_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Cancelar`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_cancel_audio = /** @type {(inputs: Book_Detail_Admin_Cancel_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Annuler`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Cancel" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_Cancel_AudioInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_cancel_audio = /** @type {((inputs?: Book_Detail_Admin_Cancel_AudioInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_Cancel_AudioInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_cancel_audio(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_cancel_audio(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_cancel_audio(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_cancel_audio(inputs)
|
||||
return fr_book_detail_admin_cancel_audio(inputs)
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_Chapter_CoverInputs */
|
||||
|
||||
const en_book_detail_admin_chapter_cover = /** @type {(inputs: Book_Detail_Admin_Chapter_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Chapter Cover`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_chapter_cover = /** @type {(inputs: Book_Detail_Admin_Chapter_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Обложка главы`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_chapter_cover = /** @type {(inputs: Book_Detail_Admin_Chapter_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sampul Bab`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_chapter_cover = /** @type {(inputs: Book_Detail_Admin_Chapter_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Capa do Capítulo`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_chapter_cover = /** @type {(inputs: Book_Detail_Admin_Chapter_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Couverture du chapitre`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Chapter Cover" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_Chapter_CoverInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_chapter_cover = /** @type {((inputs?: Book_Detail_Admin_Chapter_CoverInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_Chapter_CoverInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_chapter_cover(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_chapter_cover(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_chapter_cover(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_chapter_cover(inputs)
|
||||
return fr_book_detail_admin_chapter_cover(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_chapter_n.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_chapter_n.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_Chapter_NInputs */
|
||||
|
||||
const en_book_detail_admin_chapter_n = /** @type {(inputs: Book_Detail_Admin_Chapter_NInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Chapter #`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_chapter_n = /** @type {(inputs: Book_Detail_Admin_Chapter_NInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Глава №`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_chapter_n = /** @type {(inputs: Book_Detail_Admin_Chapter_NInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Bab #`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_chapter_n = /** @type {(inputs: Book_Detail_Admin_Chapter_NInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Capítulo nº`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_chapter_n = /** @type {(inputs: Book_Detail_Admin_Chapter_NInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Chapitre n°`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Chapter #" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_Chapter_NInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_chapter_n = /** @type {((inputs?: Book_Detail_Admin_Chapter_NInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_Chapter_NInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_chapter_n(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_chapter_n(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_chapter_n(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_chapter_n(inputs)
|
||||
return fr_book_detail_admin_chapter_n(inputs)
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_Chapter_NamesInputs */
|
||||
|
||||
const en_book_detail_admin_chapter_names = /** @type {(inputs: Book_Detail_Admin_Chapter_NamesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Chapter Names`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_chapter_names = /** @type {(inputs: Book_Detail_Admin_Chapter_NamesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Названия глав`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_chapter_names = /** @type {(inputs: Book_Detail_Admin_Chapter_NamesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Nama Bab`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_chapter_names = /** @type {(inputs: Book_Detail_Admin_Chapter_NamesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Nomes dos Capítulos`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_chapter_names = /** @type {(inputs: Book_Detail_Admin_Chapter_NamesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Noms des chapitres`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Chapter Names" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_Chapter_NamesInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_chapter_names = /** @type {((inputs?: Book_Detail_Admin_Chapter_NamesInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_Chapter_NamesInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_chapter_names(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_chapter_names(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_chapter_names(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_chapter_names(inputs)
|
||||
return fr_book_detail_admin_chapter_names(inputs)
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_DescriptionInputs */
|
||||
|
||||
const en_book_detail_admin_description = /** @type {(inputs: Book_Detail_Admin_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Description`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_description = /** @type {(inputs: Book_Detail_Admin_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Описание`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_description = /** @type {(inputs: Book_Detail_Admin_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Deskripsi`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_description = /** @type {(inputs: Book_Detail_Admin_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Descrição`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_description = /** @type {(inputs: Book_Detail_Admin_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Description`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Description" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_description = /** @type {((inputs?: Book_Detail_Admin_DescriptionInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_DescriptionInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_description(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_description(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_description(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_description(inputs)
|
||||
return fr_book_detail_admin_description(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_discard.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_discard.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_DiscardInputs */
|
||||
|
||||
const en_book_detail_admin_discard = /** @type {(inputs: Book_Detail_Admin_DiscardInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Discard`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_discard = /** @type {(inputs: Book_Detail_Admin_DiscardInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Отменить`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_discard = /** @type {(inputs: Book_Detail_Admin_DiscardInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Buang`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_discard = /** @type {(inputs: Book_Detail_Admin_DiscardInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Descartar`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_discard = /** @type {(inputs: Book_Detail_Admin_DiscardInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Ignorer`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Discard" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_DiscardInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_discard = /** @type {((inputs?: Book_Detail_Admin_DiscardInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_DiscardInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_discard(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_discard(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_discard(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_discard(inputs)
|
||||
return fr_book_detail_admin_discard(inputs)
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_Enqueue_AudioInputs */
|
||||
|
||||
const en_book_detail_admin_enqueue_audio = /** @type {(inputs: Book_Detail_Admin_Enqueue_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Enqueue Audio`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_enqueue_audio = /** @type {(inputs: Book_Detail_Admin_Enqueue_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Поставить в очередь`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_enqueue_audio = /** @type {(inputs: Book_Detail_Admin_Enqueue_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Antre Audio`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_enqueue_audio = /** @type {(inputs: Book_Detail_Admin_Enqueue_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Enfileirar Áudio`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_enqueue_audio = /** @type {(inputs: Book_Detail_Admin_Enqueue_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Mettre en file audio`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Enqueue Audio" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_Enqueue_AudioInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_enqueue_audio = /** @type {((inputs?: Book_Detail_Admin_Enqueue_AudioInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_Enqueue_AudioInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_enqueue_audio(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_enqueue_audio(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_enqueue_audio(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_enqueue_audio(inputs)
|
||||
return fr_book_detail_admin_enqueue_audio(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_enqueued.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_enqueued.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ enqueued: NonNullable<unknown>, skipped: NonNullable<unknown> }} Book_Detail_Admin_EnqueuedInputs */
|
||||
|
||||
const en_book_detail_admin_enqueued = /** @type {(inputs: Book_Detail_Admin_EnqueuedInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`Enqueued ${i?.enqueued}, skipped ${i?.skipped}`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_enqueued = /** @type {(inputs: Book_Detail_Admin_EnqueuedInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`В очереди ${i?.enqueued}, пропущено ${i?.skipped}`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_enqueued = /** @type {(inputs: Book_Detail_Admin_EnqueuedInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`Diantre ${i?.enqueued}, dilewati ${i?.skipped}`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_enqueued = /** @type {(inputs: Book_Detail_Admin_EnqueuedInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`${i?.enqueued} enfileirados, ${i?.skipped} ignorados`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_enqueued = /** @type {(inputs: Book_Detail_Admin_EnqueuedInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`${i?.enqueued} en file, ${i?.skipped} ignorés`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Enqueued {enqueued}, skipped {skipped}" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_EnqueuedInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_enqueued = /** @type {((inputs: Book_Detail_Admin_EnqueuedInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_EnqueuedInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_enqueued(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_enqueued(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_enqueued(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_enqueued(inputs)
|
||||
return fr_book_detail_admin_enqueued(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_generate.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_generate.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_GenerateInputs */
|
||||
|
||||
const en_book_detail_admin_generate = /** @type {(inputs: Book_Detail_Admin_GenerateInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Generate`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_generate = /** @type {(inputs: Book_Detail_Admin_GenerateInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Сгенерировать`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_generate = /** @type {(inputs: Book_Detail_Admin_GenerateInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Buat`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_generate = /** @type {(inputs: Book_Detail_Admin_GenerateInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Gerar`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_generate = /** @type {(inputs: Book_Detail_Admin_GenerateInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Générer`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Generate" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_GenerateInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_generate = /** @type {((inputs?: Book_Detail_Admin_GenerateInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_GenerateInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_generate(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_generate(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_generate(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_generate(inputs)
|
||||
return fr_book_detail_admin_generate(inputs)
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_Save_CoverInputs */
|
||||
|
||||
const en_book_detail_admin_save_cover = /** @type {(inputs: Book_Detail_Admin_Save_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Save Cover`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_save_cover = /** @type {(inputs: Book_Detail_Admin_Save_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Сохранить обложку`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_save_cover = /** @type {(inputs: Book_Detail_Admin_Save_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Simpan Sampul`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_save_cover = /** @type {(inputs: Book_Detail_Admin_Save_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Salvar Capa`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_save_cover = /** @type {(inputs: Book_Detail_Admin_Save_CoverInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Enregistrer la couverture`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Save Cover" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_Save_CoverInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_save_cover = /** @type {((inputs?: Book_Detail_Admin_Save_CoverInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_Save_CoverInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_save_cover(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_save_cover(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_save_cover(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_save_cover(inputs)
|
||||
return fr_book_detail_admin_save_cover(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_saved.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_saved.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_SavedInputs */
|
||||
|
||||
const en_book_detail_admin_saved = /** @type {(inputs: Book_Detail_Admin_SavedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Saved`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_saved = /** @type {(inputs: Book_Detail_Admin_SavedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Сохранено`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_saved = /** @type {(inputs: Book_Detail_Admin_SavedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Tersimpan`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_saved = /** @type {(inputs: Book_Detail_Admin_SavedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Salvo`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_saved = /** @type {(inputs: Book_Detail_Admin_SavedInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Enregistré`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Saved" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_SavedInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_saved = /** @type {((inputs?: Book_Detail_Admin_SavedInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_SavedInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_saved(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_saved(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_saved(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_saved(inputs)
|
||||
return fr_book_detail_admin_saved(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_saving.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_saving.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_SavingInputs */
|
||||
|
||||
const en_book_detail_admin_saving = /** @type {(inputs: Book_Detail_Admin_SavingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Saving…`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_saving = /** @type {(inputs: Book_Detail_Admin_SavingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Сохранение…`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_saving = /** @type {(inputs: Book_Detail_Admin_SavingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Menyimpan…`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_saving = /** @type {(inputs: Book_Detail_Admin_SavingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Salvando…`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_saving = /** @type {(inputs: Book_Detail_Admin_SavingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Enregistrement…`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Saving…" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_SavingInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_saving = /** @type {((inputs?: Book_Detail_Admin_SavingInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_SavingInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_saving(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_saving(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_saving(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_saving(inputs)
|
||||
return fr_book_detail_admin_saving(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/book_detail_admin_voice.js
Normal file
44
ui/src/lib/paraglide/messages/book_detail_admin_voice.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Book_Detail_Admin_VoiceInputs */
|
||||
|
||||
const en_book_detail_admin_voice = /** @type {(inputs: Book_Detail_Admin_VoiceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Voice`)
|
||||
};
|
||||
|
||||
const ru_book_detail_admin_voice = /** @type {(inputs: Book_Detail_Admin_VoiceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Голос`)
|
||||
};
|
||||
|
||||
const id_book_detail_admin_voice = /** @type {(inputs: Book_Detail_Admin_VoiceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Suara`)
|
||||
};
|
||||
|
||||
const pt_book_detail_admin_voice = /** @type {(inputs: Book_Detail_Admin_VoiceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Voz`)
|
||||
};
|
||||
|
||||
const fr_book_detail_admin_voice = /** @type {(inputs: Book_Detail_Admin_VoiceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Voix`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Voice" |
|
||||
*
|
||||
* @param {Book_Detail_Admin_VoiceInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const book_detail_admin_voice = /** @type {((inputs?: Book_Detail_Admin_VoiceInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Book_Detail_Admin_VoiceInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_book_detail_admin_voice(inputs)
|
||||
if (locale === "ru") return ru_book_detail_admin_voice(inputs)
|
||||
if (locale === "id") return id_book_detail_admin_voice(inputs)
|
||||
if (locale === "pt") return pt_book_detail_admin_voice(inputs)
|
||||
return fr_book_detail_admin_voice(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_already_pro.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_already_pro.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Already_ProInputs */
|
||||
|
||||
const en_subscribe_already_pro = /** @type {(inputs: Subscribe_Already_ProInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`You already have a Pro subscription.`)
|
||||
};
|
||||
|
||||
const ru_subscribe_already_pro = /** @type {(inputs: Subscribe_Already_ProInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`У вас уже есть подписка Pro.`)
|
||||
};
|
||||
|
||||
const id_subscribe_already_pro = /** @type {(inputs: Subscribe_Already_ProInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Anda sudah berlangganan Pro.`)
|
||||
};
|
||||
|
||||
const pt_subscribe_already_pro = /** @type {(inputs: Subscribe_Already_ProInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Você já tem uma assinatura Pro.`)
|
||||
};
|
||||
|
||||
const fr_subscribe_already_pro = /** @type {(inputs: Subscribe_Already_ProInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Vous avez déjà un abonnement Pro.`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "You already have a Pro subscription." |
|
||||
*
|
||||
* @param {Subscribe_Already_ProInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_already_pro = /** @type {((inputs?: Subscribe_Already_ProInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Already_ProInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_already_pro(inputs)
|
||||
if (locale === "ru") return ru_subscribe_already_pro(inputs)
|
||||
if (locale === "id") return id_subscribe_already_pro(inputs)
|
||||
if (locale === "pt") return pt_subscribe_already_pro(inputs)
|
||||
return fr_subscribe_already_pro(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_annual_label.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_annual_label.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Annual_LabelInputs */
|
||||
|
||||
const en_subscribe_annual_label = /** @type {(inputs: Subscribe_Annual_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Annual`)
|
||||
};
|
||||
|
||||
const ru_subscribe_annual_label = /** @type {(inputs: Subscribe_Annual_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Ежегодно`)
|
||||
};
|
||||
|
||||
const id_subscribe_annual_label = /** @type {(inputs: Subscribe_Annual_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Tahunan`)
|
||||
};
|
||||
|
||||
const pt_subscribe_annual_label = /** @type {(inputs: Subscribe_Annual_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Anual`)
|
||||
};
|
||||
|
||||
const fr_subscribe_annual_label = /** @type {(inputs: Subscribe_Annual_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Annuel`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Annual" |
|
||||
*
|
||||
* @param {Subscribe_Annual_LabelInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_annual_label = /** @type {((inputs?: Subscribe_Annual_LabelInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Annual_LabelInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_annual_label(inputs)
|
||||
if (locale === "ru") return ru_subscribe_annual_label(inputs)
|
||||
if (locale === "id") return id_subscribe_annual_label(inputs)
|
||||
if (locale === "pt") return pt_subscribe_annual_label(inputs)
|
||||
return fr_subscribe_annual_label(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_annual_period.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_annual_period.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Annual_PeriodInputs */
|
||||
|
||||
const en_subscribe_annual_period = /** @type {(inputs: Subscribe_Annual_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`per year`)
|
||||
};
|
||||
|
||||
const ru_subscribe_annual_period = /** @type {(inputs: Subscribe_Annual_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`в год`)
|
||||
};
|
||||
|
||||
const id_subscribe_annual_period = /** @type {(inputs: Subscribe_Annual_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`per tahun`)
|
||||
};
|
||||
|
||||
const pt_subscribe_annual_period = /** @type {(inputs: Subscribe_Annual_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`por ano`)
|
||||
};
|
||||
|
||||
const fr_subscribe_annual_period = /** @type {(inputs: Subscribe_Annual_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`par an`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "per year" |
|
||||
*
|
||||
* @param {Subscribe_Annual_PeriodInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_annual_period = /** @type {((inputs?: Subscribe_Annual_PeriodInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Annual_PeriodInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_annual_period(inputs)
|
||||
if (locale === "ru") return ru_subscribe_annual_period(inputs)
|
||||
if (locale === "id") return id_subscribe_annual_period(inputs)
|
||||
if (locale === "pt") return pt_subscribe_annual_period(inputs)
|
||||
return fr_subscribe_annual_period(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_annual_price.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_annual_price.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Annual_PriceInputs */
|
||||
|
||||
const en_subscribe_annual_price = /** @type {(inputs: Subscribe_Annual_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`$48`)
|
||||
};
|
||||
|
||||
const ru_subscribe_annual_price = /** @type {(inputs: Subscribe_Annual_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`$48`)
|
||||
};
|
||||
|
||||
const id_subscribe_annual_price = /** @type {(inputs: Subscribe_Annual_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`$48`)
|
||||
};
|
||||
|
||||
const pt_subscribe_annual_price = /** @type {(inputs: Subscribe_Annual_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`$48`)
|
||||
};
|
||||
|
||||
const fr_subscribe_annual_price = /** @type {(inputs: Subscribe_Annual_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`48 $`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "$48" |
|
||||
*
|
||||
* @param {Subscribe_Annual_PriceInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_annual_price = /** @type {((inputs?: Subscribe_Annual_PriceInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Annual_PriceInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_annual_price(inputs)
|
||||
if (locale === "ru") return ru_subscribe_annual_price(inputs)
|
||||
if (locale === "id") return id_subscribe_annual_price(inputs)
|
||||
if (locale === "pt") return pt_subscribe_annual_price(inputs)
|
||||
return fr_subscribe_annual_price(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_annual_save.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_annual_save.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Annual_SaveInputs */
|
||||
|
||||
const en_subscribe_annual_save = /** @type {(inputs: Subscribe_Annual_SaveInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Save 33%`)
|
||||
};
|
||||
|
||||
const ru_subscribe_annual_save = /** @type {(inputs: Subscribe_Annual_SaveInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Сэкономьте 33%`)
|
||||
};
|
||||
|
||||
const id_subscribe_annual_save = /** @type {(inputs: Subscribe_Annual_SaveInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Hemat 33%`)
|
||||
};
|
||||
|
||||
const pt_subscribe_annual_save = /** @type {(inputs: Subscribe_Annual_SaveInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Economize 33%`)
|
||||
};
|
||||
|
||||
const fr_subscribe_annual_save = /** @type {(inputs: Subscribe_Annual_SaveInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Économisez 33 %`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Save 33%" |
|
||||
*
|
||||
* @param {Subscribe_Annual_SaveInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_annual_save = /** @type {((inputs?: Subscribe_Annual_SaveInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Annual_SaveInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_annual_save(inputs)
|
||||
if (locale === "ru") return ru_subscribe_annual_save(inputs)
|
||||
if (locale === "id") return id_subscribe_annual_save(inputs)
|
||||
if (locale === "pt") return pt_subscribe_annual_save(inputs)
|
||||
return fr_subscribe_annual_save(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_benefit_audio.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_benefit_audio.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Benefit_AudioInputs */
|
||||
|
||||
const en_subscribe_benefit_audio = /** @type {(inputs: Subscribe_Benefit_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Unlimited audio chapters per day`)
|
||||
};
|
||||
|
||||
const ru_subscribe_benefit_audio = /** @type {(inputs: Subscribe_Benefit_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Неограниченные аудиоглавы в день`)
|
||||
};
|
||||
|
||||
const id_subscribe_benefit_audio = /** @type {(inputs: Subscribe_Benefit_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Bab audio tak terbatas per hari`)
|
||||
};
|
||||
|
||||
const pt_subscribe_benefit_audio = /** @type {(inputs: Subscribe_Benefit_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Capítulos de áudio ilimitados por dia`)
|
||||
};
|
||||
|
||||
const fr_subscribe_benefit_audio = /** @type {(inputs: Subscribe_Benefit_AudioInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Chapitres audio illimités par jour`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Unlimited audio chapters per day" |
|
||||
*
|
||||
* @param {Subscribe_Benefit_AudioInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_benefit_audio = /** @type {((inputs?: Subscribe_Benefit_AudioInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Benefit_AudioInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_benefit_audio(inputs)
|
||||
if (locale === "ru") return ru_subscribe_benefit_audio(inputs)
|
||||
if (locale === "id") return id_subscribe_benefit_audio(inputs)
|
||||
if (locale === "pt") return pt_subscribe_benefit_audio(inputs)
|
||||
return fr_subscribe_benefit_audio(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_benefit_downloads.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_benefit_downloads.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Benefit_DownloadsInputs */
|
||||
|
||||
const en_subscribe_benefit_downloads = /** @type {(inputs: Subscribe_Benefit_DownloadsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Download chapters for offline listening`)
|
||||
};
|
||||
|
||||
const ru_subscribe_benefit_downloads = /** @type {(inputs: Subscribe_Benefit_DownloadsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Скачивайте главы для прослушивания офлайн`)
|
||||
};
|
||||
|
||||
const id_subscribe_benefit_downloads = /** @type {(inputs: Subscribe_Benefit_DownloadsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Unduh bab untuk didengarkan secara offline`)
|
||||
};
|
||||
|
||||
const pt_subscribe_benefit_downloads = /** @type {(inputs: Subscribe_Benefit_DownloadsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Baixe capítulos para ouvir offline`)
|
||||
};
|
||||
|
||||
const fr_subscribe_benefit_downloads = /** @type {(inputs: Subscribe_Benefit_DownloadsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Télécharger des chapitres pour une écoute hors ligne`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Download chapters for offline listening" |
|
||||
*
|
||||
* @param {Subscribe_Benefit_DownloadsInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_benefit_downloads = /** @type {((inputs?: Subscribe_Benefit_DownloadsInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Benefit_DownloadsInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_benefit_downloads(inputs)
|
||||
if (locale === "ru") return ru_subscribe_benefit_downloads(inputs)
|
||||
if (locale === "id") return id_subscribe_benefit_downloads(inputs)
|
||||
if (locale === "pt") return pt_subscribe_benefit_downloads(inputs)
|
||||
return fr_subscribe_benefit_downloads(inputs)
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Benefit_TranslationInputs */
|
||||
|
||||
const en_subscribe_benefit_translation = /** @type {(inputs: Subscribe_Benefit_TranslationInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Read in French, Indonesian, Portuguese, and Russian`)
|
||||
};
|
||||
|
||||
const ru_subscribe_benefit_translation = /** @type {(inputs: Subscribe_Benefit_TranslationInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Читайте на французском, индонезийском, португальском и русском`)
|
||||
};
|
||||
|
||||
const id_subscribe_benefit_translation = /** @type {(inputs: Subscribe_Benefit_TranslationInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Baca dalam bahasa Prancis, Indonesia, Portugis, dan Rusia`)
|
||||
};
|
||||
|
||||
const pt_subscribe_benefit_translation = /** @type {(inputs: Subscribe_Benefit_TranslationInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Leia em francês, indonésio, português e russo`)
|
||||
};
|
||||
|
||||
const fr_subscribe_benefit_translation = /** @type {(inputs: Subscribe_Benefit_TranslationInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Lire en français, indonésien, portugais et russe`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Read in French, Indonesian, Portuguese, and Russian" |
|
||||
*
|
||||
* @param {Subscribe_Benefit_TranslationInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_benefit_translation = /** @type {((inputs?: Subscribe_Benefit_TranslationInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Benefit_TranslationInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_benefit_translation(inputs)
|
||||
if (locale === "ru") return ru_subscribe_benefit_translation(inputs)
|
||||
if (locale === "id") return id_subscribe_benefit_translation(inputs)
|
||||
if (locale === "pt") return pt_subscribe_benefit_translation(inputs)
|
||||
return fr_subscribe_benefit_translation(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_benefit_voices.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_benefit_voices.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Benefit_VoicesInputs */
|
||||
|
||||
const en_subscribe_benefit_voices = /** @type {(inputs: Subscribe_Benefit_VoicesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Voice selection across all TTS engines`)
|
||||
};
|
||||
|
||||
const ru_subscribe_benefit_voices = /** @type {(inputs: Subscribe_Benefit_VoicesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Выбор голоса для всех TTS-движков`)
|
||||
};
|
||||
|
||||
const id_subscribe_benefit_voices = /** @type {(inputs: Subscribe_Benefit_VoicesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Pilihan suara untuk semua mesin TTS`)
|
||||
};
|
||||
|
||||
const pt_subscribe_benefit_voices = /** @type {(inputs: Subscribe_Benefit_VoicesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Seleção de voz para todos os mecanismos TTS`)
|
||||
};
|
||||
|
||||
const fr_subscribe_benefit_voices = /** @type {(inputs: Subscribe_Benefit_VoicesInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sélection de voix pour tous les moteurs TTS`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Voice selection across all TTS engines" |
|
||||
*
|
||||
* @param {Subscribe_Benefit_VoicesInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_benefit_voices = /** @type {((inputs?: Subscribe_Benefit_VoicesInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Benefit_VoicesInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_benefit_voices(inputs)
|
||||
if (locale === "ru") return ru_subscribe_benefit_voices(inputs)
|
||||
if (locale === "id") return id_subscribe_benefit_voices(inputs)
|
||||
if (locale === "pt") return pt_subscribe_benefit_voices(inputs)
|
||||
return fr_subscribe_benefit_voices(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_cta_annual.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_cta_annual.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Cta_AnnualInputs */
|
||||
|
||||
const en_subscribe_cta_annual = /** @type {(inputs: Subscribe_Cta_AnnualInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Start annual plan`)
|
||||
};
|
||||
|
||||
const ru_subscribe_cta_annual = /** @type {(inputs: Subscribe_Cta_AnnualInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Начать годовой план`)
|
||||
};
|
||||
|
||||
const id_subscribe_cta_annual = /** @type {(inputs: Subscribe_Cta_AnnualInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Mulai paket tahunan`)
|
||||
};
|
||||
|
||||
const pt_subscribe_cta_annual = /** @type {(inputs: Subscribe_Cta_AnnualInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Começar plano anual`)
|
||||
};
|
||||
|
||||
const fr_subscribe_cta_annual = /** @type {(inputs: Subscribe_Cta_AnnualInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Commencer le plan annuel`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Start annual plan" |
|
||||
*
|
||||
* @param {Subscribe_Cta_AnnualInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_cta_annual = /** @type {((inputs?: Subscribe_Cta_AnnualInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Cta_AnnualInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_cta_annual(inputs)
|
||||
if (locale === "ru") return ru_subscribe_cta_annual(inputs)
|
||||
if (locale === "id") return id_subscribe_cta_annual(inputs)
|
||||
if (locale === "pt") return pt_subscribe_cta_annual(inputs)
|
||||
return fr_subscribe_cta_annual(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_cta_monthly.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_cta_monthly.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Cta_MonthlyInputs */
|
||||
|
||||
const en_subscribe_cta_monthly = /** @type {(inputs: Subscribe_Cta_MonthlyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Start monthly plan`)
|
||||
};
|
||||
|
||||
const ru_subscribe_cta_monthly = /** @type {(inputs: Subscribe_Cta_MonthlyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Начать месячный план`)
|
||||
};
|
||||
|
||||
const id_subscribe_cta_monthly = /** @type {(inputs: Subscribe_Cta_MonthlyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Mulai paket bulanan`)
|
||||
};
|
||||
|
||||
const pt_subscribe_cta_monthly = /** @type {(inputs: Subscribe_Cta_MonthlyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Começar plano mensal`)
|
||||
};
|
||||
|
||||
const fr_subscribe_cta_monthly = /** @type {(inputs: Subscribe_Cta_MonthlyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Commencer le plan mensuel`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Start monthly plan" |
|
||||
*
|
||||
* @param {Subscribe_Cta_MonthlyInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_cta_monthly = /** @type {((inputs?: Subscribe_Cta_MonthlyInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Cta_MonthlyInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_cta_monthly(inputs)
|
||||
if (locale === "ru") return ru_subscribe_cta_monthly(inputs)
|
||||
if (locale === "id") return id_subscribe_cta_monthly(inputs)
|
||||
if (locale === "pt") return pt_subscribe_cta_monthly(inputs)
|
||||
return fr_subscribe_cta_monthly(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_heading.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_heading.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_HeadingInputs */
|
||||
|
||||
const en_subscribe_heading = /** @type {(inputs: Subscribe_HeadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Read more. Listen more.`)
|
||||
};
|
||||
|
||||
const ru_subscribe_heading = /** @type {(inputs: Subscribe_HeadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Читайте больше. Слушайте больше.`)
|
||||
};
|
||||
|
||||
const id_subscribe_heading = /** @type {(inputs: Subscribe_HeadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Baca lebih. Dengarkan lebih.`)
|
||||
};
|
||||
|
||||
const pt_subscribe_heading = /** @type {(inputs: Subscribe_HeadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Leia mais. Ouça mais.`)
|
||||
};
|
||||
|
||||
const fr_subscribe_heading = /** @type {(inputs: Subscribe_HeadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Lisez plus. Écoutez plus.`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Read more. Listen more." |
|
||||
*
|
||||
* @param {Subscribe_HeadingInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_heading = /** @type {((inputs?: Subscribe_HeadingInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_HeadingInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_heading(inputs)
|
||||
if (locale === "ru") return ru_subscribe_heading(inputs)
|
||||
if (locale === "id") return id_subscribe_heading(inputs)
|
||||
if (locale === "pt") return pt_subscribe_heading(inputs)
|
||||
return fr_subscribe_heading(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_login_cta.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_login_cta.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Login_CtaInputs */
|
||||
|
||||
const en_subscribe_login_cta = /** @type {(inputs: Subscribe_Login_CtaInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sign in`)
|
||||
};
|
||||
|
||||
const ru_subscribe_login_cta = /** @type {(inputs: Subscribe_Login_CtaInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Войти`)
|
||||
};
|
||||
|
||||
const id_subscribe_login_cta = /** @type {(inputs: Subscribe_Login_CtaInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Masuk`)
|
||||
};
|
||||
|
||||
const pt_subscribe_login_cta = /** @type {(inputs: Subscribe_Login_CtaInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Entrar`)
|
||||
};
|
||||
|
||||
const fr_subscribe_login_cta = /** @type {(inputs: Subscribe_Login_CtaInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Se connecter`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sign in" |
|
||||
*
|
||||
* @param {Subscribe_Login_CtaInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_login_cta = /** @type {((inputs?: Subscribe_Login_CtaInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Login_CtaInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_login_cta(inputs)
|
||||
if (locale === "ru") return ru_subscribe_login_cta(inputs)
|
||||
if (locale === "id") return id_subscribe_login_cta(inputs)
|
||||
if (locale === "pt") return pt_subscribe_login_cta(inputs)
|
||||
return fr_subscribe_login_cta(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_login_prompt.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_login_prompt.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Login_PromptInputs */
|
||||
|
||||
const en_subscribe_login_prompt = /** @type {(inputs: Subscribe_Login_PromptInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sign in to subscribe`)
|
||||
};
|
||||
|
||||
const ru_subscribe_login_prompt = /** @type {(inputs: Subscribe_Login_PromptInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Войдите, чтобы оформить подписку`)
|
||||
};
|
||||
|
||||
const id_subscribe_login_prompt = /** @type {(inputs: Subscribe_Login_PromptInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Masuk untuk berlangganan`)
|
||||
};
|
||||
|
||||
const pt_subscribe_login_prompt = /** @type {(inputs: Subscribe_Login_PromptInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Entre para assinar`)
|
||||
};
|
||||
|
||||
const fr_subscribe_login_prompt = /** @type {(inputs: Subscribe_Login_PromptInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Connectez-vous pour vous abonner`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sign in to subscribe" |
|
||||
*
|
||||
* @param {Subscribe_Login_PromptInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_login_prompt = /** @type {((inputs?: Subscribe_Login_PromptInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Login_PromptInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_login_prompt(inputs)
|
||||
if (locale === "ru") return ru_subscribe_login_prompt(inputs)
|
||||
if (locale === "id") return id_subscribe_login_prompt(inputs)
|
||||
if (locale === "pt") return pt_subscribe_login_prompt(inputs)
|
||||
return fr_subscribe_login_prompt(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_manage.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_manage.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_ManageInputs */
|
||||
|
||||
const en_subscribe_manage = /** @type {(inputs: Subscribe_ManageInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Manage subscription`)
|
||||
};
|
||||
|
||||
const ru_subscribe_manage = /** @type {(inputs: Subscribe_ManageInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Управление подпиской`)
|
||||
};
|
||||
|
||||
const id_subscribe_manage = /** @type {(inputs: Subscribe_ManageInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Kelola langganan`)
|
||||
};
|
||||
|
||||
const pt_subscribe_manage = /** @type {(inputs: Subscribe_ManageInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Gerenciar assinatura`)
|
||||
};
|
||||
|
||||
const fr_subscribe_manage = /** @type {(inputs: Subscribe_ManageInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Gérer l'abonnement`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Manage subscription" |
|
||||
*
|
||||
* @param {Subscribe_ManageInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_manage = /** @type {((inputs?: Subscribe_ManageInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_ManageInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_manage(inputs)
|
||||
if (locale === "ru") return ru_subscribe_manage(inputs)
|
||||
if (locale === "id") return id_subscribe_manage(inputs)
|
||||
if (locale === "pt") return pt_subscribe_manage(inputs)
|
||||
return fr_subscribe_manage(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_monthly_label.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_monthly_label.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Monthly_LabelInputs */
|
||||
|
||||
const en_subscribe_monthly_label = /** @type {(inputs: Subscribe_Monthly_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Monthly`)
|
||||
};
|
||||
|
||||
const ru_subscribe_monthly_label = /** @type {(inputs: Subscribe_Monthly_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Ежемесячно`)
|
||||
};
|
||||
|
||||
const id_subscribe_monthly_label = /** @type {(inputs: Subscribe_Monthly_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Bulanan`)
|
||||
};
|
||||
|
||||
const pt_subscribe_monthly_label = /** @type {(inputs: Subscribe_Monthly_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Mensal`)
|
||||
};
|
||||
|
||||
const fr_subscribe_monthly_label = /** @type {(inputs: Subscribe_Monthly_LabelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Mensuel`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Monthly" |
|
||||
*
|
||||
* @param {Subscribe_Monthly_LabelInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_monthly_label = /** @type {((inputs?: Subscribe_Monthly_LabelInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Monthly_LabelInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_monthly_label(inputs)
|
||||
if (locale === "ru") return ru_subscribe_monthly_label(inputs)
|
||||
if (locale === "id") return id_subscribe_monthly_label(inputs)
|
||||
if (locale === "pt") return pt_subscribe_monthly_label(inputs)
|
||||
return fr_subscribe_monthly_label(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_monthly_period.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_monthly_period.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Monthly_PeriodInputs */
|
||||
|
||||
const en_subscribe_monthly_period = /** @type {(inputs: Subscribe_Monthly_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`per month`)
|
||||
};
|
||||
|
||||
const ru_subscribe_monthly_period = /** @type {(inputs: Subscribe_Monthly_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`в месяц`)
|
||||
};
|
||||
|
||||
const id_subscribe_monthly_period = /** @type {(inputs: Subscribe_Monthly_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`per bulan`)
|
||||
};
|
||||
|
||||
const pt_subscribe_monthly_period = /** @type {(inputs: Subscribe_Monthly_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`por mês`)
|
||||
};
|
||||
|
||||
const fr_subscribe_monthly_period = /** @type {(inputs: Subscribe_Monthly_PeriodInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`par mois`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "per month" |
|
||||
*
|
||||
* @param {Subscribe_Monthly_PeriodInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_monthly_period = /** @type {((inputs?: Subscribe_Monthly_PeriodInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Monthly_PeriodInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_monthly_period(inputs)
|
||||
if (locale === "ru") return ru_subscribe_monthly_period(inputs)
|
||||
if (locale === "id") return id_subscribe_monthly_period(inputs)
|
||||
if (locale === "pt") return pt_subscribe_monthly_period(inputs)
|
||||
return fr_subscribe_monthly_period(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_monthly_price.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_monthly_price.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Monthly_PriceInputs */
|
||||
|
||||
const en_subscribe_monthly_price = /** @type {(inputs: Subscribe_Monthly_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`$6`)
|
||||
};
|
||||
|
||||
const ru_subscribe_monthly_price = /** @type {(inputs: Subscribe_Monthly_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`$6`)
|
||||
};
|
||||
|
||||
const id_subscribe_monthly_price = /** @type {(inputs: Subscribe_Monthly_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`$6`)
|
||||
};
|
||||
|
||||
const pt_subscribe_monthly_price = /** @type {(inputs: Subscribe_Monthly_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`$6`)
|
||||
};
|
||||
|
||||
const fr_subscribe_monthly_price = /** @type {(inputs: Subscribe_Monthly_PriceInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`6 $`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "$6" |
|
||||
*
|
||||
* @param {Subscribe_Monthly_PriceInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_monthly_price = /** @type {((inputs?: Subscribe_Monthly_PriceInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Monthly_PriceInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_monthly_price(inputs)
|
||||
if (locale === "ru") return ru_subscribe_monthly_price(inputs)
|
||||
if (locale === "id") return id_subscribe_monthly_price(inputs)
|
||||
if (locale === "pt") return pt_subscribe_monthly_price(inputs)
|
||||
return fr_subscribe_monthly_price(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_page_title.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_page_title.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_Page_TitleInputs */
|
||||
|
||||
const en_subscribe_page_title = /** @type {(inputs: Subscribe_Page_TitleInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Go Pro — libnovel`)
|
||||
};
|
||||
|
||||
const ru_subscribe_page_title = /** @type {(inputs: Subscribe_Page_TitleInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Перейти на Pro — libnovel`)
|
||||
};
|
||||
|
||||
const id_subscribe_page_title = /** @type {(inputs: Subscribe_Page_TitleInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Jadi Pro — libnovel`)
|
||||
};
|
||||
|
||||
const pt_subscribe_page_title = /** @type {(inputs: Subscribe_Page_TitleInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Seja Pro — libnovel`)
|
||||
};
|
||||
|
||||
const fr_subscribe_page_title = /** @type {(inputs: Subscribe_Page_TitleInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Passer Pro — libnovel`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Go Pro — libnovel" |
|
||||
*
|
||||
* @param {Subscribe_Page_TitleInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_page_title = /** @type {((inputs?: Subscribe_Page_TitleInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_Page_TitleInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_page_title(inputs)
|
||||
if (locale === "ru") return ru_subscribe_page_title(inputs)
|
||||
if (locale === "id") return id_subscribe_page_title(inputs)
|
||||
if (locale === "pt") return pt_subscribe_page_title(inputs)
|
||||
return fr_subscribe_page_title(inputs)
|
||||
});
|
||||
44
ui/src/lib/paraglide/messages/subscribe_subheading.js
Normal file
44
ui/src/lib/paraglide/messages/subscribe_subheading.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Subscribe_SubheadingInputs */
|
||||
|
||||
const en_subscribe_subheading = /** @type {(inputs: Subscribe_SubheadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Upgrade to Pro and unlock the full libnovel experience.`)
|
||||
};
|
||||
|
||||
const ru_subscribe_subheading = /** @type {(inputs: Subscribe_SubheadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Перейдите на Pro и откройте полный опыт libnovel.`)
|
||||
};
|
||||
|
||||
const id_subscribe_subheading = /** @type {(inputs: Subscribe_SubheadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Tingkatkan ke Pro dan buka pengalaman libnovel sepenuhnya.`)
|
||||
};
|
||||
|
||||
const pt_subscribe_subheading = /** @type {(inputs: Subscribe_SubheadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Torne-se Pro e desbloqueie a experiência completa do libnovel.`)
|
||||
};
|
||||
|
||||
const fr_subscribe_subheading = /** @type {(inputs: Subscribe_SubheadingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Passez Pro et débloquez l'expérience libnovel complète.`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Upgrade to Pro and unlock the full libnovel experience." |
|
||||
*
|
||||
* @param {Subscribe_SubheadingInputs} inputs
|
||||
* @param {{ locale?: "en" | "ru" | "id" | "pt" | "fr" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const subscribe_subheading = /** @type {((inputs?: Subscribe_SubheadingInputs, options?: { locale?: "en" | "ru" | "id" | "pt" | "fr" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Subscribe_SubheadingInputs, { locale?: "en" | "ru" | "id" | "pt" | "fr" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_subscribe_subheading(inputs)
|
||||
if (locale === "ru") return ru_subscribe_subheading(inputs)
|
||||
if (locale === "id") return id_subscribe_subheading(inputs)
|
||||
if (locale === "pt") return pt_subscribe_subheading(inputs)
|
||||
return fr_subscribe_subheading(inputs)
|
||||
});
|
||||
@@ -192,6 +192,50 @@
|
||||
return () => clearTimeout(id);
|
||||
});
|
||||
|
||||
// ── MediaSession action handlers ────────────────────────────────────────────
|
||||
// Without explicit handlers, iOS Safari loses lock-screen resume ability after
|
||||
// ~1 minute of pause because it falls back to its own default which doesn't
|
||||
// satisfy the user-gesture requirement for <audio>.play().
|
||||
// Handlers registered here call audioEl directly so iOS trusts the gesture.
|
||||
$effect(() => {
|
||||
if (typeof navigator === 'undefined' || !('mediaSession' in navigator) || !audioEl) return;
|
||||
const el = audioEl; // capture for closure
|
||||
|
||||
navigator.mediaSession.setActionHandler('play', () => {
|
||||
el.play().catch(() => {});
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('pause', () => {
|
||||
el.pause();
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('seekbackward', (d) => {
|
||||
el.currentTime = Math.max(0, el.currentTime - (d.seekOffset ?? 15));
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('seekforward', (d) => {
|
||||
el.currentTime = Math.min(el.duration || 0, el.currentTime + (d.seekOffset ?? 30));
|
||||
});
|
||||
// previoustrack / nexttrack fall back to skip ±30s if no chapter nav available
|
||||
try {
|
||||
navigator.mediaSession.setActionHandler('previoustrack', () => {
|
||||
el.currentTime = Math.max(0, el.currentTime - 30);
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('nexttrack', () => {
|
||||
el.currentTime = Math.min(el.duration || 0, el.currentTime + 30);
|
||||
});
|
||||
} catch { /* some browsers don't support these */ }
|
||||
|
||||
return () => {
|
||||
(['play', 'pause', 'seekbackward', 'seekforward'] as MediaSessionAction[]).forEach((a) => {
|
||||
try { navigator.mediaSession.setActionHandler(a, null); } catch { /* ignore */ }
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
// Keep playbackState in sync so iOS lock screen shows the right button state
|
||||
$effect(() => {
|
||||
if (typeof navigator === 'undefined' || !('mediaSession' in navigator)) return;
|
||||
navigator.mediaSession.playbackState = audioStore.isPlaying ? 'playing' : 'paused';
|
||||
});
|
||||
|
||||
// ── Save audio time on pause/end (debounced 2s) ─────────────────────────
|
||||
let audioTimeSaveTimer = 0;
|
||||
function saveAudioTime() {
|
||||
@@ -363,6 +407,15 @@
|
||||
>
|
||||
{m.nav_catalogue()}
|
||||
</a>
|
||||
{#if !data.isPro}
|
||||
<a
|
||||
href="/subscribe"
|
||||
class="hidden sm:inline-flex items-center gap-1 text-sm font-semibold transition-colors {page.url.pathname.startsWith('/subscribe') ? 'text-(--color-brand)' : 'text-(--color-brand) opacity-70 hover:opacity-100'}"
|
||||
>
|
||||
<svg class="w-3.5 h-3.5 shrink-0" fill="currentColor" viewBox="0 0 24 24"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23L16.23 18z"/></svg>
|
||||
Pro
|
||||
</a>
|
||||
{/if}
|
||||
<div class="ml-auto flex items-center gap-2">
|
||||
<!-- Theme dropdown (desktop) -->
|
||||
<div class="hidden sm:block relative">
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
{ href: '/admin/audio', label: () => m.admin_nav_audio() },
|
||||
{ href: '/admin/translation', label: () => m.admin_nav_translation() },
|
||||
{ href: '/admin/changelog', label: () => m.admin_nav_changelog() },
|
||||
{ href: '/admin/image-gen', label: () => m.admin_nav_image_gen() }
|
||||
{ href: '/admin/image-gen', label: () => m.admin_nav_image_gen() },
|
||||
{ href: '/admin/text-gen', label: () => m.admin_nav_text_gen() }
|
||||
];
|
||||
|
||||
const externalLinks = [
|
||||
|
||||
@@ -219,28 +219,12 @@
|
||||
saveSuccess = false;
|
||||
|
||||
try {
|
||||
const payload = {
|
||||
prompt: prompt.trim(),
|
||||
model: result.model,
|
||||
type: 'cover',
|
||||
slug: result.slug,
|
||||
num_steps: numSteps,
|
||||
guidance,
|
||||
strength,
|
||||
width,
|
||||
height,
|
||||
save_to_cover: true
|
||||
};
|
||||
|
||||
// Re-generate with save_to_cover=true (backend saves atomically)
|
||||
// Alternatively, we could add a separate save endpoint.
|
||||
// For now we pass the same prompt + model to re-generate and save.
|
||||
// TODO: A lighter approach would be a dedicated save endpoint that accepts
|
||||
// the base64 payload. For now re-gen is acceptable given admin-only usage.
|
||||
const res = await fetch('/api/admin/image-gen', {
|
||||
// Extract the raw base64 from the data URL (data:<mime>;base64,<b64>)
|
||||
const b64 = result.imageSrc.split(',')[1];
|
||||
const res = await fetch('/api/admin/image-gen/save-cover', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload)
|
||||
body: JSON.stringify({ slug: result.slug, image_b64: b64 })
|
||||
});
|
||||
const body = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
|
||||
27
ui/src/routes/admin/text-gen/+page.server.ts
Normal file
27
ui/src/routes/admin/text-gen/+page.server.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
import { log } from '$lib/server/logger';
|
||||
|
||||
export interface TextModelInfo {
|
||||
id: string;
|
||||
label: string;
|
||||
provider: string;
|
||||
context_size: number;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
// Parent layout already guards admin role.
|
||||
try {
|
||||
const res = await backendFetch('/api/admin/text-gen/models');
|
||||
if (!res.ok) {
|
||||
log.warn('admin/text-gen', 'failed to load models', { status: res.status });
|
||||
return { models: [] as TextModelInfo[] };
|
||||
}
|
||||
const data = await res.json();
|
||||
return { models: (data.models ?? []) as TextModelInfo[] };
|
||||
} catch (e) {
|
||||
log.warn('admin/text-gen', 'backend unreachable', { err: String(e) });
|
||||
return { models: [] as TextModelInfo[] };
|
||||
}
|
||||
};
|
||||
516
ui/src/routes/admin/text-gen/+page.svelte
Normal file
516
ui/src/routes/admin/text-gen/+page.svelte
Normal file
@@ -0,0 +1,516 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import type { TextModelInfo } from './+page.server';
|
||||
|
||||
let { data }: { data: PageData } = $props();
|
||||
|
||||
const models = data.models as TextModelInfo[];
|
||||
|
||||
// ── Shared ────────────────────────────────────────────────────────────────────
|
||||
type ActiveTab = 'chapters' | 'description';
|
||||
let activeTab = $state<ActiveTab>('chapters');
|
||||
let selectedModel = $state(models[0]?.id ?? '');
|
||||
|
||||
let selectedModelInfo = $derived(models.find((m) => m.id === selectedModel) ?? null);
|
||||
|
||||
function fmtCtx(n: number) {
|
||||
if (n >= 1000) return `${(n / 1000).toFixed(0)}k ctx`;
|
||||
return `${n} ctx`;
|
||||
}
|
||||
|
||||
// ── Chapter names state ───────────────────────────────────────────────────────
|
||||
let chSlug = $state('');
|
||||
let chPattern = $state('Chapter {n}: {scene}');
|
||||
let chGenerating = $state(false);
|
||||
let chError = $state('');
|
||||
|
||||
interface ProposedChapter {
|
||||
number: number;
|
||||
old_title: string;
|
||||
new_title: string;
|
||||
// editable copy
|
||||
edited: string;
|
||||
}
|
||||
let chProposals = $state<ProposedChapter[]>([]);
|
||||
let chRawResponse = $state('');
|
||||
let chUsedModel = $state('');
|
||||
let chShowRaw = $state(false);
|
||||
|
||||
let chApplying = $state(false);
|
||||
let chApplyError = $state('');
|
||||
let chApplySuccess = $state(false);
|
||||
|
||||
let chCanGenerate = $derived(chSlug.trim().length > 0 && chPattern.trim().length > 0 && !chGenerating);
|
||||
let chCanApply = $derived(chProposals.length > 0 && !chApplying);
|
||||
|
||||
async function generateChapterNames() {
|
||||
if (!chCanGenerate) return;
|
||||
chGenerating = true;
|
||||
chError = '';
|
||||
chProposals = [];
|
||||
chApplySuccess = false;
|
||||
chApplyError = '';
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/admin/text-gen/chapter-names', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
slug: chSlug.trim(),
|
||||
pattern: chPattern.trim(),
|
||||
model: selectedModel
|
||||
})
|
||||
});
|
||||
const body = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
chError = body.error ?? body.message ?? `Error ${res.status}`;
|
||||
return;
|
||||
}
|
||||
chProposals = ((body.chapters ?? []) as { number: number; old_title: string; new_title: string }[]).map(
|
||||
(p) => ({ ...p, edited: p.new_title })
|
||||
);
|
||||
chRawResponse = body.raw_response ?? '';
|
||||
chUsedModel = body.model ?? '';
|
||||
// If backend returned chapters:[] but we have a raw response, the model
|
||||
// output was unparseable (likely truncated). Treat it as an error.
|
||||
if (chProposals.length === 0 && chRawResponse.trim().length > 0) {
|
||||
chError = 'Model response could not be parsed (output may be truncated). Raw response shown below.';
|
||||
}
|
||||
} catch {
|
||||
chError = 'Network error.';
|
||||
} finally {
|
||||
chGenerating = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function applyChapterNames() {
|
||||
if (!chCanApply) return;
|
||||
chApplying = true;
|
||||
chApplyError = '';
|
||||
chApplySuccess = false;
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/admin/text-gen/chapter-names/apply', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
slug: chSlug.trim(),
|
||||
chapters: chProposals.map((p) => ({ number: p.number, title: p.edited.trim() || p.new_title }))
|
||||
})
|
||||
});
|
||||
const body = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
chApplyError = body.error ?? body.message ?? `Error ${res.status}`;
|
||||
return;
|
||||
}
|
||||
chApplySuccess = true;
|
||||
} catch {
|
||||
chApplyError = 'Network error.';
|
||||
} finally {
|
||||
chApplying = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Description state ─────────────────────────────────────────────────────────
|
||||
let dSlug = $state('');
|
||||
let dInstructions = $state('');
|
||||
let dGenerating = $state(false);
|
||||
let dError = $state('');
|
||||
|
||||
let dOldDesc = $state('');
|
||||
let dNewDesc = $state('');
|
||||
let dUsedModel = $state('');
|
||||
|
||||
let dApplying = $state(false);
|
||||
let dApplyError = $state('');
|
||||
let dApplySuccess = $state(false);
|
||||
|
||||
let dCanGenerate = $derived(dSlug.trim().length > 0 && !dGenerating);
|
||||
let dCanApply = $derived(dNewDesc.trim().length > 0 && !dApplying);
|
||||
|
||||
async function generateDescription() {
|
||||
if (!dCanGenerate) return;
|
||||
dGenerating = true;
|
||||
dError = '';
|
||||
dOldDesc = '';
|
||||
dNewDesc = '';
|
||||
dApplySuccess = false;
|
||||
dApplyError = '';
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/admin/text-gen/description', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
slug: dSlug.trim(),
|
||||
instructions: dInstructions.trim(),
|
||||
model: selectedModel
|
||||
})
|
||||
});
|
||||
const body = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
dError = body.error ?? body.message ?? `Error ${res.status}`;
|
||||
return;
|
||||
}
|
||||
dOldDesc = body.old_description ?? '';
|
||||
dNewDesc = body.new_description ?? '';
|
||||
dUsedModel = body.model ?? '';
|
||||
} catch {
|
||||
dError = 'Network error.';
|
||||
} finally {
|
||||
dGenerating = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function applyDescription() {
|
||||
if (!dCanApply) return;
|
||||
dApplying = true;
|
||||
dApplyError = '';
|
||||
dApplySuccess = false;
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/admin/text-gen/description/apply', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
slug: dSlug.trim(),
|
||||
description: dNewDesc.trim()
|
||||
})
|
||||
});
|
||||
const body = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
dApplyError = body.error ?? body.message ?? `Error ${res.status}`;
|
||||
return;
|
||||
}
|
||||
dApplySuccess = true;
|
||||
} catch {
|
||||
dApplyError = 'Network error.';
|
||||
} finally {
|
||||
dApplying = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Text Gen — Admin</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="space-y-6 max-w-5xl">
|
||||
<!-- Header -->
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-(--color-text)">Text Generation</h1>
|
||||
<p class="text-(--color-muted) text-sm mt-1">
|
||||
Generate chapter titles and book descriptions using Cloudflare Workers AI.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Model selector (shared) -->
|
||||
<div class="space-y-1 max-w-md">
|
||||
<label class="text-xs font-medium text-(--color-muted) uppercase tracking-wide" for="model-select">
|
||||
Model
|
||||
</label>
|
||||
<select
|
||||
id="model-select"
|
||||
bind:value={selectedModel}
|
||||
class="w-full bg-(--color-surface-2) border border-(--color-border) rounded-lg px-3 py-2 text-(--color-text) text-sm focus:outline-none focus:ring-2 focus:ring-(--color-brand)"
|
||||
>
|
||||
{#each models as m}
|
||||
<option value={m.id}>{m.label} — {m.provider} ({fmtCtx(m.context_size)})</option>
|
||||
{/each}
|
||||
</select>
|
||||
{#if selectedModelInfo}
|
||||
<p class="text-xs text-(--color-muted)">{selectedModelInfo.description}</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Tab toggle -->
|
||||
<div class="flex gap-1 bg-(--color-surface-2) rounded-lg p-1 w-fit border border-(--color-border)">
|
||||
{#each (['chapters', 'description'] as const) as t}
|
||||
<button
|
||||
onclick={() => (activeTab = t)}
|
||||
class="px-4 py-1.5 rounded-md text-sm font-medium transition-colors
|
||||
{activeTab === t
|
||||
? 'bg-(--color-surface-3) text-(--color-text)'
|
||||
: 'text-(--color-muted) hover:text-(--color-text)'}"
|
||||
>
|
||||
{t === 'chapters' ? 'Chapter Names' : 'Description'}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<!-- ── Chapter names panel ────────────────────────────────────────────────── -->
|
||||
{#if activeTab === 'chapters'}
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 items-start">
|
||||
<!-- Left: form -->
|
||||
<div class="space-y-4">
|
||||
<div class="space-y-1">
|
||||
<label class="text-xs font-medium text-(--color-muted) uppercase tracking-wide" for="ch-slug">
|
||||
Book slug
|
||||
</label>
|
||||
<input
|
||||
id="ch-slug"
|
||||
type="text"
|
||||
bind:value={chSlug}
|
||||
placeholder="e.g. shadow-slave"
|
||||
class="w-full bg-(--color-surface-2) border border-(--color-border) rounded-lg px-3 py-2 text-(--color-text) text-sm placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-(--color-brand)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1">
|
||||
<label class="text-xs font-medium text-(--color-muted) uppercase tracking-wide" for="ch-pattern">
|
||||
Naming pattern
|
||||
</label>
|
||||
<input
|
||||
id="ch-pattern"
|
||||
type="text"
|
||||
bind:value={chPattern}
|
||||
placeholder="e.g. Chapter [n]: [brief scene description]"
|
||||
class="w-full bg-(--color-surface-2) border border-(--color-border) rounded-lg px-3 py-2 text-(--color-text) text-sm placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-(--color-brand)"
|
||||
/>
|
||||
<p class="text-xs text-(--color-muted)">
|
||||
Describe the desired chapter title format. The AI will rename every chapter to match.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onclick={generateChapterNames}
|
||||
disabled={!chCanGenerate}
|
||||
class="w-full py-2.5 rounded-lg bg-(--color-brand) text-(--color-surface) font-semibold text-sm
|
||||
hover:bg-(--color-brand-dim) transition-colors disabled:opacity-50 disabled:cursor-not-allowed
|
||||
flex items-center justify-center gap-2"
|
||||
>
|
||||
{#if chGenerating}
|
||||
<svg class="w-4 h-4 animate-spin" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" />
|
||||
</svg>
|
||||
Generating…
|
||||
{:else}
|
||||
Generate proposals
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
{#if chError}
|
||||
<p class="text-sm text-(--color-danger) bg-(--color-danger)/10 rounded-lg px-3 py-2">{chError}</p>
|
||||
{#if chRawResponse}
|
||||
<pre class="text-xs bg-(--color-surface-2) border border-(--color-border) rounded-lg p-3 overflow-auto max-h-48 text-(--color-muted) whitespace-pre-wrap break-words">{chRawResponse}</pre>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Right: proposals -->
|
||||
<div class="space-y-4">
|
||||
{#if chProposals.length > 0}
|
||||
<div class="space-y-2">
|
||||
<div class="flex items-center justify-between">
|
||||
<p class="text-xs font-semibold text-(--color-muted) uppercase tracking-widest">
|
||||
{chProposals.length} proposals
|
||||
{#if chUsedModel}
|
||||
<span class="normal-case font-normal">· {chUsedModel.split('/').pop()}</span>
|
||||
{/if}
|
||||
</p>
|
||||
<button
|
||||
onclick={() => (chShowRaw = !chShowRaw)}
|
||||
class="text-xs text-(--color-muted) hover:text-(--color-text) transition-colors"
|
||||
>
|
||||
{chShowRaw ? 'Hide raw' : 'Show raw'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if chShowRaw}
|
||||
<pre class="text-xs bg-(--color-surface-2) border border-(--color-border) rounded-lg p-3 overflow-auto max-h-40 text-(--color-muted)">{chRawResponse}</pre>
|
||||
{/if}
|
||||
|
||||
<div class="max-h-[28rem] overflow-y-auto space-y-2 pr-1">
|
||||
{#each chProposals as proposal}
|
||||
<div class="bg-(--color-surface) border border-(--color-border) rounded-lg p-3 space-y-1.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-xs font-mono text-(--color-muted) w-8 shrink-0">#{proposal.number}</span>
|
||||
<p class="text-xs text-(--color-muted) line-through truncate flex-1" title={proposal.old_title}>
|
||||
{proposal.old_title}
|
||||
</p>
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
bind:value={proposal.edited}
|
||||
class="w-full bg-(--color-surface-2) border border-(--color-border) rounded-md px-2.5 py-1.5 text-(--color-text) text-sm focus:outline-none focus:ring-1 focus:ring-(--color-brand)"
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2 pt-1">
|
||||
<button
|
||||
onclick={applyChapterNames}
|
||||
disabled={!chCanApply}
|
||||
class="flex-1 py-2 rounded-lg bg-(--color-brand) text-(--color-surface) font-semibold text-sm
|
||||
hover:bg-(--color-brand-dim) transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
{chApplying ? 'Saving…' : chApplySuccess ? 'Saved ✓' : `Apply ${chProposals.length} titles`}
|
||||
</button>
|
||||
<button
|
||||
onclick={() => { chProposals = []; chRawResponse = ''; chApplySuccess = false; }}
|
||||
class="px-4 py-2 rounded-lg bg-(--color-surface-2) text-(--color-muted) text-sm
|
||||
hover:text-(--color-text) transition-colors border border-(--color-border)"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if chApplyError}
|
||||
<p class="text-sm text-(--color-danger) bg-(--color-danger)/10 rounded-lg px-3 py-2">{chApplyError}</p>
|
||||
{/if}
|
||||
{#if chApplySuccess}
|
||||
<p class="text-sm text-green-400 bg-green-400/10 rounded-lg px-3 py-2">
|
||||
{chProposals.length} chapter titles saved successfully.
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if chGenerating}
|
||||
<div class="flex items-center justify-center bg-(--color-surface) border border-(--color-border) rounded-xl h-48">
|
||||
<div class="text-center space-y-3">
|
||||
<svg class="w-8 h-8 animate-spin mx-auto text-(--color-brand)" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" />
|
||||
</svg>
|
||||
<p class="text-sm text-(--color-muted)">Generating chapter titles…</p>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex items-center justify-center bg-(--color-surface) border border-(--color-border) border-dashed rounded-xl h-48">
|
||||
<p class="text-sm text-(--color-muted)">Proposed titles will appear here</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- ── Description panel ──────────────────────────────────────────────────── -->
|
||||
{#if activeTab === 'description'}
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 items-start">
|
||||
<!-- Left: form -->
|
||||
<div class="space-y-4">
|
||||
<div class="space-y-1">
|
||||
<label class="text-xs font-medium text-(--color-muted) uppercase tracking-wide" for="d-slug">
|
||||
Book slug
|
||||
</label>
|
||||
<input
|
||||
id="d-slug"
|
||||
type="text"
|
||||
bind:value={dSlug}
|
||||
placeholder="e.g. shadow-slave"
|
||||
class="w-full bg-(--color-surface-2) border border-(--color-border) rounded-lg px-3 py-2 text-(--color-text) text-sm placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-(--color-brand)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1">
|
||||
<label class="text-xs font-medium text-(--color-muted) uppercase tracking-wide" for="d-instructions">
|
||||
Instructions <span class="normal-case font-normal text-(--color-muted)">(optional)</span>
|
||||
</label>
|
||||
<textarea
|
||||
id="d-instructions"
|
||||
bind:value={dInstructions}
|
||||
rows="3"
|
||||
placeholder="e.g. Write a 3-sentence blurb, avoid spoilers, dramatic tone."
|
||||
class="w-full bg-(--color-surface-2) border border-(--color-border) rounded-lg px-3 py-2 text-(--color-text) text-sm placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-(--color-brand) resize-y"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onclick={generateDescription}
|
||||
disabled={!dCanGenerate}
|
||||
class="w-full py-2.5 rounded-lg bg-(--color-brand) text-(--color-surface) font-semibold text-sm
|
||||
hover:bg-(--color-brand-dim) transition-colors disabled:opacity-50 disabled:cursor-not-allowed
|
||||
flex items-center justify-center gap-2"
|
||||
>
|
||||
{#if dGenerating}
|
||||
<svg class="w-4 h-4 animate-spin" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" />
|
||||
</svg>
|
||||
Generating…
|
||||
{:else}
|
||||
Generate description
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
{#if dError}
|
||||
<p class="text-sm text-(--color-danger) bg-(--color-danger)/10 rounded-lg px-3 py-2">{dError}</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Right: result -->
|
||||
<div class="space-y-4">
|
||||
{#if dNewDesc || dOldDesc}
|
||||
<div class="space-y-4">
|
||||
{#if dOldDesc}
|
||||
<div class="space-y-1">
|
||||
<p class="text-xs font-semibold text-(--color-muted) uppercase tracking-widest">Current description</p>
|
||||
<div class="bg-(--color-surface) border border-(--color-border) rounded-lg p-3">
|
||||
<p class="text-sm text-(--color-muted) whitespace-pre-wrap">{dOldDesc}</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if dNewDesc}
|
||||
<div class="space-y-1">
|
||||
<div class="flex items-center justify-between">
|
||||
<p class="text-xs font-semibold text-(--color-muted) uppercase tracking-widest">
|
||||
Proposed description
|
||||
{#if dUsedModel}
|
||||
<span class="normal-case font-normal">· {dUsedModel.split('/').pop()}</span>
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
<textarea
|
||||
bind:value={dNewDesc}
|
||||
rows="6"
|
||||
class="w-full bg-(--color-surface-2) border border-(--color-border) rounded-lg px-3 py-2 text-(--color-text) text-sm focus:outline-none focus:ring-2 focus:ring-(--color-brand) resize-y"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
onclick={applyDescription}
|
||||
disabled={!dCanApply}
|
||||
class="flex-1 py-2 rounded-lg bg-(--color-brand) text-(--color-surface) font-semibold text-sm
|
||||
hover:bg-(--color-brand-dim) transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
{dApplying ? 'Saving…' : dApplySuccess ? 'Saved ✓' : 'Apply description'}
|
||||
</button>
|
||||
<button
|
||||
onclick={() => { dNewDesc = ''; dOldDesc = ''; dApplySuccess = false; }}
|
||||
class="px-4 py-2 rounded-lg bg-(--color-surface-2) text-(--color-muted) text-sm
|
||||
hover:text-(--color-text) transition-colors border border-(--color-border)"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if dApplyError}
|
||||
<p class="text-sm text-(--color-danger) bg-(--color-danger)/10 rounded-lg px-3 py-2">{dApplyError}</p>
|
||||
{/if}
|
||||
{#if dApplySuccess}
|
||||
<p class="text-sm text-green-400 bg-green-400/10 rounded-lg px-3 py-2">Description saved successfully.</p>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{:else if dGenerating}
|
||||
<div class="flex items-center justify-center bg-(--color-surface) border border-(--color-border) rounded-xl h-48">
|
||||
<div class="text-center space-y-3">
|
||||
<svg class="w-8 h-8 animate-spin mx-auto text-(--color-brand)" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" />
|
||||
</svg>
|
||||
<p class="text-sm text-(--color-muted)">Generating description…</p>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex items-center justify-center bg-(--color-surface) border border-(--color-border) border-dashed rounded-xl h-48">
|
||||
<p class="text-sm text-(--color-muted)">Proposed description will appear here</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
34
ui/src/routes/api/admin/audio/bulk/+server.ts
Normal file
34
ui/src/routes/api/admin/audio/bulk/+server.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* POST /api/admin/audio/bulk
|
||||
*
|
||||
* Admin-only proxy to the Go backend's audio bulk-enqueue endpoint.
|
||||
* Body: { slug, voice?, from, to, skip_existing?, force? }
|
||||
* Response 202: { enqueued, skipped, task_ids }
|
||||
*/
|
||||
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { log } from '$lib/server/logger';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const POST: RequestHandler = async ({ request, locals }) => {
|
||||
if (!locals.user || locals.user.role !== 'admin') {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
|
||||
const body = await request.text();
|
||||
let res: Response;
|
||||
try {
|
||||
res = await backendFetch('/api/admin/audio/bulk', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body
|
||||
});
|
||||
} catch (e) {
|
||||
log.error('admin/audio/bulk', 'backend proxy error', { err: String(e) });
|
||||
throw error(502, 'Could not reach backend');
|
||||
}
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
return json(data, { status: res.status });
|
||||
};
|
||||
34
ui/src/routes/api/admin/audio/cancel-bulk/+server.ts
Normal file
34
ui/src/routes/api/admin/audio/cancel-bulk/+server.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* POST /api/admin/audio/cancel-bulk
|
||||
*
|
||||
* Admin-only proxy to cancel all pending/running audio tasks for a slug.
|
||||
* Body: { slug }
|
||||
* Response 200: { cancelled }
|
||||
*/
|
||||
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { log } from '$lib/server/logger';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const POST: RequestHandler = async ({ request, locals }) => {
|
||||
if (!locals.user || locals.user.role !== 'admin') {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
|
||||
const body = await request.text();
|
||||
let res: Response;
|
||||
try {
|
||||
res = await backendFetch('/api/admin/audio/cancel-bulk', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body
|
||||
});
|
||||
} catch (e) {
|
||||
log.error('admin/audio/cancel-bulk', 'backend proxy error', { err: String(e) });
|
||||
throw error(502, 'Could not reach backend');
|
||||
}
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
return json(data, { status: res.status });
|
||||
};
|
||||
35
ui/src/routes/api/admin/image-gen/save-cover/+server.ts
Normal file
35
ui/src/routes/api/admin/image-gen/save-cover/+server.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* POST /api/admin/image-gen/save-cover
|
||||
*
|
||||
* Admin-only proxy: persists a pre-generated base64 image as a book cover in
|
||||
* MinIO without re-calling Cloudflare AI.
|
||||
*
|
||||
* Body: { slug: string, image_b64: string }
|
||||
*/
|
||||
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { log } from '$lib/server/logger';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const POST: RequestHandler = async ({ request, locals }) => {
|
||||
if (!locals.user || locals.user.role !== 'admin') {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
|
||||
const body = await request.text();
|
||||
let res: Response;
|
||||
try {
|
||||
res = await backendFetch('/api/admin/image-gen/save-cover', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body
|
||||
});
|
||||
} catch (e) {
|
||||
log.error('admin/image-gen/save-cover', 'backend proxy error', { err: String(e) });
|
||||
throw error(502, 'Could not reach backend');
|
||||
}
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
return json(data, { status: res.status });
|
||||
};
|
||||
33
ui/src/routes/api/admin/text-gen/chapter-names/+server.ts
Normal file
33
ui/src/routes/api/admin/text-gen/chapter-names/+server.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* POST /api/admin/text-gen/chapter-names
|
||||
*
|
||||
* Admin-only proxy to the Go backend's chapter-name generation endpoint.
|
||||
* Returns AI-proposed chapter titles; does NOT persist anything.
|
||||
*/
|
||||
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { log } from '$lib/server/logger';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const POST: RequestHandler = async ({ request, locals }) => {
|
||||
if (!locals.user || locals.user.role !== 'admin') {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
|
||||
const body = await request.text();
|
||||
let res: Response;
|
||||
try {
|
||||
res = await backendFetch('/api/admin/text-gen/chapter-names', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body
|
||||
});
|
||||
} catch (e) {
|
||||
log.error('admin/text-gen/chapter-names', 'backend proxy error', { err: String(e) });
|
||||
throw error(502, 'Could not reach backend');
|
||||
}
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
return json(data, { status: res.status });
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* POST /api/admin/text-gen/chapter-names/apply
|
||||
*
|
||||
* Admin-only proxy to persist confirmed chapter titles to PocketBase.
|
||||
*/
|
||||
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { log } from '$lib/server/logger';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const POST: RequestHandler = async ({ request, locals }) => {
|
||||
if (!locals.user || locals.user.role !== 'admin') {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
|
||||
const body = await request.text();
|
||||
let res: Response;
|
||||
try {
|
||||
res = await backendFetch('/api/admin/text-gen/chapter-names/apply', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body
|
||||
});
|
||||
} catch (e) {
|
||||
log.error('admin/text-gen/chapter-names/apply', 'backend proxy error', { err: String(e) });
|
||||
throw error(502, 'Could not reach backend');
|
||||
}
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
return json(data, { status: res.status });
|
||||
};
|
||||
33
ui/src/routes/api/admin/text-gen/description/+server.ts
Normal file
33
ui/src/routes/api/admin/text-gen/description/+server.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* POST /api/admin/text-gen/description
|
||||
*
|
||||
* Admin-only proxy to the Go backend's book description generation endpoint.
|
||||
* Returns an AI-proposed description; does NOT persist anything.
|
||||
*/
|
||||
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { log } from '$lib/server/logger';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const POST: RequestHandler = async ({ request, locals }) => {
|
||||
if (!locals.user || locals.user.role !== 'admin') {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
|
||||
const body = await request.text();
|
||||
let res: Response;
|
||||
try {
|
||||
res = await backendFetch('/api/admin/text-gen/description', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body
|
||||
});
|
||||
} catch (e) {
|
||||
log.error('admin/text-gen/description', 'backend proxy error', { err: String(e) });
|
||||
throw error(502, 'Could not reach backend');
|
||||
}
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
return json(data, { status: res.status });
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* POST /api/admin/text-gen/description/apply
|
||||
*
|
||||
* Admin-only proxy to persist the confirmed book description to PocketBase.
|
||||
*/
|
||||
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { log } from '$lib/server/logger';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const POST: RequestHandler = async ({ request, locals }) => {
|
||||
if (!locals.user || locals.user.role !== 'admin') {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
|
||||
const body = await request.text();
|
||||
let res: Response;
|
||||
try {
|
||||
res = await backendFetch('/api/admin/text-gen/description/apply', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body
|
||||
});
|
||||
} catch (e) {
|
||||
log.error('admin/text-gen/description/apply', 'backend proxy error', { err: String(e) });
|
||||
throw error(502, 'Could not reach backend');
|
||||
}
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
return json(data, { status: res.status });
|
||||
};
|
||||
17
ui/src/routes/api/admin/text-gen/models/+server.ts
Normal file
17
ui/src/routes/api/admin/text-gen/models/+server.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
|
||||
export const GET: RequestHandler = async ({ locals }) => {
|
||||
if (!locals.user || locals.user.role !== 'admin') {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
let res: Response;
|
||||
try {
|
||||
res = await backendFetch('/api/admin/text-gen/models');
|
||||
} catch {
|
||||
throw error(502, 'Could not reach backend');
|
||||
}
|
||||
const data = await res.json().catch(() => ({}));
|
||||
return json(data, { status: res.status });
|
||||
};
|
||||
134
ui/src/routes/api/audio-stream/[slug]/[n]/+server.ts
Normal file
134
ui/src/routes/api/audio-stream/[slug]/[n]/+server.ts
Normal file
@@ -0,0 +1,134 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { log } from '$lib/server/logger';
|
||||
import { backendFetch } from '$lib/server/scraper';
|
||||
import * as cache from '$lib/server/cache';
|
||||
|
||||
const FREE_DAILY_AUDIO_LIMIT = 3;
|
||||
|
||||
function dailyAudioKey(identifier: string): string {
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
return `audio:daily:${identifier}:${today}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of audio chapters a user/session has generated today,
|
||||
* and increment the counter. Shared logic with POST /api/audio/[slug]/[n].
|
||||
*
|
||||
* Key: audio:daily:<userId|sessionId>:<YYYY-MM-DD>
|
||||
*/
|
||||
async function incrementDailyAudioCount(identifier: string): Promise<number> {
|
||||
const key = dailyAudioKey(identifier);
|
||||
const now = new Date();
|
||||
const endOfDay = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + 1));
|
||||
const ttl = Math.ceil((endOfDay.getTime() - now.getTime()) / 1000);
|
||||
try {
|
||||
const raw = await cache.get<number>(key);
|
||||
const current = (raw ?? 0) + 1;
|
||||
await cache.set(key, current, ttl);
|
||||
return current;
|
||||
} catch {
|
||||
// On cache failure, fail open (don't block audio for cache errors)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/audio-stream/[slug]/[n]?voice=...
|
||||
*
|
||||
* Proxies the backend's streaming TTS endpoint to the browser.
|
||||
*
|
||||
* Fast path: if audio already in MinIO, backend sends a 302 → fetch follows it
|
||||
* and we stream the MinIO audio through.
|
||||
*
|
||||
* Slow path (Kokoro/PocketTTS): backend streams audio bytes as they are
|
||||
* generated. The browser receives the first bytes within seconds and can start
|
||||
* playing before generation completes. MinIO upload happens concurrently
|
||||
* server-side so subsequent requests use the cached fast path.
|
||||
*
|
||||
* Slow path (CF AI): backend buffers the full response (batch API limitation)
|
||||
* before sending — effectively the same as the old POST+poll approach but
|
||||
* without the separate progress-bar flow. Prefer the traditional POST route
|
||||
* for CF AI voices to preserve the generating UI.
|
||||
*/
|
||||
export const GET: RequestHandler = async ({ params, url, locals }) => {
|
||||
const { slug, n } = params;
|
||||
const chapter = parseInt(n, 10);
|
||||
if (!slug || !chapter || chapter < 1) {
|
||||
error(400, 'Invalid slug or chapter number');
|
||||
}
|
||||
|
||||
const voice = url.searchParams.get('voice') ?? '';
|
||||
|
||||
// ── Paywall: 3 audio chapters/day for free users ─────────────────────────
|
||||
// Only count when the audio is not already cached — same rule as POST route.
|
||||
if (!locals.isPro) {
|
||||
const statusRes = await backendFetch(
|
||||
`/api/audio/status/${slug}/${chapter}${voice ? `?voice=${encodeURIComponent(voice)}` : ''}`
|
||||
).catch(() => null);
|
||||
const statusData = statusRes?.ok
|
||||
? ((await statusRes.json().catch(() => ({}))) as { status?: string })
|
||||
: {};
|
||||
|
||||
if (statusData.status !== 'done') {
|
||||
const identifier = locals.user?.id ?? locals.sessionId;
|
||||
const count = await incrementDailyAudioCount(identifier);
|
||||
if (count > FREE_DAILY_AUDIO_LIMIT) {
|
||||
log.info('polar', 'free audio stream limit reached', { identifier, count });
|
||||
return new Response(
|
||||
JSON.stringify({ error: 'pro_required', limit: FREE_DAILY_AUDIO_LIMIT }),
|
||||
{ status: 402, headers: { 'Content-Type': 'application/json' } }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const qs = new URLSearchParams({ format: 'mp3' });
|
||||
if (voice) qs.set('voice', voice);
|
||||
|
||||
// fetch() follows the backend's 302 (MinIO fast path) automatically.
|
||||
const backendRes = await backendFetch(`/api/audio-stream/${slug}/${chapter}?${qs}`);
|
||||
|
||||
if (!backendRes.ok) {
|
||||
const text = await backendRes.text().catch(() => '');
|
||||
log.error('audio-stream', 'backend stream failed', {
|
||||
slug,
|
||||
chapter,
|
||||
status: backendRes.status,
|
||||
body: text
|
||||
});
|
||||
error(backendRes.status as Parameters<typeof error>[0], text || 'Audio stream failed');
|
||||
}
|
||||
|
||||
// Stream the response body directly — no buffering.
|
||||
return new Response(backendRes.body, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': backendRes.headers.get('Content-Type') ?? 'audio/mpeg',
|
||||
'Cache-Control': 'no-store',
|
||||
'X-Accel-Buffering': 'no'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* HEAD /api/audio-stream/[slug]/[n]?voice=...
|
||||
*
|
||||
* Paywall pre-check without incrementing the daily counter or triggering
|
||||
* any generation. The AudioPlayer uses this to surface the upgrade CTA
|
||||
* before pointing the <audio> element at the streaming URL.
|
||||
*
|
||||
* Returns 402 if the user has already hit their daily limit, 200 otherwise.
|
||||
*/
|
||||
export const HEAD: RequestHandler = async ({ locals }) => {
|
||||
if (locals.isPro) {
|
||||
return new Response(null, { status: 200 });
|
||||
}
|
||||
const identifier = locals.user?.id ?? locals.sessionId;
|
||||
const count = (await cache.get<number>(dailyAudioKey(identifier))) ?? 0;
|
||||
// count >= limit means the next GET would exceed the limit after increment
|
||||
if (count >= FREE_DAILY_AUDIO_LIMIT) {
|
||||
return new Response(null, { status: 402 });
|
||||
}
|
||||
return new Response(null, { status: 200 });
|
||||
};
|
||||
@@ -133,6 +133,301 @@
|
||||
// ── Admin panel expand/collapse ───────────────────────────────────────────
|
||||
let adminOpen = $state(false);
|
||||
|
||||
// ── Admin: book cover generation ──────────────────────────────────────────
|
||||
let coverGenerating = $state(false);
|
||||
let coverPreview = $state<string | null>(null);
|
||||
let coverSaving = $state(false);
|
||||
let coverResult = $state<'saved' | 'error' | ''>('');
|
||||
|
||||
async function generateCover() {
|
||||
const slug = data.book?.slug;
|
||||
if (coverGenerating || !slug) return;
|
||||
coverGenerating = true;
|
||||
coverPreview = null;
|
||||
coverResult = '';
|
||||
try {
|
||||
const res = await fetch('/api/admin/image-gen', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug, type: 'cover', prompt: data.book?.title ?? slug })
|
||||
});
|
||||
if (res.ok) {
|
||||
const d = await res.json();
|
||||
coverPreview = d.image_b64 ? `data:${d.content_type ?? 'image/png'};base64,${d.image_b64}` : null;
|
||||
} else {
|
||||
coverResult = 'error';
|
||||
}
|
||||
} catch {
|
||||
coverResult = 'error';
|
||||
} finally {
|
||||
coverGenerating = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function saveCover() {
|
||||
const slug = data.book?.slug;
|
||||
if (coverSaving || !coverPreview || !slug) return;
|
||||
coverSaving = true;
|
||||
coverResult = '';
|
||||
try {
|
||||
const b64 = coverPreview.replace(/^data:[^;]+;base64,/, '');
|
||||
const res = await fetch('/api/admin/image-gen/save-cover', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug, image_b64: b64 })
|
||||
});
|
||||
if (res.ok) {
|
||||
coverResult = 'saved';
|
||||
coverPreview = null;
|
||||
await invalidateAll();
|
||||
} else {
|
||||
coverResult = 'error';
|
||||
}
|
||||
} catch {
|
||||
coverResult = 'error';
|
||||
} finally {
|
||||
coverSaving = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Admin: chapter cover generation ───────────────────────────────────────
|
||||
let chapterCoverN = $state('1');
|
||||
let chapterCoverGenerating = $state(false);
|
||||
let chapterCoverPreview = $state<string | null>(null);
|
||||
let chapterCoverResult = $state<'error' | ''>('');
|
||||
|
||||
async function generateChapterCover() {
|
||||
const slug = data.book?.slug;
|
||||
if (chapterCoverGenerating || !slug) return;
|
||||
const n = parseInt(chapterCoverN, 10);
|
||||
if (!n || n < 1) return;
|
||||
chapterCoverGenerating = true;
|
||||
chapterCoverPreview = null;
|
||||
chapterCoverResult = '';
|
||||
try {
|
||||
const res = await fetch('/api/admin/image-gen', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug, type: 'chapter', chapter: n, prompt: data.book?.title ?? slug })
|
||||
});
|
||||
if (res.ok) {
|
||||
const d = await res.json();
|
||||
chapterCoverPreview = d.image_b64 ? `data:${d.content_type ?? 'image/png'};base64,${d.image_b64}` : null;
|
||||
} else {
|
||||
chapterCoverResult = 'error';
|
||||
}
|
||||
} catch {
|
||||
chapterCoverResult = 'error';
|
||||
} finally {
|
||||
chapterCoverGenerating = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Admin: description generation ─────────────────────────────────────────
|
||||
let descGenerating = $state(false);
|
||||
let descPreview = $state('');
|
||||
let descApplying = $state(false);
|
||||
let descResult = $state<'applied' | 'error' | ''>('');
|
||||
|
||||
async function generateDesc() {
|
||||
const slug = data.book?.slug;
|
||||
if (descGenerating || !slug) return;
|
||||
descGenerating = true;
|
||||
descPreview = '';
|
||||
descResult = '';
|
||||
try {
|
||||
const res = await fetch('/api/admin/text-gen/description', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug })
|
||||
});
|
||||
if (res.ok) {
|
||||
const d = await res.json();
|
||||
descPreview = d.new_description ?? '';
|
||||
} else {
|
||||
descResult = 'error';
|
||||
}
|
||||
} catch {
|
||||
descResult = 'error';
|
||||
} finally {
|
||||
descGenerating = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function applyDesc() {
|
||||
const slug = data.book?.slug;
|
||||
if (descApplying || !descPreview || !slug) return;
|
||||
descApplying = true;
|
||||
descResult = '';
|
||||
try {
|
||||
const res = await fetch('/api/admin/text-gen/description/apply', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug, description: descPreview })
|
||||
});
|
||||
if (res.ok) {
|
||||
descResult = 'applied';
|
||||
descPreview = '';
|
||||
await invalidateAll();
|
||||
} else {
|
||||
descResult = 'error';
|
||||
}
|
||||
} catch {
|
||||
descResult = 'error';
|
||||
} finally {
|
||||
descApplying = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Admin: chapter names generation ───────────────────────────────────────
|
||||
let chapNamesGenerating = $state(false);
|
||||
let chapNamesPreview = $state<{ number: number; old_title: string; new_title: string }[]>([]);
|
||||
let chapNamesApplying = $state(false);
|
||||
let chapNamesResult = $state<'applied' | 'error' | ''>('');
|
||||
|
||||
async function generateChapNames() {
|
||||
const slug = data.book?.slug;
|
||||
if (chapNamesGenerating || !slug) return;
|
||||
chapNamesGenerating = true;
|
||||
chapNamesPreview = [];
|
||||
chapNamesResult = '';
|
||||
try {
|
||||
const res = await fetch('/api/admin/text-gen/chapter-names', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug, pattern: 'Chapter {n}: {scene}' })
|
||||
});
|
||||
if (res.ok) {
|
||||
const d = await res.json();
|
||||
chapNamesPreview = d.chapters ?? [];
|
||||
} else {
|
||||
chapNamesResult = 'error';
|
||||
}
|
||||
} catch {
|
||||
chapNamesResult = 'error';
|
||||
} finally {
|
||||
chapNamesGenerating = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function applyChapNames() {
|
||||
const slug = data.book?.slug;
|
||||
if (chapNamesApplying || chapNamesPreview.length === 0 || !slug) return;
|
||||
chapNamesApplying = true;
|
||||
chapNamesResult = '';
|
||||
try {
|
||||
const chapters = chapNamesPreview.map((c) => ({ number: c.number, title: c.new_title }));
|
||||
const res = await fetch('/api/admin/text-gen/chapter-names/apply', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug, chapters })
|
||||
});
|
||||
if (res.ok) {
|
||||
chapNamesResult = 'applied';
|
||||
chapNamesPreview = [];
|
||||
await invalidateAll();
|
||||
} else {
|
||||
chapNamesResult = 'error';
|
||||
}
|
||||
} catch {
|
||||
chapNamesResult = 'error';
|
||||
} finally {
|
||||
chapNamesApplying = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Admin: audio TTS bulk enqueue ─────────────────────────────────────────
|
||||
interface Voice { id: string; engine: string; lang: string; gender: string }
|
||||
let audioVoices = $state<Voice[]>([]);
|
||||
let audioVoicesLoaded = $state(false);
|
||||
let audioVoice = $state('af_bella');
|
||||
let audioFrom = $state('1');
|
||||
let audioTo = $state('');
|
||||
let audioEnqueuing = $state(false);
|
||||
let audioResult = $state<{ enqueued: number; skipped: number } | null>(null);
|
||||
let audioError = $state('');
|
||||
|
||||
// Load voices lazily when admin panel opens
|
||||
$effect(() => {
|
||||
if (!adminOpen || audioVoicesLoaded) return;
|
||||
fetch('/api/voices')
|
||||
.then((r) => r.json())
|
||||
.then((d: { voices: Voice[] }) => {
|
||||
audioVoices = d.voices ?? [];
|
||||
audioVoicesLoaded = true;
|
||||
})
|
||||
.catch(() => { audioVoicesLoaded = true; });
|
||||
});
|
||||
|
||||
function voiceLabel(v: Voice): string {
|
||||
if (v.engine === 'cfai') {
|
||||
const speaker = v.id.startsWith('cfai:') ? v.id.slice(5) : v.id;
|
||||
return speaker.replace(/\b\w/g, (c) => c.toUpperCase()) + ' (CF AI)';
|
||||
}
|
||||
if (v.engine === 'pocket-tts') {
|
||||
return v.id.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase()) + ' (Pocket)';
|
||||
}
|
||||
// Kokoro
|
||||
const langMap: Record<string, string> = {
|
||||
af: 'US', am: 'US', bf: 'UK', bm: 'UK',
|
||||
ef: 'ES', em: 'ES', ff: 'FR', hf: 'IN', hm: 'IN',
|
||||
'if': 'IT', im: 'IT', jf: 'JP', jm: 'JP', pf: 'PT', pm: 'PT', zf: 'ZH', zm: 'ZH',
|
||||
};
|
||||
const prefix = v.id.slice(0, 2);
|
||||
const name = v.id.slice(3).replace(/^v0/, '').replace(/^([a-z])/, (c) => c.toUpperCase());
|
||||
const lang = langMap[prefix] ?? prefix.toUpperCase();
|
||||
return `${name} (${lang})`;
|
||||
}
|
||||
|
||||
async function enqueueAudio() {
|
||||
const slug = data.book?.slug;
|
||||
if (audioEnqueuing || !slug) return;
|
||||
const from = parseInt(audioFrom, 10);
|
||||
const to = audioTo ? parseInt(audioTo, 10) : (data.book?.total_chapters ?? 1);
|
||||
if (!from || from < 1) return;
|
||||
audioEnqueuing = true;
|
||||
audioResult = null;
|
||||
audioError = '';
|
||||
try {
|
||||
const res = await fetch('/api/admin/audio/bulk', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug, voice: audioVoice, from, to })
|
||||
});
|
||||
if (res.ok || res.status === 202) {
|
||||
const d = await res.json();
|
||||
audioResult = { enqueued: d.enqueued ?? 0, skipped: d.skipped ?? 0 };
|
||||
} else {
|
||||
const d = await res.json().catch(() => ({}));
|
||||
audioError = d.error ?? 'Failed to enqueue';
|
||||
}
|
||||
} catch {
|
||||
audioError = 'Network error';
|
||||
} finally {
|
||||
audioEnqueuing = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function cancelAudio() {
|
||||
const slug = data.book?.slug;
|
||||
if (!slug) return;
|
||||
audioResult = null;
|
||||
audioError = '';
|
||||
try {
|
||||
const res = await fetch('/api/admin/audio/cancel-bulk', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ slug })
|
||||
});
|
||||
if (res.ok) {
|
||||
const d = await res.json();
|
||||
audioError = `Cancelled ${d.cancelled ?? 0} task(s).`;
|
||||
}
|
||||
} catch {
|
||||
audioError = 'Cancel failed';
|
||||
}
|
||||
}
|
||||
|
||||
// ── "More like this" ─────────────────────────────────────────────────────
|
||||
interface SimilarBook { slug: string; title: string; cover: string | null; author: string | null }
|
||||
let similarBooks = $state<SimilarBook[]>([]);
|
||||
@@ -520,78 +815,336 @@
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
{#if adminOpen}
|
||||
<div class="px-4 py-3 border-t border-(--color-border) flex flex-col gap-4">
|
||||
<!-- Rescrape -->
|
||||
{#if adminOpen}
|
||||
<div class="px-4 py-3 border-t border-(--color-border) flex flex-col gap-5">
|
||||
<!-- Rescrape -->
|
||||
<div class="flex items-center gap-3 flex-wrap">
|
||||
<button
|
||||
onclick={rescrape}
|
||||
disabled={scraping}
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{scraping ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-(--color-surface-3) text-(--color-text) hover:bg-(--color-surface-3)'}"
|
||||
>
|
||||
{#if scraping}
|
||||
<svg class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
|
||||
</svg>
|
||||
{m.book_detail_rescraping()}
|
||||
{:else}
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
||||
</svg>
|
||||
{m.book_detail_rescrape_book()}
|
||||
{/if}
|
||||
</button>
|
||||
{#if scrapeResult}
|
||||
<span class="text-xs {scrapeResult === 'queued' ? 'text-green-400' : scrapeResult === 'busy' ? 'text-(--color-brand)' : 'text-(--color-danger)'}">
|
||||
{scrapeResult === 'queued' ? m.catalogue_scrape_queued_badge() + '.' : scrapeResult === 'busy' ? m.catalogue_scrape_busy_badge() + '.' : m.common_error() + '.'}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Range scrape -->
|
||||
<div class="flex flex-wrap items-end gap-3">
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="range-from" class="text-xs text-(--color-muted)">{m.book_detail_from_chapter()}</label>
|
||||
<input
|
||||
id="range-from"
|
||||
type="number"
|
||||
min="1"
|
||||
bind:value={rangeFrom}
|
||||
placeholder="1"
|
||||
class="w-24 px-2 py-1 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="range-to" class="text-xs text-(--color-muted)">{m.book_detail_to_chapter()}</label>
|
||||
<input
|
||||
id="range-to"
|
||||
type="number"
|
||||
min="1"
|
||||
bind:value={rangeTo}
|
||||
placeholder="end"
|
||||
class="w-24 px-2 py-1 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
onclick={scrapeRange}
|
||||
disabled={rangeScraping || !rangeFrom}
|
||||
class="px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{rangeScraping || !rangeFrom
|
||||
? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed'
|
||||
: 'bg-(--color-brand)/20 text-(--color-brand-dim) hover:bg-(--color-brand)/40 border border-(--color-brand)/30'}"
|
||||
>
|
||||
{rangeScraping ? m.book_detail_range_queuing() : m.book_detail_scrape_range()}
|
||||
</button>
|
||||
{#if rangeResult}
|
||||
<span class="text-xs {rangeResult === 'queued' ? 'text-green-400' : rangeResult === 'busy' ? 'text-(--color-brand)' : 'text-(--color-danger)'}">
|
||||
{rangeResult === 'queued' ? m.catalogue_scrape_queued_badge() + '.' : rangeResult === 'busy' ? m.catalogue_scrape_busy_badge() + '.' : m.common_error() + '.'}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<hr class="border-(--color-border)" />
|
||||
|
||||
<!-- Book cover generation -->
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-xs font-medium text-(--color-muted) uppercase tracking-wide">{m.book_detail_admin_book_cover()}</p>
|
||||
<div class="flex items-center gap-3 flex-wrap">
|
||||
<button
|
||||
onclick={rescrape}
|
||||
disabled={scraping}
|
||||
onclick={generateCover}
|
||||
disabled={coverGenerating}
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{scraping ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-(--color-surface-3) text-(--color-text) hover:bg-(--color-surface-3)'}"
|
||||
{coverGenerating ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-(--color-surface-3) text-(--color-text) hover:bg-(--color-surface-2)'}"
|
||||
>
|
||||
{#if scraping}
|
||||
<svg class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
|
||||
</svg>
|
||||
{m.book_detail_rescraping()}
|
||||
{#if coverGenerating}
|
||||
<svg class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"/></svg>
|
||||
{:else}
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
||||
</svg>
|
||||
{m.book_detail_rescrape_book()}
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
|
||||
{/if}
|
||||
{m.book_detail_admin_generate()}
|
||||
</button>
|
||||
{#if scrapeResult}
|
||||
<span class="text-xs {scrapeResult === 'queued' ? 'text-green-400' : scrapeResult === 'busy' ? 'text-(--color-brand)' : 'text-(--color-danger)'}">
|
||||
{scrapeResult === 'queued' ? m.catalogue_scrape_queued_badge() + '.' : scrapeResult === 'busy' ? m.catalogue_scrape_busy_badge() + '.' : m.common_error() + '.'}
|
||||
</span>
|
||||
{#if coverResult === 'error'}
|
||||
<span class="text-xs text-(--color-danger)">{m.common_error()}</span>
|
||||
{:else if coverResult === 'saved'}
|
||||
<span class="text-xs text-green-400">{m.book_detail_admin_saved()}</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Range scrape -->
|
||||
<div class="flex flex-wrap items-end gap-3">
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="range-from" class="text-xs text-(--color-muted)">{m.book_detail_from_chapter()}</label>
|
||||
<input
|
||||
id="range-from"
|
||||
type="number"
|
||||
min="1"
|
||||
bind:value={rangeFrom}
|
||||
placeholder="1"
|
||||
class="w-24 px-2 py-1 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
/>
|
||||
{#if coverPreview}
|
||||
<div class="flex items-start gap-3 mt-1">
|
||||
<img src={coverPreview} alt="Cover preview" class="w-24 rounded border border-(--color-border)" />
|
||||
<div class="flex flex-col gap-2 pt-1">
|
||||
<button
|
||||
onclick={saveCover}
|
||||
disabled={coverSaving}
|
||||
class="px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{coverSaving ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-green-600/20 text-green-400 hover:bg-green-600/30 border border-green-600/30'}"
|
||||
>
|
||||
{coverSaving ? m.book_detail_admin_saving() : m.book_detail_admin_save_cover()}
|
||||
</button>
|
||||
<button onclick={() => (coverPreview = null)} class="text-xs text-(--color-muted) hover:text-(--color-text) transition-colors">{m.book_detail_admin_discard()}</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Chapter cover generation -->
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-xs font-medium text-(--color-muted) uppercase tracking-wide">{m.book_detail_admin_chapter_cover()}</p>
|
||||
<div class="flex items-end gap-3 flex-wrap">
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="range-to" class="text-xs text-(--color-muted)">{m.book_detail_to_chapter()}</label>
|
||||
<label for="ch-cover-n" class="text-xs text-(--color-muted)">{m.book_detail_admin_chapter_n()}</label>
|
||||
<input
|
||||
id="range-to"
|
||||
id="ch-cover-n"
|
||||
type="number"
|
||||
min="1"
|
||||
bind:value={rangeTo}
|
||||
placeholder="end"
|
||||
class="w-24 px-2 py-1 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
bind:value={chapterCoverN}
|
||||
placeholder="1"
|
||||
class="w-20 px-2 py-1 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
onclick={scrapeRange}
|
||||
disabled={rangeScraping || !rangeFrom}
|
||||
class="px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{rangeScraping || !rangeFrom
|
||||
? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed'
|
||||
: 'bg-(--color-brand)/20 text-(--color-brand-dim) hover:bg-(--color-brand)/40 border border-(--color-brand)/30'}"
|
||||
onclick={generateChapterCover}
|
||||
disabled={chapterCoverGenerating || !chapterCoverN}
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{chapterCoverGenerating || !chapterCoverN ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-(--color-surface-3) text-(--color-text) hover:bg-(--color-surface-2)'}"
|
||||
>
|
||||
{rangeScraping ? m.book_detail_range_queuing() : m.book_detail_scrape_range()}
|
||||
{#if chapterCoverGenerating}
|
||||
<svg class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"/></svg>
|
||||
{:else}
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
|
||||
{/if}
|
||||
{m.book_detail_admin_generate()}
|
||||
</button>
|
||||
{#if rangeResult}
|
||||
<span class="text-xs {rangeResult === 'queued' ? 'text-green-400' : rangeResult === 'busy' ? 'text-(--color-brand)' : 'text-(--color-danger)'}">
|
||||
{rangeResult === 'queued' ? m.catalogue_scrape_queued_badge() + '.' : rangeResult === 'busy' ? m.catalogue_scrape_busy_badge() + '.' : m.common_error() + '.'}
|
||||
</span>
|
||||
{#if chapterCoverResult === 'error'}
|
||||
<span class="text-xs text-(--color-danger)">{m.common_error()}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if chapterCoverPreview}
|
||||
<div class="flex items-start gap-3 mt-1">
|
||||
<img src={chapterCoverPreview} alt="Chapter cover preview" class="w-24 rounded border border-(--color-border)" />
|
||||
<button onclick={() => (chapterCoverPreview = null)} class="text-xs text-(--color-muted) hover:text-(--color-text) transition-colors pt-1">{m.book_detail_admin_discard()}</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<hr class="border-(--color-border)" />
|
||||
|
||||
<!-- Description generation -->
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-xs font-medium text-(--color-muted) uppercase tracking-wide">{m.book_detail_admin_description()}</p>
|
||||
<div class="flex items-center gap-3 flex-wrap">
|
||||
<button
|
||||
onclick={generateDesc}
|
||||
disabled={descGenerating}
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{descGenerating ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-(--color-surface-3) text-(--color-text) hover:bg-(--color-surface-2)'}"
|
||||
>
|
||||
{#if descGenerating}
|
||||
<svg class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"/></svg>
|
||||
{:else}
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/></svg>
|
||||
{/if}
|
||||
{m.book_detail_admin_generate()}
|
||||
</button>
|
||||
{#if descResult === 'error'}
|
||||
<span class="text-xs text-(--color-danger)">{m.common_error()}</span>
|
||||
{:else if descResult === 'applied'}
|
||||
<span class="text-xs text-green-400">{m.book_detail_admin_applied()}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if descPreview}
|
||||
<div class="flex flex-col gap-2">
|
||||
<textarea
|
||||
bind:value={descPreview}
|
||||
rows="5"
|
||||
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) resize-y"
|
||||
></textarea>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
onclick={applyDesc}
|
||||
disabled={descApplying}
|
||||
class="px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{descApplying ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-green-600/20 text-green-400 hover:bg-green-600/30 border border-green-600/30'}"
|
||||
>
|
||||
{descApplying ? m.book_detail_admin_applying() : m.book_detail_admin_apply()}
|
||||
</button>
|
||||
<button onclick={() => (descPreview = '')} class="text-xs text-(--color-muted) hover:text-(--color-text) transition-colors">{m.book_detail_admin_discard()}</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Chapter names generation -->
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-xs font-medium text-(--color-muted) uppercase tracking-wide">{m.book_detail_admin_chapter_names()}</p>
|
||||
<div class="flex items-center gap-3 flex-wrap">
|
||||
<button
|
||||
onclick={generateChapNames}
|
||||
disabled={chapNamesGenerating}
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{chapNamesGenerating ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-(--color-surface-3) text-(--color-text) hover:bg-(--color-surface-2)'}"
|
||||
>
|
||||
{#if chapNamesGenerating}
|
||||
<svg class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"/></svg>
|
||||
{:else}
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h10"/></svg>
|
||||
{/if}
|
||||
{m.book_detail_admin_generate()}
|
||||
</button>
|
||||
{#if chapNamesResult === 'error'}
|
||||
<span class="text-xs text-(--color-danger)">{m.common_error()}</span>
|
||||
{:else if chapNamesResult === 'applied'}
|
||||
<span class="text-xs text-green-400">{m.book_detail_admin_applied()} ({chapNamesPreview.length > 0 ? chapNamesPreview.length : ''})</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if chapNamesPreview.length > 0}
|
||||
<div class="flex flex-col gap-1.5 max-h-48 overflow-y-auto rounded border border-(--color-border) p-2 bg-(--color-surface-3)">
|
||||
{#each chapNamesPreview as ch}
|
||||
<div class="flex gap-2 text-xs">
|
||||
<span class="text-(--color-muted) flex-shrink-0 w-6 text-right">{ch.number}.</span>
|
||||
<span class="text-(--color-text) truncate">{ch.new_title}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
onclick={applyChapNames}
|
||||
disabled={chapNamesApplying}
|
||||
class="px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{chapNamesApplying ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-green-600/20 text-green-400 hover:bg-green-600/30 border border-green-600/30'}"
|
||||
>
|
||||
{chapNamesApplying ? m.book_detail_admin_applying() : m.book_detail_admin_apply()} ({chapNamesPreview.length})
|
||||
</button>
|
||||
<button onclick={() => (chapNamesPreview = [])} class="text-xs text-(--color-muted) hover:text-(--color-text) transition-colors">{m.book_detail_admin_discard()}</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<hr class="border-(--color-border)" />
|
||||
|
||||
<!-- Audio TTS bulk enqueue -->
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-xs font-medium text-(--color-muted) uppercase tracking-wide">{m.book_detail_admin_audio_tts()}</p>
|
||||
<div class="flex flex-col gap-3">
|
||||
<!-- Voice selector -->
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="audio-voice" class="text-xs text-(--color-muted)">{m.book_detail_admin_voice()}</label>
|
||||
<select
|
||||
id="audio-voice"
|
||||
bind:value={audioVoice}
|
||||
class="px-2 py-1 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
>
|
||||
{#if !audioVoicesLoaded}
|
||||
<option value="af_bella">af_bella (loading…)</option>
|
||||
{:else}
|
||||
{#each audioVoices.filter(v => v.engine === 'kokoro') as v}
|
||||
<option value={v.id}>{voiceLabel(v)}</option>
|
||||
{/each}
|
||||
{#each audioVoices.filter(v => v.engine === 'pocket-tts') as v}
|
||||
<option value={v.id}>{voiceLabel(v)}</option>
|
||||
{/each}
|
||||
{#each audioVoices.filter(v => v.engine === 'cfai') as v}
|
||||
<option value={v.id}>{voiceLabel(v)}</option>
|
||||
{/each}
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
<!-- Chapter range -->
|
||||
<div class="flex items-end gap-3 flex-wrap">
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="audio-from" class="text-xs text-(--color-muted)">{m.book_detail_from_chapter()}</label>
|
||||
<input
|
||||
id="audio-from"
|
||||
type="number"
|
||||
min="1"
|
||||
bind:value={audioFrom}
|
||||
placeholder="1"
|
||||
class="w-20 px-2 py-1 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="audio-to" class="text-xs text-(--color-muted)">{m.book_detail_to_chapter()}</label>
|
||||
<input
|
||||
id="audio-to"
|
||||
type="number"
|
||||
min="1"
|
||||
bind:value={audioTo}
|
||||
placeholder="end"
|
||||
class="w-20 px-2 py-1 rounded bg-(--color-surface-3) border border-(--color-border) text-(--color-text) text-xs focus:outline-none focus:border-(--color-brand)"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
onclick={enqueueAudio}
|
||||
disabled={audioEnqueuing || !audioFrom}
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors
|
||||
{audioEnqueuing || !audioFrom ? 'bg-(--color-surface-3) text-(--color-muted) cursor-not-allowed' : 'bg-(--color-brand)/20 text-(--color-brand-dim) hover:bg-(--color-brand)/40 border border-(--color-brand)/30'}"
|
||||
>
|
||||
{#if audioEnqueuing}
|
||||
<svg class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"/></svg>
|
||||
{:else}
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072M12 6v6m0 0l-2-2m2 2l2-2M6.343 17.657a8 8 0 010-11.314"/></svg>
|
||||
{/if}
|
||||
{m.book_detail_admin_enqueue_audio()}
|
||||
</button>
|
||||
<button
|
||||
onclick={cancelAudio}
|
||||
class="px-3 py-1.5 rounded text-xs font-medium text-(--color-muted) hover:text-(--color-danger) transition-colors border border-(--color-border)"
|
||||
>
|
||||
{m.book_detail_admin_cancel_audio()}
|
||||
</button>
|
||||
</div>
|
||||
{#if audioResult}
|
||||
<span class="text-xs text-green-400">{m.book_detail_admin_enqueued({ enqueued: audioResult.enqueued, skipped: audioResult.skipped })}</span>
|
||||
{/if}
|
||||
{#if audioError}
|
||||
<span class="text-xs text-(--color-muted)">{audioError}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import CommentsSection from '$lib/components/CommentsSection.svelte';
|
||||
import type { PageData } from './$types';
|
||||
import * as m from '$lib/paraglide/messages.js';
|
||||
import { audioStore } from '$lib/audio.svelte';
|
||||
|
||||
let { data }: { data: PageData } = $props();
|
||||
|
||||
@@ -62,6 +63,7 @@
|
||||
type LineSpacing = 'compact' | 'normal' | 'relaxed';
|
||||
type ReadWidth = 'narrow' | 'normal' | 'wide';
|
||||
type ParaStyle = 'spaced' | 'indented';
|
||||
type PlayerStyle = 'standard' | 'compact';
|
||||
|
||||
interface LayoutPrefs {
|
||||
readMode: ReadMode;
|
||||
@@ -69,12 +71,13 @@
|
||||
readWidth: ReadWidth;
|
||||
paraStyle: ParaStyle;
|
||||
focusMode: boolean;
|
||||
playerStyle: PlayerStyle;
|
||||
}
|
||||
|
||||
const LAYOUT_KEY = 'reader_layout_v1';
|
||||
const LINE_HEIGHTS: Record<LineSpacing, number> = { compact: 1.55, normal: 1.85, relaxed: 2.2 };
|
||||
const READ_WIDTHS: Record<ReadWidth, string> = { narrow: '58ch', normal: '72ch', wide: 'min(90ch, 100%)' };
|
||||
const DEFAULT_LAYOUT: LayoutPrefs = { readMode: 'scroll', lineSpacing: 'normal', readWidth: 'normal', paraStyle: 'spaced', focusMode: false };
|
||||
const DEFAULT_LAYOUT: LayoutPrefs = { readMode: 'scroll', lineSpacing: 'normal', readWidth: 'normal', paraStyle: 'spaced', focusMode: false, playerStyle: 'standard' };
|
||||
|
||||
function loadLayout(): LayoutPrefs {
|
||||
if (!browser) return DEFAULT_LAYOUT;
|
||||
@@ -92,6 +95,34 @@
|
||||
if (browser) localStorage.setItem(LAYOUT_KEY, JSON.stringify(layout));
|
||||
}
|
||||
|
||||
// ── Listening settings helpers ───────────────────────────────────────────────
|
||||
const SETTINGS_SLEEP_OPTIONS = [15, 30, 45, 60];
|
||||
const sleepSettingsLabel = $derived(
|
||||
audioStore.sleepAfterChapter
|
||||
? 'End Ch.'
|
||||
: audioStore.sleepUntil > Date.now()
|
||||
? `${Math.ceil((audioStore.sleepUntil - Date.now()) / 60000)}m`
|
||||
: 'Off'
|
||||
);
|
||||
|
||||
function toggleSleepFromSettings() {
|
||||
if (!audioStore.sleepUntil && !audioStore.sleepAfterChapter) {
|
||||
audioStore.sleepAfterChapter = true;
|
||||
} else if (audioStore.sleepAfterChapter) {
|
||||
audioStore.sleepAfterChapter = false;
|
||||
audioStore.sleepUntil = Date.now() + SETTINGS_SLEEP_OPTIONS[0] * 60 * 1000;
|
||||
} else {
|
||||
const remaining = audioStore.sleepUntil - Date.now();
|
||||
const currentMin = Math.round(remaining / 60000);
|
||||
const idx = SETTINGS_SLEEP_OPTIONS.findIndex((m) => m >= currentMin);
|
||||
if (idx === -1 || idx === SETTINGS_SLEEP_OPTIONS.length - 1) {
|
||||
audioStore.sleepUntil = 0;
|
||||
} else {
|
||||
audioStore.sleepUntil = Date.now() + SETTINGS_SLEEP_OPTIONS[idx + 1] * 60 * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply reading CSS vars whenever layout changes
|
||||
$effect(() => {
|
||||
if (!browser) return;
|
||||
@@ -444,6 +475,7 @@
|
||||
nextChapter={data.next}
|
||||
chapters={data.chapters}
|
||||
voices={data.voices}
|
||||
playerStyle={layout.playerStyle}
|
||||
onProRequired={() => { audioProRequired = true; }}
|
||||
/>
|
||||
{/if}
|
||||
@@ -735,6 +767,75 @@
|
||||
<span class="opacity-60 text-xs">{layout.focusMode ? 'On — audio & nav hidden' : 'Off'}</span>
|
||||
</button>
|
||||
|
||||
<!-- ── Listening section ─────────────────────────────────────────── -->
|
||||
<div class="border-t border-(--color-border)"></div>
|
||||
<p class="text-xs font-semibold text-(--color-muted) uppercase tracking-wider">Listening</p>
|
||||
|
||||
<!-- Player style -->
|
||||
<div class="space-y-2">
|
||||
<p class="text-xs text-(--color-muted)">Player style</p>
|
||||
<div class="flex gap-1.5">
|
||||
{#each ([['standard', 'Standard'], ['compact', 'Compact']] as const) as [s, label]}
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => setLayout('playerStyle', s)}
|
||||
class="flex-1 py-1.5 rounded-lg border text-xs font-medium transition-colors
|
||||
{layout.playerStyle === s
|
||||
? 'border-(--color-brand) bg-(--color-brand)/10 text-(--color-brand)'
|
||||
: 'border-(--color-border) bg-(--color-surface-3) text-(--color-muted) hover:border-(--color-brand)/50 hover:text-(--color-text)'}"
|
||||
aria-pressed={layout.playerStyle === s}
|
||||
>{label}</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if page.data.user}
|
||||
<!-- Playback speed -->
|
||||
<div class="space-y-2">
|
||||
<p class="text-xs text-(--color-muted)">Speed</p>
|
||||
<div class="flex gap-1">
|
||||
{#each [0.75, 1, 1.25, 1.5, 2] as s}
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => { audioStore.speed = s; }}
|
||||
class="flex-1 py-1.5 rounded-lg border text-xs font-medium transition-colors
|
||||
{audioStore.speed === s
|
||||
? 'border-(--color-brand) bg-(--color-brand)/10 text-(--color-brand)'
|
||||
: 'border-(--color-border) bg-(--color-surface-3) text-(--color-muted) hover:border-(--color-brand)/50 hover:text-(--color-text)'}"
|
||||
aria-pressed={audioStore.speed === s}
|
||||
>{s}×</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Auto-next -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => { audioStore.autoNext = !audioStore.autoNext; }}
|
||||
class="w-full flex items-center justify-between py-2 px-3 rounded-lg border text-xs font-medium transition-colors
|
||||
{audioStore.autoNext
|
||||
? 'border-(--color-brand) bg-(--color-brand)/10 text-(--color-brand)'
|
||||
: 'border-(--color-border) bg-(--color-surface-3) text-(--color-muted) hover:border-(--color-brand)/50 hover:text-(--color-text)'}"
|
||||
aria-pressed={audioStore.autoNext}
|
||||
>
|
||||
<span>Auto-next chapter</span>
|
||||
<span class="opacity-60">{audioStore.autoNext ? 'On' : 'Off'}</span>
|
||||
</button>
|
||||
|
||||
<!-- Sleep timer -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={toggleSleepFromSettings}
|
||||
class="w-full flex items-center justify-between py-2 px-3 rounded-lg border text-xs font-medium transition-colors
|
||||
{audioStore.sleepUntil || audioStore.sleepAfterChapter
|
||||
? 'border-(--color-brand) bg-(--color-brand)/10 text-(--color-brand)'
|
||||
: 'border-(--color-border) bg-(--color-surface-3) text-(--color-muted) hover:border-(--color-brand)/50 hover:text-(--color-text)'}"
|
||||
>
|
||||
<span>Sleep timer</span>
|
||||
<span class="opacity-60">{sleepSettingsLabel}</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<p class="text-xs text-(--color-muted)/60 text-center">Changes save automatically</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -375,7 +375,7 @@
|
||||
</div>
|
||||
<div class="mt-5 pt-5 border-t border-(--color-border)">
|
||||
<p class="text-sm font-medium text-(--color-text) mb-1">{m.profile_upgrade_heading()}</p>
|
||||
<p class="text-sm text-(--color-muted) mb-4">{m.profile_upgrade_desc()}</p>
|
||||
<p class="text-sm text-(--color-muted) mb-4">{m.profile_upgrade_desc()} <a href="/subscribe" class="text-(--color-brand) hover:underline">See plans →</a></p>
|
||||
{#if checkoutError}
|
||||
<p class="text-sm text-(--color-danger) mb-3">{checkoutError}</p>
|
||||
{/if}
|
||||
|
||||
5
ui/src/routes/subscribe/+page.server.ts
Normal file
5
ui/src/routes/subscribe/+page.server.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// Data is inherited from the root layout (user, isPro).
|
||||
// This file exists only to ensure the route is treated as a page by SvelteKit.
|
||||
export const load = async () => {
|
||||
return {};
|
||||
};
|
||||
162
ui/src/routes/subscribe/+page.svelte
Normal file
162
ui/src/routes/subscribe/+page.svelte
Normal file
@@ -0,0 +1,162 @@
|
||||
<script lang="ts">
|
||||
import type { LayoutData } from '../$types';
|
||||
import * as m from '$lib/paraglide/messages.js';
|
||||
|
||||
// Data flows from root layout (user, isPro)
|
||||
let { data }: { data: LayoutData } = $props();
|
||||
|
||||
let checkoutLoading = $state<'monthly' | 'annual' | null>(null);
|
||||
let checkoutError = $state('');
|
||||
|
||||
async function startCheckout(product: 'monthly' | 'annual') {
|
||||
checkoutLoading = product;
|
||||
checkoutError = '';
|
||||
try {
|
||||
const res = await fetch('/api/checkout', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ product })
|
||||
});
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => ({})) as { message?: string };
|
||||
checkoutError = body.message ?? `Checkout failed (${res.status}). Please try again.`;
|
||||
return;
|
||||
}
|
||||
const { url } = await res.json() as { url: string };
|
||||
window.location.href = url;
|
||||
} catch {
|
||||
checkoutError = 'Network error. Please try again.';
|
||||
} finally {
|
||||
checkoutLoading = null;
|
||||
}
|
||||
}
|
||||
|
||||
const benefits = [
|
||||
{ icon: 'M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3', label: () => m.subscribe_benefit_audio() },
|
||||
{ icon: 'M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z', label: () => m.subscribe_benefit_voices() },
|
||||
{ icon: 'M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129', label: () => m.subscribe_benefit_translation() },
|
||||
{ icon: 'M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4', label: () => m.subscribe_benefit_downloads() },
|
||||
];
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{m.subscribe_page_title()}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="min-h-[calc(100vh-3.5rem)] flex flex-col items-center justify-center px-4 py-16">
|
||||
<!-- Hero -->
|
||||
<div class="text-center mb-12 max-w-xl">
|
||||
<div class="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-(--color-brand)/15 border border-(--color-brand)/30 text-(--color-brand) text-xs font-semibold uppercase tracking-wider mb-5">
|
||||
<svg class="w-3.5 h-3.5 shrink-0" fill="currentColor" viewBox="0 0 24 24"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23L16.23 18z"/></svg>
|
||||
Pro
|
||||
</div>
|
||||
<h1 class="text-4xl sm:text-5xl font-bold text-(--color-text) tracking-tight mb-4">
|
||||
{m.subscribe_heading()}
|
||||
</h1>
|
||||
<p class="text-lg text-(--color-muted)">
|
||||
{m.subscribe_subheading()}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Benefits list -->
|
||||
<ul class="mb-12 space-y-3 w-full max-w-sm">
|
||||
{#each benefits as b}
|
||||
<li class="flex items-center gap-3 text-sm text-(--color-text)">
|
||||
<span class="shrink-0 w-8 h-8 rounded-full bg-(--color-brand)/15 text-(--color-brand) flex items-center justify-center">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d={b.icon}/>
|
||||
</svg>
|
||||
</span>
|
||||
{b.label()}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
{#if data.isPro}
|
||||
<!-- Already Pro -->
|
||||
<div class="w-full max-w-sm bg-(--color-surface-2) border border-(--color-brand)/40 rounded-xl p-6 text-center">
|
||||
<p class="text-base font-semibold text-(--color-text) mb-1">{m.subscribe_already_pro()}</p>
|
||||
<a
|
||||
href="https://polar.sh/libnovel/portal"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="inline-flex items-center gap-1.5 mt-3 text-sm font-medium text-(--color-brand) hover:underline"
|
||||
>
|
||||
{m.subscribe_manage()}
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"/></svg>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{:else if !data.user}
|
||||
<!-- Not logged in -->
|
||||
<div class="w-full max-w-sm bg-(--color-surface-2) border border-(--color-border) rounded-xl p-6 text-center">
|
||||
<p class="text-sm text-(--color-muted) mb-4">{m.subscribe_login_prompt()}</p>
|
||||
<a
|
||||
href="/login?next=/subscribe"
|
||||
class="inline-flex items-center gap-2 px-5 py-2.5 rounded-lg bg-(--color-brand) text-(--color-surface) font-semibold text-sm hover:bg-(--color-brand-dim) transition-colors"
|
||||
>
|
||||
{m.subscribe_login_cta()}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<!-- Pricing cards -->
|
||||
{#if checkoutError}
|
||||
<p class="text-sm text-(--color-danger) mb-4 text-center">{checkoutError}</p>
|
||||
{/if}
|
||||
<div class="w-full max-w-sm grid gap-4">
|
||||
|
||||
<!-- Annual card (featured) -->
|
||||
<div class="relative bg-(--color-surface-2) border-2 border-(--color-brand) rounded-xl p-6">
|
||||
<div class="absolute -top-3 left-1/2 -translate-x-1/2 px-3 py-0.5 bg-(--color-brand) text-(--color-surface) text-xs font-bold rounded-full tracking-wide uppercase">
|
||||
{m.subscribe_annual_save()}
|
||||
</div>
|
||||
<div class="flex items-baseline justify-between mb-5">
|
||||
<span class="text-base font-semibold text-(--color-text)">{m.subscribe_annual_label()}</span>
|
||||
<div class="text-right">
|
||||
<span class="text-3xl font-bold text-(--color-text)">{m.subscribe_annual_price()}</span>
|
||||
<span class="text-sm text-(--color-muted) ml-1">{m.subscribe_annual_period()}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => startCheckout('annual')}
|
||||
disabled={checkoutLoading !== null}
|
||||
class="w-full flex items-center justify-center gap-2 py-2.5 rounded-lg bg-(--color-brand) text-(--color-surface) font-semibold text-sm hover:bg-(--color-brand-dim) transition-colors disabled:opacity-60 disabled:cursor-wait"
|
||||
>
|
||||
{#if checkoutLoading === 'annual'}
|
||||
<svg class="w-4 h-4 shrink-0 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z"/></svg>
|
||||
{/if}
|
||||
{m.subscribe_cta_annual()}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Monthly card -->
|
||||
<div class="bg-(--color-surface-2) border border-(--color-border) rounded-xl p-6">
|
||||
<div class="flex items-baseline justify-between mb-5">
|
||||
<span class="text-base font-semibold text-(--color-text)">{m.subscribe_monthly_label()}</span>
|
||||
<div class="text-right">
|
||||
<span class="text-3xl font-bold text-(--color-text)">{m.subscribe_monthly_price()}</span>
|
||||
<span class="text-sm text-(--color-muted) ml-1">{m.subscribe_monthly_period()}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => startCheckout('monthly')}
|
||||
disabled={checkoutLoading !== null}
|
||||
class="w-full flex items-center justify-center gap-2 py-2.5 rounded-lg border border-(--color-brand) text-(--color-brand) font-semibold text-sm hover:bg-(--color-brand)/10 transition-colors disabled:opacity-60 disabled:cursor-wait"
|
||||
>
|
||||
{#if checkoutLoading === 'monthly'}
|
||||
<svg class="w-4 h-4 shrink-0 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z"/></svg>
|
||||
{/if}
|
||||
{m.subscribe_cta_monthly()}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<p class="mt-8 text-xs text-(--color-muted) text-center max-w-xs">
|
||||
Payments processed securely by <a href="https://polar.sh" target="_blank" rel="noopener noreferrer" class="underline hover:text-(--color-text)">Polar</a>. Cancel anytime.
|
||||
</p>
|
||||
</div>
|
||||
Reference in New Issue
Block a user