Commit graph

26 commits

Author SHA1 Message Date
Simon Ser 9fdccc3a4b
Rename template.go to renderer.go 2020-01-20 22:05:42 +01:00
Simon Ser 8b10324ab6
go fmt 2020-01-20 13:22:18 +01:00
Dejan Strbac 83a5132d15
Add current path to the global context 2020-01-16 13:36:03 +01:00
Simon Ser c38b1d47f9
Fix panic when injecting a template with nil data 2020-01-10 19:34:59 +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 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 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 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 e54a359acb
Export Server.{Sessions,Plugins}
And unexport a few internal functions.
2019-12-11 13:03:31 +01:00
Simon Ser d8f411176f
Export Context
This allows plugins to access it.
2019-12-11 12:48:20 +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 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 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 e94b1311de
Add basic theme support
References: https://todo.sr.ht/~sircmpwn/koushin/1
2019-12-04 18:30:01 +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 be14524c33
Display & download any message part 2019-12-03 13:07:25 +01:00
Simon Ser fce17c9733
Linkify mailbox list 2019-12-02 18:29:06 +01:00
Simon Ser a1a067e6de
Add HTTP server boilerplate 2019-12-02 15:31:00 +01:00