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

Passing size in the captcha request doesn't make any difference #98

Closed
kringo opened this issue Dec 2, 2021 · 9 comments · Fixed by #153
Closed

Passing size in the captcha request doesn't make any difference #98

kringo opened this issue Dec 2, 2021 · 9 comments · Fixed by #153
Assignees
Milestone

Comments

@kringo
Copy link

kringo commented Dec 2, 2021

Tried the following request with additional size map but didn't make any difference

{"level":"easy","media":"image/png","input_type":"text","size":{"width":100,"height":50}}

Is this an issue or i'm doing something wrong here?

@hrj
Copy link
Contributor

hrj commented Dec 2, 2021

I think we are not yet respecting the size parameter. Thanks for bringing it to our attention!

@kringo
Copy link
Author

kringo commented Dec 2, 2021

copy that, will wait for the update. Thx.

@kringo
Copy link
Author

kringo commented Dec 10, 2021

Wondering if this didn't make the cut in v1.1.0?

@hrj
Copy link
Contributor

hrj commented Dec 11, 2021

@kringo No, it didn't. We haven't been actively committing to the code recently, so I thought cutting out a release of the past unreleased commits would help move the project forward. Now that I am aware of real world users, I might dedicate more time to this project.


Design idea for this issue

  • Define size buckets in the configuration file as an array of width and height. For example: [ [200, 150], [300, 200], [600, 400] ]
  • When creating CAPTCHAs in background thread, create them for each defined size bucket.
  • When serving CAPTCHAs, filter them by requested size.
  • In future, an improvement to save resources could be: background thread only replenishes the size buckets which have been consumed.
  • Another improvement could be: if the requested size doesn't match a configured size bucket, then find a CAPTCHA in the nearest matching size bucket and then scale it to requested size.

If anyone would like to take this up, please drop a comment.

@hrj hrj added this to the version 2.0 milestone Mar 1, 2022
@hrj hrj self-assigned this Mar 2, 2022
@hrj
Copy link
Contributor

hrj commented Mar 2, 2022

Just an update: I have started working on this. Images of the requested sizes are being created and served. The pending work is to scale the text to fit the requested size.

@kringo
Copy link
Author

kringo commented Mar 24, 2022

Thanks for the update @hrj, any thoughts to expect a release with these changes?

@hrj
Copy link
Contributor

hrj commented Mar 26, 2022

Sorry for the slow response; got busy with something else. I will hopefully get something out in April first week!

@kringo
Copy link
Author

kringo commented Mar 30, 2022

Thanks @hrj

@hrj hrj mentioned this issue Apr 4, 2022
@hrj hrj closed this as completed in #153 Apr 4, 2022
@hrj
Copy link
Contributor

hrj commented Apr 4, 2022

@kringo Just merged the changes for this issue. Do give it a try.

Note:

  • The API path is now changed to /v2 because an extra parameter (size is now required on the /captcha endpoint.
  • The config section for each Captcha now has an additional setting: allowedSizes
  • The Following Captcha Providers were modified to scale the text to fit the specified dimensions:
    • Shadow Text
    • Filter Challenge
    • Rain drops
    • Popping characters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants