1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-14 02:08:50 +02:00
The browser extension vault (Chrome, Firefox, Opera, Edge, Safari, & more).
Go to file
Addison Beck 57d60bdfa6
Misc Account Switching Fixes & Refactors (#600)
* [refactor] Restructure EnvironmentUrls in state

* Patch up (add missing fields) and more extensivly use the EnvironmentUrls class instead of passing around an any
* Add environmentUrls to the AccountSettings model in addition to GlobalState for use in both scopes
* Move EnvironmentUrls initialization to the model level and out of StateSerice
* Adjust the StateMigrationService to account for these changes

* [refactor] Improve order of operations for LockGuardService

We currently jump through a bunch of hoops to verify users can access the Lock page, like checking authentication first.
If a user is not authenticated, they are not locked, so we can improve performance for the happy path of this serivice by checking isLocked first and using isAuthenticated to deviate from the normal flow if needed.

* [bug] Subscribe to State.accounts in EnvironmentService and set urls accordingly

The EnvironmentService has no context for account changes currently and does not update actively used urls based on active account.
This commit addresses this issue by subscribing to State.accounts and resetting the service's urls on account change.

* [bug] Clear AccessToken from State on clean

In order for logout flows to function as expected we need to deauthenticate users when cleaning up state before checking for the next active user
Otherwise the service will continue to think the user being logged out is active

* [refactor] Stop pushing accounts when modifying disk state

There is no reason to push new accounts to subscribers when updating disk state.
Subscribers recieve a copy of in memory state, so changes to disk will not be refelected and have to be fetched seperatly from the service.
Pushing when saving disk state is just creating an unecassary performance burden.

* [refactor] Default to in memory active user if availible, even when accessing disk state

Sometimes we need to pull activeUserId from storage to access a bit of data, like on initial boot, but most of the time this isn't necassary.
Since we pull this userId a lot, checking disk each time is a performance burden. Defaulting to the in memory user ID if avaible helps alleviate this.

* [style] Ran prettier

* [style] Change a let to a const
2022-01-07 09:30:54 -05:00
.github Apply Prettier (#581) 2021-12-16 13:36:21 +01:00
.husky Add Prettier configuration (#574) 2021-12-16 12:45:01 +01:00
.vscode Apply Prettier (#581) 2021-12-16 13:36:21 +01:00
angular Misc Account Switching Fixes & Refactors (#600) 2022-01-07 09:30:54 -05:00
common Misc Account Switching Fixes & Refactors (#600) 2022-01-07 09:30:54 -05:00
electron Apply Prettier (#581) 2021-12-16 13:36:21 +01:00
node [feat(Account Switching)] Allow for extending application state (#584) 2021-12-20 08:48:47 -05:00
spec Fix for issue #1287 in bitwarden/web (#569) 2021-12-16 18:46:33 +01:00
.editorconfig Add Prettier configuration (#574) 2021-12-16 12:45:01 +01:00
.git-blame-ignore-revs Add .git-blame-ignore-revs and prettier instructions (#585) 2021-12-16 14:10:11 +01:00
.gitattributes Apply Prettier (#581) 2021-12-16 13:36:21 +01:00
.gitignore setup karma testing 2018-04-17 16:15:19 -04:00
.prettierignore Fix prettier (#598) 2022-01-07 14:23:42 +01:00
.prettierrc.json Add Prettier configuration (#574) 2021-12-16 12:45:01 +01:00
CONTRIBUTING.md Apply Prettier (#581) 2021-12-16 13:36:21 +01:00
LICENSE.txt license and contrib 2018-01-26 16:07:38 -05:00
package-lock.json Add Prettier configuration (#574) 2021-12-16 12:45:01 +01:00
package.json Fix prettier (#598) 2022-01-07 14:23:42 +01:00
README.md Update README.md (#586) 2021-12-16 14:38:11 +01:00
SECURITY.md Apply Prettier (#581) 2021-12-16 13:36:21 +01:00
tsconfig.json Apply Prettier (#581) 2021-12-16 13:36:21 +01:00
tslint.json Apply Prettier (#581) 2021-12-16 13:36:21 +01:00

Github Workflow build on master

Bitwarden JavaScript Library

Common code referenced across Bitwarden JavaScript projects.

Requirements

  • Node.js v16.13.1 or greater
  • NPM v8
  • Git
  • node-gyp

Windows

  • Microsoft Build Tools 2015 in Visual Studio Installer
  • Windows 10 SDK 17134 either by downloading it seperately or through the Visual Studio Installer.

Prettier

We recently migrated to using Prettier as code formatter. All previous branches will need to updated to avoid large merge conflicts using the following steps:

  1. Check out your local Branch
  2. Run git merge 8b2dfc6cdcb8ff5b604364c2ea6d343473aee7cd
  3. Resolve any merge conflicts, commit.
  4. Run npm run prettier
  5. Commit
  6. Run git merge -Xours 193434461dbd9c48fe5dcbad95693470aec422ac
  7. Push

Git blame

We also recommend that you configure git to ignore the prettier revision using:

git config blame.ignoreRevsFile .git-blame-ignore-revs