Skip to content

Commit c775bac

Browse files
committed
Merge branch 'main' of https://github.com/jef/streetmerchant into main
2 parents e6718fa + 4eb678a commit c775bac

File tree

19 files changed

+331
-69
lines changed

19 files changed

+331
-69
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog
22

3+
## [3.10.0](https://github.com/jef/streetmerchant/compare/v3.9.0...v3.10.0) (2025-01-29)
4+
5+
6+
### Features
7+
8+
* add 50xx series ([#3190](https://github.com/jef/streetmerchant/issues/3190)) ([db07796](https://github.com/jef/streetmerchant/commit/db07796ef99cc55c7ccdc67df0884b26e361c440))
9+
* add 50xx series discord notification groups ([#3193](https://github.com/jef/streetmerchant/issues/3193)) ([f59d3fc](https://github.com/jef/streetmerchant/commit/f59d3fcbb0b40e0db4e0da9e8b3c60c7d7c114a4))
10+
* add more 50xx series, add templates for adding more links ([#3191](https://github.com/jef/streetmerchant/issues/3191)) ([ce6d084](https://github.com/jef/streetmerchant/commit/ce6d08490c11fbffaeb932ddc0c6f9262d079c4d))
11+
* add new microcenters locations, more 4090 GPUs, fixed incorrect URLs ([#3181](https://github.com/jef/streetmerchant/issues/3181)) ([218b0c3](https://github.com/jef/streetmerchant/commit/218b0c30757aaaa5ddc922f32e330457c0a82318))
12+
* add NTFY.SH agent ([#3195](https://github.com/jef/streetmerchant/issues/3195)) ([e18f231](https://github.com/jef/streetmerchant/commit/e18f2316bdc43c06c164e77019d68fd614afdc89))
13+
14+
15+
### Miscellaneous
16+
17+
* update bestbuy selectors ([#3186](https://github.com/jef/streetmerchant/issues/3186)) ([810cefc](https://github.com/jef/streetmerchant/commit/810cefcd56129448d485127064478b985acb992b))
18+
19+
20+
### Continuous Integration
21+
22+
* update pr linter ([25d556c](https://github.com/jef/streetmerchant/commit/25d556c736a90b64f4312e4a4332dbc922b71f66))
23+
24+
25+
### Documentation
26+
27+
* remove badges ([4388e9a](https://github.com/jef/streetmerchant/commit/4388e9a5e0cb1d1e544b5614fdba37efc2475d52))
28+
329
## [3.9.0](https://github.com/jef/streetmerchant/compare/v3.8.3...v3.9.0) (2023-05-15)
430

531

docs/reference/filter.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727
| `MAX_PRICE_SERIES_RX6800` | Maximum price allowed for a match, applies AMD RX 6800 |
2828
| `MAX_PRICE_SERIES_RX6800XT` | Maximum price allowed for a match,applies AMD RX 6800 XT |
2929
| `MAX_PRICE_SERIES_RX6900XT` | Maximum price allowed for a match, applies AMD RX 6900 XT |
30+
| `MAX_PRICE_SERIES_RYZEN7800X3D` | Maximum price allowed for a match, applies AMD 7800X3D |
3031
| `MAX_PRICE_SERIES_RYZEN7950X` | Maximum price allowed for a match, applies to AMD Ryzen 9 7950X CPU |
31-
| `MAX_PRICE_SERIES_RYZEN9800X3D` | Maximum price allowed for a match, applies to AMD Ryzen 7 9800X3D CPU |
32+
| `MAX_PRICE_SERIES_RYZEN9800X3D` | Maximum price allowed for a match, applies AMD 9800X3D |
33+
| `MAX_PRICE_SERIES_RYZEN9600X` | Maximum price allowed for a match, applies AMD RX 9600X |
34+
| `MAX_PRICE_SERIES_RYZEN9700X` | Maximum price allowed for a match, applies AMD RX 9700X |
35+
| `MAX_PRICE_SERIES_RYZEN9900X` | Maximum price allowed for a match, applies AMD RX 9900X |
36+
| `MAX_PRICE_SERIES_RYZEN9950X` | Maximum price allowed for a match, applies AMD RX 9950X |
3237
| `MAX_PRICE_SERIES_SONYPS5C` | Maximum price allowed for a match, applies PS5 console |
3338
| `MAX_PRICE_SERIES_SONYPS5DE` | Maximum price allowed for a match, applies PS5 digital edition |
3439
| `MAX_PRICE_SERIES_XBOXSS` | Maximum price allowed for a match, applies Xbox Series S |

docs/reference/notification.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,16 @@ Copy the API key generated with the service activation.
279279
| `FREEMOBILE_API_KEY` | API key generated with your notification option activation |
280280

281281
Note: here you do not need to give neither your password nor phone number.
282+
283+
## NTFY.sh
284+
285+
You can send notifications using NTFY.sh, which supports various features like priority, tags, and action buttons.
286+
Use the free service at [ntfy.sh](https://ntfy.sh) or host your own instance.
287+
288+
| Environment variable | Description |
289+
|:---:|---|
290+
| `NTFY_URL` | ntfy server URL, e.g. `https://ntfy.sh` |
291+
| `NTFY_TOPIC` | Topic to publish alerts to |
292+
| `NTFY_PRIORITY` | Message priority, e.g. max/high/default/low/min, I recommend to use the numbers instead of the string values for the priority. https://docs.ntfy.sh/publish/?h=priority#message-priority |
293+
| `NTFY_TITLE` | Title of the message |
294+
| `NTFY_ACCESS_TOKEN` | Access token for authentication. https://docs.ntfy.sh/config/#access-tokens |

dotenv-example

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ DISCORD_NOTIFY_GROUP_RYZEN5900=
4444
DISCORD_NOTIFY_GROUP_RYZEN5950=
4545
DISCORD_NOTIFY_GROUP_RYZEN7800X3D=
4646
DISCORD_NOTIFY_GROUP_RYZEN9800X3D=
47-
DISCORD_NOTIFY_GROUP_RYZEN9600X=
48-
DISCORD_NOTIFY_GROUP_RYZEN9700X=
49-
DISCORD_NOTIFY_GROUP_RYZEN9900X=
5047
DISCORD_NOTIFY_GROUP_RYZEN9950X=
48+
DISCORD_NOTIFY_GROUP_RYZEN9900X=
49+
DISCORD_NOTIFY_GROUP_RYZEN9700X=
50+
DISCORD_NOTIFY_GROUP_RYZEN9600X=
5151
DISCORD_NOTIFY_GROUP_SONYPS5C=
5252
DISCORD_NOTIFY_GROUP_SONYPS5DE=
5353
DISCORD_NOTIFY_GROUP_XBOXSX=
@@ -74,6 +74,10 @@ MAX_PRICE_SERIES_3080TI=
7474
MAX_PRICE_SERIES_3090=
7575
MAX_PRICE_SERIES_4080_16G=
7676
MAX_PRICE_SERIES_4090=
77+
MAX_PRICE_SERIES_5070=
78+
MAX_PRICE_SERIES_5070TI=
79+
MAX_PRICE_SERIES_5080=
80+
MAX_PRICE_SERIES_5090=
7781
MAX_PRICE_SERIES_CORSAIR_SF=
7882
MAX_PRICE_SERIES_G4_DOORBELL_PRO=
7983
MAX_PRICE_SERIES_RX6800=
@@ -85,10 +89,10 @@ MAX_PRICE_SERIES_RYZEN5900=
8589
MAX_PRICE_SERIES_RYZEN5950=
8690
MAX_PRICE_SERIES_RYZEN7800X3D=
8791
MAX_PRICE_SERIES_RYZEN9800X3D=
88-
MAX_PRICE_SERIES_RYZEN9600X=
89-
MAX_PRICE_SERIES_RYZEN9800X=
90-
MAX_PRICE_SERIES_RYZEN9900X=
9192
MAX_PRICE_SERIES_RYZEN9950X=
93+
MAX_PRICE_SERIES_RYZEN9900X=
94+
MAX_PRICE_SERIES_RYZEN9700X=
95+
MAX_PRICE_SERIES_RYZEN9600X=
9296
MAX_PRICE_SERIES_SONYPS5C=
9397
MAX_PRICE_SERIES_SONYPS5DE=
9498
MAX_PRICE_SERIES_XBOXSS=
@@ -173,4 +177,9 @@ STREAMLABS_SOUND=
173177
STREAMLABS_DURATION=
174178
FREEMOBILE_ID=
175179
FREEMOBILE_API_KEY=
180+
NTFY_TOPIC=
181+
NTFY_PRIORITY=
182+
NTFY_TITLE=
183+
NTFY_ACCESS_TOKEN=
184+
NTFY_URL=
176185
WEB_PORT=

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "streetmerchant",
3-
"version": "3.9.0",
3+
"version": "3.10.0",
44
"description": "The world's easiest, most powerful stock checker",
55
"main": "src/index.ts",
66
"scripts": {

src/config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ const notifications = {
256256
ryzen5800: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN5800),
257257
ryzen5900: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN5900),
258258
ryzen5950: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN5950),
259-
ryzen7950X: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN7950X),
260259
ryzen7800x3d: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN7800X3D),
260+
ryzen7950X: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN7950X),
261261
ryzen9800x3d: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN9800X3D),
262262
ryzen9600x: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN9600X),
263263
ryzen9700x: envOrArray(process.env.DISCORD_NOTIFY_GROUP_RYZEN9700X),
@@ -388,6 +388,13 @@ const notifications = {
388388
id: envOrString(process.env.FREEMOBILE_ID),
389389
apiKey: envOrString(process.env.FREEMOBILE_API_KEY),
390390
},
391+
ntfy: {
392+
url: envOrString(process.env.NTFY_URL, 'https://ntfy.sh'),
393+
topic: envOrString(process.env.NTFY_TOPIC),
394+
priority: envOrString(process.env.NTFY_PRIORITY),
395+
title: envOrString(process.env.NTFY_TITLE),
396+
accessToken: envOrString(process.env.NTFY_ACCESS_TOKEN),
397+
},
391398
};
392399

393400
const nvidia = {

src/messaging/notification.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {sendTweet} from './twitter';
2424
export function sendNotification(link: Link, store: Store) {
2525
// Priority
2626
playSound();
27+
sendNtfyAlert(link, store);
2728
sendDiscordMessage(link, store);
2829
sendDesktopNotification(link, store);
2930
sendEmail(link, store);

src/messaging/ntfy.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import {Link, Store} from '../store/model';
2+
import {Print, logger} from '../logger';
3+
import {config} from '../config';
4+
import fetch from 'node-fetch';
5+
6+
const {ntfy} = config.notifications;
7+
8+
export function sendNtfyAlert(link: Link, store: Store) {
9+
if (ntfy.topic) {
10+
logger.debug('↗ sending ntfy alert');
11+
12+
(async () => {
13+
const message = `${Print.inStock(link, store)}`;
14+
const headers: Record<string, string> = {};
15+
16+
if (ntfy.priority) headers['Priority'] = ntfy.priority;
17+
headers[
18+
'Tags'
19+
] = `${store.name},${link.model},${link.series},${link.brand}`;
20+
if (ntfy.title) headers['Title'] = ntfy.title;
21+
if (ntfy.accessToken)
22+
headers['Authorization'] = `Bearer ${ntfy.accessToken}`;
23+
24+
const body = {
25+
topic: ntfy.topic,
26+
message,
27+
actions: [
28+
{
29+
action: 'view',
30+
label: 'Add to cart',
31+
url: link.cartUrl ?? link.url,
32+
},
33+
],
34+
};
35+
36+
try {
37+
const response = await fetch(ntfy.url, {
38+
method: 'POST',
39+
body: JSON.stringify(body),
40+
headers: {
41+
...headers,
42+
'Content-Type': 'application/json',
43+
},
44+
});
45+
46+
if (!response.ok)
47+
throw new Error(`Failed to send ntfy alert: ${response.statusText}`);
48+
49+
logger.info('✔ ntfy alert sent');
50+
} catch (error: unknown) {
51+
logger.error("✖ couldn't send ntfy alert", error);
52+
}
53+
})();
54+
}
55+
}

src/store/model/amazon.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -985,14 +985,17 @@ export const Amazon: Store = {
985985
};
986986

987987
/* Copy Paste Template
988+
988989
Copy the product id from the amazon URL.
989-
For example if you have https://www.amazon.com/gp/product/B08M9R8HQY just copy B08M9R8HQY. Paste it after ASIN.1= in the cartUrl and at the end of /dp/ in the url.
990-
{
991-
brand: '',
992-
cartUrl:
993-
'https://www.amazon.com/gp/aws/cart/add.html?ASIN.1=&Quantity.1=1',
994-
model: '',
995-
series: '',
996-
url: 'https://www.amazon.com/dp/',
997-
},
990+
For example if you have https://www.amazon.com/gp/product/B08M9R8HQY just copy B08M9R8HQY.
991+
Paste it after ASIN.1= in the cartUrl and at the end of /dp/ in the url.
992+
993+
{
994+
brand: '',
995+
cartUrl:
996+
'https://www.amazon.com/gp/aws/cart/add.html?ASIN.1=&Quantity.1=1',
997+
model: '',
998+
series: '',
999+
url: 'https://www.amazon.com/dp/',
1000+
},
9981001
*/

0 commit comments

Comments
 (0)