コミットグラフ

30 コミット

作成者 SHA1 メッセージ 日付
n9k b1f5bbdecd Force absent users to do the access captcha again
Before this, if a request was not coming from an existing user (no token
in the request or no user with the given token), then and only then
would we send the access captcha.  This meant that if a user left a chat
message and became absent, they wouldn't be prompted to do the access
captcha again until their message was eventuallly rotated.  (While
messages exist we don't delete the users who posted them.)

This commit makes it so if user['verified'] is None, the user is kicked
and prompted with the access captcha.  This is automatically done for
absent users by a background task.
2022-07-20 07:55:32 +00:00
n9k 6e8d8dc8e9 Emotes
The sheet of emotes goes in `/static/emotes.png`. Emote coordinates go
in emotes.json (by default, there is a config option).
2022-07-14 17:14:04 +00:00
n9k 8ab206d3c6 Allowedness: check in `with_user_from` wrapper 2022-07-03 08:53:02 +00:00
n9k 492078f6ce Record users' most recent HTTP headers 2022-06-29 04:30:27 +00:00
n9k 082fbf76d4 Error pages: make target="_top" for <a> elements 2022-06-25 07:45:07 +00:00
n9k 54b34ce503 Typo: update last.seen when no access captcha 2022-06-25 03:41:11 +00:00
n9k 3bb2a81c5a Bypass initial chat captcha if solved access captcha 2022-06-23 02:53:41 +00:00
n9k 0548065b1d Error pages: custom descriptions 2022-06-22 08:11:12 +00:00
n9k 9143acafd1 Access captcha 2022-06-22 08:11:12 +00:00
n9k a41f0d4f14 Escape disallowed cookie characters 2022-06-20 04:15:09 +00:00
n9k 22c84bc230 Give timestamp to route handlers 2022-06-20 04:15:09 +00:00
n9k 90e1e2099a Manual static folder 2022-06-20 04:15:08 +00:00
n9k 1d5b446291 Track the last time users were sent chat messages 2022-06-19 08:21:40 +00:00
n9k 0b78a79111 Use single quotes 2022-06-19 07:53:31 +00:00
n9k 1c7818cc0b Licence headers formatting 2022-06-16 01:31:10 +00:00
n9k 1422bebd8e Require Authorization header for broadcaster
As opposed to just the broadcaster token. This makes the broadcaster
username/password login mandatory, which previously was only mandatory
in the `auth_required` wrapper, but not elsewhere (so for example
leaving comments as the broadcaster was possible with the token only). A
less safe alternative to this would be to compare tokens in `check_auth`
once the Authorization header didn't match.
2022-06-14 08:50:31 +00:00
n9k 6ef3a77465 Explicitly reject weird tokens
Includes really long tokens
2022-06-14 08:50:31 +00:00
n9k 95f12fa632 Send <!doctype html> in responses when auth fails 2022-06-11 23:14:16 +00:00
n9k 829f3f004b Add licences 2022-03-08 16:41:47 +13:00
n9k 4bab173237 Add Content Security Policy meta tags 2022-03-08 16:13:22 +13:00
n9k bfa77b738d Tell websockets which users are watching
This adds a field 'watching' in `user_for_websocket` that's True iff WATCHING,
False iff NOTWATCHING, and None otherwise (since clients don't need to know if
a user is tentative or absent). When the value of this field changes for any
user, they get added to the update buffer (like with any other change).

Removed race condition in `t_sunset_users`: `broadcast_users_update` was being
called *after* a user was removed from memory (and for each user being removed,
which was redundant). In that scenario if there's a user in the update buffer
and `t_sunset_users` wins the race between it and `t_broadcast_users_update`,
then when `t_sunset_users` calls `broadcast_users_update` a KeyError would be
raised since the user's already been removed.

Fixed unintended behaviour of `t_sunset_users`: it was removing users based on
the result of `is_visible`, so users who were actually tenative (as opposed to
absent) were being removed.
2022-03-07 12:54:35 +13:00
n9k cc6ed63764 Segment streaming redux, accurate stream uptime 2022-02-23 15:57:04 +13:00
n9k 6ceb553b29 Buffer new and mutated users before sending to websockets
By default the buffer is exhausted every 4 seconds. This should defend against
a potential DoS against clients with JavaScript enabled. Before this, any
request with no token would generate a new user and immediately broadcast the
new user to all the websockets. It's best to lock down as much as possible the
number of places a client can cause the server to broadcasts to all the
websockets.
2022-02-22 16:25:43 +13:00
n9k 7058677000 Setup background tasks, create t_sunset_users task 2022-02-22 16:25:43 +13:00
n9k e9a4b511a3 Formalize/tidy user presence logic 2022-02-22 16:25:43 +13:00
n9k 6109de37ec Nojs chat: ETag, limit scrollback, timeout notice
Limiting scrollback is happening for the js chat too. Also reject long
comments.
2022-02-22 16:25:41 +13:00
n9k d848d1532e Reflect appearance changes with js 2022-02-18 18:17:01 +13:00
n9k 1e6563c4a2 Some more project structure 2022-02-18 14:32:34 +13:00
n9k 7dbcd43f30 Logicaler project structure, see rest of commit message
Incoming requests are handled in anonstream/routes/. Route handlers
mainly depend on files in anonstream/, which in turn depend on files in
anonstream/helpers/ and anonstream/utils/. Utils are pure functions and
helpers are almost pure functions; they don't mutate state but they
do depend on the global app config.
2022-02-17 13:30:09 +13:00
n9k e77862f4ff Nojs chat, store all user names/colors in js, forget about inactive users
Project structure evolving a bit
2022-02-17 13:30:05 +13:00