diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..456a3559 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Apply Prettier https://github.com/bitwarden/web/pull/1347 +56477eb39cfd8a73c9920577d24d75fed36e2cf5 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f12d041c..db16daaa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: - name: Cache npm id: npm-cache - uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 + uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 with: path: "~/.npm" key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} @@ -82,7 +82,7 @@ jobs: zip -r web-$_VERSION-selfhosted-open-source.zip build - name: Upload build artifact - uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 + uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 with: name: web-${{ env._VERSION }}-selfhosted-open-source.zip path: ./web-${{ env._VERSION }}-selfhosted-open-source.zip @@ -102,7 +102,7 @@ jobs: - name: Cache npm id: npm-cache - uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 + uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 with: path: "~/.npm" key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} @@ -129,7 +129,7 @@ jobs: zip -r web-$_VERSION-cloud-COMMERCIAL.zip build - name: Upload build artifact - uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 + uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 with: name: web-${{ env._VERSION }}-cloud-COMMERCIAL.zip path: ./web-${{ env._VERSION }}-cloud-COMMERCIAL.zip @@ -149,7 +149,7 @@ jobs: - name: Cache npm id: npm-cache - uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 + uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 with: path: "~/.npm" key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} @@ -191,7 +191,7 @@ jobs: zip -r web-$_VERSION-selfhosted-COMMERCIAL.zip build - name: Upload build artifact - uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 + uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 with: name: web-${{ env._VERSION }}-selfhosted-COMMERCIAL.zip path: ./web-${{ env._VERSION }}-selfhosted-COMMERCIAL.zip @@ -255,7 +255,7 @@ jobs: - name: Cache npm id: npm-cache - uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 + uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 with: path: "~/.npm" key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} @@ -304,21 +304,21 @@ jobs: docker --version docker build -t bitwardenqa.azurecr.io/web . - # - name: Get image tag - # id: image-tag - # run: | - # IMAGE_TAG=$(echo "$GITHUB_REF" | awk '{split($0, a, "/"); print a[3];}') - # TAG_EXTENSION=${{ github.event.inputs.custom_tag_extension }} + - name: Get image tag + id: image-tag + run: | + IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") + TAG_EXTENSION=${{ github.event.inputs.custom_tag_extension }} - # if [[ $TAG_EXTENSION ]]; then - # IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION - # fi - # echo "::set-output name=value::$IMAGE_TAG" + if [[ $TAG_EXTENSION ]]; then + IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION + fi + echo "::set-output name=value::$IMAGE_TAG" - # - name: Tag image - # env: - # IMAGE_TAG: ${{ steps.image-tag.outputs.value }} - # run: docker tag bitwardenqa.azurecr.io/web "bitwardenqa.azurecr.io/web:$IMAGE_TAG" + - name: Tag image + env: + IMAGE_TAG: ${{ steps.image-tag.outputs.value }} + run: docker tag bitwardenqa.azurecr.io/web "bitwardenqa.azurecr.io/web:$IMAGE_TAG" - name: Tag dev if: github.ref == 'refs/heads/master' @@ -327,10 +327,10 @@ jobs: - name: List Docker images run: docker images - # - name: Push image - # env: - # IMAGE_TAG: ${{ steps.image-tag.outputs.value }} - # run: docker push "bitwardenqa.azurecr.io/web:$IMAGE_TAG" + - name: Push image + env: + IMAGE_TAG: ${{ steps.image-tag.outputs.value }} + run: docker push "bitwardenqa.azurecr.io/web:$IMAGE_TAG" - name: Push dev images if: github.ref == 'refs/heads/master' @@ -353,7 +353,7 @@ jobs: - name: Cache npm id: npm-cache - uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 + uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6 with: path: "~/.npm" key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} @@ -401,7 +401,7 @@ jobs: _CROWDIN_PROJECT_ID: "308189" steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - name: Login to Azure uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a @@ -416,7 +416,7 @@ jobs: secrets: "crowdin-api-token" - name: Upload Sources - uses: crowdin/github-action@e39093fd75daae7859c68eded4b43d42ec78d8ea # v1.3.2 + uses: crowdin/github-action@e39093fd75daae7859c68eded4b43d42ec78d8ea # v1.3.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }} @@ -485,7 +485,7 @@ jobs: secrets: "devops-alerts-slack-webhook-url" - name: Notify Slack on failure - uses: act10ns/slack@e4e71685b9b239384b0f676a63c32367f59c2522 # v1.2.2 + uses: act10ns/slack@e4e71685b9b239384b0f676a63c32367f59c2522 # v1.2.2 if: failure() env: SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }} diff --git a/.github/workflows/crowdin-pull.yml b/.github/workflows/crowdin-pull.yml index 95c62307..0c959fea 100644 --- a/.github/workflows/crowdin-pull.yml +++ b/.github/workflows/crowdin-pull.yml @@ -15,7 +15,7 @@ jobs: _CROWDIN_PROJECT_ID: "308189" steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - name: Login to Azure uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a @@ -30,7 +30,7 @@ jobs: secrets: "crowdin-api-token" - name: Download translations - uses: crowdin/github-action@e39093fd75daae7859c68eded4b43d42ec78d8ea # v1.3.2 + uses: crowdin/github-action@e39093fd75daae7859c68eded4b43d42ec78d8ea # v1.3.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }} diff --git a/.github/workflows/qa-deploy.yml b/.github/workflows/qa-deploy.yml index ecc363fd..d654dd92 100644 --- a/.github/workflows/qa-deploy.yml +++ b/.github/workflows/qa-deploy.yml @@ -9,8 +9,8 @@ on: required: false env: - _QA_CLUSTER_RESOURCE_GROUP: "bitwarden-devops" - _QA_CLUSTER_NAME: "dev-aks" + _QA_CLUSTER_RESOURCE_GROUP: "bw-env-qa" + _QA_CLUSTER_NAME: "bw-aks-qa" _QA_K8S_NAMESPACE: "bw-qa" _QA_K8S_APP_NAME: "bw-web" @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout Repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - name: Setup run: export PATH=$PATH:~/work/web/web @@ -35,16 +35,16 @@ jobs: uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403 with: keyvault: "bitwarden-qa-kv" - secrets: "dev-aks-kubectl-credentials" + secrets: "qa-aks-kubectl-credentials" - - name: Login to dev-aks-kubectl SP + - name: Login with qa-aks-kubectl-credentials SP uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a with: - creds: ${{ env.dev-aks-kubectl-credentials }} + creds: ${{ env.qa-aks-kubectl-credentials }} - name: Setup AKS access - env: - USER_ID: ${{ env.qa-kubectl-managed-identity-clientId }} + #env: + # USER_ID: ${{ env.qa-kubectl-managed-identity-clientId }} run: | echo "---az install---" az aks install-cli --install-location ./kubectl --kubelogin-install-location ./kubelogin @@ -54,7 +54,7 @@ jobs: - name: Get image tag id: image_tag run: | - IMAGE_TAG=$(echo "$GITHUB_REF" | awk '{split($0, a, "/"); print a[3];}') + IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") TAG_EXTENSION=${{ github.event.inputs.image_extension }} if [[ $TAG_EXTENSION ]]; then diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4e4426f..544d6b4a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,15 @@ name: Release on: workflow_dispatch: - inputs: {} + inputs: + release_type: + description: 'Release Options' + required: true + default: 'Initial Release' + type: choice + options: + - Initial Release + - Redeploy jobs: setup: @@ -24,7 +32,7 @@ jobs: fi - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4 + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4 - name: Check Release Version id: version @@ -34,7 +42,8 @@ jobs: curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -r ".tag_name" ) - if [ "v$version" == "$previous_release_tag_version" ]; then + if [ "v$version" == "$previous_release_tag_version" ] && \ + [ "${{ github.event.inputs.release_type }}" == "Initial Release" ]; then echo "[!] Already released v$version. Please bump version to continue" exit 1 fi @@ -106,7 +115,7 @@ jobs: _TAG_VERSION: ${{ needs.setup.outputs.tag_version }} steps: - name: Checkout Repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 with: ref: gh-pages @@ -116,7 +125,7 @@ jobs: git push -u origin deploy-$_TAG_VERSION - name: Checkout Repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - name: Setup git config run: | @@ -138,7 +147,7 @@ jobs: run: unzip web-*-cloud-COMMERCIAL.zip - name: Deploy GitHub Pages - uses: crazy-max/ghaction-github-pages@db4476a01402e1a7ce05f41832040eef16d14925 # v2.5.0 + uses: crazy-max/ghaction-github-pages@db4476a01402e1a7ce05f41832040eef16d14925 # v2.5.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/.prettierignore b/.prettierignore index 2a26e8cf..3e3263bc 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,3 +8,6 @@ jslib src/locales src/404/*.min.css src/scripts/u2f.js + +# Github Workflows +.github/workflows \ No newline at end of file diff --git a/README.md b/README.md index 034e624d..a1478fab 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,23 @@ Where the `urls` object is defined by the [Urls type in jslib](https://github.co Code contributions are welcome! Please commit any pull requests against the `master` branch. Learn more about how to contribute by reading the [`CONTRIBUTING.md`](CONTRIBUTING.md) file. Security audits and feedback are welcome. Please open an issue or email us privately if the report is sensitive in nature. You can read our security policy in the [`SECURITY.md`](SECURITY.md) file. + +## 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 2b0a9d995e0147601ca8ae4778434a19354a60c2` +3. Resolve any merge conflicts, commit. +4. Run `npm run prettier` +5. Commit +6. Run `git merge -Xours 56477eb39cfd8a73c9920577d24d75fed36e2cf5` +7. Push + +### Git blame + +We also recommend that you configure git to ignore the prettier revision using: + +```bash +git config blame.ignoreRevsFile .git-blame-ignore-revs +``` diff --git a/bitwarden_license/src/app/organizations/manage/sso.component.ts b/bitwarden_license/src/app/organizations/manage/sso.component.ts index 7c2aed98..d2c0a26f 100644 --- a/bitwarden_license/src/app/organizations/manage/sso.component.ts +++ b/bitwarden_license/src/app/organizations/manage/sso.component.ts @@ -34,8 +34,8 @@ export class SsoComponent implements OnInit { spMetadataUrl: string; spAcsUrl: string; - enabled = this.fb.control(false); - data = this.fb.group({ + enabled = this.formBuilder.control(false); + data = this.formBuilder.group({ configType: [], keyConnectorEnabled: [], @@ -76,7 +76,7 @@ export class SsoComponent implements OnInit { }); constructor( - private fb: FormBuilder, + private formBuilder: FormBuilder, private route: ActivatedRoute, private apiService: ApiService, private platformUtilsService: PlatformUtilsService, diff --git a/bitwarden_license/src/app/policies/maximum-vault-timeout.component.ts b/bitwarden_license/src/app/policies/maximum-vault-timeout.component.ts index 9c1b4453..fb0071ae 100644 --- a/bitwarden_license/src/app/policies/maximum-vault-timeout.component.ts +++ b/bitwarden_license/src/app/policies/maximum-vault-timeout.component.ts @@ -24,12 +24,12 @@ export class MaximumVaultTimeoutPolicy extends BasePolicy { templateUrl: "maximum-vault-timeout.component.html", }) export class MaximumVaultTimeoutPolicyComponent extends BasePolicyComponent { - data = this.fb.group({ + data = this.formBuilder.group({ hours: [null], minutes: [null], }); - constructor(private fb: FormBuilder, private i18nService: I18nService) { + constructor(private formBuilder: FormBuilder, private i18nService: I18nService) { super(); } diff --git a/jslib b/jslib index 512c5c28..e4cd0af2 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 512c5c283745c0e2aedaa17fc5d386c60d622064 +Subproject commit e4cd0af2f9ae924f9b749fefe3695f7c69135bf6 diff --git a/package-lock.json b/package-lock.json index a29ce7ed..535343f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bitwarden-web", - "version": "2.25.0", + "version": "2.25.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bitwarden-web", - "version": "2.25.0", + "version": "2.25.1", "hasInstallScript": true, "license": "GPL-3.0", "dependencies": { diff --git a/package.json b/package.json index 065c1d58..fee533b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitwarden-web", - "version": "2.25.0", + "version": "2.25.1", "license": "GPL-3.0", "repository": "https://github.com/bitwarden/web", "scripts": { @@ -101,6 +101,7 @@ "npm": "~8" }, "lint-staged": { - "*.{js,ts,css,scss,md}": "prettier --write" + "*": "prettier --ignore-unknown --write", + "*.png": "node scripts/optimize.js" } } diff --git a/scripts/optimize.js b/scripts/optimize.js new file mode 100644 index 00000000..217a91e3 --- /dev/null +++ b/scripts/optimize.js @@ -0,0 +1,21 @@ +const child_process = require("child_process"); +const path = require("path"); + +const images = process.argv.slice(2); + +images.forEach((img) => { + switch (img.split(".").pop()) { + case "png": + child_process.execSync( + `npx @squoosh/cli --oxipng {} --output-dir "${path.dirname(img)}" "${img}"` + ); + break; + case "jpg": + child_process.execSync( + `npx @squoosh/cli --mozjpeg {"quality":85,"baseline":false,"arithmetic":false,"progressive":true,"optimize_coding":true,"smoothing":0,"color_space":3,"quant_table":3,"trellis_multipass":false,"trellis_opt_zero":false,"trellis_opt_table":false,"trellis_loops":1,"auto_subsample":true,"chroma_subsample":2,"separate_chroma_quality":false,"chroma_quality":75} --output-dir "${path.dirname( + img + )}" "${img}"` + ); + break; + } +}); diff --git a/src/404.html b/src/404.html index 0d39da56..12c70a03 100644 --- a/src/404.html +++ b/src/404.html @@ -51,6 +51,6 @@ contact us.
- +