mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 16:57:34 +00:00
fix: update new additions with web panel and sleep operations (#606)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import {config, defaultStoreData} from '../../config';
|
||||
import {Adorama} from './adorama';
|
||||
import {Alternate} from './alternate';
|
||||
import {AlternateNL} from './alternate-nl';
|
||||
@@ -44,6 +45,7 @@ import {Saturn} from './saturn';
|
||||
import {Scan} from './scan';
|
||||
import {Very} from './very';
|
||||
import {Zotac} from './zotac';
|
||||
import {logger} from '../../logger';
|
||||
|
||||
export const storeList = new Map([
|
||||
[Adorama.name, Adorama],
|
||||
@@ -97,12 +99,31 @@ export const storeList = new Map([
|
||||
const brands = new Set();
|
||||
const series = new Set();
|
||||
const models = new Set();
|
||||
|
||||
for (const storeData of config.store.stores) {
|
||||
const store = storeList.get(storeData.name);
|
||||
if (store) {
|
||||
store.minPageSleep = storeData.minPageSleep;
|
||||
store.maxPageSleep = storeData.maxPageSleep;
|
||||
} else {
|
||||
logger.warn(`No store named ${storeData.name}, skipping.`);
|
||||
}
|
||||
}
|
||||
|
||||
for (const store of storeList.values()) {
|
||||
for (const link of store.links) {
|
||||
brands.add(link.brand);
|
||||
series.add(link.series);
|
||||
models.add(link.model);
|
||||
}
|
||||
|
||||
if (store.minPageSleep === undefined) {
|
||||
store.minPageSleep = defaultStoreData.minPageSleep;
|
||||
}
|
||||
|
||||
if (store.maxPageSleep === undefined) {
|
||||
store.maxPageSleep = defaultStoreData.maxPageSleep;
|
||||
}
|
||||
}
|
||||
|
||||
export function getAllBrands() {
|
||||
@@ -117,4 +138,22 @@ export function getAllModels() {
|
||||
return Array.from(models);
|
||||
}
|
||||
|
||||
if (config.store.stores.length > 0) {
|
||||
logger.info(`ℹ selected stores: ${config.store.stores.map(store => store.name).join(', ')}`);
|
||||
}
|
||||
|
||||
if (config.store.showOnlyBrands.length > 0) {
|
||||
logger.info(`ℹ selected brands: ${config.store.showOnlyBrands.join(', ')}`);
|
||||
}
|
||||
|
||||
if (config.store.showOnlyModels.length > 0) {
|
||||
logger.info(`ℹ selected models: ${config.store.showOnlyModels.map(entry => {
|
||||
return entry.series ? entry.name + ' (' + entry.series + ')' : entry.name;
|
||||
}).join(', ')}`);
|
||||
}
|
||||
|
||||
if (config.store.showOnlySeries.length > 0) {
|
||||
logger.info(`ℹ selected series: ${config.store.showOnlySeries.join(', ')}`);
|
||||
}
|
||||
|
||||
export * from './store';
|
||||
|
||||
Reference in New Issue
Block a user