Skip to content

Commit 2a11367

Browse files
authored
Merge pull request #26 from PrinceS25/GUI
Add User Interface
2 parents c2ecf85 + 31ecf84 commit 2a11367

File tree

8 files changed

+1463
-111
lines changed

8 files changed

+1463
-111
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pids
1414
*.pid
1515
*.seed
1616
*.pid.lock
17+
config.json
1718

1819
# Directory for instrumented libs generated by jscoverage/JSCover
1920
lib-cov

README.md

Lines changed: 96 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
2+
### New in v2.0: :email: E-mail notification support and an user interface :iphone: !! (see [screenshots](#Screenshots))
3+
14
# StockAlertBot
2-
Faced with the scenario of scalpers using bots to hog up all the inventory of popular holiday toys and sell them at ridiculously high markup price, I decided to at least attempt to put up a fight so we can get our hands on things we ~~want~~ need to survive the #Coronavirus quarantine(s). Of course, this is only half the battle. For full writeup on scoring items, look [here](https://github.com/PrinceS25/StockAlertBot/wiki/Beating-Scalpers).
5+
Faced with the scenario of scalpers using bots to hog up all the inventory of popular holiday toys and sell them at ridiculously high markup prices, I decided to put up a fight so we can get our hands on things we ~~want~~ need to survive the #Coronavirus quarantine(s).
6+
###### Of course, this is only half the battle. For full writeup on scoring items, look [here](https://github.com/PrinceS25/StockAlertBot/wiki/Beating-Scalpers).<br><br><br><br>
37

48
<p align="center">
59
Donate, buy me a <a href="https://buymeacoff.ee/PrinceSingh" target="_blank">Pizza</a> or <a href="https://paypal.me/PrinceSingh25" target="_blank">PayPal</a> me if you'd like to see this project expanded and support me. :) <br> <br>
@@ -10,11 +14,12 @@ Donate, buy me a <a href="https://buymeacoff.ee/PrinceSingh" target="_blank">Piz
1014
<br><br>
1115

1216

13-
> How does it work?
17+
### How does it work?
1418

15-
Enter the product URLs and set how often you want the program to check if those products are in stock. When an item becomes available, it will notify you through both text on console and three auditory beeps as well as opening the product page automatically in your default web browser if you allowed it to do so. You may further configure to send alerts to Slack or Discord.
19+
Enter links of the products you want tracked and how often you want the program to check if those products are in stock. When an item becomes available, you may configure it to notify you through variety of alerts including sound, email, discord and slack notifications, text on console, automatically opening the URL in your browser, and more to come.
20+
<br><br>
1621

17-
> What stores/wesbites are supported?
22+
### What stores/websites are supported?
1823

1924
Currently, the following stores are supported:
2025
* AntOnline
@@ -28,49 +33,89 @@ Currently, the following stores are supported:
2833
* Target (Works but may require additional setup)
2934
* Tesco (UK. For PS5, use this link: https://www.tescopreorders.com/uk/ps5)
3035

31-
![Screenshot](https://i.imgur.com/po6GtU6.png)
36+
![Console Screenshot](https://i.imgur.com/po6GtU6.png)
3237

33-
### Prerequisites
34-
1. Install [Node.js](https://nodejs.org/en/)
35-
2. Clone or download this repository
38+
39+
## Prerequisites
40+
0. A Terminal: ([cmd](https://en.wikipedia.org/wiki/Cmd.exe) (Windows), [Terminal](https://en.wikipedia.org/wiki/Terminal_(macOS)) (macOS), or [Console](https://en.wikipedia.org/wiki/Linux_console) (Linux))
41+
1. Install [Node.js](https://nodejs.org/en/), either LTS or Current.
42+
2. Clone or [download](https://github.com/PrinceS25/StockAlertBot/archive/main.zip) this repository
3643
`git clone https://github.com/PrinceS25/StockAlertBot.git`
37-
3. Change directory
44+
3. Go to root directory
3845
`cd StockAlertBot`
39-
4. Install npm packages
46+
4. Install npm packages via a terminal
4047
`npm install`
4148

42-
### Usage
43-
1. Open and edit `config.json`
44-
* Add urls of products in the `URLS` array
45-
* Change the `INTERVAL` to suit your desires.\
49+
50+
## Usage
51+
There are only two steps to use this program: 1) enter information and 2) launch the program.
52+
53+
1. You can now enter information using two ways: via a browser (recommended) or a text editor.
54+
#### Via Browser
55+
1. At the root directory, run on the terminal:
56+
`npm run settings`\
57+
A browser window should open up. If it doesn't and the console says `Server started!`, go to: `http://localhost:3250/` in your browser.
58+
2. Enter the links of the items you want to track in the URLs tab.
59+
3. Go to Settings tab and change to your heart's content.\
60+
If you have Amazon link(s), you will see an option to put delay between Amazon items.\
61+
If you have Target link(s), you will see additional options to put zip code and API Key. Only change the key if you get API key errors. Refer to the instructions in the following [section](#Via-Text-Editor).
62+
4. Configure notification options in Optional tab.\
63+
If you want notifications sent to Discord or Slack, expand WEBHOOKS and enter the URL(s) there.\
64+
If you want notifications sent to Email, turn on email and enter your service provider information. Some providers (Yahoo, AOL, AT&T) cause problems. Refer to following [section](#Via-Text-Editor).
65+
5. Once you're happy with the settings, click `Save Settings`.\
66+
`config.json` and `.env` files should now reflect your settings.\
67+
You can use `CTRL + C` or `CMD + C` to stop the program.<br><br>
68+
69+
#### Via Text Editor
70+
Open and edit `config.json`
71+
1. Add urls of products in the `URLS` array
72+
2. Change the `INTERVAL` to suit your desires.\
4673
**WARNING:** Having the interval too low might have negative consquences such as this program being detected as a bot (Amazon), or blocking your IP from accessing the website.
47-
* Set `OPEN_URL` to false if you don't want the application to automatically open urls when item is in stock
48-
* Set `ALARM` to false if you want to disable the audible warning
49-
* **If** you're planning to track more than one Amazon item, set the delay (in seconds) between items by editing `AMAZON_DELAY`.
50-
Otherwise, Amazon may flag the program's requests as a bot.
51-
* **If** you're planning to track Target item(s), enter your zip code in `TARGET_ZIP_CODE`\
52-
**NOTE:** If you encounter an error relating to API Key, you need to get this key yourself:
53-
1. Go to target.com with the DevTools (Chrome) or Developer Tools (Firefox) open (Google or ask if you're unsure how)
54-
2. On the console, you should see GET requests as you load the page.\
55-
In DevTools, you have to click the gear and check "Log XMLHttpRequests" to see them
56-
3. Click on any of the urls that has the string "key=" and copy the whole key
57-
4. Paste it to `TARGET_KEY`
58-
* **If** you want to send alerts to webhook URL(s) like [Discord](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) or [Slack](https://api.slack.com/messaging/webhooks), add them to `WEBHOOK_URLS` array
59-
* **If** you want to send alerts to email, change `EMAIL` in `config.json` to `true`. Make a copy of `example.env` and rename it to `.env`. Inside `.env`, type out one of the following service providers (`EMAIL_SERVICE`), your email (`EMAIL_FROM`) and password (`EMAIL_PASS`) and the email you want alerts sent to (`EMAIL_TO`). All without quotes.
60-
```
61-
Gmail, Yahoo, iCloud, Hotmail, Outlook365, QQ, 126, 163, 1und1, AOL, DebugMail, DynectEmail,
62-
FastMail, GandiMail, Godaddy, GodaddyAsia, GodaddyEurope, hot.ee, mail.ee, Mail.ru, Maildev, Mailgun, Mailjet,
63-
Mailosaur, Mandrill, Naver, OpenMailBox, Postmark, QQex, SendCloud, SendGrid, SendinBlue, SendPulse, SES,
64-
SES-US-EAST-1, SES-US-WEST-2, SES-EU-WEST-1, Sparkpost, Yandex, Zoho, qiye.aliyun
65-
```
66-
**NOTE** If you receive the error: `535 5.7.0 (#AUTH005) Too many bad auth attempts`, most likely you are using Yahoo for the email server or an email server managed by Yahoo, such as AOL or AT&T. Yahoo has implemented an option that by default, does not let 3rd party products access the email servers. To resolve, go to https://login.yahoo.com/account/security and then enable the option to allow apps that use less secure sign in. Use the password generated by "Generate app password". If you are using AOL, do the same thing, from https://login.aol.com/account/security.
67-
2. Execute and continue about your day
68-
`node main.js`\
69-
OR\
70-
`npm start`
71-
3. Consider [donating](https://www.paypal.com/donate?business=3Y9NEYR4TURT8&item_name=Making+software+and+hacking+the+world%21+%E2%99%A5&currency_code=USD) or buying me a [Pizza](https://buymeacoff.ee/PrinceSingh) or [PayPal](https://paypal.me/PrinceSingh25) me
72-
73-
### Things to work on
74+
3. Set `OPEN_URL` to false if you don't want the application to automatically open urls when item is in stock
75+
4. Set `ALARM` to false if you want to disable the audible warning
76+
5. Optional Settings.
77+
1. **If** you're planning to track more than one Amazon item, set the delay (in seconds) between items by editing `AMAZON_DELAY`.
78+
Otherwise, Amazon may flag the program's requests as a bot.
79+
2. **If** you're planning to track Target item(s), enter your zip code in `TARGET_ZIP_CODE`\
80+
**NOTE:** If you encounter an error relating to API Key, you need to get this key yourself:
81+
1. Go to target.com with the DevTools (Chrome) or Developer Tools (Firefox) open (Google or ask if you're unsure how)
82+
2. On the console, you should see GET requests as you load the page.\
83+
In DevTools, you have to click the gear and check "Log XMLHttpRequests" to see them
84+
3. Click on any of the urls that has the string "key=" and copy the whole key
85+
4. Paste it to `TARGET_KEY`
86+
3. **If** you want to send alerts to webhook URL(s) like [Discord](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) or [Slack](https://api.slack.com/messaging/webhooks), add them to `WEBHOOK_URLS` array
87+
4. **If** you want to send alerts to email, change `EMAIL` in `config.json` to `true`. Make a copy of `example.env` and rename it to `.env`. Inside `.env`, type out one of the following service providers (`EMAIL_SERVICE`), your email (`EMAIL_FROM`) and password (`EMAIL_PASS`) and the email you want alerts sent to (`EMAIL_TO`). All without quotes.
88+
```
89+
Gmail, Yahoo, iCloud, Hotmail, Outlook365, QQ, 126, 163, 1und1, AOL, DebugMail, DynectEmail,
90+
FastMail, GandiMail, Godaddy, GodaddyAsia, GodaddyEurope, hot.ee, mail.ee, Mail.ru, Maildev, Mailgun, Mailjet,
91+
Mailosaur, Mandrill, Naver, OpenMailBox, Postmark, QQex, SendCloud, SendGrid, SendinBlue, SendPulse, SES,
92+
SES-US-EAST-1, SES-US-WEST-2, SES-EU-WEST-1, Sparkpost, Yandex, Zoho, qiye.aliyun
93+
```
94+
**NOTE** If you receive the error: `535 5.7.0 (#AUTH005) Too many bad auth attempts`, most likely you are using Yahoo for the email server or an email server managed by Yahoo, such as AOL or AT&T. Yahoo has implemented an option that by default, does not let 3rd party products access the email servers. To resolve, go to https://login.yahoo.com/account/security and then enable the option to allow apps that use less secure sign in. Use the password generated by "Generate app password". If you are using AOL, do the same thing, from https://login.aol.com/account/security.
95+
96+
2. Execute and continue about your day:
97+
`npm start`\
98+
You can use `CTRL + C` or `CMD + C` to stop the program.
99+
100+
3. Consider [donating](https://www.paypal.com/donate?business=3Y9NEYR4TURT8&item_name=Making+software+and+hacking+the+world%21+%E2%99%A5&currency_code=USD) or buying me a [Pizza](https://buymeacoff.ee/PrinceSingh) or [PayPal](https://paypal.me/PrinceSingh25) me :smile:
101+
102+
103+
## Screenshots
104+
![Screenshot of URLs](https://i.imgur.com/FVrmKNA.png)<br><br>
105+
---
106+
<br><br>![Screenshot of Settings](https://i.imgur.com/ue3Pdlv.png)<br><br>
107+
---
108+
<br><br>![Screenshot of Optional](https://i.imgur.com/w7xkXIw.png)
109+
110+
111+
## Feedback and Support
112+
To report bugs, please create an [issue](https://github.com/PrinceS25/StockAlertBot/issues).\
113+
To ask questions, give feedback or suggestions among other things, create a new [discussion](https://github.com/PrinceS25/StockAlertBot/discussions).\
114+
To contribute code, programming questions/guidance, gaming sessions, and more, add me on Discord: Prince#0584\
115+
For monetary support, [donate](https://www.paypal.com/donate?business=3Y9NEYR4TURT8&item_name=Making+software+and+hacking+the+world%21+%E2%99%A5&currency_code=USD) or buy me a [Pizza](https://buymeacoff.ee/PrinceSingh) or [PayPal](https://paypal.me/PrinceSingh25) me
116+
117+
118+
## Things to work on
74119
* Add more stores
75120
* Walmart
76121
* Gamestop
@@ -81,13 +126,21 @@ Currently, the following stores are supported:
81126
* ~~Target~~
82127
* ~~Tesco~~
83128
* ~~Argos~~
84-
* Add GUI - Make it easier to use
85-
* Add ~~Email and~~ Maybe SMS Notifications
129+
* Add delay between items from the same store
130+
* Add ~~Email and Maybe~~ SMS Notifications
131+
* More OOP!!
86132
* ~~Fix~~ Find Bugs
133+
* ~~Add GUI - Make it easier to use~~
87134
* ~~Initially create seperation between intervals for Amazon items~~
88135
* ~~Add a way to have independent delay timers for Amazon~~
89136
* ~~Open product page when in stock~~
90137
* ~~Add webhookURL to enable posting messages to Slack and Discord~~
91138
139+
140+
## Main Technologies
141+
- [Node.js](https://nodejs.org/) with [Express.js](https://expressjs.com/)
142+
- [Vue.js](https://vuejs.org/) powered by [Vuetify](https://vuetifyjs.com/) and [Material Design Icons](https://materialdesignicons.com/)
143+
144+
92145
## License
93146
See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).

config.json

Lines changed: 18 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,31 @@
11
{
2-
"__URLS_comment": [
3-
"All the products to check",
4-
"Current domains supported: Amazon, AntOnline, Argos, Best Buy, Costco, Currys, Microcenter, Newegg, Target, Tesco",
5-
"Format: https://www.ABC123.com/..."
6-
],
7-
"URLS": [
8-
"https://www.antonline.com/Sony/Electronics/Gaming_Devices/Gaming_Consoles/1413553",
9-
"https://www.currys.co.uk/gbuk/gaming/console-gaming/consoles/microsoft-xbox-series-x-1-tb-10203371-pdt.html"
10-
],
11-
12-
13-
"__INTERVAL_comment": [
14-
"How often to check for products. Too often may be dangerous, especially for Amazon",
15-
"Units: seconds, m: minutes, h: hours"
2+
"URLS": [],
3+
"SUPPORTED_STORES_DOMAINS": [
4+
"amazon",
5+
"antonline",
6+
"argos",
7+
"bestbuy",
8+
"costco",
9+
"currys",
10+
"microcenter",
11+
"newegg",
12+
"target",
13+
"tesco",
14+
"tescopreorders"
1615
],
1716
"INTERVAL": {
1817
"unit": "seconds",
1918
"value": 10
2019
},
21-
22-
23-
"__OPEN_URL_comment": [
24-
"Opens the product url in your default browser if set to true"
25-
],
2620
"OPEN_URL": true,
27-
28-
29-
"__ALARM_comment": [
30-
"Makes a sound when a product is in stock"
31-
],
3221
"ALARM": true,
33-
34-
35-
"__AMAZON_DELAY_comment": [
36-
"IF YOU ENTERED A AMAZON PRODUCT",
37-
"Separates the check between Amazon items by this value"
38-
],
3922
"AMAZON_DELAY": 10,
40-
41-
42-
"__TARGET_ZIP_CODE_comment": [
43-
"IF YOU ENTERED A TARGET PRODUCT",
44-
"Enter your zip code to search for a Target closest to you"
45-
],
4623
"TARGET_ZIP_CODE": "90024",
47-
48-
49-
"__TARGET_KEY_comment": [
50-
"IF YOU ENTERED A TARGET PRODUCT AND YOU GET API KEY ERRORS",
51-
"Enter the key for your session as described in the README"
52-
],
5324
"TARGET_KEY": "ff457966e64d5e877fdbad070f276d18ecec4a01",
54-
55-
56-
"__EMAIL_comment": [
57-
"IF YOU WANT EMAIL ALERTS",
58-
"Make sure to rename example.env file to .env"
59-
],
6025
"EMAIL": false,
61-
62-
63-
"__WEBHOOK_URLS_comment": [
64-
"IF YOU WANT SLACK OR DISCORD ALERTS"
65-
],
66-
"WEBHOOK_URLS": [
67-
""
26+
"WEBHOOK_URLS": [],
27+
"SUPPORTED_WEBHOOK_DOMAINS": [
28+
"discord",
29+
"slack"
6830
]
69-
}
31+
}

main.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ export var {
2929
WEBHOOK_URLS
3030
} = require('./config.json')
3131

32+
// For Testing
3233
const ADDITIONAL_URLS = [
3334
// "https://www.amazon.com/PlayStation-5-Console/dp/B08FC5L3RG",
34-
"https://www.amazon.com/gp/product/B08164VTWH/",
35-
"https://www.argos.co.uk/product/8349000",
36-
"https://www.bestbuy.com/site/amd-ryzen-9-5900x-4th-gen-12-core-24-threads-unlocked-desktop-processor-without-cooler/6438942.p?skuId=6438942",
37-
"https://www.costco.com/sony-playstation-5-gaming-console-bundle.product.100691489.html",
38-
"https://www.microcenter.com/product/630283/Ryzen_9_5900X_Vermeer_37GHz_12-Core_AM4_Boxed_Processor",
39-
"https://www.newegg.com/amd-ryzen-9-5900x/p/N82E16819113664?Item=N82E16819113664",
40-
"https://www.target.com/p/playstation-5-console/-/A-81114595",
41-
"https://www.tescopreorders.com/uk/ps5",
35+
// "https://www.amazon.com/gp/product/B08164VTWH/",
36+
// "https://www.argos.co.uk/product/8349000",
37+
// "https://www.bestbuy.com/site/amd-ryzen-9-5900x-4th-gen-12-core-24-threads-unlocked-desktop-processor-without-cooler/6438942.p?skuId=6438942",
38+
// "https://www.costco.com/sony-playstation-5-gaming-console-bundle.product.100691489.html",
39+
// "https://www.microcenter.com/product/630283/Ryzen_9_5900X_Vermeer_37GHz_12-Core_AM4_Boxed_Processor",
40+
// "https://www.newegg.com/amd-ryzen-9-5900x/p/N82E16819113664?Item=N82E16819113664",
41+
// "https://www.target.com/p/playstation-5-console/-/A-81114595",
42+
// "https://www.tescopreorders.com/uk/ps5",
4243
// "https://www.tesco.com/groceries/en-GB/products/306276176",
4344
]
4445
if (ADDITIONAL_URLS.length > 0) URLS = URLS.concat(ADDITIONAL_URLS)

0 commit comments

Comments
 (0)