mirror of
https://github.com/GRFreire/nthmail.git
synced 2026-01-11 05:39:39 +00:00
Compare commits
No commits in common. "7fe3ed30aa93bf498bed12a0ad00c3f3d53838fb" and "9ec0af6278a8c141ae592a1e3fa097c4168e9759" have entirely different histories.
7fe3ed30aa
...
9ec0af6278
@ -38,6 +38,7 @@ Available env variables:
|
|||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
- Restart when either mail or web server dies
|
||||||
- Handle attachments
|
- Handle attachments
|
||||||
- Do not store the raw mail data in the DB, maybe use block storage (the provider can be a disk provider at first)
|
- Do not store the raw mail data in the DB, maybe use block storage (the provider can be a disk provider at first)
|
||||||
- Cache in general?
|
- Cache in general?
|
||||||
|
|||||||
@ -71,7 +71,7 @@ func (session *Session) Data(reader io.Reader) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = stmt.Exec(session.arrived_at, session.rcpt, mail_obj.From, mail_obj.Subject, bytes)
|
_, err = stmt.Exec(session.arrived_at, session.rcpt, session.from, mail_obj.Subject, bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,12 @@ package web_server
|
|||||||
|
|
||||||
templ header(rcpt_addr string) {
|
templ header(rcpt_addr string) {
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a href="/">
|
<h3>
|
||||||
nthmail.xyz
|
nthmail.xyz
|
||||||
</a>
|
</h3>
|
||||||
<div class="header-addr">
|
<div class="header-addr">
|
||||||
<p>inbox: </p>
|
<p>inbox: </p>
|
||||||
<button tooltip="Copied" id="mail-addr" onclick="navigator.clipboard.writeText(document.getElementById('mail-addr').innerText)">{ rcpt_addr }</button>
|
<span>{ rcpt_addr }</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,20 +111,7 @@ func (sr ServerResouces) handleInbox(res http.ResponseWriter, req *http.Request)
|
|||||||
}
|
}
|
||||||
defer tx.Commit()
|
defer tx.Commit()
|
||||||
|
|
||||||
stmt, err := tx.Prepare(
|
stmt, err := tx.Prepare("SELECT mails.id, mails.arrived_at, mails.rcpt_addr, mails.from_addr, mails.subject FROM mails WHERE mails.rcpt_addr = ?")
|
||||||
"SELECT " +
|
|
||||||
"mails.id, " +
|
|
||||||
"mails.arrived_at, " +
|
|
||||||
"mails.rcpt_addr, " +
|
|
||||||
"mails.from_addr, " +
|
|
||||||
"mails.subject " +
|
|
||||||
"FROM " +
|
|
||||||
"mails " +
|
|
||||||
"WHERE " +
|
|
||||||
"mails.rcpt_addr = ? " +
|
|
||||||
"ORDER BY " +
|
|
||||||
"mails.arrived_at DESC",
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.WriteHeader(500)
|
res.WriteHeader(500)
|
||||||
res.Write([]byte("internal server error"))
|
res.Write([]byte("internal server error"))
|
||||||
|
|||||||
@ -16,7 +16,6 @@ templ styles() {
|
|||||||
color: #FEFEFE;
|
color: #FEFEFE;
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
min-height: 100dvh; /* If the browser does not support dvh, use vh instead */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body, h1, h2, h3, h4, h5, h6, p, ol, ul {
|
body, h1, h2, h3, h4, h5, h6, p, ol, ul {
|
||||||
@ -53,7 +52,6 @@ templ styles() {
|
|||||||
body.index p {
|
body.index p {
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
font-family: monospace, "sans-serif";
|
font-family: monospace, "sans-serif";
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body.index .random {
|
body.index .random {
|
||||||
@ -76,20 +74,6 @@ templ styles() {
|
|||||||
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@media (max-width: 900px) {
|
|
||||||
body.index h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.index p {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.index .random a {
|
|
||||||
height: 60px;
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* HEADER */
|
/* HEADER */
|
||||||
.header {
|
.header {
|
||||||
@ -107,77 +91,23 @@ templ styles() {
|
|||||||
font-family: monospace, "sans-serif";
|
font-family: monospace, "sans-serif";
|
||||||
}
|
}
|
||||||
|
|
||||||
.header a {
|
.header h3 {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1.65rem;
|
|
||||||
text-decoration: none;
|
|
||||||
color: inherit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.header .header-addr {
|
.header .header-addr {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
padding-bottom: 4px;
|
|
||||||
position: relative;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.header .header-addr button {
|
.header .header-addr span {
|
||||||
background: none;
|
|
||||||
color: inherit;
|
|
||||||
border: none;
|
|
||||||
font: inherit;
|
|
||||||
cursor: pointer;
|
|
||||||
outline: inherit;
|
|
||||||
user-select: text;
|
|
||||||
|
|
||||||
margin-left: 18px;
|
margin-left: 18px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
*[tooltip]:focus:after {
|
|
||||||
content: attr(tooltip);
|
|
||||||
display:block;
|
|
||||||
position: absolute;
|
|
||||||
top: 130%;
|
|
||||||
left: 50%;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1500px) {
|
|
||||||
.header {
|
|
||||||
width: 975px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 975px) {
|
|
||||||
.header {
|
|
||||||
width: 100%;
|
|
||||||
padding: 4px 16px;
|
|
||||||
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header a {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
|
||||||
.header .header-addr {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 580px) {
|
|
||||||
.header .header-addr {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FOOTER */
|
/* FOOTER */
|
||||||
footer {
|
footer {
|
||||||
|
background-color: green;
|
||||||
padding-bottom: 64px;
|
padding-bottom: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +157,6 @@ templ styles() {
|
|||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
font-family: monospace, "sans-serif";
|
font-family: monospace, "sans-serif";
|
||||||
color: #CECECE;
|
color: #CECECE;
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body.inbox .inbox-main ul {
|
body.inbox .inbox-main ul {
|
||||||
@ -283,29 +212,6 @@ templ styles() {
|
|||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1500px) {
|
|
||||||
body.inbox .inbox-main {
|
|
||||||
width: 90%;
|
|
||||||
max-width: 975px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
|
||||||
body.inbox .inbox-main li a {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.inbox .inbox-main li a div {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.inbox .inbox-main li a .inbox-mail-date {
|
|
||||||
margin: 8px 0 0;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MAIL */
|
/* MAIL */
|
||||||
body.mail {
|
body.mail {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -325,7 +231,6 @@ templ styles() {
|
|||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
background: #262626;
|
background: #262626;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
overflow-wrap: break-word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body.mail .mail-header div:nth-child(odd) {
|
body.mail .mail-header div:nth-child(odd) {
|
||||||
@ -350,13 +255,5 @@ templ styles() {
|
|||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1500px) {
|
|
||||||
body.mail .mail-header, body.mail main {
|
|
||||||
width: 90%;
|
|
||||||
max-width: 975px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user