create-prisma-php-app 1.27.0 → 1.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,15 @@ final class AuthMiddleware
18
18
  $isPublicRoute = self::matches($requestPathname, AuthConfig::$publicRoutes);
19
19
  $isAuthRoute = self::matches($requestPathname, AuthConfig::$authRoutes);
20
20
 
21
+ // Check if the user is authenticated and refresh the token if necessary
22
+ if (AuthConfig::IS_TOKEN_AUTO_REFRESH) {
23
+ $auth = Auth::getInstance();
24
+ if (isset($_COOKIE[Auth::COOKIE_NAME])) {
25
+ $jwt = $_COOKIE[Auth::COOKIE_NAME];
26
+ $jwt = $auth->refreshToken($jwt);
27
+ }
28
+ }
29
+
21
30
  // Skip the middleware if the route is api auth route
22
31
  if ($isApiAuthRoute) {
23
32
  return;
@@ -54,7 +54,22 @@ class TemplateCompiler
54
54
  public static function convertToXml(string $templateContent): DOMDocument
55
55
  {
56
56
  // Escape `&` characters that are not part of valid XML entities
57
- $templateContent = preg_replace('/&(?![a-zA-Z0-9#]+;)/', '&', $templateContent);
57
+ $templateContent = preg_replace_callback(
58
+ '/&(.*?)/',
59
+ function ($matches) {
60
+ $str = $matches[0];
61
+
62
+ // If it already looks like a valid entity, leave it alone.
63
+ // This check can be as simple or as robust as you need.
64
+ if (preg_match('/^&(?:[a-zA-Z]+|#[0-9]+|#x[0-9A-Fa-f]+);$/', $str)) {
65
+ return $str;
66
+ }
67
+
68
+ // Otherwise, escape it.
69
+ return '&' . substr($str, 1);
70
+ },
71
+ $templateContent
72
+ );
58
73
 
59
74
  $dom = new DOMDocument();
60
75
  libxml_use_internal_errors(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.27.0",
3
+ "version": "1.27.2",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",