Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General Bug Fixes/Additons #96

Merged
merged 96 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
c24cade
added app name/version
walmat Oct 13, 2018
bdc6fc9
added size options grouped in the size dropdown
walmat Oct 14, 2018
f227eb1
fixed broken edit menu toggle
walmat Oct 14, 2018
565291b
progress on site data autofill
walmat Oct 14, 2018
f9e78f0
updated test cases
walmat Oct 14, 2018
bfb60d8
added site autocomplete && proxy location dropdown in the server page
walmat Oct 15, 2018
521fe3d
added core server impl.
walmat Oct 15, 2018
04e5557
added core server impl.
walmat Oct 15, 2018
d4bc58f
fixed css issues for windows
Oct 15, 2018
47b624e
alignment changes
walmat Oct 15, 2018
0db8fca
Merge branch 'issue_88' of https://github.com/walmat/nebula into issu…
walmat Oct 15, 2018
86079ab
added more css adjustments
walmat Oct 15, 2018
8beab0e
Fix Horizontal Scrolling for Create Task Size Select
pr1sm Oct 16, 2018
16cc002
captcha window changes
Oct 16, 2018
4c69f32
captcha window logic impl.
Oct 16, 2018
70748d8
added edit sizes cases
Oct 16, 2018
c4d7c57
progress on site autofill bugs
Oct 16, 2018
c6c359d
progress on site autofill bugs
Oct 16, 2018
54c73d3
buggy site autofill fixed
walmat Oct 16, 2018
6bbf279
rm console log
walmat Oct 16, 2018
8307b33
small change in site matching logic
walmat Oct 16, 2018
c196e93
simplified site matching
walmat Oct 16, 2018
6295b35
hotfix for http site autofill matching
walmat Oct 16, 2018
e02d0ec
progress on updating taskReducers~ test
Oct 16, 2018
577f384
max 5 captcha windows + map to control them, still buggy
Oct 17, 2018
2975c23
fixed buggy captcha windows
Oct 18, 2018
6f77bf2
clearing session still buggy, and closing a yt win -> trying to close…
Oct 18, 2018
70f2bd6
captcha window manager split out
Oct 19, 2018
397787c
progress on captcha window manager
walmat Oct 19, 2018
7f49b73
closing all windows finished, closing consecutive captcha windows is …
walmat Oct 19, 2018
0c9c1de
progress on youtube + captcha closing
walmat Oct 20, 2018
293e1e5
fixed captcha windows + youtube pairing
walmat Oct 20, 2018
aa94a7f
fixed else clause
walmat Oct 20, 2018
9ee61ea
added closing youtube pair when captcha closes
walmat Oct 20, 2018
c4e4f23
hotfix for closing all captchas -> youtubes
walmat Oct 20, 2018
541e51b
fixed taskReducer tests
walmat Oct 21, 2018
8ae5c58
more test fixes
Oct 21, 2018
f5e3659
pr changes
walmat Oct 21, 2018
229de34
Merge branch 'issue_88' of https://github.com/walmat/nebula into issu…
walmat Oct 21, 2018
b96f8f9
added recaptcha path to api
walmat Oct 21, 2018
dbea6f2
fixing broken tests progress
Oct 21, 2018
07883a5
tests fixed
Oct 22, 2018
bcb4549
increase test coverage
Oct 22, 2018
a031864
added app name/version
walmat Oct 13, 2018
4f5d9f2
added size options grouped in the size dropdown
walmat Oct 14, 2018
9b584ad
fixed broken edit menu toggle
walmat Oct 14, 2018
4afd340
progress on site data autofill
walmat Oct 14, 2018
cb36685
updated test cases
walmat Oct 14, 2018
12387fa
added site autocomplete && proxy location dropdown in the server page
walmat Oct 15, 2018
9bf5f17
added core server impl.
walmat Oct 15, 2018
6dc3f12
added core server impl.
walmat Oct 15, 2018
db9ac0e
fixed css issues for windows
Oct 15, 2018
33f0a20
alignment changes
walmat Oct 15, 2018
a8cf274
added more css adjustments
walmat Oct 15, 2018
ed5c577
Fix Horizontal Scrolling for Create Task Size Select
pr1sm Oct 16, 2018
b773970
captcha window changes
Oct 16, 2018
5cd4c6d
captcha window logic impl.
Oct 16, 2018
9c9e975
added edit sizes cases
Oct 16, 2018
d6be651
progress on site autofill bugs
Oct 16, 2018
eef9b9c
progress on site autofill bugs
Oct 16, 2018
1117e86
buggy site autofill fixed
walmat Oct 16, 2018
580f0b2
rm console log
walmat Oct 16, 2018
eafa011
small change in site matching logic
walmat Oct 16, 2018
cbd30a5
simplified site matching
walmat Oct 16, 2018
2891d49
hotfix for http site autofill matching
walmat Oct 16, 2018
ddce2a1
progress on updating taskReducers~ test
Oct 16, 2018
d9f7d5a
max 5 captcha windows + map to control them, still buggy
Oct 17, 2018
393db8e
fixed buggy captcha windows
Oct 18, 2018
47c0af0
clearing session still buggy, and closing a yt win -> trying to close…
Oct 18, 2018
b926440
captcha window manager split out
Oct 19, 2018
4d0db0a
progress on captcha window manager
walmat Oct 19, 2018
88d4032
closing all windows finished, closing consecutive captcha windows is …
walmat Oct 19, 2018
f2e608c
progress on youtube + captcha closing
walmat Oct 20, 2018
0a25bc5
fixed captcha windows + youtube pairing
walmat Oct 20, 2018
97162ce
fixed else clause
walmat Oct 20, 2018
b41ee6b
added closing youtube pair when captcha closes
walmat Oct 20, 2018
8f7767f
hotfix for closing all captchas -> youtubes
walmat Oct 20, 2018
7031be9
fixed taskReducer tests
walmat Oct 21, 2018
d1cfcbe
more test fixes
Oct 21, 2018
7595db6
pr changes
walmat Oct 21, 2018
9b12936
added recaptcha path to api
walmat Oct 21, 2018
071dac2
fixing broken tests progress
Oct 21, 2018
d4d3e6d
tests fixed
Oct 22, 2018
d1197f1
increase test coverage
Oct 22, 2018
eba7862
added in token check into constructor
walmat Oct 22, 2018
5aa79fb
updated init state in initialProxyOptionsState to match reducer
walmat Oct 22, 2018
3dac3c0
rm broken test error, oops!
Oct 23, 2018
18fafb3
fixed category foreach
walmat Oct 23, 2018
38f1f50
small changes/fixes
walmat Oct 23, 2018
3d804e2
fixed serverListReducer connect test
walmat Oct 23, 2018
17e9904
Merge branch 'issue_88' of https://github.com/walmat/nebula into issu…
walmat Oct 23, 2018
cd0e312
edits busted.. :(
walmat Oct 23, 2018
daf754f
fixed tokenContainer rename
walmat Oct 23, 2018
f656107
added more serverListReducer tests && progress on the taskReducer edi…
walmat Oct 23, 2018
918e207
updated flow from requested changes
walmat Oct 23, 2018
cd8c3ff
fixed renderer bug's test case
walmat Oct 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions frontend/lib/_electron/captchaWindowManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class CaptchaWindowManager {
/**
* Check harvested captcha tokens to see if they're expired or not
*/
static checkTokens() {
if (this._tokens.length > 0) {
checkTokens() {
if (this._tokens && this._tokens.length > 0) {
this._tokens.forEach((token) => {
token.setTimestamp(110 - moment().diff(moment(token.timestamp, 'seconds')));
if (this.isTokenExpired(token)) {
Expand All @@ -72,6 +72,7 @@ class CaptchaWindowManager {
} else {
// don't run the interval check if no tokens are present
clearInterval(this._checkTokens);
walmat marked this conversation as resolved.
Show resolved Hide resolved
this._checkTokens = null;
}
}

Expand Down Expand Up @@ -159,6 +160,9 @@ class CaptchaWindowManager {

_onRequestHarvestToken(ev, token, host, sitekey) {
this._tokens.push(new Token(token, moment(), host, sitekey));
if (this._checkTokens === null) {
this._checkTokens = setInterval(this.checkTokens, 1000);
}
}

/**
Expand Down
8 changes: 8 additions & 0 deletions frontend/lib/_electron/windowManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ class WindowManager {
} else if (this._captchas.size > 0) {
this._captchas.forEach((captchaWindowManager) => {
if (win.id === captchaWindowManager._captchaWindow.id) {
// deregister the interval from the captcha window
WindowManager.handleCloseCaptcha(this._captchas.get(win.id));
this._captchas.delete(win.id);
} else if (win.id === captchaWindowManager._youtubeWindow.id) {
captchaWindowManager._youtubeWindow = null;
Expand All @@ -205,6 +207,12 @@ class WindowManager {
};
}

static handleCloseCaptcha(win) {
win._tokens = [];
clearInterval(win._checkTokens);
win._checkTokens = null;
}

/**
* Function to handle the transition between main -> auth window
*/
Expand Down
65 changes: 0 additions & 65 deletions frontend/lib/common/classes/token.js

This file was deleted.

9 changes: 9 additions & 0 deletions frontend/lib/common/classes/tokenContainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class TokenContainer {
constructor(token, timestamp, host, sitekey) {
this._token = token;
this._timestamp = timestamp;
this._host = host;
this._sitekey = sitekey;
}
}
module.exports = TokenContainer;
5 changes: 1 addition & 4 deletions frontend/src/__tests__/constants/getAllSizes.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ describe('getAllSizes', () => {
});

it('should return correct category', () => {
expect(getCategory('Clothing')).toEqual(expectedSizes[0]);
expect(getCategory('US Men\'s')).toEqual(expectedSizes[1]);
expect(getCategory('UK Men\'s')).toEqual(expectedSizes[2]);
expect(getCategory('EU Men\'s')).toEqual(expectedSizes[3]);
expectedSizes.forEach(category => expect(getCategory(category.label)).toEqual(category));
});

it('should lookup the correct sizes', () => {
Expand Down
9 changes: 3 additions & 6 deletions frontend/src/__tests__/navbar/navbar.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ describe('<Navbar />', () => {
delete global.window.Bridge;
});

describe('when window Bridge is defined', () => {
it('should return name and version correctly', () => {
describe('should render name and version correctly', () => {
test('when window Bridge is defined', () => {
Bridge = {
getAppData: jest.fn(() => ({ name: 'Nebula Orion', version: '1.0.0' })),
};
Expand All @@ -63,10 +63,7 @@ describe('<Navbar />', () => {
expect(appName).toEqual('Nebula Orion');
expect(version).toEqual('1.0.0');
});
});

describe('when window Bridge is undefined', () => {
it('should return name and version correctly', () => {
test('when window Bridge is undefined', () => {
const wrapper = renderShallowWithProps();
const appName = wrapper.find('.appName').text();
const version = wrapper.find('.appVersion').text();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/__tests__/server/createProxies.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('<CreateProxies />', () => {
const destroyButton = getByTestId(wrapper, 'CreateProxies.destroyProxiesButton');
const generateButton = getByTestId(wrapper, 'CreateProxies.generateProxiesButton');
expect(numProxiesInput).toHaveLength(1);
expect(numProxiesInput.prop('value')).toBe('');
expect(numProxiesInput.prop('value')).toBe(0);
expect(locationSelect).toHaveLength(1);
expect(locationSelect.prop('value')).toBe(null);
expect(usernameInput).toHaveLength(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,27 @@ describe('server list reducer', () => {
expect(actual).toEqual(initialServerStates.serverList);
});

it.skip('should handle connect action', () => {
const newServerInfo = {
id: 2,
it('should handle connect action', () => {
const initial = [{
id: 1,
type: { id: 1, value: 'test_type', label: 'test_type_label' },
size: { id: 1, value: 'test_size', label: 'test_size_label' },
location: { id: 1, value: 'test_loc', label: 'test_loc_label' },
charges: 0,
charges: '0',
status: 'Initializing...',
};
}];

const expected = {
servers: [
newServerInfo,
],
coreServer: {
type: { id: 1, value: 'test_type', label: 'test_type_label' },
size: { id: 1, value: 'test_size', label: 'test_size_label' },
location: { id: 1, value: 'test_loc', label: 'test_loc_label' },
errors: {},
},
path: 'testing...',
};
const expected = [{
id: 1,
type: { id: 1, value: 'test_type', label: 'test_type_label' },
size: { id: 1, value: 'test_size', label: 'test_size_label' },
location: { id: 1, value: 'test_loc', label: 'test_loc_label' },
charges: '0',
status: 'Connected',
}];
const actual = serverListReducer(
initialServerStates.serverList,
{ type: SERVER_ACTIONS.CONNECT, serverInfo: expected },
initial,
{ type: SERVER_ACTIONS.CONNECT, action: null },
walmat marked this conversation as resolved.
Show resolved Hide resolved
);
expect(actual).toEqual(expected);
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/server/createProxies.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class CreateProxiesPrimitive extends Component {
<div className="col col--no-gutter">
<p className="proxy-options__label">Number</p>
<NumberFormat
value={serverInfo.proxyOptions.numProxies || ''}
value={serverInfo.proxyOptions.numProxies}
format="##"
placeholder="00"
className="proxy-options__input proxy-options__input--bordered proxy-options__input--number"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/settings/settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class SettingsPrimitive extends Component {
if (window.Bridge) {
window.Bridge.closeAllCaptchaWindows();
} else {
// TODO - error handling
console.error('Unable to close all windows');
walmat marked this conversation as resolved.
Show resolved Hide resolved
}
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/state/reducers/server/serverReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function serverReducer(state = initialServerStates.serverInfo, action) {
};
break;
case SERVER_FIELDS.EDIT_PROXY_NUMBER:
const intValue = parseInt(action.value, 10);
const intValue = action.value === '' ? 0 : parseInt(action.value, 10);
change = {
numProxies: Number.isNaN(intValue) ?
initialServerStates.proxyOptions.numProxies :
Expand Down Expand Up @@ -89,7 +89,7 @@ export function serverListReducer(state = initialServerStates.serverList, action
switch (action.type) {
case SERVER_ACTIONS.CONNECT:
const server = nextState.find(s => s.id);
server.status = 'connected';
server.status = 'Connected';
walmat marked this conversation as resolved.
Show resolved Hide resolved
break;
case SERVER_ACTIONS.CREATE:
// perform a deep copy of given profile
Expand Down
1 change: 0 additions & 1 deletion frontend/src/state/reducers/tasks/taskListReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export default function taskListReducer(state = initialTaskStates.list, action)
// Check if current task has been setup properly
if (updateTask.edits) {
// Set it up properly
console.log(updateTask.edits.product, updateTask.product);
updateTask.profile = updateTask.edits.profile || updateTask.profile;
updateTask.product = updateTask.edits.product || updateTask.product;
updateTask.site = updateTask.edits.site || updateTask.site;
Expand Down
47 changes: 30 additions & 17 deletions frontend/src/state/reducers/tasks/taskReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,38 @@ export function taskReducer(state = initialTaskStates.task, action) {
// If we are editing an existing task, only perform the change on valid edit fields
switch (action.field) {
case TASK_FIELDS.EDIT_PRODUCT: {
if (action.value) {
change = {
edits: {
...state.edits,
errors: Object.assign({}, state.edits.errors, action.errors),
product: {
raw: action.value,
},
},
};
} else {
change = {
edits: {
...state.edits,
errors: Object.assign({}, state.edits.errors, action.errors),
product: initialTaskStates.edit.product,
change = {
...state.edits,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go inside the edits object, not inside change itself. This is probably why the tests are all failing.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any tips?

if (action.value) {
            change = {
              edits: {
                ...state.edits,
                errors: Object.assign({}, state.edits.errors, action.errors),
                product: {
                  raw: action.value,
                },
              },
            };
            if (!action.value || !action.value.startsWith('http')) {
              break;
            }
            const URL = parseURL(action.value);
            if (!URL || !URL.path) {
              break;
            }
            const site = getAllSites().filter(s => s.value.split('/')[2] === URL.host);
            if (site.length === 0) {
              break;
            }
            console.log(change);
            change = {
              ...change,
              edits: {
                ...change.edits,
                site: {
                  url: site[0].value,
                  name: site[0].label,
                },
                username: null,
                password: null,
              },
            };
          } else {
            change = {
              edits: {
                ...state.edits,
                errors: Object.assign({}, state.edits.errors, action.errors),
                product: initialTaskStates.edit.product,
              },
            };
          }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need for the else case at the end? If we don't have a value passed with the action, there should be no change, right?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk I was working backwards and comparing it to when it worked. Seems to be a bug when edits.product === null

edits: {
errors: Object.assign({}, state.edits.errors, action.errors),
product: {
raw: action.value,
},
};
},
};
if (!action.value || !action.value.startsWith('http')) {
break;
}
const URL = parseURL(action.value);
if (!URL || !URL.path) {
break;
}
const site = getAllSites().filter(s => s.value.split('/')[2] === URL.host);
if (site.length === 0) {
break;
}
change = {
...change,
edits: {
...change.edits,
site: {
url: site[0].value,
name: site[0].label,
},
username: null,
password: null,
},
};
break;
}
case TASK_FIELDS.EDIT_SITE: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/definitions/server/proxyOptions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';

export const initialProxyOptionsState = {
numProxies: '',
numProxies: 0,
location: null,
username: '',
password: '',
Expand Down