mirror of
https://github.com/lifegpc/bookdownload.git
synced 2026-06-16 18:34:17 +08:00
fix bug
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -91,15 +91,16 @@ export class PocketBaseDb implements Db {
|
||||
}
|
||||
}
|
||||
async createCollection(name: string, fields: Record<string, unknown>[], 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<string, unknown>[], 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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user