diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index a097c9dc8..ce4db1098 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -4,7 +4,7 @@ inputs: node-version: description: "Version of nodejs to install" required: false - default: '20' + default: "20" runs: using: "composite" steps: diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index 1cc8d0038..c301b1562 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -10,7 +10,7 @@ inputs: cache_backend: description: "Choose between sccache or github" required: false - default: 'sccache' + default: "sccache" targets: description: "Additional targets to install" required: false diff --git a/.github/pre-commit-config.yaml b/.github/pre-commit-config.yaml index 9c58945ac..15c00bf01 100644 --- a/.github/pre-commit-config.yaml +++ b/.github/pre-commit-config.yaml @@ -7,6 +7,11 @@ repos: entry: codespell language: system pass_filenames: false + - id: prettier-git-files + name: Prettier (only git-tracked files) + entry: bash -c 'git ls-files -z | xargs -0 prettier --check --ignore-unknown' + language: system + pass_filenames: false # Standard pre-commit hooks - repo: https://github.com/pre-commit/pre-commit-hooks @@ -44,23 +49,6 @@ repos: args: - -i - "4" - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.8" - hooks: - - id: prettier - # Exclude non-website files for now - # TODO: Lint these files in all directories - exclude: "^(?!website/)" - types_or: - - javascript - - jsx - - css - - scss - - json - - mdx - - markdown - - html - - xml - repo: https://github.com/DevinR528/cargo-sort rev: v1.0.9 hooks: diff --git a/.github/workflows/_build_artifacts.yml b/.github/workflows/_build_artifacts.yml index f79d1eb39..c854e8525 100644 --- a/.github/workflows/_build_artifacts.yml +++ b/.github/workflows/_build_artifacts.yml @@ -90,8 +90,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: - ${{ steps.login.outputs.registry }}/firezone/${{matrix.image_name }} + images: ${{ steps.login.outputs.registry }}/firezone/${{matrix.image_name }} tags: | type=raw,value=${{ inputs.sha }} - name: Sanitize github.ref_name @@ -135,19 +134,19 @@ jobs: # Syntax is weird because https://github.com/actions/runner/issues/1512 exclude: # Exclude debug builds for non-amd64 targets since they won't be used. - - {stage: debug, arch: {platform: linux/arm/v7}} - - {stage: debug, arch: {platform: linux/arm64}} + - { stage: debug, arch: { platform: linux/arm/v7 } } + - { stage: debug, arch: { platform: linux/arm64 } } # Exclude http-test-server from perf image builds - - {image_prefix: perf, name: {package: http-test-server}} + - { image_prefix: perf, name: { package: http-test-server } } arch: - target: x86_64-unknown-linux-musl shortname: x86_64 platform: linux/amd64 - - target: aarch64-unknown-linux-musl # E.g. AWS Graviton + - target: aarch64-unknown-linux-musl # E.g. AWS Graviton shortname: aarch64 platform: linux/arm64 - - target: armv7-unknown-linux-musleabihf # E.g. Raspberry Pi + - target: armv7-unknown-linux-musleabihf # E.g. Raspberry Pi platform: linux/arm/v7 shortname: armv7 name: @@ -278,8 +277,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: - ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_prefix && format('{0}/', matrix.image_prefix) || '' }}${{ matrix.name.image_name }} + images: ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_prefix && format('{0}/', matrix.image_prefix) || '' }}${{ matrix.name.image_name }} # We only version client and gateway tags: | type=raw,value=latest @@ -309,8 +307,7 @@ jobs: cache-to: | type=registry,ref=${{ steps.login.outputs.registry }}/cache/${{ matrix.name.image_name }}:${{ env.CACHE_TAG }},mode=max target: ${{ matrix.stage }} - outputs: - type=image,name=${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_prefix && format('{0}/', matrix.image_prefix) || '' }}${{ matrix.name.image_name }},push-by-digest=true,name-canonical=true,push=true + outputs: type=image,name=${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_prefix && format('{0}/', matrix.image_prefix) || '' }}${{ matrix.name.image_name }},push-by-digest=true,name-canonical=true,push=true - name: Export digest run: | mkdir -p /tmp/digests/${{ matrix.name.image_name }} @@ -342,7 +339,7 @@ jobs: # Exclude http-test-server from perf image builds exclude: - - {image_prefix: perf, image: {name: http-test-server}} + - { image_prefix: perf, image: { name: http-test-server } } image: - name: relay @@ -390,8 +387,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: - ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_prefix && format('{0}/', matrix.image_prefix) || '' }}${{ matrix.image.name }} + images: ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_prefix && format('{0}/', matrix.image_prefix) || '' }}${{ matrix.image.name }} tags: | type=raw,value=latest type=raw,value=${{ inputs.sha }} diff --git a/.github/workflows/_deploy_production.yml b/.github/workflows/_deploy_production.yml index a029caae9..f3891986d 100644 --- a/.github/workflows/_deploy_production.yml +++ b/.github/workflows/_deploy_production.yml @@ -136,20 +136,17 @@ jobs: uses: hashicorp/tfc-workflows-github/actions/create-run@v1.3.1 id: apply-run env: - TF_VAR_image_tag: - '"${{ inputs.tag }}"' + TF_VAR_image_tag: '"${{ inputs.tag }}"' with: workspace: ${{ env.TF_WORKSPACE }} - configuration_version: - ${{ steps.apply-upload.outputs.configuration_version_id }} + configuration_version: ${{ steps.apply-upload.outputs.configuration_version_id }} - name: Apply uses: hashicorp/tfc-workflows-github/actions/apply-run@v1.3.1 if: fromJSON(steps.apply-run.outputs.payload).data.attributes.actions.IsConfirmable id: apply with: run: ${{ steps.apply-run.outputs.run_id }} - comment: - "Apply Run from GitHub Actions CI ${{ inputs.tag }}" + comment: "Apply Run from GitHub Actions CI ${{ inputs.tag }}" # Some intrepid users are self-hosting these, so support them as best we can by making our # infrastructure images available to them. diff --git a/.github/workflows/_integration_tests.yml b/.github/workflows/_integration_tests.yml index b81bc5b34..5898a7770 100644 --- a/.github/workflows/_integration_tests.yml +++ b/.github/workflows/_integration_tests.yml @@ -6,7 +6,7 @@ on: domain_image: required: false type: string - default: 'us-east1-docker.pkg.dev/firezone-staging/firezone/domain' + default: "us-east1-docker.pkg.dev/firezone-staging/firezone/domain" domain_tag: required: false type: string @@ -14,7 +14,7 @@ on: api_image: required: false type: string - default: 'us-east1-docker.pkg.dev/firezone-staging/firezone/api' + default: "us-east1-docker.pkg.dev/firezone-staging/firezone/api" api_tag: required: false type: string @@ -22,7 +22,7 @@ on: web_image: required: false type: string - default: 'us-east1-docker.pkg.dev/firezone-staging/firezone/web' + default: "us-east1-docker.pkg.dev/firezone-staging/firezone/web" web_tag: required: false type: string @@ -30,7 +30,7 @@ on: elixir_image: required: false type: string - default: 'us-east1-docker.pkg.dev/firezone-staging/firezone/elixir' + default: "us-east1-docker.pkg.dev/firezone-staging/firezone/elixir" elixir_tag: required: false type: string @@ -38,7 +38,7 @@ on: relay_image: required: false type: string - default: 'us-east1-docker.pkg.dev/firezone-staging/firezone/debug/relay' + default: "us-east1-docker.pkg.dev/firezone-staging/firezone/debug/relay" relay_tag: required: false type: string @@ -46,7 +46,7 @@ on: gateway_image: required: false type: string - default: 'us-east1-docker.pkg.dev/firezone-staging/firezone/debug/gateway' + default: "us-east1-docker.pkg.dev/firezone-staging/firezone/debug/gateway" gateway_tag: required: false type: string @@ -54,7 +54,7 @@ on: client_image: required: false type: string - default: 'us-east1-docker.pkg.dev/firezone-staging/firezone/debug/client' + default: "us-east1-docker.pkg.dev/firezone-staging/firezone/debug/client" client_tag: required: false type: string @@ -62,7 +62,7 @@ on: http_test_server_image: required: false type: string - default: 'us-east1-docker.pkg.dev/firezone-staging/firezone/debug/http-test-server' + default: "us-east1-docker.pkg.dev/firezone-staging/firezone/debug/http-test-server" http_test_server_tag: required: false type: string diff --git a/.github/workflows/_kotlin.yml b/.github/workflows/_kotlin.yml index d5e4d9ace..1e71a0656 100644 --- a/.github/workflows/_kotlin.yml +++ b/.github/workflows/_kotlin.yml @@ -8,8 +8,8 @@ defaults: working-directory: ./kotlin/android permissions: - contents: 'read' - id-token: 'write' + contents: "read" + id-token: "write" jobs: static-analysis: diff --git a/.github/workflows/_rust.yml b/.github/workflows/_rust.yml index 5ba707120..d48c351ea 100644 --- a/.github/workflows/_rust.yml +++ b/.github/workflows/_rust.yml @@ -8,8 +8,8 @@ defaults: working-directory: ./rust permissions: - contents: 'read' - id-token: 'write' + contents: "read" + id-token: "write" # Never tolerate warnings. Duplicated in `_tauri.yml` env: @@ -23,8 +23,8 @@ jobs: fail-fast: false matrix: runs-on: [ - windows-2019 # Only platform with a benchmark right now - ] + windows-2019, # Only platform with a benchmark right now + ] runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v4 @@ -42,11 +42,7 @@ jobs: fail-fast: false matrix: # TODO: https://github.com/rust-lang/cargo/issues/5220 - runs-on: [ - ubuntu-22.04, - macos-14, - windows-2022 - ] + runs-on: [ubuntu-22.04, macos-14, windows-2022] runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v4 @@ -75,14 +71,15 @@ jobs: fail-fast: false matrix: # TODO: https://github.com/rust-lang/cargo/issues/5220 - runs-on: [ - ubuntu-22.04, - ubuntu-24.04, - macos-13, - macos-14, - windows-2019, - windows-2022 - ] + runs-on: + [ + ubuntu-22.04, + ubuntu-24.04, + macos-13, + macos-14, + windows-2019, + windows-2022, + ] runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v4 @@ -131,12 +128,7 @@ jobs: strategy: fail-fast: false matrix: - runs-on: [ - ubuntu-22.04, - ubuntu-24.04, - windows-2019, - windows-2022 - ] + runs-on: [ubuntu-22.04, ubuntu-24.04, windows-2019, windows-2022] runs-on: ${{ matrix.runs-on }} defaults: run: diff --git a/.github/workflows/_static-analysis.yml b/.github/workflows/_static-analysis.yml index 094dee86b..e41d45c71 100644 --- a/.github/workflows/_static-analysis.yml +++ b/.github/workflows/_static-analysis.yml @@ -55,10 +55,14 @@ jobs: - name: Install Python Dependencies run: | pip install -r .github/requirements.txt + - uses: actions/setup-node@v4 + with: + node-version: 20 - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y shfmt + npm install -g prettier - name: Run pre-commit run: | pre-commit install --config .github/pre-commit-config.yaml diff --git a/.github/workflows/_swift.yml b/.github/workflows/_swift.yml index fba6200e3..6c5268b19 100644 --- a/.github/workflows/_swift.yml +++ b/.github/workflows/_swift.yml @@ -14,16 +14,16 @@ jobs: - sdk: macosx runs-on: macos-14 platform: macOS - xcode: '15.2' + xcode: "15.2" destination: platform=macOS - sdk: iphoneos runs-on: macos-14 platform: iOS - xcode: '15.2' + xcode: "15.2" destination: generic/platform=iOS permissions: contents: read - id-token: 'write' + id-token: "write" defaults: run: working-directory: ./swift/apple diff --git a/.github/workflows/_terraform.yml b/.github/workflows/_terraform.yml index 05971f8be..e47e2946d 100644 --- a/.github/workflows/_terraform.yml +++ b/.github/workflows/_terraform.yml @@ -56,8 +56,7 @@ jobs: TF_VAR_image_tag: '"${{ github.sha }}"' with: workspace: ${{ env.TF_WORKSPACE }} - configuration_version: - ${{ steps.plan-upload.outputs.configuration_version_id }} + configuration_version: ${{ steps.plan-upload.outputs.configuration_version_id }} plan_only: true - if: steps.changes.outputs.terraform == 'true' name: Get Plan Output diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 257b34286..2cbb2c0f7 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -82,8 +82,7 @@ jobs: TF_VAR_image_tag: '"${{ github.sha }}"' with: workspace: ${{ env.TF_WORKSPACE }} - configuration_version: - ${{ steps.apply-upload.outputs.configuration_version_id }} + configuration_version: ${{ steps.apply-upload.outputs.configuration_version_id }} - name: Apply uses: hashicorp/tfc-workflows-github/actions/apply-run@v1.3.1 if: fromJSON(steps.apply-run.outputs.payload).data.attributes.actions.IsConfirmable diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e90da1969..165eeb1dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,9 +89,9 @@ jobs: secrets: inherit with: sha: ${{ github.sha }} - image_prefix: 'perf' - profile: 'release' - stage: 'debug' # Only the debug images have perf tooling + image_prefix: "perf" + profile: "release" + stage: "debug" # Only the debug images have perf tooling integration-tests: uses: ./.github/workflows/_integration_tests.yml @@ -140,17 +140,17 @@ jobs: id-token: write pull-requests: write env: - API_IMAGE: 'us-east1-docker.pkg.dev/firezone-staging/firezone/api' + API_IMAGE: "us-east1-docker.pkg.dev/firezone-staging/firezone/api" API_TAG: ${{ github.sha }} - WEB_IMAGE: 'us-east1-docker.pkg.dev/firezone-staging/firezone/web' + WEB_IMAGE: "us-east1-docker.pkg.dev/firezone-staging/firezone/web" WEB_TAG: ${{ github.sha }} - ELIXIR_IMAGE: 'us-east1-docker.pkg.dev/firezone-staging/firezone/elixir' + ELIXIR_IMAGE: "us-east1-docker.pkg.dev/firezone-staging/firezone/elixir" ELIXIR_TAG: ${{ github.sha }} - GATEWAY_IMAGE: 'us-east1-docker.pkg.dev/firezone-staging/firezone/perf/gateway' + GATEWAY_IMAGE: "us-east1-docker.pkg.dev/firezone-staging/firezone/perf/gateway" GATEWAY_TAG: ${{ github.sha }} - CLIENT_IMAGE: 'us-east1-docker.pkg.dev/firezone-staging/firezone/perf/client' + CLIENT_IMAGE: "us-east1-docker.pkg.dev/firezone-staging/firezone/perf/client" CLIENT_TAG: ${{ github.sha }} - RELAY_IMAGE: 'us-east1-docker.pkg.dev/firezone-staging/firezone/perf/relay' + RELAY_IMAGE: "us-east1-docker.pkg.dev/firezone-staging/firezone/perf/relay" RELAY_TAG: ${{ github.sha }} strategy: fail-fast: false @@ -171,8 +171,7 @@ jobs: with: project: firezone-staging - name: Seed database - run: - docker compose run elixir /bin/sh -c 'cd apps/domain && mix ecto.seed' + run: docker compose run elixir /bin/sh -c 'cd apps/domain && mix ecto.seed' - name: Start docker compose in the background run: | # We need to increase the log level to make sure that they don't hold off storm of packets @@ -186,14 +185,14 @@ jobs: docker compose up -d relay-1 relay-2 --no-build docker compose up -d gateway --no-build docker compose up -d client --no-build - - name: 'Performance test: ${{ matrix.test_name }}' + - name: "Performance test: ${{ matrix.test_name }}" timeout-minutes: 5 env: TEST_NAME: ${{ matrix.test_name }} run: | ./scripts/tests/perf/${{ matrix.test_name }}.sh jq '{ "${{ matrix.test_name }}": { "throughput": { "value": .end.sum_received.bits_per_second } } }' ./${{ matrix.test_name }}.json > ./${{ matrix.test_name }}.bmf.json - - name: 'Save performance test results: ${{ matrix.test_name }}' + - name: "Save performance test results: ${{ matrix.test_name }}" uses: actions/upload-artifact@v4 with: overwrite: true @@ -239,7 +238,7 @@ jobs: - name: Download performance test results uses: actions/download-artifact@v4 with: - pattern: '*-${{ github.sha }}-iperf3results' + pattern: "*-${{ github.sha }}-iperf3results" merge-multiple: true path: ./${{ github.sha }} - name: Merge benchmarks results into one report diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fd1b328fa..77aaa6ce0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,7 +24,7 @@ jobs: uses: ./.github/workflows/_integration_tests.yml secrets: inherit with: - relay_image: 'us-east1-docker.pkg.dev/firezone-staging/firezone/relay' + relay_image: "us-east1-docker.pkg.dev/firezone-staging/firezone/relay" gateway_image: "ghcr.io/firezone/gateway" gateway_tag: "latest" client_image: "ghcr.io/firezone/client" diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..0ad18b6fd --- /dev/null +++ b/.prettierignore @@ -0,0 +1,12 @@ +elixir/_build +elixir/deps +elixir/apps/web/assets +rust/target +kotlin/android/build +website/node_modules +**/*.sh +**/*.ex +**/*.rs +**/*.wxs +**/pnpm-lock.yaml +swift/apple/**/Contents.json diff --git a/docker-compose.yml b/docker-compose.yml index 6cfd8af72..53ee72d5c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -419,7 +419,11 @@ services: iperf3: image: mlabbe/iperf3 healthcheck: - test: ["CMD-SHELL", "(cat /proc/net/tcp | grep 5201) && (cat /proc/net/udp | grep 5201)"] + test: + [ + "CMD-SHELL", + "(cat /proc/net/tcp | grep 5201) && (cat /proc/net/udp | grep 5201)", + ] command: -s -V networks: resources: @@ -458,12 +462,12 @@ services: api: condition: "service_healthy" # ports: - # NOTE: Only 111 ports are used for local dev / testing because Docker Desktop - # allocates a userland proxy process for each forwarded port X_X. - # - # Large ranges here will bring your machine to its knees. - # - "55555-55666:55555-55666/udp" - # - 3478:3478/udp + # NOTE: Only 111 ports are used for local dev / testing because Docker Desktop + # allocates a userland proxy process for each forwarded port X_X. + # + # Large ranges here will bring your machine to its knees. + # - "55555-55666:55555-55666/udp" + # - 3478:3478/udp networks: app: ipv4_address: ${RELAY_1_PUBLIC_IP4_ADDR:-172.28.0.101} diff --git a/docs/MAINTAINERS.md b/docs/MAINTAINERS.md index 63e4c9fa6..d91f6bc97 100644 --- a/docs/MAINTAINERS.md +++ b/docs/MAINTAINERS.md @@ -33,10 +33,10 @@ Given that `main` is tested: 1. Open a PR and make the following changes: 1. Update [scripts/Makefile](../scripts/Makefile) with the new version number(s). Run `make -f scripts/Makefile version` to propagate the versions in the Makefile to all components. 1. Update the Changelog (e.g. `../website/src/components/Changelog/GUI.tsx`) with: - 1. New version numbers - 1. Release notes - 1. Release date - 1. Empty draft entry + 1. New version numbers + 1. Release notes + 1. Release date + 1. Empty draft entry 1. Update the known issues in `website/src/app/kb/client-apps/*` 1. When the PR merges, the website will now redirect to the new version(s). diff --git a/elixir/apps/domain/coveralls.json b/elixir/apps/domain/coveralls.json index 3d771278d..497a971cb 100644 --- a/elixir/apps/domain/coveralls.json +++ b/elixir/apps/domain/coveralls.json @@ -1,5 +1,3 @@ { - "skip_files": [ - "test" - ] + "skip_files": ["test"] } diff --git a/elixir/apps/web/README.md b/elixir/apps/web/README.md index d7d805593..7012259ad 100644 --- a/elixir/apps/web/README.md +++ b/elixir/apps/web/README.md @@ -2,8 +2,8 @@ To start your Phoenix server: - * Run `mix setup` to install and setup dependencies - * Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server` +- Run `mix setup` to install and setup dependencies +- Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server` Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. @@ -11,8 +11,8 @@ Ready to run in production? Please [check our deployment guides](https://hexdocs ## Learn more - * Official website: https://www.phoenixframework.org/ - * Guides: https://hexdocs.pm/phoenix/overview.html - * Docs: https://hexdocs.pm/phoenix - * Forum: https://elixirforum.com/c/phoenix-forum - * Source: https://github.com/phoenixframework/phoenix +- Official website: https://www.phoenixframework.org/ +- Guides: https://hexdocs.pm/phoenix/overview.html +- Docs: https://hexdocs.pm/phoenix +- Forum: https://elixirforum.com/c/phoenix-forum +- Source: https://github.com/phoenixframework/phoenix diff --git a/elixir/apps/web/assets/js/app.js b/elixir/apps/web/assets/js/app.js index 303cd93e9..80ab6ac6a 100644 --- a/elixir/apps/web/assets/js/app.js +++ b/elixir/apps/web/assets/js/app.js @@ -1,42 +1,41 @@ -import '@fontsource/source-sans-3/200.css'; -import '@fontsource/source-sans-3/300.css'; -import '@fontsource/source-sans-3/400.css'; -import '@fontsource/source-sans-3/500.css'; -import '@fontsource/source-sans-3/600.css'; -import '@fontsource/source-sans-3/700.css'; -import '@fontsource/source-sans-3/800.css'; -import '@fontsource/source-sans-3/900.css'; +import "@fontsource/source-sans-3/200.css"; +import "@fontsource/source-sans-3/300.css"; +import "@fontsource/source-sans-3/400.css"; +import "@fontsource/source-sans-3/500.css"; +import "@fontsource/source-sans-3/600.css"; +import "@fontsource/source-sans-3/700.css"; +import "@fontsource/source-sans-3/800.css"; +import "@fontsource/source-sans-3/900.css"; -import '@fontsource/source-sans-3/200-italic.css'; -import '@fontsource/source-sans-3/300-italic.css'; -import '@fontsource/source-sans-3/400-italic.css'; -import '@fontsource/source-sans-3/500-italic.css'; -import '@fontsource/source-sans-3/600-italic.css'; -import '@fontsource/source-sans-3/700-italic.css'; -import '@fontsource/source-sans-3/800-italic.css'; -import '@fontsource/source-sans-3/900-italic.css'; +import "@fontsource/source-sans-3/200-italic.css"; +import "@fontsource/source-sans-3/300-italic.css"; +import "@fontsource/source-sans-3/400-italic.css"; +import "@fontsource/source-sans-3/500-italic.css"; +import "@fontsource/source-sans-3/600-italic.css"; +import "@fontsource/source-sans-3/700-italic.css"; +import "@fontsource/source-sans-3/800-italic.css"; +import "@fontsource/source-sans-3/900-italic.css"; // Import CSS generated by Tailwind compiler -import "../tmp/tailwind/app.css" +import "../tmp/tailwind/app.css"; // Include phoenix_html to handle method=PUT/DELETE in forms and buttons. -import "phoenix_html" +import "phoenix_html"; // Flowbite's Phoenix LiveView integration -import "flowbite/dist/flowbite.phoenix.js" +import "flowbite/dist/flowbite.phoenix.js"; // Establish Phoenix Socket and LiveView configuration. -import { Socket } from "phoenix" -import { LiveSocket } from "phoenix_live_view" -import topbar from "../vendor/topbar" -import Hooks from "./hooks" -import "./event_listeners" +import { Socket } from "phoenix"; +import { LiveSocket } from "phoenix_live_view"; +import topbar from "../vendor/topbar"; +import Hooks from "./hooks"; +import "./event_listeners"; // Read CSRF token from the meta tag and use it in the LiveSocket params let csrfToken = document .querySelector("meta[name='csrf-token']") - .getAttribute("content") - + .getAttribute("content"); let liveSocket = new LiveSocket("/live", Socket, { hooks: Hooks, @@ -45,25 +44,25 @@ let liveSocket = new LiveSocket("/live", Socket, { timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, locale: Intl.NumberFormat().resolvedOptions().locale, }, -}) +}); // Show progress bar on live navigation and form submits -topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" }) -window.addEventListener("phx:page-loading-start", (_info) => topbar.show(300)) -window.addEventListener("phx:page-loading-stop", (_info) => topbar.hide()) +topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" }); +window.addEventListener("phx:page-loading-start", (_info) => topbar.show(300)); +window.addEventListener("phx:page-loading-stop", (_info) => topbar.hide()); // connect if there are any LiveViews on the page -liveSocket.connect() +liveSocket.connect(); // expose liveSocket on window for web console debug logs and latency simulation: // >> liveSocket.enableDebug() // >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session // >> liveSocket.disableLatencySim() -window.liveSocket = liveSocket +window.liveSocket = liveSocket; window.addEventListener("phx:live_reload:attached", ({ detail: reloader }) => { // Enable server log streaming to client. // Disable with reloader.disableServerLogs() - reloader.enableServerLogs() - window.liveReloader = reloader -}) + reloader.enableServerLogs(); + window.liveReloader = reloader; +}); diff --git a/elixir/apps/web/assets/js/event_listeners.js b/elixir/apps/web/assets/js/event_listeners.js index 8cfcdc947..dbaf9640a 100644 --- a/elixir/apps/web/assets/js/event_listeners.js +++ b/elixir/apps/web/assets/js/event_listeners.js @@ -1,7 +1,7 @@ // Helper for copying text to the clipboard in a Phoenix-idiomatic way. window.addEventListener("phx:copy", (event) => { - let text = event.target.dataset.copy + let text = event.target.dataset.copy; navigator.clipboard.writeText(text).then(() => { // noop - }) -}) + }); +}); diff --git a/elixir/apps/web/assets/js/hooks.js b/elixir/apps/web/assets/js/hooks.js index e5121b4d8..583a5defd 100644 --- a/elixir/apps/web/assets/js/hooks.js +++ b/elixir/apps/web/assets/js/hooks.js @@ -114,16 +114,18 @@ Hooks.ConfirmDialog = { Hooks.Popover = { mounted() { const $triggerEl = this.el; - const $targetEl = document.getElementById($triggerEl.getAttribute('data-popover-target-id')); + const $targetEl = document.getElementById( + $triggerEl.getAttribute("data-popover-target-id") + ); const options = { - placement: 'top', - triggerType: 'hover', + placement: "top", + triggerType: "hover", offset: 5, }; new Popover($targetEl, $triggerEl, options); - } -} + }, +}; export default Hooks; diff --git a/elixir/apps/web/assets/tailwind.config.js b/elixir/apps/web/assets/tailwind.config.js index bf55dfb51..ded70ab6a 100644 --- a/elixir/apps/web/assets/tailwind.config.js +++ b/elixir/apps/web/assets/tailwind.config.js @@ -1,11 +1,11 @@ // See the Tailwind configuration guide for advanced usage // https://tailwindcss.com/docs/configuration -const plugin = require("tailwindcss/plugin") -const fs = require("fs") -const path = require("path") -const defaultTheme = require("tailwindcss/defaultTheme") -const colors = require('tailwindcss/colors') +const plugin = require("tailwindcss/plugin"); +const fs = require("fs"); +const path = require("path"); +const defaultTheme = require("tailwindcss/defaultTheme"); +const colors = require("tailwindcss/colors"); const firezoneColors = { // See our brand palette in Figma. @@ -40,7 +40,7 @@ const firezoneColors = { 900: "#160033", }, // neutral: chicago - "chicago": { + chicago: { 50: "#f6f6f6", 100: "#e7e7e7", 200: "#d1d1d1", @@ -62,7 +62,7 @@ module.exports = { "./node_modules/flowbite/**/*.js", "./js/**/*.js", "../lib/web.ex", - "../lib/web/**/*.*ex" + "../lib/web/**/*.*ex", ], theme: { fontFamily: { @@ -73,51 +73,72 @@ module.exports = { brand: "#FD4F00", primary: firezoneColors["heat-wave"], accent: firezoneColors["electric-violet"], - neutral: firezoneColors["chicago"] - } + neutral: firezoneColors["chicago"], + }, }, }, plugins: [ - require('flowbite/plugin')({ + require("flowbite/plugin")({ charts: true, }), require("@tailwindcss/forms"), - plugin(({ addVariant }) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])), - plugin(({ addVariant }) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])), - plugin(({ addVariant }) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])), + plugin(({ addVariant }) => + addVariant("phx-click-loading", [ + ".phx-click-loading&", + ".phx-click-loading &", + ]) + ), + plugin(({ addVariant }) => + addVariant("phx-submit-loading", [ + ".phx-submit-loading&", + ".phx-submit-loading &", + ]) + ), + plugin(({ addVariant }) => + addVariant("phx-change-loading", [ + ".phx-change-loading&", + ".phx-change-loading &", + ]) + ), // Embeds Hero Icons (https://heroicons.com) into your app.css bundle // See your `CoreComponents.icon/1` for more information. // plugin(function ({ matchComponents, theme }) { - let iconsDir = path.join(__dirname, "./vendor/heroicons/optimized") - let values = {} + let iconsDir = path.join(__dirname, "./vendor/heroicons/optimized"); + let values = {}; let icons = [ ["", "/24/outline"], ["-solid", "/24/solid"], - ["-mini", "/20/solid"] - ] + ["-mini", "/20/solid"], + ]; icons.forEach(([suffix, dir]) => { - fs.readdirSync(path.join(iconsDir, dir)).map(file => { - let name = path.basename(file, ".svg") + suffix - values[name] = { name, fullPath: path.join(iconsDir, dir, file) } - }) - }) - matchComponents({ - "hero": ({ name, fullPath }) => { - let content = fs.readFileSync(fullPath).toString().replace(/\r?\n|\r/g, "") - return { - [`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`, - "-webkit-mask": `var(--hero-${name})`, - "mask": `var(--hero-${name})`, - "background-color": "currentColor", - "vertical-align": "middle", - "display": "inline-block", - "width": theme("spacing.5"), - "height": theme("spacing.5") - } - } - }, { values }) - }) - ] -} + fs.readdirSync(path.join(iconsDir, dir)).map((file) => { + let name = path.basename(file, ".svg") + suffix; + values[name] = { name, fullPath: path.join(iconsDir, dir, file) }; + }); + }); + matchComponents( + { + hero: ({ name, fullPath }) => { + let content = fs + .readFileSync(fullPath) + .toString() + .replace(/\r?\n|\r/g, ""); + return { + [`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`, + "-webkit-mask": `var(--hero-${name})`, + mask: `var(--hero-${name})`, + "background-color": "currentColor", + "vertical-align": "middle", + display: "inline-block", + width: theme("spacing.5"), + height: theme("spacing.5"), + }; + }, + }, + { values } + ); + }), + ], +}; diff --git a/elixir/apps/web/assets/vendor/topbar.js b/elixir/apps/web/assets/vendor/topbar.js index 41957274d..273ad1587 100644 --- a/elixir/apps/web/assets/vendor/topbar.js +++ b/elixir/apps/web/assets/vendor/topbar.js @@ -101,7 +101,7 @@ if (delay) { if (delayTimerId) return; delayTimerId = setTimeout(() => topbar.show(), delay); - } else { + } else { showing = true; if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId); if (!canvas) createCanvas(); @@ -162,4 +162,4 @@ } else { this.topbar = topbar; } -}.call(this, window, document)); +}).call(this, window, document); diff --git a/elixir/apps/web/priv/static/site.webmanifest b/elixir/apps/web/priv/static/site.webmanifest index 175eb56e9..791e16ddb 100644 --- a/elixir/apps/web/priv/static/site.webmanifest +++ b/elixir/apps/web/priv/static/site.webmanifest @@ -1,19 +1,19 @@ { - "name": "Firezone", - "short_name": "Firezone", - "icons": [ - { - "src": "/images/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/images/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#331700", - "background_color": "#331700", - "display": "standalone" + "name": "Firezone", + "short_name": "Firezone", + "icons": [ + { + "src": "/images/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/images/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#331700", + "background_color": "#331700", + "display": "standalone" } diff --git a/rust/gui-client/README.md b/rust/gui-client/README.md index 7e31c04b7..1bfee728b 100644 --- a/rust/gui-client/README.md +++ b/rust/gui-client/README.md @@ -65,8 +65,6 @@ To do so, login to [the Azure portal](https://portal.azure.com) using your `@fir Try to access it via the following [deep-link](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/~/Credentials/appId/51da0daa-39dd-4890-9018-e02609efc9c8). If that doesn't work: - - - Go to the `Microsoft Entra ID` service - Click on `App Registrations` - Make sure the tab `All applications` is selected diff --git a/rust/gui-client/src-tauri/tauri.conf.json b/rust/gui-client/src-tauri/tauri.conf.json index 50ab9a71a..aebe051ca 100644 --- a/rust/gui-client/src-tauri/tauri.conf.json +++ b/rust/gui-client/src-tauri/tauri.conf.json @@ -15,20 +15,13 @@ } } }, - "targets": [ - "deb", - "msi" - ], + "targets": ["deb", "msi"], "windows": { "wix": { "bannerPath": "./win_files/banner.png", - "componentRefs": [ - "FirezoneClientIpcService" - ], + "componentRefs": ["FirezoneClientIpcService"], "dialogImagePath": "./win_files/install_dialog.png", - "fragmentPaths": [ - "./win_files/service.wxs" - ], + "fragmentPaths": ["./win_files/service.wxs"], "template": "./win_files/main.wxs" } }, diff --git a/rust/gui-client/src/about.html b/rust/gui-client/src/about.html index 9acf4d88e..96b4683fd 100644 --- a/rust/gui-client/src/about.html +++ b/rust/gui-client/src/about.html @@ -2,7 +2,7 @@
- +