Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

TOP: friends and family can join in seconds - pick a username in the app (no forge account), then queue and drive #38

opened this in answer to

Merged 45d 19h ago

Anyone can now join with just a username, no forge account needed. They can then queue, drive and chat, and the owner can ban people from the chat. Anonymous visitors still watch without joining.

Notes

opened this

Anyone can now join with just a username, no forge account needed. They can then queue, drive and chat, and the owner can ban people from the chat. Anonymous visitors still watch without joining.

Joining (src/accounts.ts, new; POST /join in src/relay.ts)

  • Name rules: 3–20 letters, digits, _ or -. Names are unique ignoring case. Reserved names (admin, owner, mod, system, forge…) are refused, and so are offensive words, including look-alike digit spellings.
  • Forge names are taken: a name used by anyone who signed in through the forge is reserved, so nobody can pose as the owner.
  • Cookie: the answer sets a random token in an HttpOnly, Secure, SameSite=Lax cookie that lasts a year. The same browser stays the same person, and a second join from it gets a 409 naming who it already is. Only a SHA-256 of the token is stored.
  • Rate limit: at most 3 new names per address per hour.
  • Same-origin: /join passes the same check as every other mutation.
  • Storage: people and bans live in $FORGE_APP_DATA/so101/accounts.sqlite, using bun's built-in sqlite, so there is no new dependency.
  • Client address: the last x-forwarded-for entry, the one the forge's proxy wrote. Earlier entries are set by the client and are ignored.

Identity (src/lobby.ts)

  • who() takes a verified forge identity first and the session cookie second.
  • The owner signed in to the forge is still the admin without joining.
  • A forged forge header next to a real cookie changes nothing.
  • Joined users can also keep a leader calibration.

Bans

  • The owner's ban frame bars the person's account, their name and the address they were last seen at.
  • Their turn ends, they leave the queue, and they can no longer chat, queue, send commands or open /follow. They can still watch.
  • No new name can be made from that address.
  • A user-agent hash is stored with each ban for reading only. It isn't used to block, because too many people share one browser.
  • An address ban covers everyone at that address, so a household shares a ban.
  • The owner sees a ban list with unban under the queue, and a ban button beside mute on each chat line.

Viewer: "Sign in to take control" is now a single 44 px name field with a Join to take control button. A small link under it lets people with a forge account sign in instead. The form is a static element, so live updates don't steal focus while someone is typing.

Left out:

  • The /admin page and timed mutes/bans. Those are #12 and #13, which build on this identity.
  • The optional 4-digit PIN for using the same name on another device.
  • Sign-out. Without a PIN, signing out would lose the name for good.

Tests: I changed three existing assertions in lobby.test.ts from "sign in" to "join", because the issue changes that wording; the tests weren't wrong. New tests cover:

  • a fresh browser joining, queueing and driving
  • duplicate names, bad names and cross-origin joins being refused
  • the forge owner being admin without joining, and their name being reserved
  • forged headers being ignored
  • a ban ending the turn, blocking chat and queue while watching still works, refusing a new name from that address, and unban restoring things
  • the 3-per-hour limit
  • names and the blocked-word filter
  • persistence across a restart, and the token never appearing in the file

bun x tsc --noEmit is clean and bun test passes 169/169.

To try it: open the preview in a private window, pick a name, then press Take control. Signed in to the forge as the owner, hover that person's chat line and press ban: their window switches to "You are banned: you can still watch", and joining under a new name from the same address is refused.

🤖 Generated with Claude Code

Closes #33

2 earlier comments
commented

Anyone can now join with just a username, no forge account needed. They can then queue, drive and chat, and the owner can ban people from the chat. Anonymous visitors still watch without joining.

Joining (src/accounts.ts, new; POST /join in src/relay.ts)

  • Name rules: 3–20 letters, digits, _ or -. Names are unique ignoring case. Reserved names (admin, owner, mod, system, forge…) are refused, and so are offensive words, including look-alike digit spellings.
  • Forge names are taken: a name used by anyone who signed in through the forge is reserved, so nobody can pose as the owner.
  • Cookie: the answer sets a random token in an HttpOnly, Secure, SameSite=Lax cookie that lasts a year. The same browser stays the same person, and a second join from it gets a 409 naming who it already is. Only a SHA-256 of the token is stored.
  • Rate limit: at most 3 new names per address per hour.
  • Same-origin: /join passes the same check as every other mutation.
  • Storage: people and bans live in $FORGE_APP_DATA/so101/accounts.sqlite, using bun's built-in sqlite, so there is no new dependency.
  • Client address: the last x-forwarded-for entry, the one the forge's proxy wrote. Earlier entries are set by the client and are ignored.

Identity (src/lobby.ts)

  • who() takes a verified forge identity first and the session cookie second.
  • The owner signed in to the forge is still the admin without joining.
  • A forged forge header next to a real cookie changes nothing.
  • Joined users can also keep a leader calibration.

Bans

  • The owner's ban frame bars the person's account, their name and the address they were last seen at.
  • Their turn ends, they leave the queue, and they can no longer chat, queue, send commands or open /follow. They can still watch.
  • No new name can be made from that address.
  • A user-agent hash is stored with each ban for reading only. It isn't used to block, because too many people share one browser.
  • An address ban covers everyone at that address, so a household shares a ban.
  • The owner sees a ban list with unban under the queue, and a ban button beside mute on each chat line.

Viewer: "Sign in to take control" is now a single 44 px name field with a Join to take control button. A small link under it lets people with a forge account sign in instead. The form is a static element, so live updates don't steal focus while someone is typing.

Left out:

  • The /admin page and timed mutes/bans. Those are #12 and #13, which build on this identity.
  • The optional 4-digit PIN for using the same name on another device.
  • Sign-out. Without a PIN, signing out would lose the name for good.

Tests: I changed three existing assertions in lobby.test.ts from "sign in" to "join", because the issue changes that wording; the tests weren't wrong. New tests cover:

  • a fresh browser joining, queueing and driving
  • duplicate names, bad names and cross-origin joins being refused
  • the forge owner being admin without joining, and their name being reserved
  • forged headers being ignored
  • a ban ending the turn, blocking chat and queue while watching still works, refusing a new name from that address, and unban restoring things
  • the 3-per-hour limit
  • names and the blocked-word filter
  • persistence across a restart, and the token never appearing in the file

bun x tsc --noEmit is clean and bun test passes 169/169.

To try it: open the preview in a private window, pick a name, then press Take control. Signed in to the forge as the owner, hover that person's chat line and press ban: their window switches to "You are banned: you can still watch", and joining under a new name from the same address is refused.

🤖 Generated with Claude Code

commented

Anyone can now join with just a username, no forge account needed. They can then queue, drive and chat, and the owner can ban people from the chat. Anonymous visitors still watch without joining. This branch is now merged with main, which brought in the admin controls (#30), the crew moderator (#24) and leader-arm driving (#29); both sides' changes are kept. The type check is clean and bun test passes 210/210. The merged app boots, / answers 200 and a join succeeds.

Joining (src/accounts.ts, new; POST /join in src/relay.ts)

  • Name rules: 3–20 letters, digits, _ or -. Names are unique ignoring case. Reserved names (admin, owner, mod, system, forge…) are refused, and so are offensive words, including look-alike digit spellings.
  • Forge names are taken: a name used by anyone who signed in through the forge is reserved, so nobody can pose as the owner.
  • Cookie: the answer sets a random token in an HttpOnly, Secure, SameSite=Lax cookie that lasts a year. The same browser stays the same person, and a second join from it gets a 409 naming who it already is. Only a SHA-256 of the token is stored.
  • Rate limit: at most 3 new names per address per hour.
  • Same-origin: /join passes the same check as every other change.
  • Storage: people and bans live in $FORGE_APP_DATA/so101/accounts.sqlite, using bun's built-in sqlite, so there is no new dependency.
  • Client address: the last x-forwarded-for entry, the one the forge's proxy wrote. Earlier entries are set by the client and are ignored.

Identity (src/lobby.ts)

  • who() takes a verified forge identity first and the session cookie second.
  • The owner signed in to the forge is still the admin without joining, and /admin stays theirs alone.
  • A forged forge header next to a real cookie changes nothing.

Bans

  • The owner's ban frame bars the person's account, their name and the address they were last seen at.
  • Their turn ends, they leave the queue, and they can no longer chat, queue, send commands or open /follow. They can still watch.
  • No new name can be made from that address.
  • Every ban and unban is written to the admin log.
  • A user-agent hash is stored with each ban for reading only. It isn't used to block, because too many people share one browser.
  • An address ban covers everyone at that address, so a household shares a ban.
  • The owner sees a ban list with unban under the queue, and a ban button beside mute on each chat line.

Viewer: "Sign in to take control" is now a single 44 px name field with a Join to take control button. A small link under it lets people with a forge account sign in instead. The form is a static element, so live updates don't steal focus while someone is typing. The ban list sits alongside the admin bar and crew panel that came from main.

Left out:

  • Timed mutes and bans, which belong to #13.
  • The optional 4-digit PIN for using the same name on another device.
  • Sign-out. Without a PIN, signing out would lose the name for good.

Tests: I changed three existing assertions in lobby.test.ts from "sign in" to "join", because the issue changes that wording; the tests weren't wrong. New tests cover:

  • a fresh browser joining, queueing and driving
  • duplicate names, bad names and cross-origin joins being refused
  • the forge owner being admin without joining, and their name being reserved
  • forged headers being ignored
  • a ban ending the turn, blocking chat and queue while watching still works, refusing a new name from that address, being logged, and unban restoring things
  • the 3-per-hour limit
  • names and the blocked-word filter
  • persistence across a restart, and the token never appearing in the file

To try it: open the preview in a private window, pick a name, then press Take control. Signed in to the forge as the owner, hover that person's chat line and press ban: their window switches to "You are banned: you can still watch", and joining under a new name from the same address is refused.

🤖 Generated with Claude Code

commented

Anyone can now join with just a username, no forge account needed. They can then queue, drive and chat, and the owner can ban people from the chat. Anonymous visitors still watch without joining. This branch is now merged with the latest main, including multiple cameras (#28); both sides' changes are kept. The type check is clean and bun test passes 218/218. The merged app boots, / answers 200, /cameras answers, and a join succeeds.

Joining (src/accounts.ts, new; POST /join in src/relay.ts)

  • Name rules: 3–20 letters, digits, _ or -. Names are unique ignoring case. Reserved names (admin, owner, mod, system, forge…) are refused, and so are offensive words, including look-alike digit spellings.
  • Forge names are taken: a name used by anyone who signed in through the forge is reserved, so nobody can pose as the owner.
  • Cookie: the answer sets a random token in an HttpOnly, Secure, SameSite=Lax cookie that lasts a year. The same browser stays the same person, and a second join from it gets a 409 naming who it already is. Only a SHA-256 of the token is stored.
  • Rate limit: at most 3 new names per address per hour.
  • Same-origin: /join passes the same check as every other change.
  • Storage: people and bans live in $FORGE_APP_DATA/so101/accounts.sqlite, using bun's built-in sqlite, so there is no new dependency.
  • Client address: the last x-forwarded-for entry, the one the forge's proxy wrote. Earlier entries are set by the client and are ignored.

Identity (src/lobby.ts)

  • who() takes a verified forge identity first and the session cookie second.
  • The owner signed in to the forge is still the admin without joining, and /admin and the camera admin stay theirs alone.
  • A forged forge header next to a real cookie changes nothing.

Bans

  • The owner's ban frame bars the person's account, their name and the address they were last seen at.
  • Their turn ends, they leave the queue, and they can no longer chat, queue, send commands or open /follow. They can still watch.
  • No new name can be made from that address.
  • Every ban and unban is written to the admin log.
  • A user-agent hash is stored with each ban for reading only. It isn't used to block, because too many people share one browser.
  • An address ban covers everyone at that address, so a household shares a ban.
  • The owner sees a ban list with unban under the queue, and a ban button beside mute on each chat line.

Viewer: "Sign in to take control" is now a single 44 px name field with a Join to take control button. A small link under it lets people with a forge account sign in instead. The form is a static element, so live updates don't steal focus while someone is typing.

Left out:

  • Timed mutes and bans, which belong to #13.
  • The optional 4-digit PIN for using the same name on another device.
  • Sign-out. Without a PIN, signing out would lose the name for good.

Tests: I changed three existing assertions in lobby.test.ts from "sign in" to "join", because the issue changes that wording; the tests weren't wrong. New tests cover:

  • a fresh browser joining, queueing and driving
  • duplicate names, bad names and cross-origin joins being refused
  • the forge owner being admin without joining, and their name being reserved
  • forged headers being ignored
  • a ban ending the turn, blocking chat and queue while watching still works, refusing a new name from that address, being logged, and unban restoring things
  • the 3-per-hour limit
  • names and the blocked-word filter
  • persistence across a restart, and the token never appearing in the file

To try it: open the preview in a private window, pick a name, then press Take control. Signed in to the forge as the owner, hover that person's chat line and press ban: their window switches to "You are banned: you can still watch", and joining under a new name from the same address is refused.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs