Commit Graph

75 Commits

Author SHA1 Message Date
66998ff752
Use release archive instead of git. 2022-08-25 04:54:11 +04:00
3319649487
Removed '-git' from package name. 2022-08-24 21:22:54 +04:00
edab141532
Removed unnecessary quotes around a path to unix-socket. 2022-08-24 21:22:31 +04:00
f33bc7e650
Updated go.sum. 2022-08-24 21:21:54 +04:00
612b03e531
README minor change. 2022-08-19 21:37:51 +04:00
181f4870d7
Updated indirect dependencies. And go version to 1.18. 2022-08-19 02:31:02 +04:00
cdd861b944
Version changed to 1.1.2. 2022-08-19 02:26:03 +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
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
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
517ebb1689
Changed a description in systemd service file. 2022-08-17 21:53:31 +04:00
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
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
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
37060dd4ff
Minor version number incremented. 2022-07-29 21:10:46 +04:00
a31c995909
Better CAPTCHA image generation algorithm. 2022-06-27 20:48:39 +04:00
21e5ec118e
Added comment for CaptchaDB.GetExpiry(). 2022-06-27 03:19:39 +04:00
f2d7271111
Lets reduce string comparisons here. 2022-06-27 03:03:22 +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
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
ffbc79ce4b
In README.md added style query parameter for image endpoint and its description. 2022-06-27 01:21:16 +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
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
6307433ea0
Removed instantiating of Answer field in NewDwellingCaptcha(). 2022-06-27 00:44:42 +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
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
66d443183f
In README.md a little formatting change to highlight HTTP codes. 2022-06-26 21:03:11 +04:00
63e832c217
In README.md section Usage was added. 2022-06-26 21:01:47 +04:00