mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-08-29 01:53:47 +08:00
chore(deps): replace mailparser with postal-mime
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ImapFlow, type MailboxObject } from 'imapflow';
|
||||
import { simpleParser } from 'mailparser';
|
||||
import PostalMime from 'postal-mime';
|
||||
|
||||
import { config } from '@/config';
|
||||
import ConfigNotFoundError from '@/errors/types/config-not-found';
|
||||
@@ -93,9 +93,9 @@ async function handler(ctx) {
|
||||
const items = await Promise.all(
|
||||
mails.map((item) =>
|
||||
cache.tryGet(`mail:${email}:${item.envelope.messageId}`, async () => {
|
||||
const parsed = await simpleParser(item.source);
|
||||
const parsed = await PostalMime.parse(item.source);
|
||||
|
||||
let description = parsed.html || parsed.textAsHtml;
|
||||
let description = parsed.html || parsed.text?.replaceAll('\n', '<br>');
|
||||
if (parsed.attachments.length) {
|
||||
description += `<h3>Attachments (${parsed.attachments.length})</h3>`;
|
||||
for (const attachment of parsed.attachments) {
|
||||
@@ -107,7 +107,7 @@ async function handler(ctx) {
|
||||
title: item.envelope.subject,
|
||||
description,
|
||||
pubDate: parseDate(item.envelope.date),
|
||||
author: parsed.from!.text,
|
||||
author: parsed.from!.name || parsed.from!.address,
|
||||
guid: `mail:${email}:${item.envelope.messageId}`,
|
||||
};
|
||||
})
|
||||
|
||||
+1
-2
@@ -105,7 +105,6 @@
|
||||
"jsrsasign": "11.1.5",
|
||||
"lru-cache": "11.5.2",
|
||||
"lz-string": "1.5.0",
|
||||
"mailparser": "3.9.15",
|
||||
"markdown-it": "15.0.0",
|
||||
"mixi2": "0.2.2",
|
||||
"narou": "2.0.1",
|
||||
@@ -116,6 +115,7 @@
|
||||
"p-map": "7.0.6",
|
||||
"pac-proxy-agent": "9.1.0",
|
||||
"patchright": "1.62.1",
|
||||
"postal-mime": "3.0.0",
|
||||
"query-string": "9.5.0",
|
||||
"rate-limiter-flexible": "11.2.0",
|
||||
"re2js": "2.8.6",
|
||||
@@ -165,7 +165,6 @@
|
||||
"@types/jsdom": "30.0.0",
|
||||
"@types/json-bigint": "1.0.4",
|
||||
"@types/jsrsasign": "10.5.15",
|
||||
"@types/mailparser": "3.4.6",
|
||||
"@types/module-alias": "2.0.4",
|
||||
"@types/node": "26.2.0",
|
||||
"@types/sanitize-html": "2.16.1",
|
||||
|
||||
Generated
+8
-66
@@ -172,9 +172,6 @@ importers:
|
||||
lz-string:
|
||||
specifier: 1.5.0
|
||||
version: 1.5.0
|
||||
mailparser:
|
||||
specifier: 3.9.15
|
||||
version: 3.9.15
|
||||
markdown-it:
|
||||
specifier: 15.0.0
|
||||
version: 15.0.0
|
||||
@@ -205,6 +202,9 @@ importers:
|
||||
patchright:
|
||||
specifier: 1.62.1
|
||||
version: 1.62.1
|
||||
postal-mime:
|
||||
specifier: 3.0.0
|
||||
version: 3.0.0
|
||||
query-string:
|
||||
specifier: 9.5.0
|
||||
version: 9.5.0
|
||||
@@ -347,9 +347,6 @@ importers:
|
||||
'@types/jsrsasign':
|
||||
specifier: 10.5.15
|
||||
version: 10.5.15
|
||||
'@types/mailparser':
|
||||
specifier: 3.4.6
|
||||
version: 3.4.6
|
||||
'@types/module-alias':
|
||||
specifier: 2.0.4
|
||||
version: 2.0.4
|
||||
@@ -2844,9 +2841,6 @@ packages:
|
||||
'@types/jsrsasign@10.5.15':
|
||||
resolution: {integrity: sha512-3stUTaSRtN09PPzVWR6aySD9gNnuymz+WviNHoTb85dKu+BjaV4uBbWWGykBBJkfwPtcNZVfTn2lbX00U+yhpQ==}
|
||||
|
||||
'@types/mailparser@3.4.6':
|
||||
resolution: {integrity: sha512-wVV3cnIKzxTffaPH8iRnddX1zahbYB1ZEoAxyhoBo3TBCBuK6nZ8M8JYO/RhsCuuBVOw/DEN/t/ENbruwlxn6Q==}
|
||||
|
||||
'@types/mdast@4.0.4':
|
||||
resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
|
||||
|
||||
@@ -3725,10 +3719,6 @@ packages:
|
||||
deep-is@0.1.4:
|
||||
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
|
||||
|
||||
deepmerge-ts@7.1.6:
|
||||
resolution: {integrity: sha512-gQhL1ksGBLQbHeAo47YU6cs2ahd3Pv+8PFYoWogNZbQnNwQyOh9Ad5kbeHFiWwbKdeWQJ5Z7Y7mwb9ew2hXBLw==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
|
||||
deepmerge-ts@8.0.1:
|
||||
resolution: {integrity: sha512-szCXE7YLCvLKR9bFPJcvsezOShdalctSvrgN/LM/QGUEPZQajwjmsMObZ6/DuANT5lxzM/wtO8Feubwdkz8myA==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
@@ -4353,10 +4343,6 @@ packages:
|
||||
html-escaper@2.0.2:
|
||||
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
|
||||
|
||||
html-to-text@10.0.0:
|
||||
resolution: {integrity: sha512-2OH59Gtprdczel+7Rxgpz9hGVJREaf8Lt1H4kZwWHpEn70VQKRuMNGsb2eDbwaTzrYzb0hheiOG1P7Dim0B4dQ==}
|
||||
engines: {node: '>=20.19.0'}
|
||||
|
||||
html-to-text@10.0.1:
|
||||
resolution: {integrity: sha512-GiVhRI1BatGARSCmlXWNCjDT0cWrwBWoeduLoV0WSKAgaV/wa+hUWy5LiQLUs4UwiUrE52ZCMfBGiKD87TDPrg==}
|
||||
engines: {node: '>=20.19.0'}
|
||||
@@ -4794,9 +4780,6 @@ packages:
|
||||
resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
|
||||
linkify-it@5.0.2:
|
||||
resolution: {integrity: sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==}
|
||||
|
||||
linkify-it@6.1.0:
|
||||
resolution: {integrity: sha512-wJ/TwpSDTLepCrQoYWYIExIKg5Zchex2Nn5yk2mFnB+6PtdkHtyLx742md9csRjjOnGkKIS/RrbY7l8D6gT9Vw==}
|
||||
|
||||
@@ -4853,9 +4836,6 @@ packages:
|
||||
magicast@0.5.4:
|
||||
resolution: {integrity: sha512-llBEhWm1SacoRwgHUoQJYtwp4PBLF4faQi5TCpIGyGs9n4y5+juI0tDgyKIfpqxckRHaHzouUEph3THklWh03w==}
|
||||
|
||||
mailparser@3.9.15:
|
||||
resolution: {integrity: sha512-/5hgybKDMKFS05jAh8OPeEE7N53lj8nF6ywlo89VPjF2TtwqIQbjaxumQWnJIkmaagnJ6u1eansMOViHFxIXwQ==}
|
||||
|
||||
make-asynchronous@1.1.0:
|
||||
resolution: {integrity: sha512-ayF7iT+44LXdxJLTrTd3TLQpFDDvPCBxXxbv+pMUSuHA5Q8zyAfwkRP6aHHwNVFBUFWtxAHqwNJxF8vMZLAbVg==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -5170,10 +5150,6 @@ packages:
|
||||
resolution: {integrity: sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
nodemailer@9.0.5:
|
||||
resolution: {integrity: sha512-wvjiKvjczmsN7U/8006JOdXubgBk2XFAbioDMbT+sM7cPs0QrhJTa6KBRX7P5REGGkDcLUz/EarWidb8G8C1jQ==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
||||
nopt@10.0.1:
|
||||
resolution: {integrity: sha512-df3sBr/6ax9hSGuC3CspvLlbnX8cP5L5nZwXF8cGN8l0zSWR6BvzmQ6jPUKjvo6+/xdpkNvEcucBNUdBeeV13g==}
|
||||
engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0}
|
||||
@@ -5421,6 +5397,9 @@ packages:
|
||||
resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
postal-mime@3.0.0:
|
||||
resolution: {integrity: sha512-Z4a9ar2Bv3YpK3IXag+Yda30k7bMZfpRuUGyqtHnZ2pjHG8Bl62EhZIk4n1dzv00gfzP9g+94e9kd8+XmjVWLA==}
|
||||
|
||||
postcss@8.5.26:
|
||||
resolution: {integrity: sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
@@ -6101,9 +6080,6 @@ packages:
|
||||
engines: {node: '>=16.20.0'}
|
||||
hasBin: true
|
||||
|
||||
uc.micro@2.1.0:
|
||||
resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==}
|
||||
|
||||
uc.micro@3.0.0:
|
||||
resolution: {integrity: sha512-U3PppEkleoTnIfi8BozMx3yju3qc/L6SwqWo2Sw+54PX+PX0q9I+r1Um5HCmqD7n9VDX5/v3vQH/AjA6deDdtw==}
|
||||
|
||||
@@ -8326,11 +8302,6 @@ snapshots:
|
||||
|
||||
'@types/jsrsasign@10.5.15': {}
|
||||
|
||||
'@types/mailparser@3.4.6':
|
||||
dependencies:
|
||||
'@types/node': 26.2.0
|
||||
iconv-lite: 0.6.3
|
||||
|
||||
'@types/mdast@4.0.4':
|
||||
dependencies:
|
||||
'@types/unist': 3.0.3
|
||||
@@ -9092,8 +9063,6 @@ snapshots:
|
||||
|
||||
deep-is@0.1.4: {}
|
||||
|
||||
deepmerge-ts@7.1.6: {}
|
||||
|
||||
deepmerge-ts@8.0.1: {}
|
||||
|
||||
deepmerge@4.3.1: {}
|
||||
@@ -9863,14 +9832,6 @@ snapshots:
|
||||
|
||||
html-escaper@2.0.2: {}
|
||||
|
||||
html-to-text@10.0.0:
|
||||
dependencies:
|
||||
'@selderee/plugin-htmlparser2': 0.12.0(selderee@0.12.0)
|
||||
deepmerge-ts: 7.1.6
|
||||
dom-serializer: 2.0.0
|
||||
htmlparser2: 10.1.0
|
||||
selderee: 0.12.0
|
||||
|
||||
html-to-text@10.0.1:
|
||||
dependencies:
|
||||
'@selderee/plugin-htmlparser2': 0.12.0(selderee@0.12.0)
|
||||
@@ -10317,10 +10278,6 @@ snapshots:
|
||||
lightningcss-win32-x64-msvc: 1.32.0
|
||||
optional: true
|
||||
|
||||
linkify-it@5.0.2:
|
||||
dependencies:
|
||||
uc.micro: 2.1.0
|
||||
|
||||
linkify-it@6.1.0:
|
||||
dependencies:
|
||||
uc.micro: 3.0.0
|
||||
@@ -10378,19 +10335,6 @@ snapshots:
|
||||
'@babel/types': 7.29.8
|
||||
source-map-js: 1.2.1
|
||||
|
||||
mailparser@3.9.15:
|
||||
dependencies:
|
||||
'@zone-eu/mailsplit': 5.4.15
|
||||
encoding-japanese: 2.2.0
|
||||
he: 1.2.0
|
||||
html-to-text: 10.0.0
|
||||
iconv-lite: 0.7.3
|
||||
libmime: 5.4.2
|
||||
linkify-it: 5.0.2
|
||||
nodemailer: 9.0.5
|
||||
punycode.js: 2.3.1
|
||||
tlds: 1.261.0
|
||||
|
||||
make-asynchronous@1.1.0:
|
||||
dependencies:
|
||||
p-event: 6.0.1
|
||||
@@ -10879,8 +10823,6 @@ snapshots:
|
||||
|
||||
node-releases@2.0.53: {}
|
||||
|
||||
nodemailer@9.0.5: {}
|
||||
|
||||
nopt@10.0.1:
|
||||
dependencies:
|
||||
abbrev: 5.0.0
|
||||
@@ -11206,6 +11148,8 @@ snapshots:
|
||||
|
||||
pluralize@8.0.0: {}
|
||||
|
||||
postal-mime@3.0.0: {}
|
||||
|
||||
postcss@8.5.26:
|
||||
dependencies:
|
||||
nanoid: 3.3.18
|
||||
@@ -11942,8 +11886,6 @@ snapshots:
|
||||
'@typescript/typescript-win32-arm64': 7.0.2
|
||||
'@typescript/typescript-win32-x64': 7.0.2
|
||||
|
||||
uc.micro@2.1.0: {}
|
||||
|
||||
uc.micro@3.0.0: {}
|
||||
|
||||
ufo@1.6.4: {}
|
||||
|
||||
Reference in New Issue
Block a user