isite 2022.8.4 → 2022.8.5
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/apps/client-side/site_files/css/bootstrap5-addon.css +18 -1
- package/apps/client-side/site_files/css/images.css +0 -3
- package/apps/client-side/site_files/css/table.css +3 -3
- package/apps/client-side/site_files/html/{sub/i-file.content.html → directive/i-file.html} +1 -1
- package/apps/client-side/site_files/html/directive/i-image.html +7 -0
- package/apps/client-side/site_files/html/{sub/i-list2.content.html → directive/i-list.html} +0 -0
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +17 -703
- package/apps/client-side/site_files/js/directive.js +2 -2
- package/apps/client-side/site_files/js/site.js +18 -2
- package/index.js +280 -278
- package/lib/email.js +108 -0
- package/lib/integrated.js +10 -26
- package/lib/security.js +1109 -1081
- package/object-options/index.js +18 -0
- package/object-options/lib/fn.js +6 -3
- package/package.json +3 -2
- package/apps/client-side/site_files/html/sub/i-list.content.html +0 -31
package/lib/email.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
module.exports = function init(____0) {
|
|
2
|
+
|
|
3
|
+
____0.sendFreeMail = function (mail, callback) {
|
|
4
|
+
callback =
|
|
5
|
+
callback ||
|
|
6
|
+
function (err, res) {
|
|
7
|
+
console.log(err || res);
|
|
8
|
+
};
|
|
9
|
+
if (!mail || !mail.from || !mail.to || !mail.subject || !mail.message) {
|
|
10
|
+
callback({ message: ' Check Mail All Fields [ from , to , subject , message ] ' });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
mail.source = 'isite';
|
|
14
|
+
mail.from_email = mail.from;
|
|
15
|
+
mail.to_email = mail.to;
|
|
16
|
+
|
|
17
|
+
____0
|
|
18
|
+
.fetch(`http://emails.egytag.com/api/emails/add`, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
headers: { 'Content-Type': 'application/json' },
|
|
21
|
+
body: JSON.stringify(mail),
|
|
22
|
+
})
|
|
23
|
+
.then((res) => res.json())
|
|
24
|
+
.then((body) => {
|
|
25
|
+
callback(null, body);
|
|
26
|
+
})
|
|
27
|
+
.catch((err) => {
|
|
28
|
+
callback(err);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
____0.sendSmptMail = function (mail, callback) {
|
|
33
|
+
callback =
|
|
34
|
+
callback ||
|
|
35
|
+
function (err, res) {
|
|
36
|
+
console.log(err || res);
|
|
37
|
+
};
|
|
38
|
+
if (!mail || !mail.from || !mail.to || !mail.subject || !mail.message) {
|
|
39
|
+
callback({ message: ' Check Mail All Fields [ from , to , subject , message ] ' });
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
mail = { ...____0.options.mail, ...mail };
|
|
43
|
+
var transporter = ____0.nodemailer.createTransport({
|
|
44
|
+
host: mail.host,
|
|
45
|
+
port: mail.port || 587,
|
|
46
|
+
secure: mail.secure, // true for 465, false for other ports
|
|
47
|
+
auth: {
|
|
48
|
+
user: mail.username, // generated ethereal user
|
|
49
|
+
pass: mail.password, // generated ethereal password
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var mailOptions = {
|
|
54
|
+
from: mail.from,
|
|
55
|
+
to: mail.to,
|
|
56
|
+
cc: mail.cc,
|
|
57
|
+
bcc: mail.bcc,
|
|
58
|
+
subject: mail.subject,
|
|
59
|
+
html: mail.message,
|
|
60
|
+
text: mail.message.replace(/<[^>]+>/g, ''),
|
|
61
|
+
headers: {
|
|
62
|
+
'x-lib': 'isite',
|
|
63
|
+
},
|
|
64
|
+
date: new Date(),
|
|
65
|
+
attachments: [{ filename: 'isite.txt', content: 'test attachment', contentType: 'text/plain' }],
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
transporter.sendMail(mailOptions, function (err, info) {
|
|
69
|
+
callback(err, info);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
____0.checkMailConfig = function (mail, callback) {
|
|
74
|
+
callback =
|
|
75
|
+
callback ||
|
|
76
|
+
function (err, res) {
|
|
77
|
+
console.log(err || res);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
mail = { ...____0.options.mail, ...mail };
|
|
81
|
+
var transporter = ____0.nodemailer.createTransport({
|
|
82
|
+
host: mail.host,
|
|
83
|
+
port: mail.port || 587,
|
|
84
|
+
secure: mail.secure, // true for 465, false for other ports
|
|
85
|
+
auth: {
|
|
86
|
+
user: mail.username, // generated ethereal user
|
|
87
|
+
pass: mail.password, // generated ethereal password
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
transporter.verify(function (err, success) {
|
|
92
|
+
callback(err, success);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// let transporter = nodemailer.createTransport({
|
|
97
|
+
// host: "smtp.gmail.com",
|
|
98
|
+
// port: 465,
|
|
99
|
+
// secure: true,
|
|
100
|
+
// auth: {
|
|
101
|
+
// type: "OAuth2",
|
|
102
|
+
// user: "user@example.com",
|
|
103
|
+
// accessToken: "ya29.Xx_XX0xxxxx-xX0X0XxXXxXxXXXxX0x",
|
|
104
|
+
// },
|
|
105
|
+
// });
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
};
|
package/lib/integrated.js
CHANGED
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
module.exports = function init(____0) {
|
|
2
|
-
____0.sendEmail = function (mail, callback) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
____0.sendEmail =____0.sendMail = function (mail, callback) {
|
|
3
|
+
mail = { ...____0.options.mail, ...mail };
|
|
4
|
+
if (mail.enabled) {
|
|
5
|
+
if (mail.type === 'smpt') {
|
|
6
|
+
____0.sendSmptMail(mail, callback);
|
|
7
|
+
} else {
|
|
8
|
+
____0.sendFreeMail(mail, callback);
|
|
9
|
+
}
|
|
10
|
+
} else {
|
|
11
|
+
callback({ message: 'mail not enabled in site options' });
|
|
11
12
|
}
|
|
12
|
-
mail.source = 'isite';
|
|
13
|
-
mail.from_email = mail.from;
|
|
14
|
-
mail.to_email = mail.to;
|
|
15
|
-
|
|
16
|
-
____0
|
|
17
|
-
.fetch(`http://emails.egytag.com/api/emails/add`, {
|
|
18
|
-
method: 'POST',
|
|
19
|
-
headers: { 'Content-Type': 'application/json' },
|
|
20
|
-
body: JSON.stringify(mail),
|
|
21
|
-
})
|
|
22
|
-
.then((res) => res.json())
|
|
23
|
-
.then((body) => {
|
|
24
|
-
callback(null, body);
|
|
25
|
-
})
|
|
26
|
-
.catch((err) => {
|
|
27
|
-
callback(err);
|
|
28
|
-
});
|
|
29
13
|
};
|
|
30
14
|
};
|