From e24c839c050b7216c531b7fed7e55c0f45d2da45 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Mon, 16 Feb 2026 16:16:42 +0800 Subject: [PATCH] fix bug --- src/components/Notifiction.ts | 2 +- src/db/pocketBase.ts | 7 ++++--- src/qdchapter.ts | 10 ++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/Notifiction.ts b/src/components/Notifiction.ts index 62b938a..3444af7 100644 --- a/src/components/Notifiction.ts +++ b/src/components/Notifiction.ts @@ -6,7 +6,7 @@ export default function Notification(message: string, type: 'success' | 'error' const colors = { success: { bg: '#4caf50', icon: '✓' }, error: { bg: '#f44336', icon: '✕' }, - info: { bg: '#2196f3', icon: 'ℹ' } + info: { bg: '#2196f3', icon: 'i' } }; const color = colors[type]; diff --git a/src/db/pocketBase.ts b/src/db/pocketBase.ts index ee35761..cf39f27 100644 --- a/src/db/pocketBase.ts +++ b/src/db/pocketBase.ts @@ -91,15 +91,16 @@ export class PocketBaseDb implements Db { } } async createCollection(name: string, fields: Record[], indexes: string[]) { + const nindexes = indexes.map(i => i.replaceAll('{name}', `${this.cfg.prefix}${name}`)); await this.client.collections.create({ name: `${this.cfg.prefix}${name}`, type: 'base', fields: fields, - indexes: indexes, + indexes: nindexes, }); } async updateCollection(name: string, fields: Record[], indexes: string[]) { - const nidexes = indexes.map(i => i.replace('{name}', `${this.cfg.prefix}${name}`)); + const nidexes = indexes.map(i => i.replaceAll('{name}', `${this.cfg.prefix}${name}`)); await this.client.collections.update(`${this.cfg.prefix}${name}`, { fields: fields, indexes: nidexes, @@ -119,7 +120,7 @@ export class PocketBaseDb implements Db { } } for (const index of indexes) { - const tindex = index.replace('{name}', col.name); + const tindex = index.replaceAll('{name}', col.name); if (!col.indexes.includes(tindex)) { return false; } diff --git a/src/qdchapter.ts b/src/qdchapter.ts index 3cc791a..09bb60f 100644 --- a/src/qdchapter.ts +++ b/src/qdchapter.ts @@ -29,8 +29,14 @@ async function load() { const bookInfo = pageData.pageContext.pageProps.pageData.bookInfo; let contents: string[] | undefined = undefined; if (chapterInfo.vipStatus !== 0) { - if (!chapterInfo.isBuy) return; - if (chapterInfo.cES !== 0) return; + if (!chapterInfo.isBuy) { + Notification(`章节《${chapterInfo.chapterName}》未购买,跳过保存`, 'info'); + return; + } + if (chapterInfo.cES !== 0) { + Notification(`章节《${chapterInfo.chapterName}》有特殊加密,无法保存`, 'info'); + return; + } contents = getContents(); } else { contents = get_chapter_content(chapterInfo.content);