@reddoorla/maintenance 0.54.2 → 0.54.4

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/dist/index.js CHANGED
@@ -1152,11 +1152,15 @@ async function browserAudit(ctx) {
1152
1152
  await runner.close?.();
1153
1153
  }
1154
1154
  }
1155
+ var FETCH_TIMEOUT_MS = 1e4;
1155
1156
  function defaultDiscoverDeps() {
1156
1157
  return {
1157
1158
  fetchText: async (url) => {
1158
1159
  try {
1159
- const res = await fetch(url, { redirect: "follow" });
1160
+ const res = await fetch(url, {
1161
+ redirect: "follow",
1162
+ signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
1163
+ });
1160
1164
  if (!res.ok) return null;
1161
1165
  return await res.text();
1162
1166
  } catch {
@@ -1257,9 +1261,17 @@ async function defaultBrowserRunner() {
1257
1261
  for (const url of urls) {
1258
1262
  let status;
1259
1263
  try {
1260
- let res = await fetch(url, { method: "HEAD", redirect: "follow" });
1264
+ let res = await fetch(url, {
1265
+ method: "HEAD",
1266
+ redirect: "follow",
1267
+ signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
1268
+ });
1261
1269
  if (res.status === 405 || res.status === 501) {
1262
- res = await fetch(url, { method: "GET", redirect: "follow" });
1270
+ res = await fetch(url, {
1271
+ method: "GET",
1272
+ redirect: "follow",
1273
+ signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
1274
+ });
1263
1275
  }
1264
1276
  status = res.status;
1265
1277
  } catch {
@@ -4930,7 +4942,7 @@ function checklistBlock(r) {
4930
4942
  }
4931
4943
  function approveButton(r) {
4932
4944
  const disabled = isChecklistComplete(r) ? "" : " disabled";
4933
- return `<button class="approve" data-report-id="${escapeHtml(r.id)}" data-approve-url="/api/reports/${encodeURIComponent(r.id)}/approve"${disabled}>Approve</button>`;
4945
+ return `<button class="approve" data-report-id="${escapeHtml(r.id)}" data-approve-url="${escapeHtml(`/api/reports/${encodeURIComponent(r.id)}/approve`)}"${disabled}>Approve</button>`;
4934
4946
  }
4935
4947
  function pendingRow(r) {
4936
4948
  const type = escapeHtml(r.reportType);
@@ -5354,7 +5366,7 @@ function approveStrip(model) {
5354
5366
  return `<div class="approve-row" data-signal="pending">
5355
5367
  <strong>${escapeHtml(p.siteName)}</strong>
5356
5368
  <span class="muted">${escapeHtml(p.reportType)} ${escapeHtml(p.period)}</span>
5357
- <button class="approve" data-report-id="${escapeHtml(p.reportId)}" data-approve-url="${url}">Approve</button>
5369
+ <button class="approve" data-report-id="${escapeHtml(p.reportId)}" data-approve-url="${escapeHtml(url)}">Approve</button>
5358
5370
  <a href="${href}">open \u25B8</a>
5359
5371
  </div>`;
5360
5372
  }).join("");