biz-slide-core 1.2.52 → 1.2.54
Sign up to get free protection for your applications and to get access to all the features.
package/entity/ppt.entity.js
CHANGED
@@ -28,6 +28,7 @@ var PPTSchema = new mongoose_1.Schema({
|
|
28
28
|
noOfSlides: { type: Number, default: null },
|
29
29
|
appName: { type: String, default: null },
|
30
30
|
navigateFromGPT: { type: Boolean, default: false },
|
31
|
+
googleDriveId: { type: String, default: null }
|
31
32
|
}, {
|
32
33
|
timestamps: true,
|
33
34
|
});
|
@@ -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,7 @@ var authorizeWithGpt = function () {
|
|
198
199
|
req.user = {
|
199
200
|
userId: userId,
|
200
201
|
ipAddress: ipAddress,
|
201
|
-
appName:
|
202
|
+
appName: secretKey[1],
|
202
203
|
navigateFromGPT: true
|
203
204
|
};
|
204
205
|
next();
|