Commit graph

138 commits

Author SHA1 Message Date
Simon Ser
9fdccc3a4b
Rename template.go to renderer.go 2020-01-20 22:05:42 +01:00
Simon Ser
b58c15d121
Extract Lua infrastructure into a plugin 2020-01-20 22:04:50 +01:00
Simon Ser
efa0816333
Add Server.Logger 2020-01-20 22:03:05 +01:00
Simon Ser
01983eb7b5
Introduce PluginLoaderFunc
This allows registered plugins to execute code when loaded. This will
also allow the Lua support code to be a plugin.

Closes: https://todo.sr.ht/~sircmpwn/koushin/54
2020-01-20 21:37:28 +01:00
Simon Ser
d19c17c6d5
go fmt 2020-01-20 20:27:49 +01:00
Simon Ser
589b303f9f
plugins/base: append outgoing messages to Sent mailbox
And mark original message as answered.

Closes: https://todo.sr.ht/~sircmpwn/koushin/15
2020-01-20 20:25:41 +01:00
Simon Ser
3340fcd63d
Check IMAP/SMTP servers on startup
Closes: https://todo.sr.ht/~sircmpwn/koushin/46
2020-01-20 18:46:50 +01:00
Simon Ser
3bf17752ab
plugins/base: remove external resources URLs, sanitize CSS 2020-01-20 18:28:49 +01:00
Simon Ser
b9a180b154
Disable DNS prefetching 2020-01-20 18:26:22 +01:00
Simon Ser
a66ef1059b
Make the text/* part content a []byte 2020-01-20 16:20:16 +01:00
Simon Ser
8d248bc32f
Extract HTML sanitizer to its own file 2020-01-20 16:20:16 +01:00
Simon Ser
d745f98bb7
Add polyfill for browsers not supporting srcdoc 2020-01-20 16:20:15 +01:00
Simon Ser
efaf6fd444
Open e-mail links in new tab 2020-01-20 16:20:15 +01:00
Simon Ser
721c3ce3eb
Resize e-mail iframe with content 2020-01-20 16:20:15 +01:00
Simon Ser
af5ffd12f9
Add support for HTML parts 2020-01-20 16:20:15 +01:00
Simon Ser
577685ca14
Update dependencies 2020-01-20 15:41:37 +01:00
Simon Ser
e6e457e4a7
Fix dangling goroutine on session expiration
The timer channel may already have been drained by `case <-timer.C`. In
this case, we need not to drain it again or we'll block forever.

To fix this, stop draining the timer channel. Since we're not going to
use the timer again anyway, it should be fine.
2020-01-20 15:25:46 +01:00
Simon Ser
8b10324ab6
go fmt 2020-01-20 13:22:18 +01:00
Simon Ser
a0800c2436
Auto-discover upstream SMTP and IMAP servers
Closes: https://todo.sr.ht/~sircmpwn/koushin/49
2020-01-20 13:08:05 +01:00
Simon Ser
db328bf7c3
Generalize upstream server URLs
koushin now takes a list of upstream URLs instead of an IMAP and SMTP
URL. This allows to specify upstream server URLs for plugins. In the
future, this will allow for auto-discovering upstream servers based on a
single domain name.

References: https://todo.sr.ht/~sircmpwn/koushin/49
2020-01-20 12:00:04 +01:00
Reto Brunner
d5124c9645
Hide echo banner 2020-01-17 00:26:13 +01:00
Dejan Strbac
83a5132d15
Add current path to the global context 2020-01-16 13:36:03 +01:00
Dejan Strbac
15a77185b4
Include flags when fetching items over IMAP 2020-01-16 13:34:10 +01:00
Simon Ser
425445f443
Add Session.SetHTTPBasicAuth
This is not 100% idiot-proof, but still makes it mroe difficult for
plugins to steal credentials.
2020-01-10 19:37:24 +01:00
Simon Ser
c38b1d47f9
Fix panic when injecting a template with nil data 2020-01-10 19:34:59 +01:00
Simon Ser
24718f1ac4
Redirect to original URL after login 2020-01-10 17:29:37 +01:00
Simon Ser
b014c1898f
Close Lua plugins on reload 2020-01-10 17:00:34 +01:00
Simon Ser
171da51289
cmd/koushin: add -addr flag 2020-01-08 12:01:50 +01:00
Simon Ser
04199eb121
readme: document hot reload 2020-01-08 12:01:48 +01:00
Simon Ser
ad1d2ee7f4
Implement plugin/template reload on SIGUSR1
There's no way around having a global mutex, because we need to update
the HTTP routes when reloading plugins. During reload we need to lock
the whole server.

Closes: https://todo.sr.ht/~sircmpwn/koushin/43
2020-01-08 11:50:29 +01:00
Simon Ser
3d8569d185
cmd/koushin: reload on SIGUSR1
References: https://todo.sr.ht/~sircmpwn/koushin/43
2020-01-08 11:02:39 +01:00
Simon Ser
97b314b6e7
Add Server.Reload
This only reloads templates for now. In the future it'll also reload
Lua plugins.
2020-01-08 10:52:28 +01:00
Simon Ser
f6758264b2
Make New return the Server
This will be useful to implement hot reload.
2020-01-08 10:38:33 +01:00
Simon Ser
3d9ddc05be
themes/sourcehut: add search input to mailbox view 2019-12-25 19:34:24 +01:00
Simon Ser
d36ec520aa
Fix extra comma in address list 2019-12-18 17:07:10 +01:00
Simon Ser
8c4587f477
Fix header missing from raw e-mail download 2019-12-18 16:57:53 +01:00
Simon Ser
3d2da43207
Add a default CSP
Disallows loading external ressources. Providers can override it with
their reverse proxy settings.
2019-12-18 12:03:56 +01:00
Simon Ser
80da410c3b
Implement paging for search 2019-12-17 16:23:51 +01:00
Simon Ser
6bccdd62ce
Document that plugins don't have access to passwords 2019-12-17 15:55:52 +01:00
Simon Ser
f106c1125f
Make Go plugin handlers take a *Context
Take a *Context instead of a echo.Context. This saves a type assertion
in each handler.
2019-12-17 15:19:37 +01:00
Simon Ser
020e27fe45
Add Context to Plugin.Inject
This allows to access the request metadata and the session from injectors.
2019-12-17 15:14:36 +01:00
Simon Ser
ca3672df2a
Add RenderData interface
This allows Go plugins to easily inject global data.
2019-12-17 15:01:15 +01:00
Simon Ser
d8a875a5f7
Rename RenderData to BaseRenderData
RenderData will be used for an interface.
2019-12-17 13:27:20 +01:00
Simon Ser
29e0879dd9
Allow Go Plugins to inject template data 2019-12-17 13:23:10 +01:00
Simon Ser
733304c88f
Allow Lua plugins to inject all templates 2019-12-17 13:15:10 +01:00
Simon Ser
38d73f5771
Use Context.FormParams 2019-12-17 13:09:25 +01:00
Simon Ser
e2d70ba6ca
Linkify address lists 2019-12-17 13:02:38 +01:00
Simon Ser
0c21c501ff
Redirect / to INBOX 2019-12-17 12:44:13 +01:00
Simon Ser
2a2a48c7fa
Add a form to set message flags
References: https://todo.sr.ht/~sircmpwn/koushin/36
2019-12-17 12:42:04 +01:00
Simon Ser
3aea768cad
plugins/base: extract route registration into function 2019-12-17 11:36:08 +01:00