-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add Captcha Support #104
Add Captcha Support #104
Conversation
@walmat I think this PR is complete feature wise -- ready for your review. If you could test out the checks in the OP and let me know if there are any errors, that would be great too! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. Just wow. Excellent work man! Just some small touch ups. Most of them were your own TODO tags, so if you're planning on doing them after this PR, just ignore those!
Super good work as usual 👍
This commit adds a handler that gets called when task captcha events are emitted from the TaskManager. These events are related to starting/stopping harvesting tokens for a specific task. These events will call a method on the window manager to handle showing/spawning captcha windows. The specific event handler body/parameters are subject to change as the task manager development is still in progress.
This commit adds stubs to the window manager for handling the starting/stopping of captcha harvesting. These methods will be implemented next Windows might need to get allocated for a specific task -- Stubs are added for that case. If this isn't needed, they can be removed.
This commit adds more progress to connect the start/stop harvest events to the captcha window. The harvest events flow from the window manager to the captcha window managers to the captcha windows themselves. Handlers were added to listen for the correct events and properly load the captcha when it is necessary.
This commit adds a new Captcha Server Manager that starts when the captcha windows are opened. This is necessary for the captcha to render properly.
This commit updates the captcha server manager to dynamically choose a root dir for what to server based on the environment. This prevents the need to rebuild the frontend every time a change is made to captcha html/js
This commit adjusts the captcha html to add the js into a separate file. This simplifies the html file, and isolates all js to a single place.
This commit changes the source of the sitekey, so it can be added dynamically if needed. A default sitekey is used if no key is given.
This commit adds a hook for harvesting captcha tokens from the captcha windows for the task manager wrapper. This will allow a direct handler to link the captcha token back to the task manager.
This commit adds a new queue data structure that allows synchronous inserts, but asynchronous returns. This will be used as the structure for the captcha queues in TaskManager.
This commit updates the task manager captcha handling to use AsyncQueues for handling the register/deregister captcha functions. This allows the register call to act like a promise even though updates are triggered through event handlers. The constants map was updated to include events for the TaskManager. This is used to standardize event channels surrounding captcha events.
This commit adjusts the implementation of the TaskRunner and Checkout to connect captcha related code to the new TaskManager captcha methods.
This commit updates the frontend's TaskManagerWrapper to correctly bind/call the right events to link harvesting captchas.
This commit fixes the flow for checkout connections now that the captcha request has been implemented.
This commit updates the WindowManager to automatically open a new captcha window if it receives a harvest request and no captcha windows are already open. This means that even if the user forgets to open the window, they will still be able to complete the captcha request.
This commit updates the task manager wrapper to handle a new debug command to view all the harvested tokens. The preload now listens to and prints out responses of debug events.
This commit transitions the task manager to keep a queue of reserved spaces for captcha tokens. This is under the assumption that currently all captchas use the same sitekey. Instead of allocating windows to specific runners. The tokens come in to the task manager and are assigned on a first come, first serve basis to running queues. This allows the tokens to be spread evenly among running tasks.
This commit fixes a failing unit tests due to adding blends as a supported site.
Rebased onto master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Merge 👍
merging... |
Changes
TaskManager
TaskManager
fromfrontend
Checks
debug
command when in dev envwindow.Bridge.sendDebugCmd('testStartHarvest')
(or load/run a task manually)window.Bridge.sendDebugCmd('viewHarvestedFrontendTokens')
)debug
command when in dev envfixes #65