Skip to content

Commit

Permalink
Merge pull request #54 from val92130/develop
Browse files Browse the repository at this point in the history
2.8
  • Loading branch information
Valentin Chatelain authored Oct 15, 2017
2 parents 373d7d5 + 7233ee5 commit e0b1756
Show file tree
Hide file tree
Showing 31 changed files with 689 additions and 152 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
**/node_modules
.vscode
.expo
bot/build
bot/build
bot/build.zip
30 changes: 7 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ Supreme Auto Checkout provides many features such as:
- **Multi profiles** - You can setup multiple profiles to quickly switch settings during drop day!
- **Configurable delays for every steps of the checkout process.**
- **Size choice for every category of product.**
- **Captcha bypass** (beta feature).
- **Option to set a minimum/maximum price for a product.**
- **Option to hide sold out products.**
- **Easy configuration.**
- **AutoCop** - You can set keywords for products and they will automatically be added to cart when they are available on the shop.
- **Product Monitor**
- **Product Monitor** - Be notified when a product goes back in stock!
- **Profile Export** - Export your profiles and securely import them onto another computer (Your data will be encrypted using AES).
- **Drop list**

# Coming soon
Features that will be added in the future:
- **Proxies support**
- **Drop list**

# Installation

Expand All @@ -40,14 +39,6 @@ Once it's done, follow these steps:
>- Open Google Chrome and type in your address bar **chrome://extensions/** and enable the **Developer** mode option at the top of the page.
>- Drag the extracted folder containing the extension into Google Chrome.

# Updating

If you already have a previous version of the bot installed, I recommend you to **uninstall it before installing the new version**
as it can cause issues if the new version introduced some changes in the way the data is saved to the local storage.

Note: You'll have to reconfigure the bot when you reinstall it.

# Configuration

After the extension is installed, the extension logo should appear on the Chrome menu.
Expand Down Expand Up @@ -83,7 +74,7 @@ You will have to set the time as a 24hour format (hh:mm:ss), note that it will b

A recommended value would be **11:00:10** to make sure that the shop has updated before running the ATC.

Once the ATC time is reached, the bot will automatically open tabs to add to cart matching products.
Once the ATC time is reached, the bot will automatically open a tab to add to cart matching products.

The product who matches the most the keywords will be added to the cart.

Expand All @@ -94,23 +85,16 @@ The product who matches the most the keywords will be added to the cart.
To setup AutoCop products, you need to go in the **AutoCop** tab of your bot then click on the **Add new** button.

This will open a form requesting the following informations:
- **Name** - A name to distinct your atc products, not really important
- **Name** - A name to distinct your atc products, not really important.
- **Product keywords** - This field is a multi-selectable input, you can add keywords by pressing the Enter key,
thoses keywords are **case insensitive** and white-spaces at the end and start of the keyword will be removed.
- **Color** (optional) - If set, the ATC will try to checkout the product matching this color, also **case insensitive**
- **Product category** - The category of the product
- **Color** (optional) - If set, the ATC will try to checkout the product matching this color, also **case insensitive**.
- **Product category** - The category of the product.
- **Retry count if not found** - If the product is not found during an Autocop, the page will tryo to find the product again for N times before skipping to the next Autocop product.
- **Enabled**

You can manually trigger the AutoCop for a product by clicking on the `Run now` button in the Atc product list.

# Captcha Bypass

The **Captcha Bypass** feature works by deleting from the DOM the node containing the re-captcha input.

This temporary works because Supreme doesn't seems to validate Google's Re-captcha on server-side.

This option is **NOT** recommended, use with caution.

# Development

Requirements:
Expand Down
2 changes: 1 addition & 1 deletion bot/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Supreme Auto-Checkout bot",
"description": "Supreme Open-Source add to cart bot",
"version": "2.7.1",
"version": "2.8",
"background": {
"scripts": ["background.js"]
},
Expand Down
14 changes: 14 additions & 0 deletions bot/src/app/components/shops/supreme/AtcCreateForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class AtcCreateForm extends Component {
<div>
<p style={{ fontSize: '0.8em' }}>ATC Product description is only used to differentiate different ATC products, it doesn't have any effect on the Autocop process.</p>
<p style={{ fontSize: '0.8em' }}>Keywords is the most important information to find a product for Autocop, make sure to add detailed keywords. For example for a Box Logo add the following keywords: box, logo, hoodie.</p>
<p style={{ fontSize: '0.8em' }}>You can also add negative keywords by prepending a <b>"!"</b> to a keyword, for example the keywords "<b>box logo !longsleeve tee</b>" will match a product like <b>"Box Logo Tee"</b> but not <b>"Box Logo Longsleeve tee"</b></p>
<form onSubmit={handleSubmit} id="atc-form">
<div>
<Field
Expand Down Expand Up @@ -107,6 +108,18 @@ class AtcCreateForm extends Component {
}
</Field>
</div>

<div>
<Field
name="retryCount"
validate={[Validators.number]}
component={TextField}
floatingLabelText="Retry count if not found"
hintText="Retry count if not found"
style={Styles.fields.text}
/>
</div>

<br />
<div>
<Field
Expand Down Expand Up @@ -153,6 +166,7 @@ function mapStateToProps(state, ownProps) {
atcProducts: state.atc.atcProducts,
initialValues: Object.assign({
enabled: true,
retryCount: 3,
}, ownProps.initialValues),
};
}
Expand Down
43 changes: 24 additions & 19 deletions bot/src/app/components/shops/supreme/pages/Atc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,33 @@ class Atc extends Component {
}

async runAll() {
const atcProducts = this.props.atcProducts;
for (let i = 0; i < atcProducts.length; i += 1) {
const product = atcProducts[i];
setTimeout(async () => await this.runNow(product.category, product.keywords, product.color), i * 400);
const profile = await StorageService.getCurrentProfileSettings(version);
if (!profile || !profile.Supreme) {
this.props.notify('Please configure your bot before running ATC');
return false;
}
const useMonitor = profile.Supreme.Options.atcUseMonitor;
if (!useMonitor) {
return await AtcService.runAll();
}
const hasFound = await AtcService.runAllMonitor();
if (!hasFound) {
this.props.notify('No matching product found');
}
return hasFound;
}

async runNow(category, keywords, color) {
let atcCategory = category;
async runNow(atcProduct) {
const profile = await StorageService.getCurrentProfileSettings(version);
if (!profile || !profile.Supreme) {
this.props.notify('Please configure your bot before running ATC');
return false;
}
const useMonitor = profile.Supreme.Options.atcUseMonitor;
if (!useMonitor) {
return AtcService.openAtcTab(atcCategory, keywords, color);
}
const monitorProducts = await ProductsService.fetchProducts();
if (!monitorProducts) {
return false;
return await AtcService.openAtcTab(atcProduct);
}
const hasFound = AtcService.openAtcTabMonitor(monitorProducts, atcCategory, keywords, color);
const hasFound = await AtcService.openAtcTabMonitor(atcProduct);
if (!hasFound) {
this.props.notify('No matching product found');
}
Expand Down Expand Up @@ -170,24 +174,25 @@ class Atc extends Component {
return (<p style={{ textAlign: 'center' }}>Click "Add new" to add a new Autocop Product"</p>);
}
return atcProducts.map((x) => {
const product = x.product;
return (
<TableRow key={x.name}>
<TableRowColumn>{x.name}</TableRowColumn>
<TableRow key={product.name}>
<TableRowColumn>{product.name}</TableRowColumn>
<TableRowColumn>
<Toggle toggled={x.enabled} onToggle={async () => await this.toggleAtc(x.name, !x.enabled)} />
<Toggle toggled={product.enabled} onToggle={async () => await this.toggleAtc(product.name, !product.enabled)} />
</TableRowColumn>
<TableRowColumn>
<IconButton onTouchTap={async () => await this.runNow(x.category, x.keywords, x.color)}>
<IconButton onTouchTap={async () => await this.runNow(x)}>
<LaunchIcon />
</IconButton>
</TableRowColumn>
<TableRowColumn>
<IconButton onTouchTap={() => this.requestModalOpen(x)}>
<IconButton onTouchTap={() => this.requestModalOpen(product)}>
<EditIcon />
</IconButton>
</TableRowColumn>
<TableRowColumn>
<IconButton onTouchTap={() => this.onRequestDeleteAtc(x.name)}>
<IconButton onTouchTap={() => this.onRequestDeleteAtc(product.name)}>
<DeleteButton color={red300} />
</IconButton>
</TableRowColumn>
Expand All @@ -207,7 +212,7 @@ function mapStateToProps(state) {
const currentProfile = state.profiles.currentProfile;
const settings = state.profiles.profiles.filter(x => x.name === currentProfile)[0].settings;
let props = {
atcProducts: state.atc.atcProducts,
atcProducts: state.atc.atcProducts.sort((a, b) => a.id - b.id),
};
if (settings && settings.Supreme && settings.Supreme.Options) {
props = Object.assign({}, props, {
Expand Down
25 changes: 24 additions & 1 deletion bot/src/app/components/shops/supreme/pages/Billing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ function getStatesForCountry(country) {
}
}

function getCreditCardsForCountry(country) {
switch (country) {
case 'CANADA':
case 'USA':
return Utils.usCreditCards;
case 'JAPAN':
return Utils.japanCreditCards;
default:
return Utils.creditCards;
}
}

const Billing = props => {
const { handleSubmit, pristine, submitting, country } = props;
return (
Expand Down Expand Up @@ -77,6 +89,16 @@ const Billing = props => {
/>
</div>

<div>
<Field
name="oba3"
component={TextField}
floatingLabelText="Address 2"
hintText="Address 2"
style={Styles.fields.text}
/>
</div>

<div>
<Field
name="order_billing_city"
Expand Down Expand Up @@ -124,6 +146,7 @@ const Billing = props => {
component={TextField}
floatingLabelText="Zip"
style={Styles.fields.text}
validate={[Validators.required]}
/>
</div>

Expand All @@ -136,7 +159,7 @@ const Billing = props => {
validate={[Validators.required]}
>
{
(country === 'JAPAN' ? Utils.japanCreditCards : Utils.creditCards).map(x =>
getCreditCardsForCountry(country).map(x =>
<MenuItem value={x.value} primaryText={x.text} key={x.value} />,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { connect } from 'react-redux';
import Divider from 'material-ui/Divider';
import CircularProgress from 'material-ui/CircularProgress';
import { Card, CardMedia, CardText } from 'material-ui/Card';
import FlatButton from 'material-ui/FlatButton';
import Dialog from 'material-ui/Dialog';
import Layout from '../../../../containers/Layout';
import DropsService from '../../../../../services/supreme/DropsService';
Expand Down Expand Up @@ -47,6 +46,7 @@ class DropProducts extends Component {
return {
name: product.name,
keywords: product.keywords,
category: product.category,
};
}

Expand Down
9 changes: 5 additions & 4 deletions bot/src/app/components/shops/supreme/pages/Options.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const defaultValues = {
autoPay: false,
strictSize: true,
hideSoldOut: false,
captchaBypass: false,
addToCartDelay: 200,
checkoutDelay: 2000,
showNotifications: true,
};

class HelperField extends Component {
Expand Down Expand Up @@ -166,21 +166,22 @@ const Options = props => {
<HelperField
field={
<Field
name="captchaBypass"
name="showNotifications"
component={Toggle}
style={{ width: 'auto' }}
/>
}
title="Bypass captcha (beta)"
title="Display restock notifications"
helperText={
<div>
<p>
This option will remove the captcha during the checkout process, use with caution as they are high chances the bypass won't work.
If this option is enabled you will receive a notification whenever a product restocks or land on the shop.
</p>
</div>
}
/>
</div>

<div>
<HelperField
field={
Expand Down
Loading

0 comments on commit e0b1756

Please sign in to comment.