@operstack/audit 0.13.0 → 0.13.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/bin/audit.mjs CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operstack/audit",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "SEO, AEO and GEO audit generator: collect public signals from a site into audit.json, let an analyst or an agent fill the narrative, render the OperStack report as HTML and PDF.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/collect.mjs CHANGED
@@ -185,7 +185,12 @@ export async function collect(startUrl, { pages = 20, log = () => {}, backlinks
185
185
  log(`homepage ${startUrl}`);
186
186
  const home = await follow(startUrl);
187
187
  const homePage = home.response.ok ? analysePage(home.final, home.response.text) : null;
188
- checks.push(row('https', 'technical', 'HTTPS', home.final.startsWith('https://') ? 'ok' : 'bad', home.final.startsWith('https://') ? 'certificate active' : 'site served over http'));
188
+ // Сайт, который не ответил, не имеет ни сертификата, ни чего-либо ещё. Пока эта строка смотрела
189
+ // только на схему в адресе, отчёт по несуществующему домену уверенно сообщал «certificate active».
190
+ const homeAnswered = Boolean(home.response.ok);
191
+ checks.push(homeAnswered
192
+ ? row('https', 'technical', 'HTTPS', home.final.startsWith('https://') ? 'ok' : 'bad', home.final.startsWith('https://') ? 'certificate active' : 'site served over http')
193
+ : row('https', 'technical', 'HTTPS', 'bad', `the site did not answer${home.response.status ? `: HTTP ${home.response.status}` : ''}`, 'nothing below could be measured on a site that does not answer'));
189
194
  const altHost = host.startsWith('www.') ? host.slice(4) : `www.${host}`;
190
195
  const alt = await follow(`${new URL(home.final).protocol}//${altHost}/`);
191
196
  const altOk = alt.final.replace(/\/$/, '') === new URL(home.final).origin.replace(/\/$/, '') || alt.hops.some((h) => h.status >= 300 && h.status < 400);
@@ -423,7 +428,7 @@ export async function collect(startUrl, { pages = 20, log = () => {}, backlinks
423
428
  const critical = checks.filter((c) => c.status === 'bad').map((c) => ({ title: c.label, text: `${c.value}${c.comment ? `. ${c.comment}` : ''}`, level: 'bad' }));
424
429
 
425
430
  return {
426
- meta: { site: home.final, host, collectedAt: new Date().toISOString(), tool: `@operstack/audit ${VERSION}`, auditType: lang === 'ru' ? 'Аудит по публичным сигналам' : 'External audit (no Search Console or analytics access)', lang, language: hp ? (hp.og?.locale || '') : '' },
431
+ meta: { site: home.final, host, reachable: homeAnswered, collectedAt: new Date().toISOString(), tool: `@operstack/audit ${VERSION}`, auditType: lang === 'ru' ? 'Аудит по публичным сигналам' : 'External audit (no Search Console or analytics access)', lang, language: hp ? (hp.og?.locale || '') : '' },
427
432
  client: { name: '{{CLIENT NAME}}', subject: '{{What the site sells and where}}', reportDate: new Date().toISOString().slice(0, 10), preparedBy: 'OperStack' },
428
433
  scores,
429
434
  scoreBasis,
package/src/i18n.mjs CHANGED
@@ -43,7 +43,7 @@ export function localiseBasisNote(note) {
43
43
  * пересобирая его из тех же чисел. Там, где текст постоянный, возвращается константа.
44
44
  */
45
45
  const RU = {
46
- https: { label: 'HTTPS', value: (v) => (/certificate active/.test(v) ? 'сертификат активен' : 'сайт отдаётся по http, без шифрования') },
46
+ https: { label: 'HTTPS', value: (v) => (/did not answer/.test(v) ? `сайт не ответил${/HTTP (\d+)/.exec(v) ? `: HTTP ${/HTTP (\d+)/.exec(v)[1]}` : ''}` : /certificate active/.test(v) ? 'сертификат активен' : 'сайт отдаётся по http, без шифрования'), comment: (c) => (c ? 'на сайте, который не отвечает, измерить нельзя ничего' : '') },
47
47
  www: {
48
48
  label: 'Склейка адреса с www',
49
49
  value: (v) => (/redirects to/.test(v) ? 'адрес с www перенаправляется на основной'