Commit Graph

21 Commits

Author SHA1 Message Date
Jonas Schäfer
d168f2ecd3 Silence mypy strangeness 2021-01-23 14:13:43 +01:00
Jonas Schäfer
0d03cd5227 Add support for setting a human-friendly SITE_NAME 2021-01-22 15:28:06 +01:00
Jonas Schäfer
f363ff0b38 Fix error handling
Previously, some kinds of errors would throw nice and fun cascades
of exceptions.

We now have a nice, clean error page for 500 and 503 (backend
connectivity) errors which includes minimal debugging information
for productive setups and a traceback for development setups.

In any case, the full exception is logged to the log with an error
ID which is printed on the error page.
2021-01-21 18:09:55 +01:00
Jonas Schäfer
e0cfcc6aaa 12-factorize application a little
snikket_web can now be fully configured via the environment alone,
no extra files needed. It is still supported to inject a python
file to generate environment variables though, which may be
useful for generating and reloading a secret key.
2021-01-17 20:11:26 +01:00
Jonas Schäfer
fa700bba07 Massive code cleanup
- Avoid fighting import cycles using a factory function
- Collapse useless subpackages into simple modules
- Move flask plugins / infrastructure in own module
- Refactor how blueprints are used to localize information about
  URL routing to app factory
2021-01-17 20:11:25 +01:00
Jonas Schäfer
e476d9b7c2 Implement admin dashboard
Fixes #23.
2021-01-17 20:10:04 +01:00
Jonas Schäfer
9e3fcbaf67 Prepare for fully typechecked codebase 2021-01-16 16:05:54 +01:00
Jonas Schäfer
d3777d3b07 Make flake8 happy 2021-01-16 15:22:46 +01:00
Jonas Schäfer
d6b1ce8773 Make logging configurable 2020-04-30 16:14:14 +02:00
Jonas Schäfer
095970adb4 Convert login page to proper form
- free CSRF protection
- free "empty field" early out
- easier passing on of errors to the view
2020-04-30 16:14:14 +02:00
Jonas Schäfer
af08f31cf3 Include language tag in html/@lang 2020-03-07 16:56:15 +01:00
Jonas Schäfer
e07fbb0c97 Start translating the web portal 2020-03-07 16:55:12 +01:00
Jonas Schäfer
6819a4eec6 Clean up about page 2020-03-07 13:31:40 +01:00
Jonas Schäfer
18279e3478 Add version info to package 2020-03-07 13:31:30 +01:00
Jonas Schäfer
76c38030a8 Improve avatar route handler
- Fix etag attaching (add_etag is actually a coroutine which hashes
  the data payload)
- Add expires header (with now + 1800s default) so that we don’t
  get hit with an avatar request on each load -- also helps with
  page responsiveness.
- Proper handling for HEAD requests.
- CSP to prevent funny SVG attacks.
2020-03-07 13:12:30 +01:00
Jonas Schäfer
71733adc90 Fix various edge cases around stale sessions
If a session cookie is set, but prosody doesn’t know about the
session anymore, we could get into fun states. This patch fixes
them by requiring the session to be tested with a ping request
on each HTTP request.
2020-03-07 13:11:45 +01:00
Jonas Schäfer
5ee2d97eb6 Implement support for shim avatar display 2020-03-07 13:11:43 +01:00
Jonas Schäfer
c902c59f8b Implement support for avatars 2020-03-07 12:38:17 +01:00
Jonas Schäfer
e985fe9c61 Design foundations
- Create a colour palette
- Create a sizing schema for paddings and fonts
- Implement basic form controls
- Create a theme demo page
- Apply the theme to the existing pages.

Still TODO is the final font selection.
2020-03-05 18:43:52 +01:00
Jonas Schäfer
9318b0d152 Implement support for password change and logout
Note the hack.
2020-02-29 13:43:10 +01:00
Jonas Schäfer
aade4c67fd Bootstrap initial thing which can login 2020-02-29 12:37:56 +01:00