Commit Graph

46 Commits

Author SHA1 Message Date
Matthew Wild
67c94bb045 Add 'secure' attribute to session cookies 2024-04-29 11:08:30 +01:00
Matthew Wild
95a8ac1387 Enable Russian and Ukranian languages by default 2024-01-04 14:11:27 +00:00
Matthew Wild
d6d4bb5afb Add policy URLs and contact addresses for instances in the relevant places 2023-10-25 16:18:12 +01:00
Jonas Schäfer
f1351eb5cc Merge branch 'fix/use-english-default' into premerge 2022-06-06 19:46:49 +02:00
Jonas Schäfer
68f72743c5 Bump quart to version 0.17
This is needed because jinja2 had an update which caused the portal to
not work at all:

```
ImportError: cannot import name 'escape' from 'jinja2'
```

Quart needed updating for that.

This update required a lot of typefixes. Apparently, the "canned"
responses (like redirect) are now plain werkzeug responses, while
quart.Response does not inherit from werkzeug.Response (otherwise, we
could've changed the type annotations to werkzeug.Response everywhere,
but that doesn't work because a quart.Response is not a
werkzeug.Response).

P.S.: This time, I *did* check that avatar uploads don't break (see
b007afc).
2022-05-30 17:37:54 +02:00
Jonas Schäfer
eb22688302 Use english as default language instead of danish
It is more likely that a user for whose language no translation exists
can read english than danish.

The fallback to english was apparently introduced in c58ce845, though it
is possible that `best_match` did that internally before.

Fixes #131.
2022-05-15 14:12:51 +02:00
Raka-loah
bbfe8624ef Add Simplified Chinese support 2022-05-14 17:53:40 +08:00
Jonas Schäfer
261758b07a 🎉 Finally set the URL for the App Store
See-Also: https://snikket.org/blog/snikket-ios-public-release/
2021-08-31 17:03:21 +02:00
Jonas Schäfer
0f2127a672 Bring happiness to mypy 2021-06-18 16:11:22 +02:00
Matthew Wild
531565d55c Automatically determine version from build info or git 2021-05-31 11:20:39 +01:00
Jonas Schäfer
b40a625283 admin: allow disabling display of metrics
This is useful in situations where the admins of the Snikket
server (i.e. those who care for the docker containers) are not the
same people as the people who are admins of the Snikket service
(i.e. those who care for the users).
2021-05-27 17:59:40 +02:00
Jonas Schäfer
13b2a76c3d Fix mypy errors introduced in b007afc901 2021-05-27 16:33:46 +02:00
Jonas Schäfer
b007afc901 Revert "Upgrade to quart 0.15"
This reverts commit 486596f89f.
It was discovered that multipart/form-data forms do not work
correctly with Quart 0.15. The upgrade to Quart 0.15 was rushed
and not tested correctly, which I apologize for.

See-Also: https://github.com/pgjones/quart/issues/126
2021-05-22 11:11:16 +02:00
Jonas Schäfer
c58ce8450f Fix type annotations after bumping dependencies 2021-05-18 14:33:06 +02:00
Jonas Schäfer
486596f89f Upgrade to quart 0.15 2021-05-18 12:35:31 +02:00
Jonas Schäfer
3eb8036ebd Implement size checking for the avatar
This checks the avatar size on the client side (if available) and
on the server side against a configuration-defined limit. The
default limit is set to use the same value as in the original
report, as no sensible limit value is known.

Fixes #67.
2021-03-20 12:57:11 +01:00
Jonas Schäfer
3083c118a3 Add fully translated language codes 2021-03-09 22:03:08 +01:00
Matthew Wild
4de4509fc9 Update __init__.py 2021-02-20 07:07:18 +00:00
Michał Mazur
fa61ee4e11 Update __init__.py
Wrong Polish language ISO code. That's probably why it doesn't work.
2021-02-04 14:37:51 +01:00
Jonas Schäfer
7456295cb6 Make title red if running in debug
This (a) helps developers to not accidentally their production
server and (b) deters user from letting it run that way for long.
2021-02-03 18:50:36 +01:00
Jonas Schäfer
2f8e724104 Enable Polish by default 2021-01-31 20:51:03 +01:00
Jonas Schäfer
a3ab537de0 Add more translated languages to the list 2021-01-31 15:29:21 +01:00
Jonas Schäfer
7013161872 Add full support for favicon magic in portal even without proxy 2021-01-31 12:51:09 +01:00
Jonas Schäfer
4044e857bc Disable iOS app reference by default
The app is not published yet, so we hide it by default. But we
allow allow to set an environment variable to show the button with
an appropriate link.
2021-01-29 09:32:01 +01:00
Jonas Schäfer
c1132ae975 Implement invite flow in the web portal
This allows us to translate the pages using the same tooling and
to have consistent theming.
2021-01-25 17:10:42 +01:00
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