Make sidebars wait for worker to be loaded, and only load the database on sign-in

This PR is intended to fix the main initialisation issues around the worker taking longer than sidebars to initialise.

The basic ideas here are:

a) Create a new worker object, to be used in future as the main object in the worker; hence moving towards removing globals.
b) fix issues around the async database loading by making it load only when we sign-in.
c) make the sidebar wait until the worker has finished loading before starting any sign-in items.

Now ready for review, suggest from @n1k0 or @dmose