feat(web): sync translated manga galleries, clean titles, synopsis integration, original source links, anthology badges, and mobile-first reader UI
This commit is contained in:
+11
-3
@@ -30,6 +30,7 @@ function migrate(db: Database.Database) {
|
||||
num_pages INTEGER DEFAULT 0,
|
||||
source TEXT,
|
||||
cover_url TEXT,
|
||||
url TEXT,
|
||||
summary TEXT,
|
||||
slug TEXT UNIQUE NOT NULL,
|
||||
published INTEGER DEFAULT 0,
|
||||
@@ -43,6 +44,10 @@ function migrate(db: Database.Database) {
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_published ON posts(published);
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_created ON posts(created_at DESC);
|
||||
`)
|
||||
|
||||
try {
|
||||
db.exec("ALTER TABLE posts ADD COLUMN url TEXT")
|
||||
} catch {}
|
||||
}
|
||||
|
||||
export interface Post {
|
||||
@@ -56,6 +61,7 @@ export interface Post {
|
||||
num_pages: number
|
||||
source: string | null
|
||||
cover_url: string | null
|
||||
url: string | null
|
||||
summary: string | null
|
||||
slug: string
|
||||
published: number
|
||||
@@ -74,6 +80,7 @@ export interface PostInput {
|
||||
num_pages?: number
|
||||
source?: string
|
||||
cover_url?: string
|
||||
url?: string
|
||||
summary?: string
|
||||
slug: string
|
||||
published?: number
|
||||
@@ -117,8 +124,8 @@ export function createPost(input: PostInput): Post {
|
||||
const published = input.published ?? 1
|
||||
const publishedAt = published ? "datetime('now')" : null
|
||||
const stmt = d.prepare(`
|
||||
INSERT INTO posts (gid, title, title_jpn, artist, parody, tags, num_pages, source, cover_url, summary, slug, published, published_at)
|
||||
VALUES (@gid, @title, @title_jpn, @artist, @parody, @tags, @num_pages, @source, @cover_url, @summary, @slug, @published, ${publishedAt})
|
||||
INSERT INTO posts (gid, title, title_jpn, artist, parody, tags, num_pages, source, cover_url, url, summary, slug, published, published_at)
|
||||
VALUES (@gid, @title, @title_jpn, @artist, @parody, @tags, @num_pages, @source, @cover_url, @url, @summary, @slug, @published, ${publishedAt})
|
||||
`)
|
||||
const result = stmt.run({
|
||||
gid: input.gid,
|
||||
@@ -130,6 +137,7 @@ export function createPost(input: PostInput): Post {
|
||||
num_pages: input.num_pages || 0,
|
||||
source: input.source || null,
|
||||
cover_url: input.cover_url || null,
|
||||
url: input.url || null,
|
||||
summary: input.summary || null,
|
||||
slug: input.slug,
|
||||
published,
|
||||
@@ -157,7 +165,7 @@ export function updatePost(id: number, updates: Partial<PostInput & { published:
|
||||
if (fields.length === 0) return getPostById(id)
|
||||
|
||||
fields.push("updated_at = datetime('now')")
|
||||
d.prepare(`UPDATE posts SET ${fields.join(", ")} WHERE id = ?`).run(id)
|
||||
d.prepare(`UPDATE posts SET ${fields.join(", ")} WHERE id = @id`).run(values)
|
||||
return getPostById(id)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user