mirror of
https://github.com/lifegpc/bookdownload.git
synced 2026-07-08 01:31:31 +08:00
fix bug
This commit is contained in:
@@ -6,7 +6,7 @@ export default function Notification(message: string, type: 'success' | 'error'
|
|||||||
const colors = {
|
const colors = {
|
||||||
success: { bg: '#4caf50', icon: '✓' },
|
success: { bg: '#4caf50', icon: '✓' },
|
||||||
error: { bg: '#f44336', icon: '✕' },
|
error: { bg: '#f44336', icon: '✕' },
|
||||||
info: { bg: '#2196f3', icon: 'ℹ' }
|
info: { bg: '#2196f3', icon: 'i' }
|
||||||
};
|
};
|
||||||
|
|
||||||
const color = colors[type];
|
const color = colors[type];
|
||||||
|
|||||||
@@ -91,15 +91,16 @@ export class PocketBaseDb implements Db {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async createCollection(name: string, fields: Record<string, unknown>[], indexes: string[]) {
|
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({
|
await this.client.collections.create({
|
||||||
name: `${this.cfg.prefix}${name}`,
|
name: `${this.cfg.prefix}${name}`,
|
||||||
type: 'base',
|
type: 'base',
|
||||||
fields: fields,
|
fields: fields,
|
||||||
indexes: indexes,
|
indexes: nindexes,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async updateCollection(name: string, fields: Record<string, unknown>[], indexes: string[]) {
|
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}`, {
|
await this.client.collections.update(`${this.cfg.prefix}${name}`, {
|
||||||
fields: fields,
|
fields: fields,
|
||||||
indexes: nidexes,
|
indexes: nidexes,
|
||||||
@@ -119,7 +120,7 @@ export class PocketBaseDb implements Db {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const index of indexes) {
|
for (const index of indexes) {
|
||||||
const tindex = index.replace('{name}', col.name);
|
const tindex = index.replaceAll('{name}', col.name);
|
||||||
if (!col.indexes.includes(tindex)) {
|
if (!col.indexes.includes(tindex)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,14 @@ async function load() {
|
|||||||
const bookInfo = pageData.pageContext.pageProps.pageData.bookInfo;
|
const bookInfo = pageData.pageContext.pageProps.pageData.bookInfo;
|
||||||
let contents: string[] | undefined = undefined;
|
let contents: string[] | undefined = undefined;
|
||||||
if (chapterInfo.vipStatus !== 0) {
|
if (chapterInfo.vipStatus !== 0) {
|
||||||
if (!chapterInfo.isBuy) return;
|
if (!chapterInfo.isBuy) {
|
||||||
if (chapterInfo.cES !== 0) return;
|
Notification(`章节《${chapterInfo.chapterName}》未购买,跳过保存`, 'info');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (chapterInfo.cES !== 0) {
|
||||||
|
Notification(`章节《${chapterInfo.chapterName}》有特殊加密,无法保存`, 'info');
|
||||||
|
return;
|
||||||
|
}
|
||||||
contents = getContents();
|
contents = getContents();
|
||||||
} else {
|
} else {
|
||||||
contents = get_chapter_content(chapterInfo.content);
|
contents = get_chapter_content(chapterInfo.content);
|
||||||
|
|||||||
Reference in New Issue
Block a user