flok
flok copied to clipboard
Simplify session creation: Make sessions invite-only
On home page, user can create a new session or join an existing one.
Create session
- First, Flok automatically creates an invite token for the session, stores all the session attributes locally (local storage or cookies), then goes to the editor.
- On the editor, Flok joins the WebRTC room and tries to store the session attributes stored on the browser in a special Yjs document. Then, it displays a modal showing the invite token, and for easier access, an invite URL for other peers. It also shows instructions on how to run
flok-replfor this particular session (e.g. depending on the specified targets, the command line arguments needed).
Join session
- User can enter the invite token from the
/joinpage, or join via the invite URL directly (/join?token=). - After joining, Flok enters the WebRTC room and tries to retrieve the session attributes. If the document does not exists, returns 404 and redirects to home page. Otherwise, it shows basic session info (targets and enabled extensions) and asks the user for her nickname. When accepting, Flok goes to the editor
- On the editor, Flok displays a modal with info about how to set up
flok-repl(similar to the user who created the session).
Now sessions are created with a unique name instead of letting the user set a name, making it way more secure than before. It'd still be much better to implement the session attributes shared document to hold information like layout and other things.