Commit graph

210 commits

Author SHA1 Message Date
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
Simon Ser b8407569f0
themes/sourcehut: use formatdate template func 2019-12-17 11:33:29 +01:00
Simon Ser 9404be1a32
Add envelope metadata to message view 2019-12-17 11:33:23 +01:00
Simon Ser e78d2db3ea
Improve docs 2019-12-17 10:58:31 +01:00
Simon Ser a425e17b0e
Add button to delete message
Maybe we should add a confirmation step in the future.

References: https://todo.sr.ht/~sircmpwn/koushin/36
2019-12-16 17:45:20 +01:00
Simon Ser 1841609fbc
Add form to move messages
References: https://todo.sr.ht/~sircmpwn/koushin/36
2019-12-16 17:25:53 +01:00
Simon Ser a061e85f00
Update deps 2019-12-16 15:50:32 +01:00
Simon Ser 4449416357
Export IMAPMessage
This is a public type other plugins and templates may want to access.
2019-12-16 15:46:29 +01:00
Simon Ser 08b259bd50
Add attachments support to composer
Closes: https://todo.sr.ht/~sircmpwn/koushin/13
2019-12-16 15:40:30 +01:00
Simon Ser 7f48702b83
go fmt 2019-12-16 14:53:56 +01:00
Simon Ser 65931445a8
Use <label> in compose form 2019-12-16 14:45:55 +01:00
Simon Ser 1c5e17472d
Add basic search
Closes: https://todo.sr.ht/~sircmpwn/koushin/23
2019-12-16 14:36:43 +01:00
Simon Ser 1a658fc22c
Add line break to login form 2019-12-16 13:51:49 +01:00
Simon Ser 622f00fe06
Replace Session.ConnectSMTP with Session.DoSMTP
This gives more flexibility in Session for optimizations, e.g. keep the
SMTP connection around for some time if possible.
2019-12-16 13:07:35 +01:00
Simon Ser d01c85616a
Rename Session.Do to Session.DoIMAP 2019-12-16 13:01:33 +01:00
Simon Ser e93346ffa9
Remove the public/ directory
Now that all templates are provided by plugins, there's no need to have
a public/ directory. Themes can be in /themes instead of /public/themes.
2019-12-16 12:58:21 +01:00
Simon Ser d897eeee5c
Introduce base plugin
This plugin offers base IMAP/SMTP functionality.

References: https://todo.sr.ht/~sircmpwn/koushin/39
2019-12-16 12:52:44 +01:00
Simon Ser e83844fbad
Add an API for Go plugins
References: https://todo.sr.ht/~sircmpwn/koushin/39
2019-12-16 12:26:26 +01:00
Simon Ser 90080cc8b6
gitignore: don't ignore sourcehut theme 2019-12-12 20:11:38 +01:00
Drew DeVault d0355fa0d8 Add simple Sourcehut-based theme 2019-12-12 13:54:57 -05:00
Simon Ser b24cc85fb1
Fix undefined ErrSessionExpired
Fixes: f07ab52632 ("Add docs")
2019-12-12 16:40:52 +01:00
Simon Ser f07ab52632
Add docs 2019-12-11 15:24:39 +01:00
Simon Ser 1b5bc568fb
Allow plugins to provide their own templates 2019-12-11 15:08:31 +01:00
Simon Ser fec8caa3cd
readme: add godoc badge 2019-12-11 14:05:16 +01:00
Simon Ser e54a359acb
Export Server.{Sessions,Plugins}
And unexport a few internal functions.
2019-12-11 13:03:31 +01:00
Simon Ser 28a8f3f6ac
Unexport NewSessionManager
This isn't intended to be used by plugins.
2019-12-11 12:56:59 +01:00
Simon Ser 86359156ee
Export Context.SetSession, unexport Session.Token
I'm uneasy exposing the token to plugins, I prefer to hide it if
possible to prevent mis-use.

This change allows plugins to logout users.
2019-12-11 12:54:03 +01:00
Simon Ser d8f411176f
Export Context
This allows plugins to access it.
2019-12-11 12:48:20 +01:00
Simon Ser ed7ea8df33
Add plugins/ to .gitignore 2019-12-10 17:41:35 +01:00