@akinon/next 1.25.0-rc.2 → 1.25.0-rc.4
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.
- package/CHANGELOG.md +17 -0
- package/api/auth.ts +11 -2
- package/api/client.ts +0 -1
- package/middlewares/complete-gpay.ts +2 -1
- package/middlewares/complete-masterpass.ts +2 -1
- package/middlewares/default.ts +3 -2
- package/middlewares/oauth-login.ts +3 -1
- package/middlewares/redirection-payment.ts +3 -1
- package/middlewares/three-d-redirection.ts +2 -1
- package/middlewares/url-redirection.ts +3 -0
- package/package.json +1 -1
- package/utils/app-fetch.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
+
## 1.25.0-rc.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 183674f: BRDG-9158: Handle locale prefix
|
|
8
|
+
- @akinon/eslint-plugin-projectzero@1.25.0-rc.4
|
|
9
|
+
|
|
10
|
+
## 1.25.0-rc.3
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 1289982: ZERO-2521: Add x-forwarded-for header to requests
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- @akinon/eslint-plugin-projectzero@1.25.0-rc.3
|
|
19
|
+
|
|
3
20
|
## 1.25.0-rc.2
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/api/auth.ts
CHANGED
|
@@ -80,14 +80,21 @@ const nextAuthOptions = (req: NextApiRequest, res: NextApiResponse) => {
|
|
|
80
80
|
const language = Settings.localization.locales.find(
|
|
81
81
|
(item) => item.value === credentials.locale
|
|
82
82
|
).apiValue;
|
|
83
|
+
const userIp = req.headers['x-forwarded-for']?.toString() ?? '';
|
|
83
84
|
|
|
84
85
|
headers.set('Content-Type', 'application/json');
|
|
85
86
|
headers.set('cookie', `${req.headers.cookie}`);
|
|
86
87
|
headers.set('Accept-Language', `${language}`);
|
|
87
88
|
headers.set('x-currency', req.cookies['pz-currency'] ?? '');
|
|
89
|
+
headers.set('x-forwarded-for', userIp);
|
|
90
|
+
headers.set(
|
|
91
|
+
'x-app-device',
|
|
92
|
+
req.headers['x-app-device']?.toString() ?? ''
|
|
93
|
+
);
|
|
88
94
|
|
|
89
95
|
logger.debug('Trying to login/register', {
|
|
90
|
-
formType: credentials.formType
|
|
96
|
+
formType: credentials.formType,
|
|
97
|
+
userIp
|
|
91
98
|
});
|
|
92
99
|
|
|
93
100
|
const apiRequest = await fetch(
|
|
@@ -99,7 +106,9 @@ const nextAuthOptions = (req: NextApiRequest, res: NextApiResponse) => {
|
|
|
99
106
|
}
|
|
100
107
|
);
|
|
101
108
|
|
|
102
|
-
logger.info(`Login/Register request result: ${apiRequest.status}
|
|
109
|
+
logger.info(`Login/Register request result: ${apiRequest.status}`, {
|
|
110
|
+
userIp
|
|
111
|
+
});
|
|
103
112
|
|
|
104
113
|
const response = (await apiRequest.json()) as {
|
|
105
114
|
key: string;
|
package/api/client.ts
CHANGED
|
@@ -43,7 +43,8 @@ const withCompleteGpay =
|
|
|
43
43
|
'X-Requested-With': 'XMLHttpRequest',
|
|
44
44
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
45
45
|
Cookie: `osessionid=${req.cookies.get('osessionid')?.value ?? ''}`,
|
|
46
|
-
'x-currency': req.cookies.get('pz-currency')?.value ?? ''
|
|
46
|
+
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
47
|
+
'x-forwarded-for': ip
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
try {
|
|
@@ -43,7 +43,8 @@ const withCompleteMasterpass =
|
|
|
43
43
|
'X-Requested-With': 'XMLHttpRequest',
|
|
44
44
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
45
45
|
Cookie: `osessionid=${req.cookies.get('osessionid')?.value ?? ''}`,
|
|
46
|
-
'x-currency': req.cookies.get('pz-currency')?.value ?? ''
|
|
46
|
+
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
47
|
+
'x-forwarded-for': ip
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
try {
|
package/middlewares/default.ts
CHANGED
|
@@ -97,7 +97,7 @@ const withPzDefault =
|
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
if (req.nextUrl.pathname.
|
|
100
|
+
if (req.nextUrl.pathname.includes('/orders/redirect-three-d')) {
|
|
101
101
|
return NextResponse.rewrite(
|
|
102
102
|
new URL(`${encodeURI(Settings.commerceUrl)}/orders/redirect-three-d/`)
|
|
103
103
|
);
|
|
@@ -139,7 +139,8 @@ const withPzDefault =
|
|
|
139
139
|
Cookie: req.headers.get('cookie') || '',
|
|
140
140
|
Accept: 'application/json',
|
|
141
141
|
'Content-Type': 'application/json',
|
|
142
|
-
'X-Requested-With': 'XMLHttpRequest'
|
|
142
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
143
|
+
'x-forwarded-for': ip
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
);
|
|
@@ -15,11 +15,13 @@ const withOauthLogin =
|
|
|
15
15
|
const loginCallbackUrlMatcherRegex = new RegExp(
|
|
16
16
|
/^\/(\w+)\/login\/callback\/?$/
|
|
17
17
|
);
|
|
18
|
+
const ip = req.headers.get('x-forwarded-for') ?? '';
|
|
18
19
|
|
|
19
20
|
const headers = {
|
|
20
21
|
'x-forwarded-host':
|
|
21
22
|
req.headers.get('x-forwarded-host') || req.headers.get('host') || '',
|
|
22
|
-
'x-currency': req.cookies.get('pz-currency')?.value ?? ''
|
|
23
|
+
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
24
|
+
'x-forwarded-for': ip
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
if (loginUrlMatcherRegex.test(url.pathname)) {
|
|
@@ -44,7 +44,9 @@ const withRedirectionPayment =
|
|
|
44
44
|
'X-Requested-With': 'XMLHttpRequest',
|
|
45
45
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
46
46
|
Cookie: req.headers.get('cookie') ?? '',
|
|
47
|
-
'x-currency': req.cookies.get('pz-currency')?.value ?? ''
|
|
47
|
+
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
48
|
+
'x-forwarded-for': ip
|
|
49
|
+
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
try {
|
|
@@ -43,7 +43,8 @@ const withThreeDRedirection =
|
|
|
43
43
|
'X-Requested-With': 'XMLHttpRequest',
|
|
44
44
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
45
45
|
Cookie: `osessionid=${req.cookies.get('osessionid')?.value ?? ''}`,
|
|
46
|
-
'x-currency': req.cookies.get('pz-currency')?.value ?? ''
|
|
46
|
+
'x-currency': req.cookies.get('pz-currency')?.value ?? '',
|
|
47
|
+
'x-forwarded-for': ip
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
try {
|
package/package.json
CHANGED
package/utils/app-fetch.ts
CHANGED