Commit Graph

99 Commits

Author SHA1 Message Date
Alexander Andreev 29e4666bd9
Mention of 404 error was removed from GET /:captcha_id description. 2022-10-21 00:03:09 +04:00
Alexander Andreev 6e4242e6cd
Return of errors was removed from Image(), Solve(), IsSolved(), and Remove() methods. 2022-10-21 00:01:19 +04:00
Alexander Andreev c0d776fa40
Return of errors was removed for methods of CaptchaDB interface. 2022-10-20 23:50:42 +04:00
Alexander Andreev cebf4b572f
README updated. 404 codes for solving was removed. 2022-10-20 23:50:02 +04:00
Alexander Andreev be2f34f629
http.Error() func is used to send error messages and codes. 2022-10-20 23:16:30 +04:00
Alexander Andreev 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
Alexander Andreev cc30010d3f
Field expireIn -> expiry. Comments were redacted. 2022-10-20 22:56:28 +04:00
Alexander Andreev d9aba868db
db.go. InMemoryCaptchaDB was moved out. ErrorNotFound is now public. And DefaultExpiredScanInterval is now a public const. For more security a string of random data added to the end of a hash. 2022-10-20 22:55:37 +04:00
Alexander Andreev 4078bb03bc
InMemoryCaptchaDB is now within its own package alongside with an instance. 2022-10-20 22:52:13 +04:00
Alexander Andreev 0e0c91b5c2
instance.go was removed and its content was made as part of InMemoryCaptchaDB. 2022-10-20 22:51:32 +04:00
Alexander Andreev b155900579
GET / was changed to POST / for a new CAPTCHA creation. And now captcha db is being initialised in handlers. 2022-10-20 22:50:49 +04:00
Alexander Andreev aa6534aa98
DwellingCaptcha's package was renamed to dwcaptcha. 2022-10-20 22:49:46 +04:00
Alexander Andreev 07c8a90ada
README updated. 2022-10-20 22:49:08 +04:00
Alexander Andreev fa47cfa20e
Updated version to 2.0.0. 2022-10-20 22:48:20 +04:00
Alexander Andreev 2c121322cf
Updated dependencies. 2022-10-20 22:47:57 +04:00
Alexander Andreev 2c22ff00e6
Added comments for BaseCaptcha. Fixed comments for the Captcha interface. 2022-08-29 00:02:58 +04:00
Alexander Andreev d24b710ee5
Forgot about README. Version is changed there as well. 2022-08-28 23:37:58 +04:00
Alexander Andreev bc800f0472
A version is increased to 1.2.0. 2022-08-28 23:35:24 +04:00
Alexander Andreev 7e506ee982
A README was rewritten and complemented with a new behavior of a GET /:id endpoint. 2022-08-28 23:33:59 +04:00
Alexander Andreev 691659c2d0
Added a Remove() method to a DB instance. 2022-08-28 23:32:42 +04:00
Alexander Andreev 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
Alexander Andreev 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
Alexander Andreev c90f5db3a8
Added Remove() method. CAPTCHA word is capitalised in comments. In IsSolved() method of a DB a CAPTCHA's IsSolved method is now called within a return statement. 2022-08-28 23:27:54 +04:00
Alexander Andreev 4a7dce3327
Oops, removed file renaming. 2022-08-25 04:58:39 +04:00
Alexander Andreev 66998ff752
Use release archive instead of git. 2022-08-25 04:54:11 +04:00
Alexander Andreev 3319649487
Removed '-git' from package name. 2022-08-24 21:22:54 +04:00
Alexander Andreev edab141532
Removed unnecessary quotes around a path to unix-socket. 2022-08-24 21:22:31 +04:00
Alexander Andreev f33bc7e650
Updated go.sum. 2022-08-24 21:21:54 +04:00
Alexander Andreev 612b03e531
README minor change. 2022-08-19 21:37:51 +04:00
Alexander Andreev 181f4870d7
Updated indirect dependencies. And go version to 1.18. 2022-08-19 02:31:02 +04:00
Alexander Andreev cdd861b944
Version changed to 1.1.2. 2022-08-19 02:26:03 +04:00
Alexander Andreev 4b0577f1bd
GetAnswer() method changed into Answer(). 2022-08-19 02:24:00 +04:00
Alexander Andreev c6bd1a6185
NewBaseCaptcha() constructor is being used now. 2022-08-19 02:22:16 +04:00
Alexander Andreev a2bcff84d8
Fields for BaseCaptcha are made private. NewBaseCaptcha() constructor added. 2022-08-19 02:21:57 +04:00
Alexander Andreev 7737c360d0
Struct's fields made private. expireScanInterval made into a field. SetExpiry() removed. Now go routine for expiry check is in a cleanExpired() private method and being called by a constructor. Implemented a constructor for InMemoryCaptchaDB. 2022-08-19 02:15:34 +04:00
Alexander Andreev b7ba27b613
Moved Solve() to be in order of an interface. Reduced a comment for BaseCaptcha struct. 2022-08-19 02:11:06 +04:00
Alexander Andreev 0bd37dc5fa
NewDwellingCaptcha is now called by an instance. 2022-08-19 02:09:43 +04:00
Alexander Andreev 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
Alexander Andreev 517ebb1689
Changed a description in systemd service file. 2022-08-17 21:53:31 +04:00
Alexander Andreev ec10db27a5
A version increased to 1.1.1. And a version now is being passed from ldflags in a Makefile. 2022-08-17 21:49:57 +04:00
Alexander Andreev 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
Alexander Andreev 18431e0001
A function for generating an answer was transformed into a constructor with specified type of integer in its name. maxAnswer constant renamed to maxIntAnswer. 2022-08-17 21:46:10 +04:00
Alexander Andreev d7a04516e3
Not found error moved to db.go where it belongs. 2022-07-30 15:44:02 +04:00
Alexander Andreev 925d48c10d
ICaptchaDB interface renamed to CaptchaDB. And implementation was renamed to InMemoryCaptchaDB. Composition of sync.Mutex was moved to the top of struct. Methods was rearranged to resemble order from CaptchaDB interface. 2022-07-30 15:39:19 +04:00
Alexander Andreev c14f9b0149
ICaptcha interface renamed to Captcha. generateImage() method removed. Instead image is being generated returned by value in Image() method that formely was named a GetImage() method. Base captcha implementation renamed to BaseCaptcha. 2022-07-30 15:37:05 +04:00
Alexander Andreev f5ea776e87
handlers.go. Now image is being returned by value. 2022-07-30 15:35:13 +04:00
Alexander Andreev f35c16f837
CAPTCHA implementation changed to a new interface. And now composes from BaseCaptcha struct. 2022-07-30 15:33:34 +04:00
Alexander Andreev f7439eb282
Changed interface and DB struct name in instance.go. 2022-07-30 15:31:47 +04:00
Alexander Andreev 37060dd4ff
Minor version number incremented. 2022-07-29 21:10:46 +04:00
Alexander Andreev a31c995909
Better CAPTCHA image generation algorithm. 2022-06-27 20:48:39 +04:00