@kaikybrofc/omnizap-system 2.2.10 → 2.3.1
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/README.md +13 -13
- package/app/config/adminIdentity.js +1 -3
- package/app/connection/socketController.js +10 -20
- package/app/controllers/messageController.js +7 -28
- package/app/modules/aiModule/catCommand.js +29 -192
- package/app/modules/broadcastModule/noticeCommand.js +28 -97
- package/app/modules/gameModule/diceCommand.js +6 -32
- package/app/modules/playModule/playCommand.js +57 -258
- package/app/modules/quoteModule/quoteCommand.js +2 -4
- package/app/modules/rpgPokemonModule/rpgPokemonRepository.js +1 -13
- package/app/modules/statsModule/noMessageCommand.js +16 -84
- package/app/modules/statsModule/rankingCommand.js +5 -25
- package/app/modules/statsModule/rankingCommon.js +1 -9
- package/app/modules/stickerModule/convertToWebp.js +4 -27
- package/app/modules/stickerModule/stickerCommand.js +13 -24
- package/app/modules/stickerModule/stickerTextCommand.js +13 -25
- package/app/modules/stickerPackModule/autoPackCollectorService.js +16 -7
- package/app/modules/stickerPackModule/domainEventOutboxRepository.js +20 -36
- package/app/modules/stickerPackModule/domainEvents.js +2 -11
- package/app/modules/stickerPackModule/semanticReclassificationEngine.js +13 -50
- package/app/modules/stickerPackModule/semanticReclassificationEngine.test.js +2 -15
- package/app/modules/stickerPackModule/semanticThemeClusterService.js +14 -41
- package/app/modules/stickerPackModule/stickerAssetClassificationRepository.js +25 -95
- package/app/modules/stickerPackModule/stickerAssetRepository.js +12 -31
- package/app/modules/stickerPackModule/stickerAssetReprocessQueueRepository.js +13 -18
- package/app/modules/stickerPackModule/stickerAutoPackByTagsRuntime.js +284 -709
- package/app/modules/stickerPackModule/stickerClassificationBackgroundRuntime.js +27 -106
- package/app/modules/stickerPackModule/stickerClassificationService.js +46 -77
- package/app/modules/stickerPackModule/stickerDedicatedTaskWorkerRuntime.js +13 -53
- package/app/modules/stickerPackModule/stickerDomainEventBus.js +10 -16
- package/app/modules/stickerPackModule/stickerDomainEventConsumerRuntime.js +40 -39
- package/app/modules/stickerPackModule/stickerMarketplaceDriftService.js +1 -4
- package/app/modules/stickerPackModule/stickerObjectStorageService.js +26 -26
- package/app/modules/stickerPackModule/stickerPackCommandHandlers.js +32 -187
- package/app/modules/stickerPackModule/stickerPackInteractionEventRepository.js +6 -15
- package/app/modules/stickerPackModule/stickerPackItemRepository.js +6 -32
- package/app/modules/stickerPackModule/stickerPackMarketplaceService.js +12 -36
- package/app/modules/stickerPackModule/stickerPackMessageService.js +12 -40
- package/app/modules/stickerPackModule/stickerPackRepository.js +23 -66
- package/app/modules/stickerPackModule/stickerPackScoreSnapshotRepository.js +9 -21
- package/app/modules/stickerPackModule/stickerPackScoreSnapshotRuntime.js +10 -40
- package/app/modules/stickerPackModule/stickerPackService.js +50 -115
- package/app/modules/stickerPackModule/stickerPackServiceRuntime.js +2 -21
- package/app/modules/stickerPackModule/stickerPackUtils.js +13 -3
- package/app/modules/stickerPackModule/stickerStorageService.js +16 -65
- package/app/modules/stickerPackModule/stickerWorkerPipelineRuntime.js +4 -22
- package/app/modules/stickerPackModule/stickerWorkerTaskQueueRepository.js +14 -29
- package/app/modules/systemMetricsModule/pingCommand.js +9 -39
- package/app/modules/tiktokModule/tiktokCommand.js +17 -109
- package/app/modules/userModule/userCommand.js +2 -88
- package/app/observability/metrics.js +5 -16
- package/app/services/captchaService.js +1 -6
- package/app/services/dbWriteQueue.js +3 -18
- package/app/services/featureFlagService.js +2 -8
- package/app/services/newsBroadcastService.js +0 -1
- package/app/services/queueUtils.js +2 -4
- package/app/services/whatsappLoginLinkService.js +7 -9
- package/app/store/premiumUserStore.js +1 -2
- package/app/utils/antiLink/antiLinkModule.js +3 -233
- package/app/utils/logger/loggerModule.js +9 -34
- package/app/utils/systemMetrics/systemMetricsModule.js +1 -4
- package/database/index.js +1 -0
- package/database/init.js +1 -8
- package/database/migrations/20260228_0027_web_visit_event.sql +15 -0
- package/docker-compose.yml +27 -27
- package/docs/seo/omnizap-seo-playbook-br-2026-02-28.md +26 -0
- package/docs/seo/satellite-page-template.md +2 -0
- package/docs/seo/satellite-pages-phase1.json +40 -177
- package/eslint.config.js +2 -15
- package/index.js +8 -36
- package/ml/clip_classifier/README.md +4 -6
- package/observability/alert-rules.yml +12 -12
- package/observability/grafana/provisioning/dashboards/dashboards.yml +1 -1
- package/package.json +6 -3
- package/public/api-docs/index.html +220 -193
- package/public/bot-whatsapp-para-grupo/index.html +291 -261
- package/public/bot-whatsapp-sem-programar/index.html +291 -261
- package/public/comandos/index.html +421 -406
- package/public/como-automatizar-avisos-no-whatsapp/index.html +291 -261
- package/public/como-criar-comandos-whatsapp/index.html +291 -261
- package/public/como-evitar-spam-no-whatsapp/index.html +291 -261
- package/public/como-moderar-grupo-whatsapp/index.html +291 -261
- package/public/como-organizar-comunidade-whatsapp/index.html +291 -261
- package/public/css/github-project-panel.css +13 -8
- package/public/css/stickers-admin.css +25 -9
- package/public/css/styles.css +23 -16
- package/public/index.html +1106 -993
- package/public/js/apps/apiDocsApp.js +17 -167
- package/public/js/apps/createPackApp.js +69 -332
- package/public/js/apps/homeApp.js +274 -101
- package/public/js/apps/loginApp.js +3 -12
- package/public/js/apps/stickersAdminApp.js +190 -181
- package/public/js/apps/stickersApp.js +482 -1411
- package/public/js/apps/userApp.js +217 -1
- package/public/js/catalog.js +11 -74
- package/public/js/github-panel/components/ErrorState.js +1 -8
- package/public/js/github-panel/components/GithubProjectPanel.js +2 -9
- package/public/js/github-panel/components/SkeletonPanel.js +1 -11
- package/public/js/github-panel/components/StatCard.js +1 -7
- package/public/js/github-panel/vendor/react.js +1 -9
- package/public/js/runtime/react-runtime.js +1 -9
- package/public/licenca/index.html +200 -86
- package/public/login/index.html +315 -325
- package/public/melhor-bot-whatsapp-para-grupos/index.html +291 -261
- package/public/stickers/admin/index.html +14 -19
- package/public/stickers/create/index.html +39 -44
- package/public/stickers/index.html +96 -107
- package/public/termos-de-uso/index.html +369 -122
- package/public/user/index.html +527 -350
- package/scripts/cache-bust.mjs +5 -24
- package/scripts/generate-seo-satellite-pages.mjs +10 -13
- package/scripts/run-prettier-all.mjs +25 -0
- package/scripts/sticker-catalog-loadtest.mjs +13 -11
- package/scripts/sticker-worker-task.mjs +1 -4
- package/scripts/sync-readme-snapshot.mjs +3 -2
- package/server/auth/googleWebAuth/googleWebAuthService.js +614 -0
- package/server/controllers/stickerCatalogController.js +297 -632
- package/server/http/httpServer.js +2 -10
- package/server/routes/stickerCatalog/catalogHandlers/catalogAdminHttp.js +1 -8
- package/server/routes/stickerCatalog/catalogHandlers/catalogAuthHttp.js +1 -9
- package/server/routes/stickerCatalog/catalogHandlers/catalogPublicHttp.js +10 -11
- package/server/routes/stickerCatalog/catalogHandlers/catalogUploadHttp.js +1 -10
- package/server/routes/stickerCatalog/catalogRouter.js +11 -13
package/scripts/cache-bust.mjs
CHANGED
|
@@ -5,20 +5,10 @@ import path from 'node:path';
|
|
|
5
5
|
import { URLSearchParams } from 'node:url';
|
|
6
6
|
|
|
7
7
|
const TARGET_SOURCE_EXTENSIONS = new Set(['.html', '.js', '.mjs', '.css']);
|
|
8
|
-
const ASSET_SUFFIX_PATTERN =
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
'gi',
|
|
13
|
-
);
|
|
14
|
-
const QUOTED_LOCAL_ASSET_PATTERN = new RegExp(
|
|
15
|
-
String.raw`(["'])((?:\/|\.{1,2}\/)[^"'\s]+?${ASSET_SUFFIX_PATTERN})\1`,
|
|
16
|
-
'gi',
|
|
17
|
-
);
|
|
18
|
-
const CSS_URL_ASSET_PATTERN = new RegExp(
|
|
19
|
-
String.raw`(url\(\s*["']?)([^"')\s]+?${ASSET_SUFFIX_PATTERN})(["']?\s*\))`,
|
|
20
|
-
'gi',
|
|
21
|
-
);
|
|
8
|
+
const ASSET_SUFFIX_PATTERN = String.raw`\.(?:js|mjs|cjs|css|png|jpe?g|gif|svg|webp|ico|json|map|woff2?|ttf|eot)(?:\?[^"'#\s)]*)?(?:#[^"' \s)]*)?`;
|
|
9
|
+
const HTML_ATTRIBUTE_ASSET_PATTERN = new RegExp(String.raw`((?:src|href|poster)=["'])([^"']+?${ASSET_SUFFIX_PATTERN})(["'])`, 'gi');
|
|
10
|
+
const QUOTED_LOCAL_ASSET_PATTERN = new RegExp(String.raw`(["'])((?:\/|\.{1,2}\/)[^"'\s]+?${ASSET_SUFFIX_PATTERN})\1`, 'gi');
|
|
11
|
+
const CSS_URL_ASSET_PATTERN = new RegExp(String.raw`(url\(\s*["']?)([^"')\s]+?${ASSET_SUFFIX_PATTERN})(["']?\s*\))`, 'gi');
|
|
22
12
|
|
|
23
13
|
const usage = () => {
|
|
24
14
|
console.error('Uso: node scripts/cache-bust.mjs --dir <diretorio> --version <build_id>');
|
|
@@ -77,16 +67,7 @@ const isLocalAssetPath = (assetPath) => {
|
|
|
77
67
|
if (!value) return false;
|
|
78
68
|
|
|
79
69
|
const lower = value.toLowerCase();
|
|
80
|
-
if (
|
|
81
|
-
lower.startsWith('http://') ||
|
|
82
|
-
lower.startsWith('https://') ||
|
|
83
|
-
lower.startsWith('//') ||
|
|
84
|
-
lower.startsWith('data:') ||
|
|
85
|
-
lower.startsWith('mailto:') ||
|
|
86
|
-
lower.startsWith('tel:') ||
|
|
87
|
-
lower.startsWith('javascript:') ||
|
|
88
|
-
lower.startsWith('#')
|
|
89
|
-
) {
|
|
70
|
+
if (lower.startsWith('http://') || lower.startsWith('https://') || lower.startsWith('//') || lower.startsWith('data:') || lower.startsWith('mailto:') || lower.startsWith('tel:') || lower.startsWith('javascript:') || lower.startsWith('#')) {
|
|
90
71
|
return false;
|
|
91
72
|
}
|
|
92
73
|
|
|
@@ -54,7 +54,12 @@ const ensurePageConfig = (page) => {
|
|
|
54
54
|
h1: String(page.h1).trim(),
|
|
55
55
|
intro: String(page.intro).trim(),
|
|
56
56
|
intent_label: String(page.intent_label || 'Guia pratico').trim(),
|
|
57
|
-
keywords: Array.isArray(page.keywords)
|
|
57
|
+
keywords: Array.isArray(page.keywords)
|
|
58
|
+
? page.keywords
|
|
59
|
+
.filter(Boolean)
|
|
60
|
+
.map((item) => String(item).trim())
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
: [],
|
|
58
63
|
sections: Array.isArray(page.sections) ? page.sections : [],
|
|
59
64
|
faq: Array.isArray(page.faq) ? page.faq : [],
|
|
60
65
|
related_links: Array.isArray(page.related_links) ? page.related_links : [],
|
|
@@ -63,19 +68,13 @@ const ensurePageConfig = (page) => {
|
|
|
63
68
|
|
|
64
69
|
const renderSection = (section) => {
|
|
65
70
|
const title = String(section?.title || '').trim();
|
|
66
|
-
const paragraphs = Array.isArray(section?.paragraphs)
|
|
67
|
-
|
|
68
|
-
: [];
|
|
69
|
-
const bullets = Array.isArray(section?.bullets)
|
|
70
|
-
? section.bullets.map((item) => String(item || '').trim()).filter(Boolean)
|
|
71
|
-
: [];
|
|
71
|
+
const paragraphs = Array.isArray(section?.paragraphs) ? section.paragraphs.map((item) => String(item || '').trim()).filter(Boolean) : [];
|
|
72
|
+
const bullets = Array.isArray(section?.bullets) ? section.bullets.map((item) => String(item || '').trim()).filter(Boolean) : [];
|
|
72
73
|
|
|
73
74
|
if (!title && paragraphs.length === 0 && bullets.length === 0) return '';
|
|
74
75
|
|
|
75
76
|
const paragraphsHtml = paragraphs.map((paragraph) => ` <p>${escapeHtml(paragraph)}</p>`).join('\n');
|
|
76
|
-
const bulletsHtml = bullets.length
|
|
77
|
-
? `\n <ul>\n${bullets.map((bullet) => ` <li>${escapeHtml(bullet)}</li>`).join('\n')}\n </ul>`
|
|
78
|
-
: '';
|
|
77
|
+
const bulletsHtml = bullets.length ? `\n <ul>\n${bullets.map((bullet) => ` <li>${escapeHtml(bullet)}</li>`).join('\n')}\n </ul>` : '';
|
|
79
78
|
|
|
80
79
|
return `<section class="card">\n ${title ? `<h2>${escapeHtml(title)}</h2>` : ''}\n${paragraphsHtml}${bulletsHtml}\n </section>`;
|
|
81
80
|
};
|
|
@@ -122,9 +121,7 @@ const withRequiredLinks = (relatedLinks) => {
|
|
|
122
121
|
const renderLinks = (links) => {
|
|
123
122
|
if (!links.length) return '';
|
|
124
123
|
|
|
125
|
-
return `<section class="card">\n <h2>Links úteis</h2>\n <div class="links-grid">\n${links
|
|
126
|
-
.map((link) => ` <a href="${escapeHtml(link.href)}">${escapeHtml(link.label)}</a>`)
|
|
127
|
-
.join('\n')}\n </div>\n </section>`;
|
|
124
|
+
return `<section class="card">\n <h2>Links úteis</h2>\n <div class="links-grid">\n${links.map((link) => ` <a href="${escapeHtml(link.href)}">${escapeHtml(link.label)}</a>`).join('\n')}\n </div>\n </section>`;
|
|
128
125
|
};
|
|
129
126
|
|
|
130
127
|
const renderPageHtml = (page, generatedAt) => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const projectRoot = path.resolve(scriptDir, '..');
|
|
8
|
+
const prettierBin = path.join(projectRoot, 'node_modules', '.bin', process.platform === 'win32' ? 'prettier.cmd' : 'prettier');
|
|
9
|
+
|
|
10
|
+
const mode = process.argv.includes('--check') ? '--check' : '--write';
|
|
11
|
+
const args = ['.', mode, '--config', '.prettierrc', '--ignore-path', '.gitignore', '--ignore-unknown'];
|
|
12
|
+
|
|
13
|
+
const child = spawn(prettierBin, args, {
|
|
14
|
+
stdio: 'inherit',
|
|
15
|
+
cwd: projectRoot,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
child.on('exit', (code) => {
|
|
19
|
+
process.exit(code ?? 1);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
child.on('error', (error) => {
|
|
23
|
+
console.error(`[prettier] Falha ao executar: ${error?.message || 'erro desconhecido'}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
});
|
|
@@ -6,11 +6,7 @@ import fs from 'node:fs/promises';
|
|
|
6
6
|
import { URL } from 'node:url';
|
|
7
7
|
|
|
8
8
|
const DEFAULT_BASE_URL = process.env.STICKER_LOADTEST_BASE_URL || 'http://127.0.0.1:9102';
|
|
9
|
-
const DEFAULT_PATHS = [
|
|
10
|
-
'/api/sticker-packs?limit=24&offset=0&sort=popular',
|
|
11
|
-
'/api/sticker-packs/stats',
|
|
12
|
-
'/api/sticker-packs/creators?limit=25',
|
|
13
|
-
];
|
|
9
|
+
const DEFAULT_PATHS = ['/api/sticker-packs?limit=24&offset=0&sort=popular', '/api/sticker-packs/stats', '/api/sticker-packs/creators?limit=25'];
|
|
14
10
|
const DEFAULT_DURATION_SECONDS = 30;
|
|
15
11
|
const DEFAULT_CONCURRENCY = 20;
|
|
16
12
|
const DEFAULT_TIMEOUT_MS = 12_000;
|
|
@@ -33,7 +29,9 @@ const parseCliArgs = (argv) => {
|
|
|
33
29
|
};
|
|
34
30
|
|
|
35
31
|
const args = parseCliArgs(process.argv.slice(2));
|
|
36
|
-
const baseUrl = String(args.get('--base-url') || DEFAULT_BASE_URL)
|
|
32
|
+
const baseUrl = String(args.get('--base-url') || DEFAULT_BASE_URL)
|
|
33
|
+
.trim()
|
|
34
|
+
.replace(/\/+$/, '');
|
|
37
35
|
const durationSeconds = Math.max(5, Number(args.get('--duration-seconds') || DEFAULT_DURATION_SECONDS));
|
|
38
36
|
const concurrency = Math.max(1, Number(args.get('--concurrency') || DEFAULT_CONCURRENCY));
|
|
39
37
|
const timeoutMs = Math.max(1000, Number(args.get('--timeout-ms') || DEFAULT_TIMEOUT_MS));
|
|
@@ -146,11 +144,15 @@ const main = async () => {
|
|
|
146
144
|
console.log(`[loadtest] duration_seconds=${durationSeconds} concurrency=${concurrency} paths=${requestPaths.join(',')}`);
|
|
147
145
|
await sleep(250);
|
|
148
146
|
|
|
149
|
-
await Promise.all(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
await Promise.all(
|
|
148
|
+
Array.from({ length: concurrency }).map((_, index) =>
|
|
149
|
+
runWorker({
|
|
150
|
+
deadlineMs,
|
|
151
|
+
workerIndex: index,
|
|
152
|
+
stats,
|
|
153
|
+
}),
|
|
154
|
+
),
|
|
155
|
+
);
|
|
154
156
|
|
|
155
157
|
const elapsedSeconds = Math.max(0.001, (Date.now() - startedAt) / 1000);
|
|
156
158
|
const sortedLatencies = [...stats.latencies].sort((a, b) => a - b);
|
|
@@ -4,10 +4,7 @@ import 'dotenv/config';
|
|
|
4
4
|
import logger from '../app/utils/logger/loggerModule.js';
|
|
5
5
|
import initializeDatabase from '../database/init.js';
|
|
6
6
|
import { closePool } from '../database/index.js';
|
|
7
|
-
import {
|
|
8
|
-
isSupportedStickerWorkerTaskType,
|
|
9
|
-
startDedicatedStickerWorker,
|
|
10
|
-
} from '../app/modules/stickerPackModule/stickerDedicatedTaskWorkerRuntime.js';
|
|
7
|
+
import { isSupportedStickerWorkerTaskType, startDedicatedStickerWorker } from '../app/modules/stickerPackModule/stickerDedicatedTaskWorkerRuntime.js';
|
|
11
8
|
|
|
12
9
|
const parseCliArgs = (argv = []) => {
|
|
13
10
|
const args = new Map();
|
|
@@ -15,7 +15,9 @@ const START_MARKER = '<!-- README_SNAPSHOT:START -->';
|
|
|
15
15
|
const END_MARKER = '<!-- README_SNAPSHOT:END -->';
|
|
16
16
|
|
|
17
17
|
const readmePath = path.resolve(projectRoot, process.env.README_SNAPSHOT_TARGET_PATH || 'README.md');
|
|
18
|
-
const siteOrigin = String(process.env.SITE_ORIGIN || 'https://omnizap.shop')
|
|
18
|
+
const siteOrigin = String(process.env.SITE_ORIGIN || 'https://omnizap.shop')
|
|
19
|
+
.trim()
|
|
20
|
+
.replace(/\/+$/, '');
|
|
19
21
|
const sourceUrl = String(process.env.README_SNAPSHOT_SOURCE_URL || `${siteOrigin}/api/sticker-packs/readme-markdown`).trim();
|
|
20
22
|
const timeoutMs = Math.max(1000, Number(process.env.README_SNAPSHOT_TIMEOUT_MS) || 15000);
|
|
21
23
|
|
|
@@ -68,4 +70,3 @@ syncReadmeSnapshot().catch((error) => {
|
|
|
68
70
|
console.error(`[readme-sync] Falha: ${error?.message || error}`);
|
|
69
71
|
process.exit(1);
|
|
70
72
|
});
|
|
71
|
-
|