altcha-org / altcha

GDPR compliant, self-hosted CAPTCHA alternative with PoW mechanism and advanced anti-spam filter.
https://altcha.org
MIT License
483 stars 16 forks source link

Ways to give progressbar to user #65

Closed DorianCoding closed 1 month ago

DorianCoding commented 1 month ago

Hello,

This self-hosted solution is very great. However we don't have any progressbar for the user that might wait a long time depending on its hardware. Obviously, this is because the server chooses a random number.

In the current implementation, it seems very worker to analyze between [max_number/x;max_number/(x+1)]. In this way, each worker covers a non-overlapping zone and we can implement as a progressbar the average progress of each worker independantly.

However it does not seem efficient because only one worker would get the result, it can be good to implement multiple challenges on different workers and finish when half or all of them are done and progress every time one challenge is made. If you have the un minimal version of altcha.js I can make a try and show what I think.

ovx commented 1 month ago

Hi, ad progress bar: this could be implemented, but the random number ranges from 0 to maxnumber and that would result in most cases to progress going up only to a few percent and jump to 100% because it's done. I don't see much value in this for the end-user, there already is indeterminate spinner indicator and I would rather recommend using a lower maxnumber. I see this as low priority feature.

ad workers: the current implementation splits the workload between multiple workers as you pointed out, there's also an abort controller to terminate all workers once any of them finds a solution, so the verification process finishes as soon as the solution is found. I don't quite understand you proposal, the source code is available in this repository, you can demonstrate what you mean.

DorianCoding commented 1 month ago

d progress bar: this could be implemented, but the random number ranges from 0 to maxnumber and that would result in most cases to progress going up only to a few percent and jump to 100% because it's done

Yes I agree on that this is why it should be many challenges...

there already is indeterminate spinner indicator

Which can be frustating for users depending on their hardware.

I don't quite understand you proposal

Sorry I'm not good in TS to show an example. image

Imagine the server sends 8 challenges:

ovx commented 1 month ago

This would be a big change in how the widget and server libraries work and I think it wouldn't bring much value.

If you need this feature, you can implement this as a custom component, the altcha-lib package contains everything necessary for challenges.

DorianCoding commented 1 month ago

This would be a big change in how the widget and server libraries work and I think it wouldn't bring much value.

It would if the hardware and the maximum number are different and a user is more willing to wait a progressbar than a spinner but I see your point. It's an ergonomic feature that might not worth the cost.

If you need this feature, you can implement this as a custom component, the altcha-lib package contains everything necessary for challenges.

Sure I will give it a try.