コミットグラフ

57 コミット

作成者 SHA1 メッセージ 日付
n9k d7b4717cf5 Chat: show dates when the day changes (js) 2022-08-10 00:01:27 +00:00
n9k c45031277c Minor: remove unused js 2022-07-24 01:27:55 +00:00
n9k 2df92bb488 Minor formatting 2022-07-20 07:37:35 +00:00
n9k 208ef9abc7 Emotes: one emote, one file 2022-07-20 07:37:33 +00:00
n9k 9edeea1491 Emotes: sheet filename config option 2022-07-16 23:48:46 +00:00
n9k 70036ca234 Minor formatting 2022-07-16 23:48:46 +00:00
n9k 4a69b0a4ba Typo 2022-07-14 17:23:03 +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 b63bd3096d JS: set `ws = null;` before creating new websocket 2022-06-29 02:36:37 +00:00
n9k 4a76fb023e Access captcha: special case for websocket
There doesn't seem to be a way to catch a 403 Forbidden error opening a
websocket with JavaScript, so this commit changes the behaviour to this:
open the websocket normally, send one "kick" message, close the
websocket.
2022-06-22 08:11:12 +00:00
n9k 893c4273b0 Licence headers formatting for real 2022-06-17 01:10:27 +00:00
n9k e147aa0d22 Chat: always enforce length limits from config 2022-06-17 00:40:02 +00:00
n9k 1f56e635b9 Ensure chat stays at bottom if names/tripcodes change 2022-06-15 20:39:06 +00:00
n9k d06a279be6 Sanitize newlines in usernames with js
Previously usernames with newlines in them actually went over multiple
lines.
2022-06-15 09:38:47 +00:00
n9k f40637b786 WS: don't close because no pings if already closed 2022-06-13 22:04:59 +00:00
n9k 5751297f10 Control socket: delete chat messages 2022-06-13 21:25:25 +00:00
n9k d621f8ceda Reorder chat form inputs so submit has priority
When you press enter to submit a form and there are multiple submittable
inputs (e.g. type="image" / type="submit"), Firefox chooses the one that
appears first in markup. Before this commit the image input (aka the "I
want a new captcha" button) appeared before the submit button which
meant pressing enter just reloaded the captcha instead of submitting the
comment.
2022-06-11 23:14:49 +00:00
n9k 971ab4769a Use accesskey 'r' for reload stream button 2022-06-11 23:14:16 +00:00
n9k 4b68023cf2 Add websocket ping/pong
Client and server both close the connection if they don't hear from the
other party after a timeout period. This is a failsafe and should
improve reliability.
2022-06-11 23:14:16 +00:00
n9k a7bfab4f26 Offline screen 2022-06-11 23:14:12 +00:00
n9k 73824f70d7 Lock js chat scroll when not at bottom 2022-06-09 01:34:59 +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 4cde4ea07a Add js appearance form (not complete c.f. nojs) 2022-03-08 16:13:22 +13:00
n9k ce5b7ba0ba Fix js memory leak
Already existing tripcode css rules were being re-inserted because of a typo.
2022-03-08 16:13:22 +13:00
n9k 9c5fc4bc71 Keyboard accessible js captcha 2022-03-08 16:13:22 +13:00
n9k f48a27525e Autofocus chat form textarea 2022-03-08 16:13:22 +13:00
n9k 0ce1902918 Show notice from websocket in js chat form 2022-03-08 16:13:22 +13:00
n9k ade3ca4e9e Add broadcaster insignia
Also surrounded users' name tags in <b> (HTML) tags.
2022-03-08 16:13:21 +13:00
n9k 5590fbbdbe Chat: use breaking space between name and message 2022-03-07 12:56:08 +13:00
n9k 46fce9c393 Add nojs 'Reload stream' button
The nojs button appears when the stream is online and the user is not watching.
The js button appears when the stream is online and the media element either
(1) is not using the network or (2) fires an error event.
2022-03-07 12:56:08 +13:00
n9k 6eda20a244 Add 'Reload stream' button in js 2022-03-07 12:56:08 +13:00
n9k edddbf00bc Show tripcodes in users list 2022-03-07 12:56:08 +13:00
n9k 7962de87e3 WS: combine `uptime` and `viewership` into `stats`
If the stream is offline, `stats` is null, otherwise it contains uptime and
viewership.
2022-03-07 12:56:08 +13:00
n9k ba90e18e30 Minor changes to the appearance of the users list
Made the 'Users in chat' header above the overflow area, so it always stays on
top. Now using `visibility: hidden;` instead of `display: none;` to show/hide
messages/users so that nojs css animations don't reset.
2022-03-07 12:56:08 +13:00
n9k 84ec253001 Show list of watching/non-watching users with js 2022-03-07 12:56:08 +13:00
n9k 8589216bf1 Send new captcha over websocket with js 2022-03-07 12:54:35 +13:00
n9k 3016705783 Keep track of stream viewership (number of viewers) 2022-03-07 12:54:35 +13:00
n9k a3b18bdc9f Background task for broadcasting title/uptime changes 2022-03-07 12:54:35 +13:00
n9k 8b4d6e8c09 Get stream title from disk
By default from `title.txt`. Also replace newlines with spaces when setting the
title in js, for parity with the nojs info iframe.
2022-03-07 12:54:35 +13:00
n9k 8d1f273a99 Show and update stream uptime in js 2022-03-07 12:54:33 +13:00
n9k 672ef10159 Add 3-hexdigit tags for default-name users 2022-02-23 09:21:07 +00:00
n9k 93409f8095 Message dates and times in chat
Now using `get_message_for_websocket` when sending an individual message.
2022-02-23 15:57:05 +13:00
n9k 2f4a9739c0 Show and enforce the captcha in js
Also clear the chat form comment input only if the message was accepted.
2022-02-22 16:25:43 +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 20f79c5265 Fix js typos 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 4f85b52af0 Eradicate typo in js that breaks tripcodes
Any single-user tripcode update deleted all existing tripcode display css
rules, because of one place where there was `stylesheet_color` (the global
variable) where it should have been `stylesheet` (the function argument).

Also now using proper js function named-argument syntax. (Why is it legal
to declare global variables in the arguments of a function call? What?)

In JavaScript, declaring a global variable in a function call is not OK:

  > function f(x) {
  ...   console.log(typeof n);
  ...   return x;
  ... }
  > f(var n = 42)
  Uncaught SyntaxError: Unexpected token 'var'
  > f(let n = 42)
  Uncaught SyntaxError: missing ) after argument list
  > f(const n = 42)
  Uncaught SyntaxError: Unexpected token 'const'

Unless of course you elide the variable keyword:

  > f(7)
  undefined
  7
  > f(n = 42)
  number
  42
  > n
  42

Not even once.
2022-02-18 19:06:23 +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