File tree Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## [ 0.31.0] ( https://github.com/crowdsecurity/php-cs-bouncer/releases/tag/v0.31.0 ) - 2022-09-23
8
+ [ _ Compare with previous release_ ] ( https://github.com/crowdsecurity/php-cs-bouncer/compare/v0.30.0...v0.31.0 )
9
+
10
+ ### Changed
11
+ - Use Twig as template engine for ban and captcha walls
12
+
13
+ ---
7
14
8
15
## [ 0.30.0] ( https://github.com/crowdsecurity/php-cs-bouncer/releases/tag/v0.30.0 ) - 2022-09-22
9
16
[ _ Compare with previous release_ ] ( https://github.com/crowdsecurity/php-cs-bouncer/compare/v0.29.0...v0.30.0 )
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ public function getRemediationForIp(string $ip): string
151
151
}
152
152
153
153
/**
154
- * Returns a default "CrowdSec 403" HTML template to display to a web browser using a banned IP .
154
+ * Returns a default "CrowdSec 403" HTML template.
155
155
* The input $config should match the TemplateConfiguration input format.
156
156
*
157
157
* @param array $config An array of template configuration parameters
@@ -170,8 +170,14 @@ public static function getAccessForbiddenHtmlTemplate(array $config): string
170
170
}
171
171
172
172
/**
173
- * Returns a default "CrowdSec Captcha" HTML template to display to a web browser using a captchable IP .
173
+ * Returns a default "CrowdSec Captcha (401) " HTML template.
174
174
* The input $config should match the TemplateConfiguration input format.
175
+ *
176
+ * @param bool $error
177
+ * @param string $captchaImageSrc
178
+ * @param string $captchaResolutionFormUrl
179
+ * @param array $config
180
+ * @return string
175
181
*/
176
182
public static function getCaptchaHtmlTemplate (
177
183
bool $ error ,
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class Constants
20
20
public const DEFAULT_LAPI_URL = 'http://localhost:8080 ' ;
21
21
22
22
/** @var string The last version of this library */
23
- public const VERSION = 'v0.30 .0 ' ;
23
+ public const VERSION = 'v0.31 .0 ' ;
24
24
25
25
/** @var string The user agent used to send request to LAPI */
26
26
public const BASE_USER_AGENT = 'PHP CrowdSec Bouncer/ ' . self ::VERSION ;
Original file line number Diff line number Diff line change 2
2
3
3
namespace CrowdSecBouncer ;
4
4
5
+ use Twig \Error \LoaderError ;
6
+ use Twig \Error \RuntimeError ;
7
+ use Twig \Error \SyntaxError ;
5
8
use Twig \Loader \FilesystemLoader ;
6
9
use Twig \Environment ;
7
10
use Twig \TemplateWrapper ;
@@ -21,6 +24,14 @@ class Template
21
24
/** @var TemplateWrapper */
22
25
private $ template ;
23
26
27
+ /**
28
+ * @param string $path
29
+ * @param string $templatesDir
30
+ * @param array $options
31
+ * @throws LoaderError
32
+ * @throws RuntimeError
33
+ * @throws SyntaxError
34
+ */
24
35
public function __construct (string $ path , string $ templatesDir = Constants::TEMPLATES_DIR , array $ options = [])
25
36
{
26
37
$ loader = new FilesystemLoader ($ templatesDir );
You can’t perform that action at this time.
0 commit comments