@social-mail/social-mail-web-server 1.5.92 → 1.5.93
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/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/wwwroot/routes/api/emails/channel/content/html/index.d.ts.map +1 -1
- package/dist/wwwroot/routes/api/emails/channel/content/html/index.js +30 -6
- package/dist/wwwroot/routes/api/emails/channel/content/html/index.js.map +1 -1
- package/package.json +1 -1
- package/src/wwwroot/routes/api/emails/channel/content/html/index.ts +44 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/wwwroot/routes/api/emails/channel/content/html/index.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/wwwroot/routes/api/emails/channel/content/html/index.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,0CAA0C,CAAC;AAK5D,MAAM,CAAC,OAAO,MAAO,SAAQ,IAAI;IAG7B,OAAO,CAAC,EAAE,CAAoB;IAG9B,OAAO,CAAC,iBAAiB,CAAqB;IAExC,GAAG;CAkEZ"}
|
|
@@ -16,13 +16,37 @@ let default_1 = class extends Page {
|
|
|
16
16
|
async run() {
|
|
17
17
|
const [channelID, emailID, messageID] = this.childPath;
|
|
18
18
|
const host = this.request.host;
|
|
19
|
+
const userID = this.sessionUser.userID;
|
|
20
|
+
let email;
|
|
19
21
|
// verify host ...
|
|
20
|
-
const
|
|
21
|
-
.where({ emailID, messageID, channelID, host }, (p) => (x) => x.emailID === p.emailID
|
|
22
|
-
&& x.headerMessageID === p.messageID
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const q = this.db.emails
|
|
23
|
+
.where({ emailID, messageID, channelID, host, userID }, (p) => (x) => x.emailID === p.emailID
|
|
24
|
+
&& x.headerMessageID === p.messageID);
|
|
25
|
+
if (this.sessionUser.isAdmin) {
|
|
26
|
+
email = await q
|
|
27
|
+
.where({ userID, channelID }, (p) => (x) => x.mailboxes.some((c) => c.mailboxID === p.channelID
|
|
28
|
+
&& c.mailbox.userMailboxes.some((mu) => mu.userID === p.userID)))
|
|
29
|
+
.first();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (this.sessionUser.userID) {
|
|
33
|
+
email = await this.db.emails
|
|
34
|
+
.where({ emailID, messageID, channelID, host, userID }, (p) => (x) => x.emailID === p.emailID
|
|
35
|
+
&& x.headerMessageID === p.messageID
|
|
36
|
+
&& x.mailboxes.some((c) => c.mailboxID === p.channelID
|
|
37
|
+
&& c.mailbox.userMailboxes.some((mu) => mu.userID === p.userID)
|
|
38
|
+
|| c.mailbox.websiteChannels.some((wc) => wc.website.hosts.some((h) => h.host === p.host))))
|
|
39
|
+
.first();
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
email = await this.db.emails
|
|
43
|
+
.where({ emailID, messageID, channelID, host, userID }, (p) => (x) => x.emailID === p.emailID
|
|
44
|
+
&& x.headerMessageID === p.messageID
|
|
45
|
+
&& x.mailboxes.some((c) => c.mailboxID === p.channelID
|
|
46
|
+
&& c.mailbox.websiteChannels.some((wc) => wc.website.hosts.some((h) => h.host === p.host))))
|
|
47
|
+
.first();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
26
50
|
const body = await this.cacheEmailService.getHtmlText(email);
|
|
27
51
|
this.cacheControl = "public, max-age=2592000, immutable";
|
|
28
52
|
return this.content({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../src/wwwroot/routes/api/emails/channel/content/html/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,4CAA4C,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AACjF,OAAO,iBAAiB,MAAM,wDAAwD,CAAC;AACvF,OAAO,kBAAkB,MAAM,iEAAiE,CAAC;AACjG,OAAO,IAAI,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../src/wwwroot/routes/api/emails/channel/content/html/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,4CAA4C,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AACjF,OAAO,iBAAiB,MAAM,wDAAwD,CAAC;AACvF,OAAO,kBAAkB,MAAM,iEAAiE,CAAC;AACjG,OAAO,IAAI,MAAM,0CAA0C,CAAC;AAK7C,gBAAA,KAAM,SAAQ,IAAI;IAQ7B,KAAK,CAAC,GAAG;QAEL,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,SAAkB,CAAC;QAEhE,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAE/B,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;QAEvC,IAAI,KAAY,CAAC;QAEjB,kBAAkB;QAElB,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM;aACnB,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACjE,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;eACpB,CAAC,CAAC,eAAe,KAAK,CAAC,CAAC,SAAS,CACvC,CAAC;QAEN,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC3B,KAAK,GAAG,MAAM,CAAC;iBACV,KAAK,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACvC,CAAC,C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AAM;qBACvB,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACjE,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;uBACpB,CAAC,CAAC,eAAe,KAAK,CAAC,CAAC,SAAS;uBACjC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;2BAC/C,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CACrC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAClD,CACJ,CACJ;qBACA,KAAK,EAAE,CAAC;YACjB,CAAC;QACL,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAE7D,IAAI,CAAC,YAAY,GAAG,oCAAoC,CAAC;QAEzD,OAAO,IAAI,CAAC,OAAO,CAAC;YAChB,IAAI;YACJ,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,MAAM;SACnB,CAAC,CAAC;IACP,CAAC;CAEJ,CAAA;AAvEW;IADP,MAAM;8BACK,iBAAiB;qCAAC;AAGtB;IADP,MAAM;8BACoB,kBAAkB;oDAAC;AANnC;IADd,OAAO,CAAC,SAAS;aA2EjB"}
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js"
|
|
|
3
3
|
import SocialMailContext from "../../../../../../../server/model/SocialMailContext.js";
|
|
4
4
|
import CachedEmailService from "../../../../../../../server/smtp/services/CachedEmailService.js";
|
|
5
5
|
import Page from "@entity-access/server-pages/dist/Page.js";
|
|
6
|
+
import { Email } from "../../../../../../../server/model/entities/Email.js";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
@Prepare.authorize
|
|
@@ -20,16 +21,54 @@ export default class extends Page {
|
|
|
20
21
|
|
|
21
22
|
const host = this.request.host;
|
|
22
23
|
|
|
24
|
+
const userID = this.sessionUser.userID;
|
|
25
|
+
|
|
26
|
+
let email: Email;
|
|
27
|
+
|
|
23
28
|
// verify host ...
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
|
|
30
|
+
const q = this.db.emails
|
|
31
|
+
.where({ emailID, messageID, channelID, host, userID }, (p) => (x) =>
|
|
32
|
+
x.emailID === p.emailID
|
|
33
|
+
&& x.headerMessageID === p.messageID
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (this.sessionUser.isAdmin) {
|
|
37
|
+
email = await q
|
|
38
|
+
.where({ userID, channelID }, (p) => (x) =>
|
|
39
|
+
x.mailboxes.some((c) => c.mailboxID === p.channelID
|
|
40
|
+
&& c.mailbox.userMailboxes.some((mu) => mu.userID === p.userID)
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
.first();
|
|
44
|
+
} else {
|
|
45
|
+
if (this.sessionUser.userID) {
|
|
46
|
+
email = await this.db.emails
|
|
47
|
+
.where({ emailID, messageID, channelID, host, userID }, (p) => (x) =>
|
|
48
|
+
x.emailID === p.emailID
|
|
49
|
+
&& x.headerMessageID === p.messageID
|
|
50
|
+
&& x.mailboxes.some((c) => c.mailboxID === p.channelID
|
|
51
|
+
&& c.mailbox.userMailboxes.some((mu) => mu.userID === p.userID)
|
|
52
|
+
|| c.mailbox.websiteChannels.some((wc) =>
|
|
53
|
+
wc.website.hosts.some((h) => h.host === p.host)
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
.first();
|
|
58
|
+
} else {
|
|
59
|
+
email = await this.db.emails
|
|
60
|
+
.where({ emailID, messageID, channelID, host, userID }, (p) => (x) =>
|
|
26
61
|
x.emailID === p.emailID
|
|
27
62
|
&& x.headerMessageID === p.messageID
|
|
28
63
|
&& x.mailboxes.some((c) => c.mailboxID === p.channelID
|
|
29
64
|
&& c.mailbox.websiteChannels.some((wc) =>
|
|
30
|
-
wc.website.hosts.some((h) => h.host === p.host)
|
|
31
|
-
|
|
32
|
-
|
|
65
|
+
wc.website.hosts.some((h) => h.host === p.host)
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
.first();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
33
72
|
|
|
34
73
|
const body = await this.cacheEmailService.getHtmlText(email);
|
|
35
74
|
|