@bobfrankston/rmfmail 1.2.241 → 1.2.242

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.
@@ -1848,6 +1848,23 @@ function showPreviewBodyMenu(absX, absY, selectedText, sourceWindow, linkUrl, li
1848
1848
  );
1849
1849
  showContextMenu(absX, absY, items);
1850
1850
  }
1851
+ function renderBodyFetchGaveUp(bodyEl, accountId, uid, folderId, secs, previewText, specialUse, envelope) {
1852
+ const looksImapUidOnApiAccount = uid > 0 && uid < 1e9;
1853
+ const why = looksImapUidOnApiAccount ? `This message was indexed over IMAP, but its account fetches bodies through the Gmail API, which addresses messages by a different id. The body can't be requested for this row.` : `The server accepted the request but never returned the body.`;
1854
+ const snippet = previewText ? `<div class="mv-preview-placeholder">${escapeHtml3(previewText)}<div class="mv-tear-line"><span>\u2702 snippet \u2014 this is all that arrived \u2702</span></div></div>` : "";
1855
+ bodyEl.innerHTML = `${snippet}<div class="mv-system-message mv-system-error">
1856
+ <div class="mv-system-tag">rmfmail</div>
1857
+ <div class="mv-system-title">Body didn't arrive after ${secs}s \u2014 not still loading</div>
1858
+ <div class="mv-system-body">${escapeHtml3(why)}
1859
+ <div style="margin-top:8px;display:flex;gap:8px;flex-wrap:wrap">
1860
+ <button id="mv-body-retry" class="tb-btn">Try again</button>
1861
+ </div></div></div>`;
1862
+ bodyEl.querySelector("#mv-body-retry")?.addEventListener("click", () => {
1863
+ invalidateParsedCache(accountId, folderId, uid);
1864
+ showMessage(accountId, uid, folderId, specialUse, true, envelope).catch(() => {
1865
+ });
1866
+ });
1867
+ }
1851
1868
  function toggleFullscreenPreview() {
1852
1869
  const body = document.body;
1853
1870
  const on = !body.classList.contains("fullscreen-preview");
@@ -2205,8 +2222,14 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
2205
2222
  span.textContent = secs >= 60 ? `(${Math.floor(secs / 60)}m ${secs % 60}s)` : `(${secs}s)`;
2206
2223
  if (secs === 30)
2207
2224
  span.classList.add("mv-wait-slow");
2225
+ if (secs >= WAIT_GIVE_UP_SECS) {
2226
+ clearInterval(tick);
2227
+ off?.();
2228
+ renderBodyFetchGaveUp(bodyEl, accountId, uid, folderId, secs, previewText, specialUse, envelope || cached || void 0);
2229
+ }
2208
2230
  }, 1e3);
2209
- const off = subscribeStore("*", (ev) => {
2231
+ let off;
2232
+ off = subscribeStore("*", (ev) => {
2210
2233
  if (ev.kind !== "bodyAvailable")
2211
2234
  return;
2212
2235
  if (ev.accountId !== accountId || ev.uid !== uid)
@@ -3679,7 +3702,7 @@ function spawnDesktopPopout(msg, accountId) {
3679
3702
  function escapeHtmlLocal(s) {
3680
3703
  return (s || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3681
3704
  }
3682
- var currentMessage, currentAccountId, dragOutUrls, showMessageGeneration, retryCount, lastEnvelope, PARSED_CACHE_LIMIT, parsedCache, sessionAllowedRemote, recentFetchErrors, ZOOM_KEY, ZOOM_MIN, ZOOM_MAX, ZOOM_STEP, previewZoom, RENDER_MARK_KEY, RENDER_MARK_MAX_AGE_MS, poisonedMessages, renderKey, PROGRESSIVE_TEXT_THRESHOLD, TEXT_CHUNK_BYTES;
3705
+ var currentMessage, currentAccountId, dragOutUrls, showMessageGeneration, retryCount, lastEnvelope, PARSED_CACHE_LIMIT, parsedCache, sessionAllowedRemote, recentFetchErrors, WAIT_GIVE_UP_SECS, ZOOM_KEY, ZOOM_MIN, ZOOM_MAX, ZOOM_STEP, previewZoom, RENDER_MARK_KEY, RENDER_MARK_MAX_AGE_MS, poisonedMessages, renderKey, PROGRESSIVE_TEXT_THRESHOLD, TEXT_CHUNK_BYTES;
3683
3706
  var init_message_viewer = __esm({
3684
3707
  "client/components/message-viewer.js"() {
3685
3708
  "use strict";
@@ -3698,6 +3721,7 @@ var init_message_viewer = __esm({
3698
3721
  parsedCache = /* @__PURE__ */ new Map();
3699
3722
  sessionAllowedRemote = /* @__PURE__ */ new Set();
3700
3723
  recentFetchErrors = /* @__PURE__ */ new Map();
3724
+ WAIT_GIVE_UP_SECS = 45;
3701
3725
  ZOOM_KEY = "mailx-preview-zoom";
3702
3726
  ZOOM_MIN = 0.5;
3703
3727
  ZOOM_MAX = 3;