Skip to content

Commit

Permalink
quick and dirty fix for nvidia marketplace to not wrongly notifiy by …
Browse files Browse the repository at this point in the history
…checking for minimum price
  • Loading branch information
BndktCG committed Jan 30, 2025
1 parent 55b6b74 commit f1b5dfe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/reference/filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

| Environment variable | Description |
|:---:|---|
| `MIN_PRICE_FILTER` | Price filter to avoid errors
| `MAX_PRICE_SERIES_3060` | Maximum price allowed for a match, applies 3060 series cards (does not apply to these sites: Nvidia, Asus, EVGA) |
| `MAX_PRICE_SERIES_3060TI` | Maximum price allowed for a match, applies 3060 Ti series cards (does not apply to these sites: Nvidia, Asus, EVGA) |
| `MAX_PRICE_SERIES_3070` | Maximum price allowed for a match, applies 3070 series cards (does not apply to these sites: Nvidia, Asus, EVGA) |
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {existsSync, readFileSync} from 'fs';
import {banner} from './banner';
import dotenv from 'dotenv';
import path from 'path';
import { series } from 'async';

if (process.env.npm_config_conf) {
if (
Expand Down Expand Up @@ -411,6 +412,7 @@ if (process.env.MAX_PRICE) {
const store = {
autoAddToCart: envOrBoolean(process.env.AUTO_ADD_TO_CART, true),
country: envOrString(process.env.COUNTRY, 'usa'),
minPrice: envOrNumber(process.env.MIN_PRICE),
maxPrice: {
series: {
3050: envOrNumber(process.env.MAX_PRICE_SERIES_3050),
Expand Down
5 changes: 4 additions & 1 deletion src/store/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,15 +497,18 @@ async function isItemInStock(
}
}


if (store.labels.maxPrice) {
const maxPrice = config.store.maxPrice.series[link.series];
const minPrice = config.store.minPrice

link.price = await getPrice(page, store.labels.maxPrice, baseOptions);

if (link.price && link.price > maxPrice && maxPrice > 0) {
if ((link.price != null && link.price > maxPrice && maxPrice > 0) || (link.price != null && link.price < 500)) {
logger.info(Print.maxPrice(link, store, maxPrice, true));
return false;
}

}

return true;
Expand Down

0 comments on commit f1b5dfe

Please sign in to comment.