@bobfrankston/rmfmail 1.1.230 → 1.1.231

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.
Files changed (37) hide show
  1. package/client/android-bootstrap.bundle.js +4 -1
  2. package/client/android-bootstrap.bundle.js.map +2 -2
  3. package/client/app.bundle.js +25 -9
  4. package/client/app.bundle.js.map +2 -2
  5. package/client/components/message-viewer.js +30 -9
  6. package/client/components/message-viewer.js.map +1 -1
  7. package/client/components/message-viewer.ts +28 -9
  8. package/client/compose/compose.bundle.js +4 -4
  9. package/client/compose/compose.bundle.js.map +2 -2
  10. package/client/compose/compose.js +2 -2
  11. package/client/compose/compose.js.map +1 -1
  12. package/client/compose/compose.ts +2 -2
  13. package/client/lib/api-client.js +2 -2
  14. package/client/lib/api-client.js.map +1 -1
  15. package/client/lib/api-client.ts +2 -2
  16. package/package.json +5 -5
  17. package/packages/mailx-service/index.d.ts +1 -1
  18. package/packages/mailx-service/index.d.ts.map +1 -1
  19. package/packages/mailx-service/index.js +92 -5
  20. package/packages/mailx-service/index.js.map +1 -1
  21. package/packages/mailx-service/index.ts +83 -5
  22. package/packages/mailx-service/jsonrpc.js +1 -1
  23. package/packages/mailx-service/jsonrpc.js.map +1 -1
  24. package/packages/mailx-service/jsonrpc.ts +1 -1
  25. package/packages/mailx-store/db.d.ts.map +1 -1
  26. package/packages/mailx-store/db.js +30 -8
  27. package/packages/mailx-store/db.js.map +1 -1
  28. package/packages/mailx-store/db.ts +27 -8
  29. package/packages/mailx-types/index.d.ts +7 -3
  30. package/packages/mailx-types/index.d.ts.map +1 -1
  31. package/packages/mailx-types/index.js.map +1 -1
  32. package/packages/mailx-types/index.ts +7 -3
  33. package/packages/mailx-types/mailx-api.d.ts +1 -1
  34. package/packages/mailx-types/mailx-api.d.ts.map +1 -1
  35. package/packages/mailx-types/mailx-api.ts +1 -1
  36. package/tsconfig.base.json +1 -0
  37. package/packages/mailx-imap/node_modules.npmglobalize-stash-86824/.package-lock.json +0 -116
@@ -600,9 +600,9 @@ function setupAccount(name, email, password) {
600
600
  async function getAttachment(accountId, uid, attachmentId, folderId) {
601
601
  return ipc().getAttachment(accountId, uid, attachmentId, folderId);
602
602
  }
603
- async function openAttachment(accountId, uid, attachmentId, folderId) {
603
+ async function openAttachment(accountId, uid, attachmentId, folderId, filename) {
604
604
  const fn = ipc().openAttachment;
605
- return fn ? fn(accountId, uid, attachmentId, folderId) : void 0;
605
+ return fn ? fn(accountId, uid, attachmentId, folderId, filename) : void 0;
606
606
  }
607
607
  async function getDeviceAccounts() {
608
608
  return ipc().getDeviceAccounts?.() ?? [];
@@ -1816,14 +1816,30 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1816
1816
  attEl.hidden = false;
1817
1817
  const saveAttachmentAt = async (idx) => {
1818
1818
  const a0 = msg.attachments[idx];
1819
+ const name = a0.filename || "attachment";
1819
1820
  try {
1820
- const data = await getAttachment(accountId, uid, idx, msg.folderId);
1821
+ const data = await getAttachment(accountId, uid, a0.id, msg.folderId);
1821
1822
  const bytes = Uint8Array.from(atob(data.content), (c) => c.charCodeAt(0));
1822
1823
  const blob = new Blob([bytes], { type: data.contentType || "application/octet-stream" });
1824
+ const picker = window.showSaveFilePicker;
1825
+ if (typeof picker === "function") {
1826
+ let handle;
1827
+ try {
1828
+ handle = await picker({ suggestedName: name });
1829
+ } catch (e) {
1830
+ if (e?.name === "AbortError")
1831
+ return;
1832
+ throw e;
1833
+ }
1834
+ const writable = await handle.createWritable();
1835
+ await writable.write(blob);
1836
+ await writable.close();
1837
+ return;
1838
+ }
1823
1839
  const url = URL.createObjectURL(blob);
1824
1840
  const a = document.createElement("a");
1825
1841
  a.href = url;
1826
- a.download = a0.filename || "attachment";
1842
+ a.download = name;
1827
1843
  a.style.display = "none";
1828
1844
  document.body.appendChild(a);
1829
1845
  a.click();
@@ -1832,7 +1848,7 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1832
1848
  URL.revokeObjectURL(url);
1833
1849
  }, 5e3);
1834
1850
  } catch (err) {
1835
- window.dispatchEvent(new CustomEvent("mailx-alert", { detail: { message: `Couldn't save "${a0.filename}": ${err?.message || err}`, key: "attachment-save" } }));
1851
+ window.dispatchEvent(new CustomEvent("mailx-alert", { detail: { message: `Couldn't save "${name}": ${err?.message || err}`, key: "attachment-save" } }));
1836
1852
  }
1837
1853
  };
1838
1854
  const saveAllAttachments = async () => {
@@ -1866,14 +1882,14 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1866
1882
  try {
1867
1883
  const bridge = window._nativeBridge;
1868
1884
  if (bridge?.openAttachment) {
1869
- const data2 = await getAttachment(accountId, uid, i, msg.folderId);
1885
+ const data2 = await getAttachment(accountId, uid, att.id, msg.folderId);
1870
1886
  await bridge.openAttachment(att.filename, data2.contentType, data2.content);
1871
1887
  return;
1872
1888
  }
1873
- const res = await openAttachment(accountId, uid, i, msg.folderId);
1889
+ const res = await openAttachment(accountId, uid, att.id, msg.folderId, att.filename);
1874
1890
  if (res)
1875
1891
  return;
1876
- const data = await getAttachment(accountId, uid, i, msg.folderId);
1892
+ const data = await getAttachment(accountId, uid, att.id, msg.folderId);
1877
1893
  const bytes = Uint8Array.from(atob(data.content), (c) => c.charCodeAt(0));
1878
1894
  const blob = new Blob([bytes], { type: data.contentType });
1879
1895
  const url = URL.createObjectURL(blob);
@@ -1900,7 +1916,7 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1900
1916
  if (!e.dataTransfer)
1901
1917
  return;
1902
1918
  try {
1903
- const data = await getAttachment(accountId, uid, i, msg.folderId);
1919
+ const data = await getAttachment(accountId, uid, att.id, msg.folderId);
1904
1920
  const bytes = Uint8Array.from(atob(data.content), (c) => c.charCodeAt(0));
1905
1921
  const blob = new Blob([bytes], { type: data.contentType || "application/octet-stream" });
1906
1922
  const url = URL.createObjectURL(blob);