Commit Graph

47 Commits

Author SHA1 Message Date
0311a391ed
Replace arav.top with arav.su. 2023-03-05 00:18:52 +04:00
fcb656d4ea
Module name was changet to git.arav.top/Arav/justcaptcha. 2023-01-08 18:49:33 +04:00
6ab62fc43b
getURLParam() was made into a private module func. 2023-01-08 17:53:13 +04:00
ea9877f6c4
HTTP server and handlers were restructurised. 2023-01-08 17:49:03 +04:00
d7599bdf46
HTTP server moved to internal. DwellingCaptcha moved to pkg. 2023-01-08 17:00:19 +04:00
6e4242e6cd
Return of errors was removed from Image(), Solve(), IsSolved(), and Remove() methods. 2022-10-21 00:01:19 +04:00
be2f34f629
http.Error() func is used to send error messages and codes. 2022-10-20 23:16:30 +04:00
93e1344846
Handlers are edited to work with modified interfaces. Status codes are changed. Now 404 is not being returned if parameter ?remove was set. 2022-10-20 22:58:14 +04:00
0e0c91b5c2
instance.go was removed and its content was made as part of InMemoryCaptchaDB. 2022-10-20 22:51:32 +04:00
aa6534aa98
DwellingCaptcha's package was renamed to dwcaptcha. 2022-10-20 22:49:46 +04:00
691659c2d0
Added a Remove() method to a DB instance. 2022-08-28 23:32:42 +04:00
0b064e8977
Added a remove URL query parameter for IsSolved() handler. Calls a Remove() method of a DB. 2022-08-28 23:32:16 +04:00
ae67f6aa4f
PNG was replaced by JPEG because of smaller image sizes. ~11.5KB for PNG vs just <2KB for JPEG with 20% quality. 2022-08-28 23:30:38 +04:00
4b0577f1bd
GetAnswer() method changed into Answer(). 2022-08-19 02:24:00 +04:00
c6bd1a6185
NewBaseCaptcha() constructor is being used now. 2022-08-19 02:22:16 +04:00
0bd37dc5fa
NewDwellingCaptcha is now called by an instance. 2022-08-19 02:09:43 +04:00
916b85500d
captchaDb is now of type CaptchaDB interface. Use a constructor for InMemoryCaptchaDB.
A new captcha is now being created here instead of passed as an argument.
2022-08-19 02:09:01 +04:00
59bd479ebe
Image now passed by a pointer instead of value. Hope it will help with memory consumption a little. 2022-08-17 21:47:27 +04:00
f5ea776e87
handlers.go. Now image is being returned by value. 2022-07-30 15:35:13 +04:00
f35c16f837
CAPTCHA implementation changed to a new interface. And now composes from BaseCaptcha struct. 2022-07-30 15:33:34 +04:00
f7439eb282
Changed interface and DB struct name in instance.go. 2022-07-30 15:31:47 +04:00
a31c995909
Better CAPTCHA image generation algorithm. 2022-06-27 20:48:39 +04:00
f2d7271111
Lets reduce string comparisons here. 2022-06-27 03:03:22 +04:00
a3faf8b9c9
Made use of a new style name feature and implemented a dark style, and now by default light version is being rendered. 2022-06-27 01:30:28 +04:00
504a8d137f
A simple refactor of generateImage() rearranging method calls in for loops. 2022-06-27 01:25:28 +04:00
96c13ec6b2
Added support for different styles for CAPTCHA. 2022-06-27 01:20:36 +04:00
0957102169
Removed reduntant cast to captcha.ID. 2022-06-27 01:13:25 +04:00
c92d02f4e4
Let instance actually use GetExpiry() method. 2022-06-27 01:10:52 +04:00
6307433ea0
Removed instantiating of Answer field in NewDwellingCaptcha(). 2022-06-27 00:44:42 +04:00
9e7f3a2728
When I moved implementation to pkg directory an error appeared that DwellingCaptcha doesn't implement generateImage() method. And these methods was copied here to resolve this problem. But, actual fix was implementing an empty generateImage() method for base Captcha struct. 2022-06-26 23:57:16 +04:00
8053952122
Captcha implementation was moved off to pkg directory to be able to be used as an external library. 2022-06-26 23:53:52 +04:00
a2f4ce30f5
Removed unneded dependency on github.com/pkg/errors. 2022-06-26 23:24:10 +04:00
96e8cf0c97
Methods Solve, GetAnswer, IsSolved, and Expiry could be implemented once for a base Captcha struct. But GetImage and generateImage methods should be implemented by all structs that compose with base Captcha struct. 2022-06-26 22:02:38 +04:00
9658bbd755
In db.go method GetExpiry() placed next to SetExpiry() method. 2022-06-26 21:28:22 +04:00
70195a666e
In ICaptcha inteface GenerateImage() method was modified into private. 2022-06-26 21:01:27 +04:00
a23c80ae88
GenerateImage() method was changed to be private. 2022-06-26 21:00:06 +04:00
3ebfcb2c95
In handlers.go GetExpireInterval() changed to GetExpiry(). 2022-06-26 20:54:15 +04:00
3251b68629
In instance.go GetExpireInterval() changed to GetExpiry(). And changed name of corresponding field of CaptchaDB to ExpireIn. 2022-06-26 20:53:48 +04:00
bb4b3bd1ba
Method Expire() changed to Expiry(). 2022-06-26 20:52:29 +04:00
f7d55b9c44
In dwelling_captcha.go. Renamed ExpireDate() to ExpiryDate(). In NewDwellingCaptcha() argument expiration changed to expiry. 2022-06-26 20:51:04 +04:00
1dd070abd4
Refactor of db.go to change expiration and expire to expiry. ExpireInterval field renamed to ExpireIn. 2022-06-26 20:49:43 +04:00
2e3d41a628
Changed Expire() method in ICaptcha to Expiry().
ExpireDate() changed to ExpiryDate() and its argument expiration changed to expiry.
2022-06-26 20:47:25 +04:00
be4050d1f5
Removed excessive variable n, and multiplying by time.Second. 2022-06-26 20:36:36 +04:00
7a7c3107d8
Added GetExpireInterval() wrapper for CaptchaDB instance. 2022-06-26 15:46:23 +04:00
4af8d67299
Expiration time now being get from CaptchaDB. 2022-06-26 15:45:42 +04:00
c5d159531c
Added GetExpireInterval() method to DB. 2022-06-26 15:44:41 +04:00
21b2f24986
Initial commit with a fully working program, lel. 2022-06-24 23:09:46 +04:00