biz-slide-core 1.2.51 → 1.2.53
Sign up to get free protection for your applications and to get access to all the features.
@@ -187,10 +187,11 @@ exports.nonAuthorizeWithSlideApp = nonAuthorizeWithSlideApp;
|
|
187
187
|
var authorizeWithGpt = function () {
|
188
188
|
return function (req, res, next) {
|
189
189
|
return __awaiter(this, void 0, void 0, function () {
|
190
|
-
var secret, ipAddress, userId;
|
190
|
+
var secret, secretKey, ipAddress, userId;
|
191
191
|
return __generator(this, function (_a) {
|
192
192
|
secret = req.headers['authorization'];
|
193
|
-
|
193
|
+
secretKey = secret ? secret.split(":") : undefined;
|
194
|
+
if (secretKey && secretKey.length === 2 && secretKey[0] !== "Bearer ".concat(process.env.GPT_API_KEY)) {
|
194
195
|
return [2 /*return*/, res.status(401).json({ message: 'keys not matching' })];
|
195
196
|
}
|
196
197
|
ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
@@ -198,7 +199,8 @@ var authorizeWithGpt = function () {
|
|
198
199
|
req.user = {
|
199
200
|
userId: userId,
|
200
201
|
ipAddress: ipAddress,
|
201
|
-
appName:
|
202
|
+
appName: secretKey[1],
|
203
|
+
navigateFromGPT: true
|
202
204
|
};
|
203
205
|
next();
|
204
206
|
return [2 /*return*/];
|