Correct async calls to init scrapers

This commit is contained in:
Wolfsblvt 2024-09-29 11:27:07 +02:00
parent ab83138b1e
commit cc527a3a33
2 changed files with 10 additions and 10 deletions

View File

@ -959,7 +959,7 @@ async function firstLoadInit() {
initCfg(); initCfg();
initLogprobs(); initLogprobs();
initInputMarkdown(); initInputMarkdown();
initScrapers(); await initScrapers();
doDailyExtensionUpdatesCheck(); doDailyExtensionUpdatesCheck();
await hideLoader(); await hideLoader();
await fixViewport(); await fixViewport();

View File

@ -37,14 +37,14 @@ export class ScraperManager {
* Register a scraper to be used by the Data Bank. * Register a scraper to be used by the Data Bank.
* @param {Scraper} scraper Instance of a scraper to register * @param {Scraper} scraper Instance of a scraper to register
*/ */
static registerDataBankScraper(scraper) { static async registerDataBankScraper(scraper) {
if (ScraperManager.#scrapers.some(s => s.id === scraper.id)) { if (ScraperManager.#scrapers.some(s => s.id === scraper.id)) {
console.warn(`Scraper with ID ${scraper.id} already registered`); console.warn(`Scraper with ID ${scraper.id} already registered`);
return; return;
} }
if (scraper.init) { if (scraper.init) {
scraper.init(); await scraper.init();
} }
ScraperManager.#scrapers.push(scraper); ScraperManager.#scrapers.push(scraper);
@ -571,11 +571,11 @@ class YouTubeScraper {
} }
} }
export function initScrapers() { export async function initScrapers() {
ScraperManager.registerDataBankScraper(new FileScraper()); await ScraperManager.registerDataBankScraper(new FileScraper());
ScraperManager.registerDataBankScraper(new Notepad()); await ScraperManager.registerDataBankScraper(new Notepad());
ScraperManager.registerDataBankScraper(new WebScraper()); await ScraperManager.registerDataBankScraper(new WebScraper());
ScraperManager.registerDataBankScraper(new MediaWikiScraper()); await ScraperManager.registerDataBankScraper(new MediaWikiScraper());
ScraperManager.registerDataBankScraper(new FandomScraper()); await ScraperManager.registerDataBankScraper(new FandomScraper());
ScraperManager.registerDataBankScraper(new YouTubeScraper()); await ScraperManager.registerDataBankScraper(new YouTubeScraper());
} }