Commit graph

77 commits

Author SHA1 Message Date
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
Simon Ser
835e9e5033
go fmt 2019-12-10 17:39:42 +01:00
Simon Ser
3748b4413e
Introduce GlobalRenderData and RenderData
GlobalRenderData contains some global metadata that can be obtained from
any template.

RenderData is a base type for template data. It contains a Global field
with global metadata and an Extra field for plugins.
2019-12-10 17:36:21 +01:00
Simon Ser
edf738f23d
Load all themes on startup
This is the first step to allow each user to have a different theme.
2019-12-10 16:41:56 +01:00
Simon Ser
49167b9a28
readme: add link to mailing list & issue tracker 2019-12-10 16:08:08 +01:00
Simon Ser
4a504b0fc6
Rename Plugin.Render to Plugin.Inject
This function doesn't render anything, it just adds extra data to the
template data.
2019-12-10 16:07:02 +01:00
Simon Ser
95da47f7c4
Extract Lua plugin logic into separate file 2019-12-10 16:02:21 +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
800a83059d
readme: sync with new Lua API 2019-12-09 17:55:52 +01:00
Simon Ser
76599232dc
Add a Lua API to set template filters 2019-12-09 17:54:24 +01:00
Simon Ser
f42cb45457
Change Lua API to koushin.on_render 2019-12-09 17:25:02 +01:00
Simon Ser
9617b412e8
Make render data static
This makes sure fields filled by vanilla koushin keep the right type. A
new Extra field allows plugins to attach their own data.

This also makes it easier to write Go plugins, which would have trouble
working with interface{}.
2019-12-09 16:17:36 +01:00
Simon Ser
4f74722c14
Add basic support for plugins 2019-12-09 16:05:40 +01:00
Simon Ser
a176409933
Drop define in templates
Just use the full filename instead, this is simpler and more explicit.
2019-12-09 15:00:01 +01:00
Simon Ser
61ffc105fd
Use imap.BodyStructure.Filename and imap.Address.Address
The former fixes encoding issues in filenames. The latter is just for
brevity.
2019-12-09 13:45:15 +01:00
Simon Ser
d1d4380957
Extract HTTP handlers in separate file 2019-12-04 20:55:08 +01:00
Simon Ser
7c0b906092
Add .gitignore 2019-12-04 18:36:59 +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
a2349050d0
Add separator between Prev and Next links 2019-12-03 19:51:44 +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
Simon Ser
b386d1c2bb
Fix mailbox view when empty
This fixes the second part of #14.

References: https://todo.sr.ht/~sircmpwn/koushin/14
2019-12-03 17:52:56 +01:00
Simon Ser
b7be271560
Add empty CSS stylesheet
References: https://todo.sr.ht/~sircmpwn/koushin/19
2019-12-03 17:42:33 +01:00
Simon Ser
c3fd390b1a
Set imap.CharsetReader
This adds support for additional charsets when parsing e.g. subject
lines.
2019-12-03 17:35:04 +01:00
Simon Ser
a4729060be
Escape mailbox names in URLs
Closes: https://todo.sr.ht/~sircmpwn/koushin/14
2019-12-03 17:31:53 +01:00
Simon Ser
48d6d5d227
Add session lock
HTTP requests can be processed in parallel, but we only have one IMAP
connection per session.

Closes: https://todo.sr.ht/~sircmpwn/koushin/12
2019-12-03 17:18:17 +01:00
Simon Ser
ec03c60dff
Import go-message charsets package
Enables support for non-UTF8 charsets.

Closes: https://todo.sr.ht/~sircmpwn/koushin/18
2019-12-03 17:03:57 +01:00
Simon Ser
36923a0dc2
Pre-fill composer with sender address 2019-12-03 16:46:03 +01:00