@wrcb/cb-common 1.0.456 → 1.0.458
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.
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import multer from 'multer';
|
|
2
2
|
import { Request, Response, NextFunction } from 'express';
|
|
3
3
|
import { UploadResult } from '../storage/types';
|
|
4
|
+
interface ExtendedField extends multer.Field {
|
|
5
|
+
maxSizeMB?: number;
|
|
6
|
+
}
|
|
4
7
|
declare global {
|
|
5
8
|
namespace Express {
|
|
6
9
|
interface Request {
|
|
7
10
|
uploadResults?: UploadResult[];
|
|
8
11
|
uploadResultsByField?: Record<string, UploadResult[]>;
|
|
12
|
+
_uploadFieldConfig?: ExtendedField[];
|
|
9
13
|
}
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
export declare const uploadMedia: {
|
|
13
17
|
single: (fieldName: string) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
14
18
|
multiple: (fieldName: string, maxCount?: number) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
15
|
-
fields: (fields:
|
|
19
|
+
fields: (fields: ExtendedField[]) => (req: Request, res: Response, next: NextFunction) => void;
|
|
16
20
|
processUpload: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
17
21
|
};
|
|
22
|
+
export {};
|
|
@@ -17,36 +17,60 @@ const multer_1 = __importDefault(require("multer"));
|
|
|
17
17
|
const factory_1 = require("../storage/factory");
|
|
18
18
|
const tenant_1 = require("../types/tenant");
|
|
19
19
|
const storageService_1 = require("../storage/services/storageService");
|
|
20
|
+
const badRequestError_1 = require("../errors/badRequestError");
|
|
20
21
|
const storage = multer_1.default.memoryStorage();
|
|
21
22
|
const upload = (0, multer_1.default)({ storage });
|
|
22
23
|
exports.uploadMedia = {
|
|
23
24
|
single: (fieldName) => upload.single(fieldName),
|
|
24
25
|
multiple: (fieldName, maxCount) => upload.array(fieldName, maxCount),
|
|
25
|
-
fields: (fields) =>
|
|
26
|
+
fields: (fields) => {
|
|
27
|
+
// apenas os campos esperados pelo multer
|
|
28
|
+
const multerFields = fields.map(({ name, maxCount }) => ({
|
|
29
|
+
name,
|
|
30
|
+
maxCount
|
|
31
|
+
}));
|
|
32
|
+
const middleware = upload.fields(multerFields);
|
|
33
|
+
return (req, res, next) => {
|
|
34
|
+
req._uploadFieldConfig = fields; // salva os dados personalizados
|
|
35
|
+
middleware(req, res, next);
|
|
36
|
+
};
|
|
37
|
+
},
|
|
26
38
|
processUpload: (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
39
|
try {
|
|
28
40
|
const storageService = new storageService_1.StorageService(factory_1.StorageFactory.create());
|
|
29
41
|
const tenant = req.headers['x-tenant'] || tenant_1.Tenant.PoliticaBet;
|
|
30
|
-
// Lidar com diferentes tipos de upload
|
|
31
42
|
let allFiles = [];
|
|
32
43
|
if (req.file) {
|
|
33
|
-
// Single file
|
|
34
44
|
allFiles = [req.file];
|
|
35
45
|
}
|
|
36
46
|
else if (req.files) {
|
|
37
47
|
if (Array.isArray(req.files)) {
|
|
38
|
-
// Multiple files (array)
|
|
39
48
|
allFiles = req.files;
|
|
40
49
|
}
|
|
41
50
|
else {
|
|
42
|
-
// Fields (object)
|
|
43
51
|
allFiles = Object.values(req.files).flat();
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
|
-
if (!allFiles.length)
|
|
54
|
+
if (!allFiles.length)
|
|
47
55
|
return next();
|
|
56
|
+
// Validação baseada no maxSizeMB por campo
|
|
57
|
+
const fieldConfig = req._uploadFieldConfig || [];
|
|
58
|
+
const getMaxSizeForField = (fieldName) => {
|
|
59
|
+
const field = fieldConfig.find(f => f.name === fieldName);
|
|
60
|
+
return (field === null || field === void 0 ? void 0 : field.maxSizeMB) ? field.maxSizeMB * 1024 * 1024 : undefined;
|
|
61
|
+
};
|
|
62
|
+
for (const file of allFiles) {
|
|
63
|
+
const isVideo = file.mimetype.startsWith('video/');
|
|
64
|
+
const isImage = file.mimetype.startsWith('image/');
|
|
65
|
+
if (!isImage && !isVideo) {
|
|
66
|
+
throw new badRequestError_1.BadRequestError('InvalidFileType');
|
|
67
|
+
}
|
|
68
|
+
const maxSize = getMaxSizeForField(file.fieldname);
|
|
69
|
+
if (maxSize && file.size > maxSize) {
|
|
70
|
+
throw new badRequestError_1.BadRequestError(isImage ? 'ImageTooLarge' : 'VideoTooLarge');
|
|
71
|
+
}
|
|
48
72
|
}
|
|
49
|
-
//
|
|
73
|
+
// Enviar para serviço de armazenamento
|
|
50
74
|
const uploadPromises = allFiles.map((file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
75
|
var _a;
|
|
52
76
|
const isVideo = file.mimetype.startsWith('video/');
|
|
@@ -58,16 +82,13 @@ exports.uploadMedia = {
|
|
|
58
82
|
type,
|
|
59
83
|
generateThumbnail: true
|
|
60
84
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
else {
|
|
65
|
-
return storageService.uploadImage(file.buffer, file.originalname, options);
|
|
66
|
-
}
|
|
85
|
+
return isVideo
|
|
86
|
+
? storageService.uploadVideo(file.buffer, file.originalname, options)
|
|
87
|
+
: storageService.uploadImage(file.buffer, file.originalname, options);
|
|
67
88
|
}));
|
|
68
89
|
const results = yield Promise.all(uploadPromises);
|
|
69
90
|
req.uploadResults = results;
|
|
70
|
-
// Organizar
|
|
91
|
+
// Organizar por campo se necessário
|
|
71
92
|
if (req.files && !Array.isArray(req.files)) {
|
|
72
93
|
req.uploadResultsByField = {};
|
|
73
94
|
let index = 0;
|
|
@@ -174,8 +174,7 @@ TenantDataService.tenantDataMap = {
|
|
|
174
174
|
[tenant_1.Tenant.PrivateShow]: {
|
|
175
175
|
TENANT: tenant_1.Tenant.PrivateShow,
|
|
176
176
|
SITE_NAME: 'PromoteView',
|
|
177
|
-
SITE_URL: '
|
|
178
|
-
// SITE_URL: 'https://privateshow.com.br:32660', // Porta HTTPS do nodeport
|
|
177
|
+
SITE_URL: 'https://privateshow.com.br',
|
|
179
178
|
SITE_DESCRIPTION: 'Aqui, você nunca fica sozinho!',
|
|
180
179
|
KEYWORDS: ['porn'],
|
|
181
180
|
SOCIAL_X: 'https://x.com/privateshow',
|
|
@@ -47,66 +47,66 @@ export declare enum UserTags {
|
|
|
47
47
|
FashionAndBeautyEvent = "FashionAndBeautyEvent",
|
|
48
48
|
FamilyAndKidsEvent = "FamilyAndKidsEvent",
|
|
49
49
|
AdventureAndEcoTourismEvent = "AdventureAndEcoTourismEvent",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
Anal = "Anal",
|
|
51
|
+
Arab = "Arab",
|
|
52
|
+
ASMR = "ASMR",
|
|
53
|
+
Asian = "Asian",
|
|
53
54
|
Athletic = "Athletic",
|
|
54
|
-
|
|
55
|
+
BBW = "BBW",
|
|
56
|
+
BDSM = "BDSM",
|
|
57
|
+
Blonde = "Blonde",
|
|
58
|
+
Brunette = "Brunette",
|
|
59
|
+
Cosplay = "Cosplay",
|
|
60
|
+
Cuckold = "Cuckold",
|
|
55
61
|
Curvy = "Curvy",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
Dancing = "Dancing",
|
|
63
|
+
DirtyTalk = "DirtyTalk",
|
|
64
|
+
Domination = "Domination",
|
|
65
|
+
DP = "DP",
|
|
66
|
+
Ebony = "Ebony",
|
|
59
67
|
Feet = "Feet",
|
|
60
|
-
BDSM = "BDSM",
|
|
61
|
-
Roleplay = "Roleplay",
|
|
62
|
-
JOI = "JOI",
|
|
63
|
-
SPH = "SPH",
|
|
64
68
|
Findom = "Findom",
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
ASMR = "ASMR",
|
|
69
|
+
Fingering = "Fingering",
|
|
70
|
+
Gamer = "Gamer",
|
|
71
|
+
GILF = "GILF",
|
|
72
|
+
Group = "Group",
|
|
73
|
+
Hairy = "Hairy",
|
|
71
74
|
InteractiveToys = "InteractiveToys",
|
|
75
|
+
JOI = "JOI",
|
|
76
|
+
Latina = "Latina",
|
|
77
|
+
Lactating = "Lactating",
|
|
78
|
+
Maid = "Maid",
|
|
79
|
+
Mature = "Mature",
|
|
80
|
+
MILF = "MILF",
|
|
81
|
+
Muscle = "Muscle",
|
|
82
|
+
Natural = "Natural",
|
|
83
|
+
Nurse = "Nurse",
|
|
84
|
+
Nympho = "Nympho",
|
|
72
85
|
OilShow = "OilShow",
|
|
73
|
-
Striptease = "Striptease",
|
|
74
|
-
Dancing = "Dancing",
|
|
75
|
-
Shower = "Shower",
|
|
76
|
-
Outdoor = "Outdoor",
|
|
77
|
-
Cosplay = "Cosplay",
|
|
78
|
-
Smoking = "Smoking",
|
|
79
|
-
Toys = "Toys",
|
|
80
|
-
Anal = "Anal",
|
|
81
|
-
Fingering = "Fingering",
|
|
82
86
|
Oral = "Oral",
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
ShowerShow = "ShowerShow",
|
|
86
|
-
Tattooed = "Tattooed",
|
|
87
|
+
Outdoor = "Outdoor",
|
|
88
|
+
Petite = "Petite",
|
|
87
89
|
Pierced = "Pierced",
|
|
88
|
-
Shaved = "Shaved",
|
|
89
|
-
Natural = "Natural",
|
|
90
|
-
Hairy = "Hairy",
|
|
91
90
|
Pregnant = "Pregnant",
|
|
92
|
-
Lactating = "Lactating",
|
|
93
|
-
MILF = "MILF",
|
|
94
|
-
GILF = "GILF",
|
|
95
|
-
Ebony = "Ebony",
|
|
96
|
-
Asian = "Asian",
|
|
97
|
-
Latina = "Latina",
|
|
98
|
-
White = "White",
|
|
99
|
-
Arab = "Arab",
|
|
100
|
-
Blonde = "Blonde",
|
|
101
|
-
Brunette = "Brunette",
|
|
102
91
|
Redhead = "Redhead",
|
|
103
|
-
|
|
92
|
+
Roleplay = "Roleplay",
|
|
93
|
+
Secretary = "Secretary",
|
|
94
|
+
Shaved = "Shaved",
|
|
95
|
+
Shower = "Shower",
|
|
96
|
+
ShowerShow = "ShowerShow",
|
|
97
|
+
Slim = "Slim",
|
|
98
|
+
Smoking = "Smoking",
|
|
99
|
+
SPH = "SPH",
|
|
100
|
+
Squirt = "Squirt",
|
|
101
|
+
Striptease = "Striptease",
|
|
104
102
|
Student = "Student",
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
Submission = "Submission",
|
|
104
|
+
Tattooed = "Tattooed",
|
|
107
105
|
Teacher = "Teacher",
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
Teen18Plus = "Teen18Plus",
|
|
107
|
+
Toys = "Toys",
|
|
108
|
+
Voyeur = "Voyeur",
|
|
109
|
+
White = "White"
|
|
110
110
|
}
|
|
111
111
|
export declare const TOUR_TAGS: UserTags[];
|
|
112
112
|
export declare const RESTAURANT_TAGS: UserTags[];
|
package/build/types/userTags.js
CHANGED
|
@@ -59,66 +59,66 @@ var UserTags;
|
|
|
59
59
|
UserTags["FamilyAndKidsEvent"] = "FamilyAndKidsEvent";
|
|
60
60
|
UserTags["AdventureAndEcoTourismEvent"] = "AdventureAndEcoTourismEvent";
|
|
61
61
|
// Private show
|
|
62
|
-
UserTags["
|
|
63
|
-
UserTags["
|
|
64
|
-
UserTags["
|
|
62
|
+
UserTags["Anal"] = "Anal";
|
|
63
|
+
UserTags["Arab"] = "Arab";
|
|
64
|
+
UserTags["ASMR"] = "ASMR";
|
|
65
|
+
UserTags["Asian"] = "Asian";
|
|
65
66
|
UserTags["Athletic"] = "Athletic";
|
|
66
|
-
UserTags["
|
|
67
|
+
UserTags["BBW"] = "BBW";
|
|
68
|
+
UserTags["BDSM"] = "BDSM";
|
|
69
|
+
UserTags["Blonde"] = "Blonde";
|
|
70
|
+
UserTags["Brunette"] = "Brunette";
|
|
71
|
+
UserTags["Cosplay"] = "Cosplay";
|
|
72
|
+
UserTags["Cuckold"] = "Cuckold";
|
|
67
73
|
UserTags["Curvy"] = "Curvy";
|
|
68
|
-
UserTags["
|
|
69
|
-
UserTags["
|
|
70
|
-
UserTags["
|
|
74
|
+
UserTags["Dancing"] = "Dancing";
|
|
75
|
+
UserTags["DirtyTalk"] = "DirtyTalk";
|
|
76
|
+
UserTags["Domination"] = "Domination";
|
|
77
|
+
UserTags["DP"] = "DP";
|
|
78
|
+
UserTags["Ebony"] = "Ebony";
|
|
71
79
|
UserTags["Feet"] = "Feet";
|
|
72
|
-
UserTags["BDSM"] = "BDSM";
|
|
73
|
-
UserTags["Roleplay"] = "Roleplay";
|
|
74
|
-
UserTags["JOI"] = "JOI";
|
|
75
|
-
UserTags["SPH"] = "SPH";
|
|
76
80
|
UserTags["Findom"] = "Findom";
|
|
77
|
-
UserTags["
|
|
78
|
-
UserTags["
|
|
79
|
-
UserTags["
|
|
80
|
-
UserTags["
|
|
81
|
-
UserTags["
|
|
82
|
-
UserTags["ASMR"] = "ASMR";
|
|
81
|
+
UserTags["Fingering"] = "Fingering";
|
|
82
|
+
UserTags["Gamer"] = "Gamer";
|
|
83
|
+
UserTags["GILF"] = "GILF";
|
|
84
|
+
UserTags["Group"] = "Group";
|
|
85
|
+
UserTags["Hairy"] = "Hairy";
|
|
83
86
|
UserTags["InteractiveToys"] = "InteractiveToys";
|
|
87
|
+
UserTags["JOI"] = "JOI";
|
|
88
|
+
UserTags["Latina"] = "Latina";
|
|
89
|
+
UserTags["Lactating"] = "Lactating";
|
|
90
|
+
UserTags["Maid"] = "Maid";
|
|
91
|
+
UserTags["Mature"] = "Mature";
|
|
92
|
+
UserTags["MILF"] = "MILF";
|
|
93
|
+
UserTags["Muscle"] = "Muscle";
|
|
94
|
+
UserTags["Natural"] = "Natural";
|
|
95
|
+
UserTags["Nurse"] = "Nurse";
|
|
96
|
+
UserTags["Nympho"] = "Nympho";
|
|
84
97
|
UserTags["OilShow"] = "OilShow";
|
|
85
|
-
UserTags["Striptease"] = "Striptease";
|
|
86
|
-
UserTags["Dancing"] = "Dancing";
|
|
87
|
-
UserTags["Shower"] = "Shower";
|
|
88
|
-
UserTags["Outdoor"] = "Outdoor";
|
|
89
|
-
UserTags["Cosplay"] = "Cosplay";
|
|
90
|
-
UserTags["Smoking"] = "Smoking";
|
|
91
|
-
UserTags["Toys"] = "Toys";
|
|
92
|
-
UserTags["Anal"] = "Anal";
|
|
93
|
-
UserTags["Fingering"] = "Fingering";
|
|
94
98
|
UserTags["Oral"] = "Oral";
|
|
95
|
-
UserTags["
|
|
96
|
-
UserTags["
|
|
97
|
-
UserTags["ShowerShow"] = "ShowerShow";
|
|
98
|
-
UserTags["Tattooed"] = "Tattooed";
|
|
99
|
+
UserTags["Outdoor"] = "Outdoor";
|
|
100
|
+
UserTags["Petite"] = "Petite";
|
|
99
101
|
UserTags["Pierced"] = "Pierced";
|
|
100
|
-
UserTags["Shaved"] = "Shaved";
|
|
101
|
-
UserTags["Natural"] = "Natural";
|
|
102
|
-
UserTags["Hairy"] = "Hairy";
|
|
103
102
|
UserTags["Pregnant"] = "Pregnant";
|
|
104
|
-
UserTags["Lactating"] = "Lactating";
|
|
105
|
-
UserTags["MILF"] = "MILF";
|
|
106
|
-
UserTags["GILF"] = "GILF";
|
|
107
|
-
UserTags["Ebony"] = "Ebony";
|
|
108
|
-
UserTags["Asian"] = "Asian";
|
|
109
|
-
UserTags["Latina"] = "Latina";
|
|
110
|
-
UserTags["White"] = "White";
|
|
111
|
-
UserTags["Arab"] = "Arab";
|
|
112
|
-
UserTags["Blonde"] = "Blonde";
|
|
113
|
-
UserTags["Brunette"] = "Brunette";
|
|
114
103
|
UserTags["Redhead"] = "Redhead";
|
|
115
|
-
UserTags["
|
|
104
|
+
UserTags["Roleplay"] = "Roleplay";
|
|
105
|
+
UserTags["Secretary"] = "Secretary";
|
|
106
|
+
UserTags["Shaved"] = "Shaved";
|
|
107
|
+
UserTags["Shower"] = "Shower";
|
|
108
|
+
UserTags["ShowerShow"] = "ShowerShow";
|
|
109
|
+
UserTags["Slim"] = "Slim";
|
|
110
|
+
UserTags["Smoking"] = "Smoking";
|
|
111
|
+
UserTags["SPH"] = "SPH";
|
|
112
|
+
UserTags["Squirt"] = "Squirt";
|
|
113
|
+
UserTags["Striptease"] = "Striptease";
|
|
116
114
|
UserTags["Student"] = "Student";
|
|
117
|
-
UserTags["
|
|
118
|
-
UserTags["
|
|
115
|
+
UserTags["Submission"] = "Submission";
|
|
116
|
+
UserTags["Tattooed"] = "Tattooed";
|
|
119
117
|
UserTags["Teacher"] = "Teacher";
|
|
120
|
-
UserTags["
|
|
121
|
-
UserTags["
|
|
118
|
+
UserTags["Teen18Plus"] = "Teen18Plus";
|
|
119
|
+
UserTags["Toys"] = "Toys";
|
|
120
|
+
UserTags["Voyeur"] = "Voyeur";
|
|
121
|
+
UserTags["White"] = "White";
|
|
122
122
|
})(UserTags || (exports.UserTags = UserTags = {}));
|
|
123
123
|
exports.TOUR_TAGS = [
|
|
124
124
|
UserTags.CityTour,
|