Commit graph

70 commits

Author SHA1 Message Date
Simon Ser
556ce5b2c8 go fmt 2021-07-05 11:19:07 +02:00
Drew DeVault
1992880454 Add theme-specific error page 2020-11-19 10:09:05 -05:00
Drew DeVault
297afc5ce6 Limit total size of unsent attachments 2020-11-19 09:28:10 -05:00
Drew DeVault
86579bb478 Remove async SMTP queue 2020-11-13 10:33:19 -05:00
Drew DeVault
5a8d1572b1 Set SameSite and Secure on cookies 2020-11-05 10:35:27 -05:00
Drew DeVault
a393429f01 Implement JavaScript UI for attachments
This one is a bit of a doozy. A summary of the changes:

- Session has grown storage for attachments which have been uploaded but
  not yet sent.
- The list of attachments on a message is refcounted so that we can
  clean up the temporary files only after it's done with - i.e. after
  copying to Sent and after all of the SMTP attempts are done.
- Abandoned attachments are cleared out on process shutdown.

Future work:
- Add a limit to the maximum number of pending attachments the user can
  have in the session.
- Periodically clean out abandoned attachments?
2020-10-29 15:18:36 -04:00
Drew DeVault
b93b2bafa5 Rig up dowork event queue and graceful termination 2020-10-23 13:30:29 -04:00
Simon Ser
8813faf71e
go fmt 2020-05-20 19:08:06 +02:00
Drew DeVault
9465f8db6d
login: set encrypted "remember me" token 2020-05-20 19:07:47 +02:00
Simon Ser
b891a95fcf
Rename project to alps 2020-05-13 14:07:44 +02:00
Simon Ser
243e090bcb
Add default ports for IMAP and SMTP 2020-02-12 16:15:18 +01:00
Simon Ser
13f5414691
cmd/koushin: add -debug flag 2020-02-11 18:39:52 +01:00
Simon Ser
bdf1a8b02b
koushin: add Store interface
References: https://todo.sr.ht/~sircmpwn/koushin/5
2020-01-28 20:04:18 +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
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
b9a180b154
Disable DNS prefetching 2020-01-20 18:26:22 +01:00
Simon Ser
af5ffd12f9
Add support for HTML parts 2020-01-20 16:20:15 +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
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
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
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
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
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
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
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
a9a607b9b2
Allow plugins to add new routes
References: https://todo.sr.ht/~sircmpwn/koushin/6
2019-12-10 16:00:53 +01:00
Simon Ser
c5afd1a61b
Reconnect to IMAP server when logged out
The session manager has been upgraded to deal with reconnections.

Each session has its own expiration timer. Each time a request is
received, the expiration timer is reset.

A session can be closed (this is used when the user wants to logout).

When the IMAP connection is closed by the server, it's set to nil in the
session. The next time an IMAP command needs to be issued, the
connection is re-established.

Closes: https://todo.sr.ht/~sircmpwn/koushin/30
2019-12-09 19:35:15 +01:00
Simon Ser
7702925497
Make SessionManager create the IMAP client
This will allow SessionManager to re-connect when the IMAP server logs
the user out.
2019-12-09 18:35:51 +01:00
Simon Ser
efd401bfbf
Rename ConnPool to SessionManager 2019-12-09 18:16:31 +01:00
Simon Ser
76599232dc
Add a Lua API to set template filters 2019-12-09 17:54:24 +01:00
Simon Ser
4f74722c14
Add basic support for plugins 2019-12-09 16:05:40 +01:00
Simon Ser
d1d4380957
Extract HTTP handlers in separate file 2019-12-04 20:55:08 +01:00
Simon Ser
e94b1311de
Add basic theme support
References: https://todo.sr.ht/~sircmpwn/koushin/1
2019-12-04 18:30:01 +01:00
Simon Ser
4ab5fb7f65
Make message view's Back link set the mailbox page
This allows to go back and forth between the mailbox view and the
message view.

References: https://todo.sr.ht/~sircmpwn/koushin/22
2019-12-03 20:06:43 +01:00
Simon Ser
8de93c50d2
Add basic pagination to message list
References: https://todo.sr.ht/~sircmpwn/koushin/22
2019-12-03 19:49:04 +01:00
Simon Ser
6344806755
Fix missing OutgoingMessage.InReplyTo assignment 2019-12-03 18:54:04 +01:00
Simon Ser
e90d4579ae
Add basic support for multiple recipients 2019-12-03 18:46:18 +01:00
Simon Ser
a103309935
Add support for replying to a message 2019-12-03 18:41:23 +01:00