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

Fix Basic Captcha Page Functionality #253

Merged
merged 4 commits into from
Jan 17, 2019
Merged

Fix Basic Captcha Page Functionality #253

merged 4 commits into from
Jan 17, 2019

Conversation

pr1sm
Copy link
Collaborator

@pr1sm pr1sm commented Jan 17, 2019

Changes

  • [Re]added a handler for starting captcha harvesting
  • Use protocol interceptors to get correct base url (this creates valid captcha tokens)
  • Add temporary workaround for variant group matching
    • Formats that include all regional sizes now only use the first size (usually US) when grouping
    • This is a temporary workaround until Variant Matching #239 is addressed
  • Fix various bugs related to Captcha window management
    • When harvesting stops, the captcha pages correctly reload to the "loading" animation
    • Attempting to create >5 captcha windows no longer causes a crash

Checks

  • CI passes
  • Coverage (<2%∆)
  • Manual Checks
    • The captcha window limit works (without crashing)
      • Attempt to create > 5 captcha windows and ensure only 5 are created
      • Ensure that captcha windows can be created again once the total number is under the limit
    • Captcha Harvesting works when no window is open initially
      • Close all captcha windows
      • Create a task that requires a captcha (e.g. a task on haven)
      • Run the task
      • Ensure a captcha window gets created
      • Ensure captcha harvesting works and creates a valid token
    • Captcha Harvesting works when window is open initially
      • Perform the same steps in the check above, but have >0 captcha windows open before the task starts

Follow Up Items

Some larger captcha issues have not been addressed in this PR since they are out of the scope. The following table includes the bugs and any issues that have been created to track them.

Issue Description
#106 After harvesting has started, new captcha windows don't start harvesting as well
#257 Captcha windows should work when multiple tasks require tokens at the same time
#272 Captcha Window reloading should be faster when multiple windows exist
#273 A dialog should warn users that the maximum captcha window limit has been reached
#274 Captcha prefetching functionality should be added

fixes #204

This commit adds a missing handler for the captcha state. This uses the checkouts handle request captcha method to request a captcha and wait for the token. The handler has also been updated to include error checking.
This commit adds a protocol interceptor to load our captcha html instead of the regular html for other sites.

This commit also updates the captcha server middleware stack to better handle loading assets such as images/styling/js while still redirecting everything else to the captcha html page.

Issue: #204
Some sites include unsupported size option values, which affects our variant group matching. This commit adds a temporary workaround until the actual issue (#239) is addressed.

Additionally, a linter error is fixed, some unnecessary log statements are removed, and another log statement is adjusted to only display relevant information.
This commit addresses some (not all!) captcha related bugs:
- Captcha Window Reloads are now handled properly
- Redundant Captcha Reset calls are removed
- Captcha Windows don't get reset in the middle of harvesting
- Attempting to add >5 captcha windows no longer crashes the frontend

These are some small bugs that fall under the scope of this branch. Other larger bugs that require separate issues are not fixed in this commit.
@pr1sm pr1sm added area:frontend Related to Nebula's Frontend Electron app area:task-runner Related to Nebula's Task Runner package labels Jan 17, 2019
@pr1sm pr1sm added this to the Beta 3 Release milestone Jan 17, 2019
@pr1sm pr1sm requested a review from walmat January 17, 2019 02:41
Copy link
Owner

@walmat walmat left a comment

Choose a reason for hiding this comment

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

Good work! Just a couple questions / comments

@@ -4,6 +4,8 @@ const path = require('path');

const express = require('express');
const bodyParser = require('body-parser');
// eslint-disable-next-line import/no-extraneous-dependencies
Copy link
Owner

Choose a reason for hiding this comment

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

is there a way to change our linter settings to recognize this? I see this popping up in a lot of files, and I'm not sure if we can just override it globally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah there is a way to disable this globally using the .eslintrc.js file. The full configuration is available here.

I don't think we should globally disable the rule since it covers a wide variety of potential errors. Unfortunately, it covers this electron case because we need electron listed as a devDependency instead of a regular dependency (for building to work properly). I noticed there was an option disable this error for all devDependencies, but I'm also a little wary about doing that since electron is a special case (it should be considered a regular dependency as opposed to other devDependencies).

I can mess around with the settings and see if we can change this to a warn, or whitelist 'electron' as a valid case.

Copy link
Owner

Choose a reason for hiding this comment

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

Sounds good! I’ll approve for now 👍🏼

@pr1sm
Copy link
Collaborator Author

pr1sm commented Jan 17, 2019

merging...

@pr1sm pr1sm merged commit 37c37ea into master Jan 17, 2019
@pr1sm pr1sm deleted the issue_204 branch January 17, 2019 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:frontend Related to Nebula's Frontend Electron app area:task-runner Related to Nebula's Task Runner package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Captcha Harvester "ERROR for site owner: Invalid domain for site key"
2 participants