mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-11 18:10:01 +08:00
fix: some browser do not support wasm (#182)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import PostalMime from 'postal-mime';
|
||||
import { parse_message } from 'mail-parser-wasm'
|
||||
|
||||
function humanFileSize(size) {
|
||||
const i = size === 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024));
|
||||
@@ -9,6 +8,7 @@ function humanFileSize(size) {
|
||||
export async function processItem(item) {
|
||||
// Try to parse the email using mail-parser-wasm
|
||||
try {
|
||||
const { parse_message } = await import('mail-parser-wasm');
|
||||
const parsedEmail = parse_message(item.raw);
|
||||
item.source = parsedEmail.sender || item.source;
|
||||
item.subject = parsedEmail.subject || '';
|
||||
@@ -67,6 +67,7 @@ export async function processItem(item) {
|
||||
item.subject = 'No Subject';
|
||||
item.message = item.raw;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
export function getDownloadEmlUrl(raw) {
|
||||
|
||||
Reference in New Issue
Block a user