@zaclinley/dsh-mailharbor 0.16.1 → 0.17.0
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/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +121 -7
- package/lib/client.js.map +2 -2
- package/lib/index.js +21 -1
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1209,6 +1209,18 @@ var MailDatabase = class {
|
|
|
1209
1209
|
where.push("e.date >= ?");
|
|
1210
1210
|
params.push(query.since);
|
|
1211
1211
|
}
|
|
1212
|
+
if (typeof query.before === "string" && query.before !== "") {
|
|
1213
|
+
where.push("e.date < ?");
|
|
1214
|
+
params.push(query.before.length === 10 ? `${query.before} 23:59:59` : query.before);
|
|
1215
|
+
}
|
|
1216
|
+
if (typeof query.from === "string" && query.from.trim() !== "") {
|
|
1217
|
+
const needle = `%${query.from.trim().toLowerCase()}%`;
|
|
1218
|
+
where.push("(lower(e.from_addr) LIKE ? OR lower(e.from_name) LIKE ?)");
|
|
1219
|
+
params.push(needle, needle);
|
|
1220
|
+
}
|
|
1221
|
+
if (query.attachmentsOnly === true) {
|
|
1222
|
+
where.push("EXISTS (SELECT 1 FROM attachments a WHERE a.email_id = e.id)");
|
|
1223
|
+
}
|
|
1212
1224
|
if (query.unread !== void 0) {
|
|
1213
1225
|
const mids = query.unread.mids.slice(0, 500);
|
|
1214
1226
|
const ids = query.unread.ids.slice(0, 500);
|
|
@@ -2768,7 +2780,7 @@ ${conversation.trim()}
|
|
|
2768
2780
|
}
|
|
2769
2781
|
|
|
2770
2782
|
// src/host/version.ts
|
|
2771
|
-
var VERSION = "0.
|
|
2783
|
+
var VERSION = "0.17.0";
|
|
2772
2784
|
|
|
2773
2785
|
// src/host/api.ts
|
|
2774
2786
|
init_smtp();
|
|
@@ -2872,11 +2884,19 @@ function buildRouter(runtime) {
|
|
|
2872
2884
|
return { ...items, offset, limit };
|
|
2873
2885
|
}
|
|
2874
2886
|
const unreadOnly = url.searchParams.get("unread") === "1";
|
|
2887
|
+
const from = url.searchParams.get("from") ?? "";
|
|
2888
|
+
const since = url.searchParams.get("since") ?? "";
|
|
2889
|
+
const before = url.searchParams.get("before") ?? "";
|
|
2890
|
+
const attachmentsOnly = url.searchParams.get("attachment") === "1";
|
|
2875
2891
|
const page = runtime.database(account).list({
|
|
2876
2892
|
mailbox: mailbox === "" ? "all" : mailbox,
|
|
2877
2893
|
query,
|
|
2878
2894
|
offset,
|
|
2879
2895
|
limit,
|
|
2896
|
+
...from.trim() === "" ? {} : { from },
|
|
2897
|
+
...since === "" ? {} : { since },
|
|
2898
|
+
...before === "" ? {} : { before },
|
|
2899
|
+
...attachmentsOnly ? { attachmentsOnly: true } : {},
|
|
2880
2900
|
...unreadOnly ? { unread: unreadKeys(runtime, account) } : {}
|
|
2881
2901
|
});
|
|
2882
2902
|
return { ...page, items: page.items.map((item) => localSummary(runtime, account, item)) };
|