mirror of
https://github.com/GRFreire/nthmail.git
synced 2026-01-09 04:49:39 +00:00
now, there is only one binary that starts both servers, making them use the same SQL connection. this commit also added some `defer tx.Commit()` to ensure all the transactions were closed
48 lines
1.0 KiB
Plaintext
48 lines
1.0 KiB
Plaintext
package web_server
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/GRFreire/nthmail/pkg/mail_utils"
|
|
)
|
|
|
|
templ inbox_body(rcpt_addr string, ms []mail_utils.Mail_obj) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<title>nthmail.xyz</title>
|
|
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
<meta name="description" content="A temporary mail service"/>
|
|
@styles()
|
|
</head>
|
|
<body class="inbox">
|
|
@header(rcpt_addr)
|
|
<div class="inbox-main">
|
|
if len(ms) != 0 {
|
|
<ul>
|
|
for _, m := range ms {
|
|
<li>
|
|
@mail_comp(m, rcpt_addr)
|
|
</li>
|
|
}
|
|
</ul>
|
|
} else {
|
|
<div class="inbox-empty">
|
|
<h3>inbox empty</h3>
|
|
</div>
|
|
}
|
|
</div>
|
|
</body>
|
|
</html>
|
|
}
|
|
|
|
templ mail_comp(m mail_utils.Mail_obj, rcpt_addr string) {
|
|
<a href={ templ.SafeURL(fmt.Sprintf("/%s/%d", rcpt_addr, m.Id)) }>
|
|
<div class="content">
|
|
<p class="inbox-mail-subj"><b>{ m.Subject }</b></p>
|
|
<p class="inbox-mail-from">{ m.From }</p>
|
|
</div>
|
|
<p class="inbox-mail-date">{ m.Date.Format("3:04 PM") }</p>
|
|
</a>
|
|
}
|