Commit Graph

32 Commits

Author SHA1 Message Date
e26bdd64f5
Added more comments. 2023-01-12 04:41:09 +04:00
f3e68f4c41
Added missing expiry changing. 2023-01-12 04:40:54 +04:00
f9154ab02f
Removed unnecessary guard around delete(). 2023-01-12 04:39:22 +04:00
fcb656d4ea
Module name was changet to git.arav.top/Arav/justcaptcha. 2023-01-08 18:49:33 +04:00
073384cc34
ExpiryDate() func was being used in just one place, so it was removed. 2023-01-08 18:21:46 +04:00
6e4242e6cd
Return of errors was removed from Image(), Solve(), IsSolved(), and Remove() methods. 2022-10-21 00:01:19 +04:00
c0d776fa40
Return of errors was removed for methods of CaptchaDB interface. 2022-10-20 23:50:42 +04:00
cc30010d3f
Field expireIn -> expiry. Comments were redacted. 2022-10-20 22:56:28 +04:00
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
4078bb03bc
InMemoryCaptchaDB is now within its own package alongside with an instance. 2022-10-20 22:52:13 +04:00
2c22ff00e6
Added comments for BaseCaptcha. Fixed comments for the Captcha interface. 2022-08-29 00:02:58 +04:00
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
4b0577f1bd
GetAnswer() method changed into Answer(). 2022-08-19 02:24:00 +04:00
a2bcff84d8
Fields for BaseCaptcha are made private. NewBaseCaptcha() constructor added. 2022-08-19 02:21:57 +04:00
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
b7ba27b613
Moved Solve() to be in order of an interface. Reduced a comment for BaseCaptcha struct. 2022-08-19 02:11:06 +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
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
d7a04516e3
Not found error moved to db.go where it belongs. 2022-07-30 15:44:02 +04:00
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
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
21e5ec118e
Added comment for CaptchaDB.GetExpiry(). 2022-06-27 03:19:39 +04:00
149675cd86
Fixed mutexes. Now program doesn't fall under high load.
Seems like an old expiry comparing didn't work as left thousands of expired captchas in a map, so it was replaced by a forgotten by me time.Since() function.
2022-06-27 02:48:55 +04:00
96c13ec6b2
Added support for different styles for CAPTCHA. 2022-06-27 01:20:36 +04:00
8f6ea671c6
Made use of mutex in a goroutine that cleans expired captchas. 2022-06-27 01:05:44 +04:00
b0d5f9d9d0
Embed sync.Mutex in CaptchaDB struct in order to directly call its methods. 2022-06-27 01:03:28 +04:00
b65f3be236
ID generating moved off to a separate function NewID(). 2022-06-27 01:02:24 +04:00
9ed5ad42e2
generateAnswer() function made into a private. And now being called by GetAnswer() method in Captcha. 2022-06-27 00:44:11 +04:00
10167c4e17
Added comments for ICaptcha interface. 2022-06-27 00:43:12 +04:00
28ceae169b
ID type moved to db.go file where it belongs. 2022-06-27 00:26:03 +04:00
508d44a512
In db.go GetExpireInterval() renamed to GetExpiry(). 2022-06-26 23:59:19 +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