diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-16 12:51:42 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-16 12:52:44 +0100 |
commit | d897eeee5c4d163891d0b6a8f85d328ccada7575 (patch) | |
tree | 39d2428b8f9cb677d79e66cb3763cdaed6147616 /plugins/base/public | |
parent | e83844fbad63a0d6fc2d29a8a412c95f2a419b56 (diff) | |
download | alps-d897eeee5c4d163891d0b6a8f85d328ccada7575.tar.gz alps-d897eeee5c4d163891d0b6a8f85d328ccada7575.zip |
Introduce base plugin
This plugin offers base IMAP/SMTP functionality.
References: https://todo.sr.ht/~sircmpwn/koushin/39
Diffstat (limited to 'plugins/base/public')
-rw-r--r-- | plugins/base/public/assets/style.css | 1 | ||||
-rw-r--r-- | plugins/base/public/compose.html | 26 | ||||
-rw-r--r-- | plugins/base/public/foot.html | 2 | ||||
-rw-r--r-- | plugins/base/public/head.html | 8 | ||||
-rw-r--r-- | plugins/base/public/login.html | 14 | ||||
-rw-r--r-- | plugins/base/public/mailbox.html | 45 | ||||
-rw-r--r-- | plugins/base/public/message.html | 58 |
7 files changed, 154 insertions, 0 deletions
diff --git a/plugins/base/public/assets/style.css b/plugins/base/public/assets/style.css new file mode 100644 index 0000000..8f414f5 --- /dev/null +++ b/plugins/base/public/assets/style.css @@ -0,0 +1 @@ +/* TODO */ diff --git a/plugins/base/public/compose.html b/plugins/base/public/compose.html new file mode 100644 index 0000000..2a52675 --- /dev/null +++ b/plugins/base/public/compose.html @@ -0,0 +1,26 @@ +{{template "head.html"}} + +<h1>koushin</h1> + +<p> + <a href="/mailbox/INBOX">Back</a> +</p> + +<h2>Compose new message</h2> + +<form method="post" action=""> + <input type="hidden" name="in_reply_to" value="{{.Message.InReplyTo}}"> + + <p>From:</p> + <input type="email" name="from" value="{{.Message.From}}"> + <p>To:</p> + <input type="email" name="to" multiple value="{{.Message.ToString}}"> + <p>Subject:</p> + <input type="text" name="subject" value="{{.Message.Subject}}"> + <p>Body:</p> + <textarea name="text" cols="80" rows="20">{{.Message.Text}}</textarea> + <br><br> + <input type="submit" value="Send"> +</form> + +{{template "foot.html"}} diff --git a/plugins/base/public/foot.html b/plugins/base/public/foot.html new file mode 100644 index 0000000..b605728 --- /dev/null +++ b/plugins/base/public/foot.html @@ -0,0 +1,2 @@ + </body> +</html> diff --git a/plugins/base/public/head.html b/plugins/base/public/head.html new file mode 100644 index 0000000..bed1bb3 --- /dev/null +++ b/plugins/base/public/head.html @@ -0,0 +1,8 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>koushin</title> + <link rel="stylesheet" href="/plugins/base/assets/style.css"> + </head> + <body> diff --git a/plugins/base/public/login.html b/plugins/base/public/login.html new file mode 100644 index 0000000..6ae1737 --- /dev/null +++ b/plugins/base/public/login.html @@ -0,0 +1,14 @@ +{{template "head.html"}} + +<h1>koushin</h1> + +<form method="post" action="/login"> + <label for="username">Username:</label> + <input type="text" name="username" id="username"/> + <label for="password">Password:</label> + <input type="password" name="password" id="password"/> + <br><br> + <input type="submit" value="Login"> +</form> + +{{template "foot.html"}} diff --git a/plugins/base/public/mailbox.html b/plugins/base/public/mailbox.html new file mode 100644 index 0000000..ddd1260 --- /dev/null +++ b/plugins/base/public/mailbox.html @@ -0,0 +1,45 @@ +{{template "head.html"}} + +<h1>koushin</h1> + +<p> + <a href="/logout">Logout</a> · <a href="/compose">Compose</a> +</p> + +<h2>{{.Mailbox.Name}}</h2> + +<p>Mailboxes:</p> +<ul> + {{range .Mailboxes}} + <li><a href="/mailbox/{{.Name | pathescape}}">{{.Name}}</a></li> + {{end}} +</ul> + +{{if .Messages}} + <p>Messages:</p> + <ul> + {{range .Messages}} + <li><a href="/message/{{$.Mailbox.Name | pathescape}}/{{.Uid}}?part={{.TextPartName}}"> + {{if .Envelope.Subject}} + {{.Envelope.Subject}} + {{else}} + (No subject) + {{end}} + </a></li> + {{end}} + </ul> + + <p> + {{if ge .PrevPage 0}} + <a href="?page={{.PrevPage}}">Prev</a> + {{end}} + {{if and (ge .PrevPage 0) (ge .NextPage 0)}}·{{end}} + {{if ge .NextPage 0}} + <a href="?page={{.NextPage}}">Next</a> + {{end}} + </p> +{{else}} + <p>Mailbox is empty.</p> +{{end}} + +{{template "foot.html"}} diff --git a/plugins/base/public/message.html b/plugins/base/public/message.html new file mode 100644 index 0000000..729937d --- /dev/null +++ b/plugins/base/public/message.html @@ -0,0 +1,58 @@ +{{template "head.html"}} + +<h1>koushin</h1> + +<p> + <a href="/mailbox/{{.Mailbox.Name | pathescape}}?page={{.MailboxPage}}"> + Back + </a> +</p> + +<h2> + {{if .Message.Envelope.Subject}} + {{.Message.Envelope.Subject}} + {{else}} + (No subject) + {{end}} +</h2> + +{{define "message-part-tree"}} + {{/* nested templates can't access the parent's context */}} + {{$ = index . 0}} + {{with index . 1}} + <a + {{if .IsText}} + href="{{$.Message.Uid}}?part={{.PathString}}" + {{else}} + href="{{$.Message.Uid}}/raw?part={{.PathString}}" + {{end}} + > + {{if eq $.PartPath .PathString}}<strong>{{end}} + {{.String}} + {{if eq $.PartPath .PathString}}</strong>{{end}} + </a> + {{if gt (len .Children) 0}} + <ul> + {{range .Children}} + <li>{{template "message-part-tree" (tuple $ .)}}</li> + {{end}} + </ul> + {{end}} + {{end}} +{{end}} + +<p>Parts:</p> + +{{template "message-part-tree" (tuple $ .Message.PartTree)}} + +<hr> + +{{if .Body}} + <p><a href="{{.Message.Uid}}/reply?part={{.PartPath}}">Reply</a></p> + <pre>{{.Body}}</pre> +{{else}} + <p>Can't preview this message part.</p> + <a href="{{.Message.Uid}}/raw?part={{.PartPath}}">Download</a> +{{end}} + +{{template "foot.html"}} |