waibu 2.7.1 → 2.8.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/index.js
CHANGED
|
@@ -12,7 +12,6 @@ import handleFavicon from './lib/handle-favicon.js'
|
|
|
12
12
|
import handleError from './lib/handle-error.js'
|
|
13
13
|
import handleNotFound from './lib/handle-not-found.js'
|
|
14
14
|
import handleHome from './lib/handle-home.js'
|
|
15
|
-
import buildLocals from './lib/build-locals.js'
|
|
16
15
|
import queryString from 'query-string'
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -502,36 +501,6 @@ async function factory (pkgName) {
|
|
|
502
501
|
return url
|
|
503
502
|
}
|
|
504
503
|
|
|
505
|
-
/**
|
|
506
|
-
* Method to send mail through Masohi Messaging System. It is a thin wrapper
|
|
507
|
-
* for {@link https://github.com/ardhi/masohi-mail|masohi-mail} send method.
|
|
508
|
-
*
|
|
509
|
-
* If masohi is not loaded, nothing is delivered.
|
|
510
|
-
*
|
|
511
|
-
* @method
|
|
512
|
-
* @async
|
|
513
|
-
* @param {(string|Array)} tpl - Mail's template to use. If a string is given, the same template will be used for html & plaintext versions. Otherwise, the first template will be used for html mail, and the second one is for it's plaintext version
|
|
514
|
-
* @param {Object} [params={}] - {@link https://github.com/ardhi/masohi-mail|masohi-mail}'s params object.
|
|
515
|
-
* @returns
|
|
516
|
-
*/
|
|
517
|
-
sendMail = async (tpl, { to, cc, bcc, from, subject, data = {}, conn, source, options = {} }) => {
|
|
518
|
-
conn = conn ?? 'masohiMail:default'
|
|
519
|
-
if (!this.app.masohi || !this.app.masohiMail) return
|
|
520
|
-
const { get, isString } = this.app.lib._
|
|
521
|
-
const { generateId } = this.app.lib.aneka
|
|
522
|
-
const { render } = this.app.bajoTemplate
|
|
523
|
-
if (isString(tpl)) tpl = [tpl]
|
|
524
|
-
const locals = await buildLocals.call(this, { tpl, params: data, opts: options })
|
|
525
|
-
const opts = {
|
|
526
|
-
lang: get(options, 'req.lang'),
|
|
527
|
-
groupId: get(options, 'req.id', generateId())
|
|
528
|
-
}
|
|
529
|
-
const message = await render(tpl[0], locals, opts)
|
|
530
|
-
if (tpl[1]) opts.messageText = await render(tpl[1], locals, opts)
|
|
531
|
-
const payload = { type: 'object', data: { to, cc, bcc, from, subject, message, options: opts } }
|
|
532
|
-
await this.app.masohi.send({ payload, source: source ?? this.ns, conn }) // mail sent through worker
|
|
533
|
-
}
|
|
534
|
-
|
|
535
504
|
/**
|
|
536
505
|
* Recursively unescape block of texts
|
|
537
506
|
*
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<head lang="<%= _meta.lang %>">
|
|
3
|
-
<meta charset="UTF-8">
|
|
4
|
-
<title><%= page.fullTitle %></title>
|
|
5
|
-
<style type="text/css">
|
|
6
|
-
</style>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<% if (arguments[0].firstName && arguments[0].lastName) { %>
|
|
10
|
-
<p>Dear <%= firstName %> <%= lastName %>,</p>
|
|
11
|
-
<% } %>
|
|
12
|
-
<!-- body -->
|
|
13
|
-
<p>Sincerely,</p>
|
|
14
|
-
|
|
15
|
-
<p><%= _meta.site.title %></p>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="<%= _meta.lang %>">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title><%= page.fullTitle %></title>
|
|
6
|
-
<style type="text/css">
|
|
7
|
-
</style>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<% if (arguments[0].firstName && arguments[0].lastName) { %>
|
|
11
|
-
<p>Yth <%= firstName %> <%= lastName %>,</p>
|
|
12
|
-
<% } %>
|
|
13
|
-
<!-- body -->
|
|
14
|
-
<p>Hormat kami,</p>
|
|
15
|
-
|
|
16
|
-
<p><%= _meta.site.title %></p>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|