Skip to content

Lichess and Firefox Multi Account Containers

schlawg edited this page May 27, 2022 · 15 revisions

Most Lila features outside of puzzles and play with computer require interaction between multiple users. Anything that facilitates switching between them is useful for developers.

Use Firefox's Multi-Account Container extension to have multiple active users logged in to a lila instance, all in their own tabs with their own session environments (cookies, local storage, etc), without using private browsing. More importantly, if you set up a few containers dedicated to specific users, you'll never have to log that user in again. Just select the user/container from the menu and let Firefox/cookie/lila handle the rest in a newly created tab.

For a dev instance with spamdb generated users, this sample Multi-Account Container menu maps containers to user sessions which persist across tab closure and browser restarts - just like your default session.

Screen Shot 2022-05-06 at 1 21 07 AM

To make the tabs reflect the username, go to the st.headTitle block in the head tag of the apply method in app/views/base/layout.scala and make it look like this:

          st.headTitle {
            if (ctx.blind) "lichess"
            else if (netConfig.isProd) fullTitle | s"$title • lichess.org"
            else ctx.me ?? {_.username} // schlawg is a dirty, filthy boy
          },

Don't check that in by mistake.

You could instead make spamdb users with command line option -bg 400 to give each one a random background image (which can make it easier to distinguish them). If you don't like the generated uids, they can be customized in lila-db-seed/spamdb/data/uids.txt. Background images are chosen from lila-db-seed/spamdb/data/image_links.txt.

For example:

python3 spamdb/spamdb.py --drop all -bg 400 -u 32

Creates a default database with 32 normal users selected from the first 32 lines of uids.txt (in addition to the special users - lichess, shusher, etc)

To see the other customization options, try python3 spamdb/spamdb.py --help

Clone this wiki locally