@omnizap-system/omnizap 2.6.2 → 2.6.3
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/.env.example +24 -0
- package/app/config/index.js +4 -0
- package/app/configParts/adminIdentity.js +29 -0
- package/app/configParts/baileysConfig.js +116 -0
- package/app/configParts/groupUtils.js +221 -0
- package/app/configParts/loggerConfig.js +185 -0
- package/app/configParts/messagePersistenceService.js +169 -7
- package/app/configParts/sessionConfig.js +85 -0
- package/app/connection/baileysCompatibility.test.js +9 -0
- package/app/connection/baileysDbAuthState.js +205 -9
- package/app/connection/baileysLibsignalPatch.js +210 -0
- package/app/connection/groupOwnerWriteStateResolver.js +53 -21
- package/app/connection/socketController.js +95 -25
- package/app/connection/socketController.multiSession.test.js +20 -0
- package/app/controllers/messagePipeline/preProcessingMiddlewares.js +17 -3
- package/app/controllers/messageProcessingPipeline.js +2 -0
- package/app/controllers/messageProcessingPipeline.test.js +15 -13
- package/app/services/multiSession/assignmentBalancerService.js +1 -6
- package/app/services/multiSession/groupOwnershipRepository.js +9 -44
- package/app/services/multiSession/groupOwnershipService.js +9 -90
- package/app/services/multiSession/groupOwnershipService.test.js +12 -4
- package/app/services/multiSession/sessionRegistryService.js +6 -60
- package/app/utils/antiLink/antiLinkModule.js +54 -24
- package/docs/security/omnizap-static-security-headers.conf +3 -3
- package/package.json +3 -2
- package/public/comandos/commands-catalog.json +1 -1
- package/public/css/payments-react.css +478 -0
- package/public/js/apps/homeReactApp.js +2 -2
- package/public/js/apps/paymentsCancelReactApp.js +45 -0
- package/public/js/apps/paymentsReactApp.js +399 -0
- package/public/js/apps/paymentsSuccessReactApp.js +148 -0
- package/public/pages/pagamentos-cancelado.html +21 -0
- package/public/pages/pagamentos-sucesso.html +21 -0
- package/public/pages/pagamentos.html +30 -0
- package/scripts/deploy.sh +3 -0
- package/scripts/new-whatsapp-session.sh +247 -0
- package/server/controllers/admin/systemAdminController.js +4 -17
- package/server/controllers/payments/paymentsController.js +731 -0
- package/server/controllers/system/systemController.js +4 -30
- package/server/email/emailAutomationRuntime.js +36 -1
- package/server/email/emailAutomationService.js +42 -1
- package/server/email/emailTemplateService.js +137 -31
- package/server/http/httpRequestUtils.js +18 -14
- package/server/middleware/securityHeaders.js +15 -2
- package/server/routes/indexRouter.js +27 -7
- package/server/routes/payments/paymentsRouter.js +47 -0
- package/server/routes/static/staticPageRouter.js +3 -0
- package/vite.config.mjs +3 -0
|
@@ -70,16 +70,7 @@ const cloneOutcome = (outcome = null) => {
|
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
export const createGroupOwnershipService = ({
|
|
74
|
-
repository = groupOwnershipRepository,
|
|
75
|
-
sessionRegistry = sessionRegistryService,
|
|
76
|
-
withTransactionImpl = withTransaction,
|
|
77
|
-
nowImpl = () => Date.now(),
|
|
78
|
-
loggerImpl = logger,
|
|
79
|
-
defaultLeaseMs = DEFAULT_LEASE_MS,
|
|
80
|
-
cacheTtlMs = parsePositiveInt(process.env.GROUP_OWNER_CACHE_TTL_MS, DEFAULT_CACHE_TTL_MS, 250, 10_000),
|
|
81
|
-
cacheMaxEntries = DEFAULT_CACHE_MAX_ENTRIES,
|
|
82
|
-
} = {}) => {
|
|
73
|
+
export const createGroupOwnershipService = ({ repository = groupOwnershipRepository, sessionRegistry = sessionRegistryService, withTransactionImpl = withTransaction, nowImpl = () => Date.now(), loggerImpl = logger, defaultLeaseMs = DEFAULT_LEASE_MS, cacheTtlMs = parsePositiveInt(process.env.GROUP_OWNER_CACHE_TTL_MS, DEFAULT_CACHE_TTL_MS, 250, 10_000), cacheMaxEntries = DEFAULT_CACHE_MAX_ENTRIES } = {}) => {
|
|
83
74
|
const ownerCache = new Map();
|
|
84
75
|
const safeDefaultLeaseMs = parsePositiveInt(defaultLeaseMs, DEFAULT_LEASE_MS, 5_000, 15 * 60 * 1000);
|
|
85
76
|
const safeCacheTtlMs = parsePositiveInt(cacheTtlMs, DEFAULT_CACHE_TTL_MS, 250, 10_000);
|
|
@@ -128,18 +119,7 @@ export const createGroupOwnershipService = ({
|
|
|
128
119
|
return Number(assignment?.assignmentVersion || 1);
|
|
129
120
|
};
|
|
130
121
|
|
|
131
|
-
const recordHistory = async (
|
|
132
|
-
{
|
|
133
|
-
groupJid,
|
|
134
|
-
previousSessionId = null,
|
|
135
|
-
newSessionId = null,
|
|
136
|
-
reason = null,
|
|
137
|
-
changedBy = 'system',
|
|
138
|
-
assignmentVersion = null,
|
|
139
|
-
metadata = null,
|
|
140
|
-
} = {},
|
|
141
|
-
connection = null,
|
|
142
|
-
) => {
|
|
122
|
+
const recordHistory = async ({ groupJid, previousSessionId = null, newSessionId = null, reason = null, changedBy = 'system', assignmentVersion = null, metadata = null } = {}, connection = null) => {
|
|
143
123
|
const safeGroupJid = repository.normalizeGroupJid(groupJid);
|
|
144
124
|
const safePreviousSessionId = repository.normalizeSessionId(previousSessionId);
|
|
145
125
|
const safeNewSessionId = repository.normalizeSessionId(newSessionId) || safePreviousSessionId;
|
|
@@ -213,14 +193,7 @@ export const createGroupOwnershipService = ({
|
|
|
213
193
|
return `${safeGroupJid}:${safeOwnerSessionId}:${safeAssignmentVersion}`;
|
|
214
194
|
};
|
|
215
195
|
|
|
216
|
-
const validateFenceToken = async (
|
|
217
|
-
{
|
|
218
|
-
groupJid,
|
|
219
|
-
sessionId,
|
|
220
|
-
assignmentVersion,
|
|
221
|
-
bypassCache = true,
|
|
222
|
-
} = {},
|
|
223
|
-
) => {
|
|
196
|
+
const validateFenceToken = async ({ groupJid, sessionId, assignmentVersion, bypassCache = true } = {}) => {
|
|
224
197
|
const safeGroupJid = repository.normalizeGroupJid(groupJid);
|
|
225
198
|
const safeSessionId = repository.normalizeSessionId(sessionId);
|
|
226
199
|
const safeAssignmentVersion = parseAssignmentVersion(assignmentVersion);
|
|
@@ -265,16 +238,7 @@ export const createGroupOwnershipService = ({
|
|
|
265
238
|
};
|
|
266
239
|
};
|
|
267
240
|
|
|
268
|
-
const tryAcquire = async (
|
|
269
|
-
{
|
|
270
|
-
groupJid,
|
|
271
|
-
sessionId,
|
|
272
|
-
leaseMs = safeDefaultLeaseMs,
|
|
273
|
-
reason = 'claim',
|
|
274
|
-
changedBy = null,
|
|
275
|
-
metadata = null,
|
|
276
|
-
} = {},
|
|
277
|
-
) => {
|
|
241
|
+
const tryAcquire = async ({ groupJid, sessionId, leaseMs = safeDefaultLeaseMs, reason = 'claim', changedBy = null, metadata = null } = {}) => {
|
|
278
242
|
const safeGroupJid = repository.normalizeGroupJid(groupJid);
|
|
279
243
|
const safeSessionId = repository.normalizeSessionId(sessionId);
|
|
280
244
|
if (!safeGroupJid || !safeSessionId) {
|
|
@@ -419,14 +383,7 @@ export const createGroupOwnershipService = ({
|
|
|
419
383
|
return cloneOutcome(outcome);
|
|
420
384
|
};
|
|
421
385
|
|
|
422
|
-
const renewLease = async (
|
|
423
|
-
{
|
|
424
|
-
groupJid,
|
|
425
|
-
sessionId,
|
|
426
|
-
leaseMs = safeDefaultLeaseMs,
|
|
427
|
-
reason = 'renew',
|
|
428
|
-
} = {},
|
|
429
|
-
) => {
|
|
386
|
+
const renewLease = async ({ groupJid, sessionId, leaseMs = safeDefaultLeaseMs, reason = 'renew' } = {}) => {
|
|
430
387
|
const safeGroupJid = repository.normalizeGroupJid(groupJid);
|
|
431
388
|
const safeSessionId = repository.normalizeSessionId(sessionId);
|
|
432
389
|
if (!safeGroupJid || !safeSessionId) {
|
|
@@ -480,17 +437,7 @@ export const createGroupOwnershipService = ({
|
|
|
480
437
|
return cloneOutcome(outcome);
|
|
481
438
|
};
|
|
482
439
|
|
|
483
|
-
const heartbeatOwnerSession = async (
|
|
484
|
-
{
|
|
485
|
-
sessionId,
|
|
486
|
-
leaseMs = safeDefaultLeaseMs,
|
|
487
|
-
reason = 'heartbeat',
|
|
488
|
-
botJid = undefined,
|
|
489
|
-
metadata = undefined,
|
|
490
|
-
currentScore = 0,
|
|
491
|
-
capacityWeight = 1,
|
|
492
|
-
} = {},
|
|
493
|
-
) => {
|
|
440
|
+
const heartbeatOwnerSession = async ({ sessionId, leaseMs = safeDefaultLeaseMs, reason = 'heartbeat', botJid = undefined, metadata = undefined, currentScore = 0, capacityWeight = 1 } = {}) => {
|
|
494
441
|
const safeSessionId = repository.normalizeSessionId(sessionId);
|
|
495
442
|
if (!safeSessionId) {
|
|
496
443
|
throw new Error('heartbeatOwnerSession requer sessionId valido.');
|
|
@@ -531,15 +478,7 @@ export const createGroupOwnershipService = ({
|
|
|
531
478
|
};
|
|
532
479
|
};
|
|
533
480
|
|
|
534
|
-
const release = async (
|
|
535
|
-
{
|
|
536
|
-
groupJid,
|
|
537
|
-
sessionId = null,
|
|
538
|
-
reason = 'release',
|
|
539
|
-
changedBy = null,
|
|
540
|
-
metadata = null,
|
|
541
|
-
} = {},
|
|
542
|
-
) => {
|
|
481
|
+
const release = async ({ groupJid, sessionId = null, reason = 'release', changedBy = null, metadata = null } = {}) => {
|
|
543
482
|
const safeGroupJid = repository.normalizeGroupJid(groupJid);
|
|
544
483
|
const safeSessionId = repository.normalizeSessionId(sessionId);
|
|
545
484
|
if (!safeGroupJid) {
|
|
@@ -620,17 +559,7 @@ export const createGroupOwnershipService = ({
|
|
|
620
559
|
return cloneOutcome(outcome);
|
|
621
560
|
};
|
|
622
561
|
|
|
623
|
-
const forceAssign = async (
|
|
624
|
-
{
|
|
625
|
-
groupJid,
|
|
626
|
-
sessionId,
|
|
627
|
-
leaseMs = safeDefaultLeaseMs,
|
|
628
|
-
reason = 'force_assign',
|
|
629
|
-
changedBy = null,
|
|
630
|
-
metadata = null,
|
|
631
|
-
pinned = undefined,
|
|
632
|
-
} = {},
|
|
633
|
-
) => {
|
|
562
|
+
const forceAssign = async ({ groupJid, sessionId, leaseMs = safeDefaultLeaseMs, reason = 'force_assign', changedBy = null, metadata = null, pinned = undefined } = {}) => {
|
|
634
563
|
const safeGroupJid = repository.normalizeGroupJid(groupJid);
|
|
635
564
|
const safeSessionId = repository.normalizeSessionId(sessionId);
|
|
636
565
|
if (!safeGroupJid || !safeSessionId) {
|
|
@@ -729,17 +658,7 @@ export const createGroupOwnershipService = ({
|
|
|
729
658
|
return cloneOutcome(outcome);
|
|
730
659
|
};
|
|
731
660
|
|
|
732
|
-
const setPinned = async (
|
|
733
|
-
{
|
|
734
|
-
groupJid,
|
|
735
|
-
pinned,
|
|
736
|
-
sessionId = null,
|
|
737
|
-
reason = null,
|
|
738
|
-
changedBy = null,
|
|
739
|
-
metadata = null,
|
|
740
|
-
leaseMs = safeDefaultLeaseMs,
|
|
741
|
-
} = {},
|
|
742
|
-
) => {
|
|
661
|
+
const setPinned = async ({ groupJid, pinned, sessionId = null, reason = null, changedBy = null, metadata = null, leaseMs = safeDefaultLeaseMs } = {}) => {
|
|
743
662
|
const safeGroupJid = repository.normalizeGroupJid(groupJid);
|
|
744
663
|
if (!safeGroupJid) {
|
|
745
664
|
throw new Error('setPinned requer groupJid valido.');
|
|
@@ -11,19 +11,27 @@ const createInMemoryRepository = () => {
|
|
|
11
11
|
const history = [];
|
|
12
12
|
|
|
13
13
|
const normalizeGroupJid = (value) => {
|
|
14
|
-
const normalized = String(value || '')
|
|
14
|
+
const normalized = String(value || '')
|
|
15
|
+
.trim()
|
|
16
|
+
.slice(0, 255);
|
|
15
17
|
return normalized || null;
|
|
16
18
|
};
|
|
17
19
|
const normalizeSessionId = (value) => {
|
|
18
|
-
const normalized = String(value || '')
|
|
20
|
+
const normalized = String(value || '')
|
|
21
|
+
.trim()
|
|
22
|
+
.slice(0, 64);
|
|
19
23
|
return normalized || null;
|
|
20
24
|
};
|
|
21
25
|
const normalizeReason = (value) => {
|
|
22
|
-
const normalized = String(value || '')
|
|
26
|
+
const normalized = String(value || '')
|
|
27
|
+
.trim()
|
|
28
|
+
.slice(0, 64);
|
|
23
29
|
return normalized || null;
|
|
24
30
|
};
|
|
25
31
|
const normalizeChangedBy = (value) => {
|
|
26
|
-
const normalized = String(value || 'system')
|
|
32
|
+
const normalized = String(value || 'system')
|
|
33
|
+
.trim()
|
|
34
|
+
.slice(0, 64);
|
|
27
35
|
return normalized || 'system';
|
|
28
36
|
};
|
|
29
37
|
|
|
@@ -38,10 +38,7 @@ const normalizeStatus = (value, fallback = DEFAULT_STATUS) => {
|
|
|
38
38
|
const normalizeBotJid = (value) => {
|
|
39
39
|
if (value === undefined) return undefined;
|
|
40
40
|
if (value === null) return null;
|
|
41
|
-
const normalized = String(value)
|
|
42
|
-
.trim()
|
|
43
|
-
.toLowerCase()
|
|
44
|
-
.slice(0, MAX_BOT_JID_LENGTH);
|
|
41
|
+
const normalized = String(value).trim().toLowerCase().slice(0, MAX_BOT_JID_LENGTH);
|
|
45
42
|
return normalized || null;
|
|
46
43
|
};
|
|
47
44
|
|
|
@@ -138,20 +135,7 @@ export const listSessions = async ({ status = null, limit = 100, connection = nu
|
|
|
138
135
|
return (Array.isArray(rows) ? rows : []).map((row) => normalizeSessionRow(row));
|
|
139
136
|
};
|
|
140
137
|
|
|
141
|
-
export const upsertSession = async (
|
|
142
|
-
{
|
|
143
|
-
sessionId,
|
|
144
|
-
botJid = undefined,
|
|
145
|
-
status = DEFAULT_STATUS,
|
|
146
|
-
capacityWeight = DEFAULT_WEIGHT,
|
|
147
|
-
currentScore = 0,
|
|
148
|
-
metadata = undefined,
|
|
149
|
-
heartbeatAt = undefined,
|
|
150
|
-
connectedAt = undefined,
|
|
151
|
-
disconnectedAt = undefined,
|
|
152
|
-
} = {},
|
|
153
|
-
{ connection = null } = {},
|
|
154
|
-
) => {
|
|
138
|
+
export const upsertSession = async ({ sessionId, botJid = undefined, status = DEFAULT_STATUS, capacityWeight = DEFAULT_WEIGHT, currentScore = 0, metadata = undefined, heartbeatAt = undefined, connectedAt = undefined, disconnectedAt = undefined } = {}, { connection = null } = {}) => {
|
|
155
139
|
const safeSessionId = normalizeSessionId(sessionId);
|
|
156
140
|
if (!safeSessionId) {
|
|
157
141
|
throw new Error('upsertSession requer sessionId valido.');
|
|
@@ -187,17 +171,7 @@ export const upsertSession = async (
|
|
|
187
171
|
return getSession(safeSessionId, { connection });
|
|
188
172
|
};
|
|
189
173
|
|
|
190
|
-
export const ensureSession = async (
|
|
191
|
-
sessionId,
|
|
192
|
-
{
|
|
193
|
-
status = 'online',
|
|
194
|
-
capacityWeight = DEFAULT_WEIGHT,
|
|
195
|
-
currentScore = 0,
|
|
196
|
-
metadata = undefined,
|
|
197
|
-
botJid = undefined,
|
|
198
|
-
connection = null,
|
|
199
|
-
} = {},
|
|
200
|
-
) =>
|
|
174
|
+
export const ensureSession = async (sessionId, { status = 'online', capacityWeight = DEFAULT_WEIGHT, currentScore = 0, metadata = undefined, botJid = undefined, connection = null } = {}) =>
|
|
201
175
|
upsertSession(
|
|
202
176
|
{
|
|
203
177
|
sessionId,
|
|
@@ -210,17 +184,7 @@ export const ensureSession = async (
|
|
|
210
184
|
{ connection },
|
|
211
185
|
);
|
|
212
186
|
|
|
213
|
-
export const heartbeatSession = async (
|
|
214
|
-
sessionId,
|
|
215
|
-
{
|
|
216
|
-
status = 'online',
|
|
217
|
-
currentScore = 0,
|
|
218
|
-
metadata = undefined,
|
|
219
|
-
botJid = undefined,
|
|
220
|
-
capacityWeight = DEFAULT_WEIGHT,
|
|
221
|
-
connection = null,
|
|
222
|
-
} = {},
|
|
223
|
-
) =>
|
|
187
|
+
export const heartbeatSession = async (sessionId, { status = 'online', currentScore = 0, metadata = undefined, botJid = undefined, capacityWeight = DEFAULT_WEIGHT, connection = null } = {}) =>
|
|
224
188
|
upsertSession(
|
|
225
189
|
{
|
|
226
190
|
sessionId,
|
|
@@ -234,16 +198,7 @@ export const heartbeatSession = async (
|
|
|
234
198
|
{ connection },
|
|
235
199
|
);
|
|
236
200
|
|
|
237
|
-
export const markSessionConnected = async (
|
|
238
|
-
sessionId,
|
|
239
|
-
{
|
|
240
|
-
botJid = undefined,
|
|
241
|
-
currentScore = 0,
|
|
242
|
-
metadata = undefined,
|
|
243
|
-
capacityWeight = DEFAULT_WEIGHT,
|
|
244
|
-
connection = null,
|
|
245
|
-
} = {},
|
|
246
|
-
) =>
|
|
201
|
+
export const markSessionConnected = async (sessionId, { botJid = undefined, currentScore = 0, metadata = undefined, capacityWeight = DEFAULT_WEIGHT, connection = null } = {}) =>
|
|
247
202
|
upsertSession(
|
|
248
203
|
{
|
|
249
204
|
sessionId,
|
|
@@ -258,16 +213,7 @@ export const markSessionConnected = async (
|
|
|
258
213
|
{ connection },
|
|
259
214
|
);
|
|
260
215
|
|
|
261
|
-
export const markSessionDisconnected = async (
|
|
262
|
-
sessionId,
|
|
263
|
-
{
|
|
264
|
-
status = 'offline',
|
|
265
|
-
currentScore = 0,
|
|
266
|
-
metadata = undefined,
|
|
267
|
-
capacityWeight = DEFAULT_WEIGHT,
|
|
268
|
-
connection = null,
|
|
269
|
-
} = {},
|
|
270
|
-
) =>
|
|
216
|
+
export const markSessionDisconnected = async (sessionId, { status = 'offline', currentScore = 0, metadata = undefined, capacityWeight = DEFAULT_WEIGHT, connection = null } = {}) =>
|
|
271
217
|
upsertSession(
|
|
272
218
|
{
|
|
273
219
|
sessionId,
|
|
@@ -965,50 +965,80 @@ export const handleAntiLink = async ({ sock, messageInfo, extractedText, remoteJ
|
|
|
965
965
|
return false;
|
|
966
966
|
}
|
|
967
967
|
|
|
968
|
+
let removedParticipantId = '';
|
|
968
969
|
try {
|
|
969
|
-
|
|
970
|
+
removedParticipantId = await removeParticipantWithFallback(sock, normalizedRemoteJid, senderContext.removalCandidates);
|
|
970
971
|
if (!removedParticipantId) {
|
|
971
972
|
throw new Error('Nenhum candidato de participante pôde ser removido.');
|
|
972
973
|
}
|
|
974
|
+
} catch (error) {
|
|
975
|
+
logger.error(`Falha ao remover usuário com antilink: ${error.message}`, {
|
|
976
|
+
action: 'antilink_error',
|
|
977
|
+
groupId: normalizedRemoteJid,
|
|
978
|
+
userId: senderContext.primarySenderId,
|
|
979
|
+
senderCandidates: senderContext.senderCandidates,
|
|
980
|
+
error: error.stack,
|
|
981
|
+
});
|
|
982
|
+
return false;
|
|
983
|
+
}
|
|
973
984
|
|
|
974
|
-
|
|
975
|
-
|
|
985
|
+
const deletionCandidates = uniqueNormalizedJids([removedParticipantId, ...senderContext.senderCandidates]);
|
|
986
|
+
let purgeResult = {
|
|
987
|
+
requested: 0,
|
|
988
|
+
deleted: 0,
|
|
989
|
+
failed: 0,
|
|
990
|
+
rounds: 0,
|
|
991
|
+
roundsWithDeletes: 0,
|
|
992
|
+
};
|
|
993
|
+
try {
|
|
994
|
+
purgeResult = await purgeRecentMessagesFromRemovedSender({
|
|
976
995
|
sock,
|
|
977
996
|
messageInfo,
|
|
978
997
|
remoteJid: normalizedRemoteJid,
|
|
979
998
|
senderCandidates: deletionCandidates,
|
|
980
999
|
});
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
const recentDeleteLine = purgeResult.deleted > 0 ? `\n🧹 ${purgeResult.deleted} mensagem(ns) dos últimos ${ANTILINK_DELETE_WINDOW_MINUTES} minuto(s) foram apagadas.` : '';
|
|
985
|
-
await sendMessageWithFallback(sock, normalizedRemoteJid, {
|
|
986
|
-
text: `🚫 @${senderUser || 'usuario'} foi removido por enviar um link.${recentDeleteLine}`,
|
|
987
|
-
mentions: senderMention ? [senderMention] : [],
|
|
988
|
-
});
|
|
989
|
-
|
|
990
|
-
logger.info(`Usuário ${removedParticipantId || senderContext.primarySenderId} removido do grupo ${normalizedRemoteJid} por enviar link.`, {
|
|
991
|
-
action: 'antilink_remove',
|
|
1000
|
+
} catch (error) {
|
|
1001
|
+
logger.warn('Falha ao limpar mensagens recentes após remoção por antilink.', {
|
|
1002
|
+
action: 'antilink_recent_delete_error',
|
|
992
1003
|
groupId: normalizedRemoteJid,
|
|
993
1004
|
userId: removedParticipantId || senderContext.primarySenderId,
|
|
994
1005
|
senderCandidates: senderContext.senderCandidates,
|
|
995
|
-
|
|
996
|
-
failedRecentMessageDeletes: purgeResult.failed,
|
|
997
|
-
requestedRecentMessageDeletes: purgeResult.requested,
|
|
998
|
-
deleteRevalidationRounds: purgeResult.rounds,
|
|
999
|
-
deleteRevalidationRoundsWithDeletes: purgeResult.roundsWithDeletes,
|
|
1006
|
+
error: error?.message,
|
|
1000
1007
|
});
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
const senderMention = senderContext.mentionJid || removedParticipantId || senderContext.primarySenderId;
|
|
1011
|
+
const senderUser = getJidUser(senderMention);
|
|
1012
|
+
const recentDeleteLine = purgeResult.deleted > 0 ? `\n🧹 ${purgeResult.deleted} mensagem(ns) dos últimos ${ANTILINK_DELETE_WINDOW_MINUTES} minuto(s) foram apagadas.` : '';
|
|
1001
1013
|
|
|
1002
|
-
|
|
1014
|
+
try {
|
|
1015
|
+
await sendMessageWithFallback(sock, normalizedRemoteJid, {
|
|
1016
|
+
text: `🚫 @${senderUser || 'usuario'} foi removido por enviar um link.${recentDeleteLine}`,
|
|
1017
|
+
mentions: senderMention ? [senderMention] : [],
|
|
1018
|
+
});
|
|
1003
1019
|
} catch (error) {
|
|
1004
|
-
logger.
|
|
1005
|
-
action: '
|
|
1020
|
+
logger.warn('Falha ao enviar aviso de remoção por antilink.', {
|
|
1021
|
+
action: 'antilink_remove_notice_error',
|
|
1006
1022
|
groupId: normalizedRemoteJid,
|
|
1007
|
-
userId: senderContext.primarySenderId,
|
|
1023
|
+
userId: removedParticipantId || senderContext.primarySenderId,
|
|
1008
1024
|
senderCandidates: senderContext.senderCandidates,
|
|
1009
|
-
error: error
|
|
1025
|
+
error: error?.message,
|
|
1010
1026
|
});
|
|
1011
1027
|
}
|
|
1028
|
+
|
|
1029
|
+
logger.info(`Usuário ${removedParticipantId || senderContext.primarySenderId} removido do grupo ${normalizedRemoteJid} por enviar link.`, {
|
|
1030
|
+
action: 'antilink_remove',
|
|
1031
|
+
groupId: normalizedRemoteJid,
|
|
1032
|
+
userId: removedParticipantId || senderContext.primarySenderId,
|
|
1033
|
+
senderCandidates: senderContext.senderCandidates,
|
|
1034
|
+
deletedRecentMessages: purgeResult.deleted,
|
|
1035
|
+
failedRecentMessageDeletes: purgeResult.failed,
|
|
1036
|
+
requestedRecentMessageDeletes: purgeResult.requested,
|
|
1037
|
+
deleteRevalidationRounds: purgeResult.rounds,
|
|
1038
|
+
deleteRevalidationRoundsWithDeletes: purgeResult.roundsWithDeletes,
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
return true;
|
|
1012
1042
|
} else if (isAdmin && !senderIsBot) {
|
|
1013
1043
|
try {
|
|
1014
1044
|
const senderMention = senderContext.mentionJid || senderContext.primarySenderId;
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
# include /etc/nginx/snippets/omnizap-static-security-headers.conf;
|
|
12
12
|
# }
|
|
13
13
|
|
|
14
|
-
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self'; script-src 'self' 'unsafe-inline' https://accounts.google.com https://cdn.tailwindcss.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com; img-src 'self' data: blob: https:; font-src 'self' data: https://fonts.gstatic.com https://cdnjs.cloudflare.com; connect-src 'self' https://accounts.google.com https://oauth2.googleapis.com https://api.github.com; frame-src 'self' https://accounts.google.com https://omnizap.shop; worker-src 'self' blob:; manifest-src 'self'" always;
|
|
15
|
-
add_header Cross-Origin-Opener-Policy "same-origin" always;
|
|
14
|
+
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self' https://accounts.google.com; script-src 'self' 'unsafe-inline' https://accounts.google.com https://cdn.tailwindcss.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com; img-src 'self' data: blob: https:; font-src 'self' data: https://fonts.gstatic.com https://cdnjs.cloudflare.com; connect-src 'self' https://accounts.google.com https://oauth2.googleapis.com https://api.github.com; frame-src 'self' https://accounts.google.com https://omnizap.shop; worker-src 'self' blob:; manifest-src 'self'" always;
|
|
15
|
+
add_header Cross-Origin-Opener-Policy "same-origin-allow-popups" always;
|
|
16
16
|
add_header Cross-Origin-Resource-Policy "same-origin" always;
|
|
17
17
|
add_header Referrer-Policy "no-referrer" always;
|
|
18
18
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
@@ -22,4 +22,4 @@ add_header X-Download-Options "noopen" always;
|
|
|
22
22
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
23
23
|
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
|
24
24
|
add_header X-XSS-Protection "0" always;
|
|
25
|
-
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
|
|
25
|
+
add_header Permissions-Policy "geolocation=(), microphone=(), camera=(), identity-credentials-get=(self)" always;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnizap-system/omnizap",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "Sistema profissional de automação WhatsApp com tecnologia Baileys",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"build": "npm run build:all",
|
|
35
35
|
"build:all": "npm run catalog:commands && npm run build:frontend",
|
|
36
36
|
"build:frontend": "npm run build:css && npm run build:js",
|
|
37
|
-
"build:css": "npm run build:css:home && npm run build:css:user && npm run build:css:login && npm run build:css:terms && npm run build:css:api-docs && npm run build:css:stickers && npm run build:css:create-pack && npm run build:css:stickers-admin && npm run build:css:user-systemadm && npm run build:css:commands",
|
|
37
|
+
"build:css": "npm run build:css:home && npm run build:css:user && npm run build:css:login && npm run build:css:terms && npm run build:css:api-docs && npm run build:css:payments && npm run build:css:stickers && npm run build:css:create-pack && npm run build:css:stickers-admin && npm run build:css:user-systemadm && npm run build:css:commands",
|
|
38
38
|
"build:js": "vite build --config ./vite.config.mjs",
|
|
39
39
|
"build:js:home": "npm run build:js",
|
|
40
40
|
"build:js:user": "npm run build:js",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"build:css:terms": "tailwindcss -i ./public/assets/css/terms-react.input.css -o ./public/assets/css/terms-react.css --minify",
|
|
52
52
|
"build:css:commands": "tailwindcss -i ./public/assets/css/commands-react.input.css -o ./public/assets/css/commands-react.css --minify",
|
|
53
53
|
"build:css:api-docs": "cp ./public/css/api-docs.css ./public/assets/css/api-docs.css",
|
|
54
|
+
"build:css:payments": "cp ./public/css/payments-react.css ./public/assets/css/payments-react.css",
|
|
54
55
|
"build:css:stickers": "tailwindcss -i ./public/assets/css/stickers-react.input.css -o ./public/assets/css/stickers-react.css --minify",
|
|
55
56
|
"build:css:create-pack": "tailwindcss -i ./public/assets/css/create-pack-react.input.css -o ./public/assets/css/create-pack-react.css --minify",
|
|
56
57
|
"build:css:stickers-admin": "cp ./public/css/stickers-admin.css ./public/assets/css/stickers-admin.css",
|