@danhachuel/jobfinder 0.1.19 → 0.1.20

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/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ All notable changes to JobFinder are documented in this file.
6
6
 
7
7
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
8
8
 
9
+ ## [0.1.20] — 2026-11-28
10
+
11
+ ### Fixed
12
+
13
+ - **Mojibake (encoding UTF-8) em toda a interface**: os arquivos fonte de 13 páginas/componentes da UI haviam sido regravados com o conteúdo UTF-8 interpretado como CP1252 ("Olá" gravado como "Olá", emojis quebrados). Reparação byte-a-byte (decoder CP1252 inverso, sem tocar nas edições `dark:`), build reverificada (0 mojibake nos bundles) e endurecimento do servidor.
14
+ - **Charset explícito no Express**: `express.static` agora fixa `Content-Type: text/html; charset=utf-8` (HTML), `text/javascript; charset=utf-8` (JS/MJS) e `text/css; charset=utf-8` (CSS) via `setHeaders`; o fallback SPA (`res.sendFile`) também envia o charset. O `index.html` do Vite já declara `<meta charset="UTF-8">` (UTF-8 sem BOM) — confirmado.
15
+
16
+ ### Tests
17
+
18
+ - Regressão de encoding no `fase1-ui-e2e.mjs`: `GET /` retorna `Content-Type` com `charset=utf-8`, HTML contém `<meta charset="UTF-8">`, HTML do fallback sem mojibake, asset estático responde e o **texto renderizado** (innerText após o login) não contém mojibake — com detector correto (à + byte de continuação, sem falso-positivo no à maiúsculo legítimo de "AÇÃO"). Suíte completa: 40 E2E + 38 keepalive + 39 fase2-worker + 32 auth + 16 serviços + 22 daemon + 40 runtime + 12 seed + 12 npx + 5 unit.
19
+
9
20
  ## [0.1.19] — 2026-11-28
10
21
 
11
22
  ### Added
package/README.md CHANGED
@@ -31,15 +31,15 @@ A **background worker** (separate Node process) keeps the queues moving even wit
31
31
  Windows / CMD / MobaXterm:
32
32
 
33
33
  ```bash
34
- npx.cmd --yes --prefer-online @danhachuel/jobfinder@0.1.17 install
35
- npx.cmd --yes --prefer-online @danhachuel/jobfinder@0.1.17
34
+ npx.cmd --yes --prefer-online @danhachuel/jobfinder@0.1.20 install
35
+ npx.cmd --yes --prefer-online @danhachuel/jobfinder@0.1.20
36
36
  ```
37
37
 
38
- Normal terminal:
38
+ Normal terminal (Linux/Mac):
39
39
 
40
40
  ```bash
41
- npx --yes @danhachuel/jobfinder@0.1.17 install
42
- npx --yes @danhachuel/jobfinder@0.1.17
41
+ npx --yes --prefer-online @danhachuel/jobfinder@0.1.20 install
42
+ npx --yes --prefer-online @danhachuel/jobfinder@0.1.20
43
43
  ```
44
44
 
45
45
  `install` creates `~/.jobfinder/` (config, auth, channels, topics, posts, connections, dm-cascades, jobs, applications, resume, logs). It is safe to re-run: existing data is never overwritten.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/jobfinder",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "JobFinder — LinkedIn automation platform (posts, connections/DMs, job matching) with a React + Vite UI. Intelligent workflows, JSON storage.",
5
5
  "keywords": [
6
6
  "linkedin",
package/scripts/cli.mjs CHANGED
@@ -112,8 +112,13 @@ Opcoes:
112
112
  --version Mostra a versão
113
113
 
114
114
  Instalação (versão canônica do npm):
115
- npx --yes @danhachuel/jobfinder@${NPM_VERSION} install
116
- npx --yes @danhachuel/jobfinder@${NPM_VERSION}
115
+ Windows / CMD / MobaXterm:
116
+ npx.cmd --yes --prefer-online @danhachuel/jobfinder@${NPM_VERSION} install
117
+ npx.cmd --yes --prefer-online @danhachuel/jobfinder@${NPM_VERSION}
118
+
119
+ Linux / Mac:
120
+ npx --yes --prefer-online @danhachuel/jobfinder@${NPM_VERSION} install
121
+ npx --yes --prefer-online @danhachuel/jobfinder@${NPM_VERSION}
117
122
 
118
123
  Recomendado no Windows (evita o EBUSY do npx, que limpa o próprio cache):
119
124
  npm install -g @danhachuel/jobfinder@latest
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Teste E2E da UI (Playwright) da Fase 1: login, proteção de rotas,
3
- * toggle de dry-run, badge Real Mode, troca de senha e logout.
2
+ * Teste E2E da UI (Playwright) da Fase 1: encoding UTF-8, login, proteção de
3
+ * rotas, toggle de dry-run, badge Real Mode, tema light/dark, troca de senha
4
+ * e logout.
4
5
  *
5
6
  * Uso: node scripts/manual-tests/fase1-ui-e2e.mjs
6
7
  * (o Playwright é uma dependência opcional do projeto)
@@ -51,6 +52,20 @@ await new Promise((resolve) => setTimeout(resolve, 1800));
51
52
 
52
53
  let browser;
53
54
  try {
55
+ console.log('\n== Encoding UTF-8 (regressao mojibake) ==');
56
+ const rootRes = await fetch(`${APP}/`);
57
+ const rootHtml = await rootRes.text();
58
+ const contentType = rootRes.headers.get('content-type') ?? '';
59
+ check('GET / responde Content-Type com charset=utf-8', /charset=utf-8/i.test(contentType), contentType);
60
+ check('HTML declara <meta charset="UTF-8">', /<meta charset="utf-8"\s*\/?>/i.test(rootHtml));
61
+ // Mojibake real: Ã (A-til) seguido de byte de continuação UTF-8 lido como
62
+ // Latin-1 — nunca "Ã" + letra ("ÃO" de AÇÃO é português legítimo).
63
+ const mojibakeInHtml = /[\u00c0-\u00df][\u0080-\u00bf]|§|â€|ð[\u0080-\u00bf]/.test(rootHtml);
64
+ check('HTML do fallback sem mojibake', !mojibakeInHtml);
65
+
66
+ const assetRes = await fetch(`${APP}/favicon.svg`);
67
+ check('asset estatico responde (charset implicito ok)', assetRes.status === 200, `HTTP ${assetRes.status}`);
68
+
54
69
  const { chromium } = await import('playwright');
55
70
  // Reuse any chromium build already on the machine (the optional Playwright
56
71
  // dependency may not match the browser cache version).
@@ -113,6 +128,11 @@ try {
113
128
  .count();
114
129
  check('sidebar mostra a conta logada', sidebarEmail > 0);
115
130
 
131
+ // Encoding renderizado: o texto visível não pode conter mojibake.
132
+ const rendered = await page.evaluate(() => document.body.innerText);
133
+ const mojibakeHit = [...rendered.matchAll(/[\u00c0-\u00df][\u0080-\u00bf]|§|â€|ð[\u0080-\u00bf]/g)].map((m) => m[0]);
134
+ check('texto renderizado sem mojibake', mojibakeHit.length === 0, mojibakeHit.slice(0, 5).map((h) => JSON.stringify(h)).join(' '));
135
+
116
136
  const dryBadge = page.locator('header span', { hasText: 'dry-run' });
117
137
  check('badge dry-run aparece no topo', (await dryBadge.count()) > 0);
118
138
 
@@ -50,14 +50,33 @@ export function createApp({ store, logger, config, rateLimiter, dataDir }) {
50
50
 
51
51
  // Static UI (built by Vite). In dev, the Vite server proxies /api here.
52
52
  if (fs.existsSync(UI_DIST)) {
53
- app.use(express.static(UI_DIST, { index: false, maxAge: '1h' }));
53
+ app.use(
54
+ express.static(UI_DIST, {
55
+ index: false,
56
+ maxAge: '1h',
57
+ // UTF-8 explícito: sem isso um cliente pode interpretar o HTML como
58
+ // latin-1 e exibir mojibake ("Olá" -> "Olá") mesmo com a build certa.
59
+ setHeaders: (res, filePath) => {
60
+ if (filePath.endsWith('.html')) {
61
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
62
+ } else if (filePath.endsWith('.js') || filePath.endsWith('.mjs')) {
63
+ res.setHeader('Content-Type', 'text/javascript; charset=utf-8');
64
+ } else if (filePath.endsWith('.css')) {
65
+ res.setHeader('Content-Type', 'text/css; charset=utf-8');
66
+ }
67
+ },
68
+ })
69
+ );
54
70
  // SPA fallback: any other GET serves index.html.
55
71
  // Express 5 EXIGE a opção `root`: um caminho absoluto "puro" falha com
56
72
  // 404 "Not Found" — foi a regressão que devolvia JSON na raiz da URL
57
73
  // enquanto os assets (servidos pelo static) funcionavam.
58
74
  app.use((req, res, next) => {
59
75
  if (req.method !== 'GET') return next();
60
- res.sendFile('index.html', { root: UI_DIST });
76
+ res.sendFile('index.html', {
77
+ root: UI_DIST,
78
+ headers: { 'Content-Type': 'text/html; charset=utf-8' },
79
+ });
61
80
  });
62
81
  } else {
63
82
  app.get('/', (req, res) => {