biz-slide-core 1.2.48 → 1.2.50
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/entity/png-svg.entity.js
CHANGED
@@ -15,7 +15,8 @@ var PngSvgSchema = new mongoose_1.Schema({
|
|
15
15
|
title: { type: String, default: null },
|
16
16
|
styleCategory: { type: String, default: null },
|
17
17
|
styleSubCategory: { type: String, default: null },
|
18
|
-
colors: { type: [{ type: String, default: null }], default: null, _id: false }
|
18
|
+
colors: { type: [{ type: String, default: null }], default: null, _id: false },
|
19
|
+
appName: { type: String, default: null },
|
19
20
|
}, {
|
20
21
|
timestamps: true,
|
21
22
|
});
|
@@ -58,7 +58,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
58
58
|
return t;
|
59
59
|
};
|
60
60
|
Object.defineProperty(exports, "__esModule", { value: true });
|
61
|
-
exports.nonAuthorizeWithSlideApp = exports.authorizeWithSlideApp = exports.authorize = void 0;
|
61
|
+
exports.authorizeWithGpt = exports.nonAuthorizeWithSlideApp = exports.authorizeWithSlideApp = exports.authorize = void 0;
|
62
62
|
var utilities_1 = require("../utilities");
|
63
63
|
var entity_1 = require("../entity");
|
64
64
|
var authorize = function (roles) {
|
@@ -184,3 +184,26 @@ var nonAuthorizeWithSlideApp = function () {
|
|
184
184
|
};
|
185
185
|
};
|
186
186
|
exports.nonAuthorizeWithSlideApp = nonAuthorizeWithSlideApp;
|
187
|
+
var authorizeWithGpt = function () {
|
188
|
+
return function (req, res, next) {
|
189
|
+
return __awaiter(this, void 0, void 0, function () {
|
190
|
+
var secret, ipAddress, userId;
|
191
|
+
return __generator(this, function (_a) {
|
192
|
+
secret = req.headers['authorization'];
|
193
|
+
if (!secret || secret !== "Bearer ".concat(process.env.GPT_API_KEY)) {
|
194
|
+
return [2 /*return*/, res.status(401).json({ message: 'keys not matching' })];
|
195
|
+
}
|
196
|
+
ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
197
|
+
userId = "guest";
|
198
|
+
req.user = {
|
199
|
+
userId: userId,
|
200
|
+
ipAddress: ipAddress,
|
201
|
+
appName: "APP_CHATGPT"
|
202
|
+
};
|
203
|
+
next();
|
204
|
+
return [2 /*return*/];
|
205
|
+
});
|
206
|
+
});
|
207
|
+
};
|
208
|
+
};
|
209
|
+
exports.authorizeWithGpt = authorizeWithGpt;
|