Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Commit

Permalink
error if browser gets stuck rather than doing nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Snelling committed Oct 4, 2018
1 parent 2f8ed9f commit fe82936
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion app/views/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,21 @@ function handleBrowser(id) {
var currentUrl = currentBrowser.webContents.getURL();
var currentUrlSplit = currentUrl.split('/');

console.log(currentUrl)

// at homepage (this shouldn't happen)
if (currentUrl == 'https://www.supremenewyork.com/shop') {
ipcRenderer.send('status', tasks[currentBrowserIndex].name, 'task error');
tasks[currentBrowserIndex].status = 'Ended';
$($('.list-group-item').not('.list-head')[currentBrowserIndex]).children('.status').text('Ended');
$($('.list-group-item').not('.list-head')[currentBrowserIndex]).children('.status').css('color', '#f39c12');
tasks[currentBrowserIndex].autofilled = false;
tasks[currentBrowserIndex].complete = false;
tasks[currentBrowserIndex].browser.destroy();
tasks[currentBrowserIndex].browser = null;
localStorage.setItem('tasks', JSON.stringify(tasks));
}

// on item page
if (currentUrl.includes('/shop/') && /^([a-zA-Z0-9]{9})$/.test(currentUrlSplit[currentUrlSplit.length - 1])) {
// select size
Expand Down Expand Up @@ -944,7 +959,7 @@ function searchForItem(searchItem, proxy, cb) {
var keywordOptions = {
shouldSort: true,
tokenize: true,
threshold: 0.4,
threshold: 0.6,
location: 0,
distance: 100,
maxPatternLength: 32,
Expand Down

0 comments on commit fe82936

Please sign in to comment.