diff --git a/README.md b/README.md
index 78f914a232..8fa81f64be 100644
--- a/README.md
+++ b/README.md
@@ -124,7 +124,7 @@ Here is a list of variables that you can use to customize your newly copied `.en
| `PUSHOVER_PRIORITY` | Pushover message priority |
| `SCREENSHOT` | Capture screenshot of page if a card is found | Default: `true` |
| `SHOW_ONLY_BRANDS` | Filter to show specified brands | Comma separated, e.g.: `evga,zotac` |
-| `SHOW_ONLY_MODELS` | Filter to show specified models | Comma separated, e.g.: `founders edition,rog strix` |
+| `SHOW_ONLY_MODELS` | Filter to show specified models | Both supported formats are comma separated
1. Standard E.g.: `founders edition,rog strix`
2. Advanced E.g: `MODEL:SERIES`, E.g: `founders edition:3090,rog strix` |
| `SHOW_ONLY_SERIES` | Filter to show specified series | Comma separated, e.g.: `3080` |
| `SLACK_CHANNEL` | Slack channel for posting | E.g.: `update`, no need for `#` |
| `SLACK_TOKEN` | Slack API token | |
diff --git a/src/config.ts b/src/config.ts
index 0d77966e30..fc035009bc 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -243,7 +243,13 @@ const store = {
},
microCenterLocation: envOrArray(process.env.MICROCENTER_LOCATION, ['web']),
showOnlyBrands: envOrArray(process.env.SHOW_ONLY_BRANDS),
- showOnlyModels: envOrArray(process.env.SHOW_ONLY_MODELS),
+ showOnlyModels: envOrArray(process.env.SHOW_ONLY_MODELS).map(entry => {
+ const [name, series] = entry.match(/[^:]+/g) ?? [];
+ return {
+ name: envOrString(name),
+ series: envOrString(series)
+ };
+ }),
showOnlySeries: envOrArray(process.env.SHOW_ONLY_SERIES, ['3070', '3080', '3090']),
stores: envOrArray(process.env.STORES, ['nvidia']).map(entry => {
const [name, minPageSleep, maxPageSleep] = entry.match(/[^:]+/g) ?? [];
diff --git a/src/store/filter.ts b/src/store/filter.ts
index 93ad46bb27..33f012287b 100644
--- a/src/store/filter.ts
+++ b/src/store/filter.ts
@@ -18,16 +18,22 @@ function filterBrand(brand: Link['brand']): boolean {
* Returns true if the model should be checked for stock
*
* @param model The model of the GPU
+ * @param series The series of the GPU
*/
-function filterModel(model: Link['model']): boolean {
+function filterModel(model: Link['model'], series: Link['series']): boolean {
if (config.store.showOnlyModels.length === 0) {
return true;
}
const sanitizedModel = model.replace(/\s/g, '');
- for (const configModel of config.store.showOnlyModels) {
- const sanitizedConfigModel = configModel.replace(/\s/g, '');
- if (sanitizedModel === sanitizedConfigModel) {
+ const sanitizedSeries = series.replace(/\s/g, '');
+ for (const configModelEntry of config.store.showOnlyModels) {
+ const sanitizedConfigModel = configModelEntry.name.replace(/\s/g, '');
+ const sanitizedConfigSeries = configModelEntry.series.replace(/\s/g, '');
+ if (sanitizedConfigSeries ?
+ sanitizedSeries === sanitizedConfigSeries && sanitizedModel === sanitizedConfigModel :
+ sanitizedModel === sanitizedConfigModel
+ ) {
return true;
}
}
@@ -56,7 +62,7 @@ export function filterSeries(series: Link['series']): boolean {
export function filterStoreLink(link: Link): boolean {
return (
filterBrand(link.brand) &&
- filterModel(link.model) &&
+ filterModel(link.model, link.series) &&
filterSeries(link.series)
);
}
diff --git a/src/store/model/index.ts b/src/store/model/index.ts
index 4b47fd3fc1..31d549fda2 100644
--- a/src/store/model/index.ts
+++ b/src/store/model/index.ts
@@ -115,7 +115,9 @@ if (config.store.showOnlyBrands.length > 0) {
}
if (config.store.showOnlyModels.length > 0) {
- logger.info(`ℹ selected models: ${config.store.showOnlyModels.join(', ')}`);
+ 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) {