style: Enforce code style across all supported languages using Prettier (#7322)

This ensure that we run prettier across all supported filetypes to check
for any formatting / style inconsistencies. Previously, it was only run
for files in the website/ directory using a deprecated pre-commit
plugin.

The benefit to keeping this in our pre-commit config is that devs can
optionally run these checks locally with `pre-commit run --config
.github/pre-commit-config.yaml`.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
Jamil
2024-11-12 16:19:15 -08:00
committed by GitHub
parent 3e18fa8ca2
commit 6f7f6a4f34
38 changed files with 279 additions and 282 deletions

View File

@@ -4,7 +4,7 @@ inputs:
node-version:
description: "Version of nodejs to install"
required: false
default: '20'
default: "20"
runs:
using: "composite"
steps:

View File

@@ -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

View File

@@ -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:

View File

@@ -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 }}

View File

@@ -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.

View File

@@ -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

View File

@@ -8,8 +8,8 @@ defaults:
working-directory: ./kotlin/android
permissions:
contents: 'read'
id-token: 'write'
contents: "read"
id-token: "write"
jobs:
static-analysis:

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"

12
.prettierignore Normal file
View File

@@ -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

View File

@@ -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}

View File

@@ -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).

View File

@@ -1,5 +1,3 @@
{
"skip_files": [
"test"
]
"skip_files": ["test"]
}

View File

@@ -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

View File

@@ -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;
});

View File

@@ -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
})
})
});
});

View File

@@ -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;

View File

@@ -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 }
);
}),
],
};

View File

@@ -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);

View File

@@ -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"
}

View File

@@ -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

View File

@@ -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"
}
},

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
<link rel="stylesheet" href="output.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>About Firezone</title>

View File

@@ -7,11 +7,10 @@ const gitVersionSpan = <HTMLSpanElement>document.getElementById("git-version");
function get_cargo_version() {
try {
invoke("get_cargo_version")
.then((cargoVersion: unknown) => {
cargoVersionSpan.innerText = cargoVersion as string;
});
} catch(e) {
invoke("get_cargo_version").then((cargoVersion: unknown) => {
cargoVersionSpan.innerText = cargoVersion as string;
});
} catch (e) {
cargoVersionSpan.innerText = "Unknown";
console.error(e);
}
@@ -19,14 +18,13 @@ function get_cargo_version() {
function get_git_version() {
try {
invoke("get_git_version")
.then((gitVersion: unknown) => {
gitVersionSpan.innerText = gitVersion as string;
});
} catch(e) {
invoke("get_git_version").then((gitVersion: unknown) => {
gitVersionSpan.innerText = gitVersion as string;
});
} catch (e) {
gitVersionSpan.innerText = "Unknown";
console.error(e);
};
}
}
document.addEventListener("DOMContentLoaded", () => {

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
<link rel="stylesheet" href="output.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Settings</title>

View File

@@ -85,7 +85,7 @@ async function applyAdvancedSettings() {
log_filter: logFilterInput.value,
},
});
} catch(e) {
} catch (e) {
console.error(e);
} finally {
unlockAdvancedSettingsForm();
@@ -97,11 +97,11 @@ async function resetAdvancedSettings() {
lockAdvancedSettingsForm();
try {
let settings = await invoke("reset_advanced_settings") as Settings;
let settings = (await invoke("reset_advanced_settings")) as Settings;
authBaseUrlInput.value = settings.auth_base_url;
apiUrlInput.value = settings.api_url;
logFilterInput.value = settings.log_filter;
} catch(e) {
} catch (e) {
console.error(e);
} finally {
unlockAdvancedSettingsForm();
@@ -113,11 +113,11 @@ async function getAdvancedSettings() {
lockAdvancedSettingsForm();
try {
let settings = await invoke("get_advanced_settings") as Settings;
let settings = (await invoke("get_advanced_settings")) as Settings;
authBaseUrlInput.value = settings.auth_base_url;
apiUrlInput.value = settings.api_url;
logFilterInput.value = settings.log_filter;
} catch(e) {
} catch (e) {
console.error(e);
} finally {
unlockAdvancedSettingsForm();
@@ -130,8 +130,8 @@ async function exportLogs() {
try {
await invoke("export_logs");
} catch(e) {
console.error(e);
} catch (e) {
console.error(e);
} finally {
unlockLogsForm();
}
@@ -143,25 +143,25 @@ async function clearLogs() {
try {
await invoke("clear_logs");
} catch(e) {
} catch (e) {
console.error(e);
} finally {
countLogs();
unlockLogsForm();
};
}
}
async function countLogs() {
try {
let fileCount = await invoke("count_logs") as FileCount;
let fileCount = (await invoke("count_logs")) as FileCount;
console.log(fileCount);
const megabytes = Math.round(fileCount.bytes / 100000) / 10;
logCountOutput.innerText = `${fileCount.files} files, ${megabytes} MB`;
} catch(e) {
} catch (e) {
let error = e as Error;
console.error(e);
logCountOutput.innerText = `Error counting logs: ${error.message}`;
};
}
}
// Setup event listeners

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
<link rel="stylesheet" href="output.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to Firezone</title>

View File

@@ -1,8 +1,6 @@
import { invoke } from "@tauri-apps/api/core";
const signInBtn = <HTMLButtonElement>(
document.getElementById("sign-in")
);
const signInBtn = <HTMLButtonElement>document.getElementById("sign-in");
signInBtn.addEventListener("click", async (_e) => {
console.log("Signing in...");

View File

@@ -1,5 +1,5 @@
import { defineConfig } from "vite";
import { resolve } from 'path';
import { resolve } from "path";
// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;
@@ -12,8 +12,8 @@ export default defineConfig(async () => ({
about: resolve(__dirname, "src/about.html"),
settings: resolve(__dirname, "src/settings.html"),
welcome: resolve(__dirname, "src/welcome.html"),
}
}
},
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`

View File

@@ -3,6 +3,7 @@
This crate acts as the CLI / headless Client, and the privileged tunnel service for the GUI Client, for both Linux and Windows.
It is built as:
- `headless-client` to act as the Linux / Windows headless Client
- `firezone-headless-client` to act as the Linux tunnel service, Windows headless Client, or Windows tunnel service
@@ -38,7 +39,6 @@ capability to open `/dev/net/tun`. You can add this to the client binary with:
sudo setcap 'cap_net_admin+eip' /path/to/firezone-headless-client
```
## Building
Assuming you have Rust installed, you can build the headless Client with:

View File

@@ -222,7 +222,7 @@ runcmd:
- sudo apt update -y
- sudo apt install -y apt-transport-https ca-certificates curl software-properties-common iperf3
- sudo install -m 0755 -d /etc/apt/keyrings
- 'sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc'
- "sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc"
- sudo chmod a+r /etc/apt/keyrings/docker.asc
- 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null'
- sudo apt-get update
@@ -235,6 +235,6 @@ runcmd:
- 'sudo apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install google-cloud-ops-agent'
- sudo docker pull ${client_container_image}
- sudo docker create --name fz-client ${client_container_image}
- 'sudo docker cp fz-client:/bin/firezone-headless-client /usr/local/bin/firezone-headless-client'
- "sudo docker cp fz-client:/bin/firezone-headless-client /usr/local/bin/firezone-headless-client"
- sudo docker rm -v fz-client
- sudo systemctl enable --now firezone.service

View File

@@ -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"
}

View File

@@ -12,7 +12,7 @@ export default function Gateway() {
<Entries href={href} arches={arches} title="Gateway">
<Unreleased>
<ChangeItem pull="7263">
Mitigates a crash in case the maximum packet size is not respected.
Mitigates a crash in case the maximum packet size is not respected.
</ChangeItem>
</Unreleased>
<Entry version="1.4.0" date={new Date("2024-11-04")}>