Skip to content

Commit

Permalink
feat: img limit
Browse files Browse the repository at this point in the history
  • Loading branch information
LetTTGACO committed Jun 15, 2024
1 parent 856f13c commit c6a025e
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/elog/src/utils/context/ImageContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ export class ElogImageContext extends ElogBaseContext {
* 替换图片
* @param docDetailList
* @param uploader
* @param limit
*/
async replaceImages(docDetailList: DocDetail[], uploader: ImageUploader) {
async replaceImages(docDetailList: DocDetail[], uploader: ImageUploader, limit?: number) {
if (this.imageBaseConfig.disable) {
this.ctx.info('图片替换已禁用');
return docDetailList;
}
return replaceImagesFunc(docDetailList, uploader, this.imageBaseConfig.limit || 10);
return replaceImagesFunc(docDetailList, uploader, limit || this.imageBaseConfig.limit || 10);
}
}
2 changes: 1 addition & 1 deletion playground/plugin-from-feishu-space/src/FeiShuClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class FeiShuClient extends ElogFromContext {
this.ctx.info(`下载文档 ${doc._index}/${needUpdateDocList.length} `, doc.title);
return this.api.getDocDetail(doc);
};
const docDetailList = await this.asyncPool(this.config.limit || 3, needUpdateDocList, promise);
const docDetailList = await this.asyncPool(this.config.limit || 10, needUpdateDocList, promise);
this.ctx.info('已下载数', String(needUpdateDocList.length));
return {
docDetailList,
Expand Down
2 changes: 1 addition & 1 deletion playground/plugin-from-feishu-wiki/src/FeiShuClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class FeiShuClient extends ElogFromContext {
this.ctx.info(`下载文档 ${doc._index}/${needUpdateDocList.length} `, doc.title);
return this.api.getDocDetail(doc);
};
const docDetailList = await this.asyncPool(this.config.limit || 3, needUpdateDocList, promise);
const docDetailList = await this.asyncPool(this.config.limit || 10, needUpdateDocList, promise);
this.ctx.info('已下载数', String(needUpdateDocList.length));
return {
docDetailList,
Expand Down
2 changes: 1 addition & 1 deletion playground/plugin-from-flowus/src/FlowUsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class FlowUsClient extends ElogFromContext {
this.ctx.info(`下载文档 ${doc._index}/${needUpdateDocList.length} `, doc.title);
return this.api.getDocDetail(doc);
};
const docDetailList = await this.asyncPool(this.config.limit || 3, needUpdateDocList, promise);
const docDetailList = await this.asyncPool(this.config.limit || 10, needUpdateDocList, promise);
this.ctx.info('已下载数', String(needUpdateDocList.length));
return {
docDetailList,
Expand Down
2 changes: 1 addition & 1 deletion playground/plugin-from-notion/src/NotionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class NotionClient extends ElogFromContext {
this.ctx.info(`下载文档 ${doc._index}/${needUpdateDocList.length} `, doc.properties.title);
return this.api.getDocDetail(doc);
};
const docDetailList = await this.asyncPool(this.config.limit || 3, needUpdateDocList, promise);
const docDetailList = await this.asyncPool(this.config.limit || 10, needUpdateDocList, promise);
this.ctx.info('已下载数', String(needUpdateDocList.length));
return {
docDetailList,
Expand Down
2 changes: 1 addition & 1 deletion playground/plugin-from-wolai/src/WolaiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class WolaiClient extends ElogFromContext {
this.ctx.info(`下载文档 ${doc._index}/${needUpdateDocList.length} `, doc.properties.title);
return this.api.getDocDetail(doc);
};
const docDetailList = await this.asyncPool(this.config.limit || 3, needUpdateDocList, promise);
const docDetailList = await this.asyncPool(this.config.limit || 10, needUpdateDocList, promise);
this.ctx.info('已下载数', String(needUpdateDocList.length));
return {
docDetailList,
Expand Down
2 changes: 1 addition & 1 deletion playground/plugin-from-yuque-pwd/src/YuqueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default class YuqueClient extends ElogFromContext {
};
return docDetail;
};
const docDetailList = await this.asyncPool(this.config.limit || 3, needUpdateDocList, promise);
const docDetailList = await this.asyncPool(this.config.limit || 10, needUpdateDocList, promise);
this.ctx.info('已下载数', String(needUpdateDocList.length));
return {
docDetailList,
Expand Down
2 changes: 1 addition & 1 deletion playground/plugin-from-yuque-token/src/YuqueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class YuqueClient extends ElogFromContext {
};
return docDetail;
};
const docDetailList = await this.asyncPool(this.config.limit || 3, needUpdateDocList, promise);
const docDetailList = await this.asyncPool(this.config.limit || 10, needUpdateDocList, promise);
this.ctx.info('已下载数', String(needUpdateDocList.length));
return {
docDetailList,
Expand Down
2 changes: 1 addition & 1 deletion playground/plugin-image-github/src/ImageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export default class ImageClient extends ElogImageContext {
* @param docDetailList
*/
async processImages(docDetailList: DocDetail[]) {
return this.replaceImages(docDetailList, this.api);
return this.replaceImages(docDetailList, this.api, 3);
}
}

0 comments on commit c6a025e

Please sign in to comment.