commit 650807c1fb01ebd2a31cbab1ef13e684f9f52dd9 Author: fristyxd Date: Tue Nov 10 10:42:39 2026 +0300 chore: restart the repository with a clean history Squash the tree into one commit, drop docs/architecture.html, reset the version line to 0.3.0, consolidate the changelog, enable Renovate automerge for non-major updates and add AGENTS.md. diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f0309d7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +node_modules/ +client/node_modules/ +client/dist/ +data/ +cli/ +docs/ +.github/ +.git/ +.idea/ +.vscode/ +config.yml +.env +*.md +!README.md diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..237488a --- /dev/null +++ b/.env.example @@ -0,0 +1,7 @@ +FRISLIT_LISTEN=0.0.0.0 +FRISLIT_PORT=8080 +FRISLIT_BASE_DOMAIN=frislit.example.com +FRISLIT_PUBLIC_URL=https://frislit.example.com +FRISLIT_TRUST_PROXY=true +FRISLIT_HTTP_MODE=subdomain +FRISLIT_GRACE_PERIOD=30 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3fa917b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +* text=auto + +*.sh text eol=lf +packaging/install/install text eol=lf +packaging/nfpm-*.yaml text eol=lf +*.service text eol=lf +*.desktop text eol=lf +packaging/docker-entrypoint.sh text eol=lf diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..2fe94f8 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,150 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + server: + name: Server + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v7 + + - name: Cache npm + uses: actions/cache@v6 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json', 'client/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install server dependencies + run: npm ci --no-audit --no-fund + + - name: Build the web interface + run: | + npm ci --no-audit --no-fund --prefix client + npm run build --prefix client + + - name: Lint the web interface + run: npm run lint --prefix client + + - name: Test the server + run: npm test + + cli: + name: CLI + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v7 + + - name: Cache cargo + uses: actions/cache@v6 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + cli/target + key: ${{ runner.os }}-cargo-check-${{ hashFiles('cli/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-check- + + - name: Check the CLI + run: cargo check --manifest-path cli/Cargo.toml + + cli-windows: + name: CLI (windows) + runs-on: windows-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v7 + + - name: Install Rust + shell: powershell + run: | + if (Get-Command rustup -ErrorAction SilentlyContinue) { + rustup show active-toolchain + } else { + Invoke-WebRequest https://win.rustup.rs/x86_64 -OutFile rustup-init.exe -UseBasicParsing + ./rustup-init.exe -y --default-toolchain stable --profile minimal + "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Append + } + + - name: Report the toolchain + shell: powershell + run: | + rustc --version + cargo --version + dotnet --version 2>$null + if (Get-Command wix -ErrorAction SilentlyContinue) { wix --version } + + - name: Put Git Bash on PATH + shell: powershell + run: | + "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Append + "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Append + + - name: Check that bash works + shell: bash + run: | + bash --version | head -1 + sed --version | head -1 + echo "bash-and-sed-ok" + + - name: Check the CLI on Windows + shell: powershell + run: cargo check --manifest-path cli/Cargo.toml + + docker: + name: Docker image + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v7 + + - name: Build the image + run: docker build -t frislit:ci . + + - name: Scan the image + run: | + trivy image --quiet --format json --severity HIGH,CRITICAL --ignore-unfixed \ + --output report.json frislit:ci + + jq -r '.Results[]?.Vulnerabilities[]? | "\(.Severity) \(.VulnerabilityID) \(.PkgName) \(.InstalledVersion)"' report.json \ + | sort | uniq -c | sort -rn | head -40 + + high=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "HIGH")] | length' report.json) + critical=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "CRITICAL")] | length' report.json) + echo "HIGH=$high CRITICAL=$critical (unfixed findings ignored)" + + if [ "$critical" -gt 0 ]; then + echo "::error::The image has $critical CRITICAL vulnerabilities" + exit 1 + fi + + cli-arm64: + name: CLI (linux-arm64, static) + runs-on: ubuntu-latest + timeout-minutes: 45 + continue-on-error: true + steps: + - uses: actions/checkout@v7 + + - name: Cache cargo + uses: actions/cache@v6 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + cli/target + key: ${{ runner.os }}-cargo-arm64-${{ hashFiles('cli/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-arm64- + + - name: Cross-compile for arm64 + working-directory: cli + run: cargo zigbuild --release --target aarch64-unknown-linux-musl --no-default-features diff --git a/.gitea/workflows/dev-image.yml b/.gitea/workflows/dev-image.yml new file mode 100644 index 0000000..5f114f3 --- /dev/null +++ b/.gitea/workflows/dev-image.yml @@ -0,0 +1,47 @@ +name: Development image + +on: + push: + branches: [main] + paths-ignore: + - "docs/**" + - "**.md" + workflow_dispatch: + +env: + REGISTRY: git.fristy.net + +jobs: + development: + name: Development image + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: read + packages: write + if: "!startsWith(github.event.head_commit.message, 'Release ')" + + steps: + - uses: actions/checkout@v7 + + - name: Name this build + id: build + run: echo "version=0.0.0-dev.$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + + - name: Log in to the registry + run: | + token="${{ secrets.REGISTRY_TOKEN }}" + [ -n "$token" ] || token="${{ secrets.GITEA_TOKEN }}" + echo "$token" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin + + - name: Build and push + uses: docker/build-push-action@v7 + with: + context: . + push: true + platforms: linux/amd64 + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:buildcache,mode=max + build-args: | + VERSION=${{ steps.build.outputs.version }} + tags: ${{ env.REGISTRY }}/${{ github.repository }}:development diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..6e69dd2 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,406 @@ +name: Release + +on: + push: + tags: ["v*"] + +env: + REGISTRY: git.fristy.net + API: https://git.fristy.net/api/v1/repos/fristy/frislit + +jobs: + prepare: + name: Prepare release + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: write + outputs: + version: ${{ steps.version.outputs.version }} + semver: ${{ steps.version.outputs.semver }} + steps: + - uses: actions/checkout@v7 + + - name: Read the version from the tag + id: version + run: | + VERSION="${GITHUB_REF_NAME#v}" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "semver=${VERSION%%-*}" >> "$GITHUB_OUTPUT" + + - name: Open a draft release + env: + TOKEN: ${{ secrets.GITEA_TOKEN }} + VERSION: ${{ steps.version.outputs.version }} + run: | + body=$(cat < /dev/null + echo "release ${GITHUB_REF_NAME} published" diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..e3cc15e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,55 @@ +name: 🐛 Report a Bug +description: Report a bug or issue in frislit +title: "[Bug] " +labels: ["bug"] +body: + - type: checkboxes + attributes: + label: General + description: Please confirm the following statements + options: + - label: I have updated to the latest version of frislit. + required: true + - label: My bug has not been reported yet. + required: true + - type: textarea + attributes: + label: The Bug + description: Describe the bug/issue in detail. If possible, include screenshots and provide steps to reproduce the error. + placeholder: An error occurs when ... + validations: + required: true + - type: dropdown + id: component + attributes: + label: Where does the problem show up? + multiple: true + options: + - In the web UI + - In the CLI + - In a tunnel that is being forwarded + validations: + required: true + - type: dropdown + id: mode + attributes: + label: Which forwarding mode is the server running? + multiple: true + options: + - Subdomain + - Path + - Direct TCP/UDP + - Not sure + validations: + required: true + - type: dropdown + id: server + attributes: + label: Which operating system is your frislit server running on? + multiple: true + options: + - Linux + - Windows + - macOS + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..aadb3c3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,21 @@ +name: 💡 Suggest idea +description: Do you have an idea? You're in the right place +title: "[Feature] " +labels: ["enhancement"] +body: + - type: checkboxes + attributes: + label: General + description: Please confirm the following statements + options: + - label: My feature does not exist in the latest version of frislit. + required: true + - label: I have checked that my feature has not been suggested by anyone else. + required: true + - type: textarea + attributes: + label: Your Idea + description: What can we add? Describe your idea as precisely as possible. + placeholder: My idea would be to ... + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..71d395b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,22 @@ +## 📋 Description + + + +## 🚀 Changes made to ... + +- [ ] 🔧 Server +- [ ] 🖥️ Client +- [ ] ⌨️ CLI +- [ ] 📚 Documentation +- [ ] 🔄 Other: ___ + +## ✅ Checklist + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have tested my changes locally +- [ ] I have looked for similar pull requests in the repository and found none + +## 🔗 Related Issues + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61bdc7f --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Dependencies +node_modules/ +client/node_modules/ + +# Client build +client/dist/ + +# Runtime +config.yml +.env +*.log +data/ + +# Docs +docs/.vitepress/dist +docs/.vitepress/cache + +# CLI +cli/target/ + +build/ +dist/ +stage/ + +# IDEs +.idea/ +.vscode/ +.DS_Store diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..d8353e5 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,22 @@ +# AGENTS.md + +Instructions for AI agents working on frislit. The human-facing guide is +[CONTRIBUTING.md](CONTRIBUTING.md); its branch, commit, versioning, changelog and test rules are +binding for agents too. This file only adds what is specific to working on the code as an agent. + +## Project + +frislit is a self-hosted tunnel server and CLI, forked from [tunlit](https://github.com/gnmyt/tunlit) +and not an official tunlit distribution. The server is one Node process with SQLite state; the CLI +is a Rust binary under `cli/`. + +Public repository: + +## Rules + +- Read the code and the surrounding conventions before editing, then run the checks listed in + CONTRIBUTING.md before claiming a change works. +- Never commit secrets or credentials. +- Read [SECURITY.md](SECURITY.md) before changing anything that touches auth, TLS or forwarding, and + never report a vulnerability in a public issue. +- Change only what the task asks for; do not add unrequested features, options or dependencies. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..65b7308 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,105 @@ +# Changelog + +All notable changes to this project are documented in this file. + +The format is based on [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.3.0] - 2026-11-10 + +First release of the frislit line, based on tunlit v0.2.5 plus 61 upstream commits (dependency +bumps only). The repository history was restarted, so every change that shipped before the restart +is listed here under one version; the version line continues from here. + +### Added + +- CHANGELOG in Keep a Changelog 1.1.0 format and a SemVer versioning policy. +- README fork notice: frislit is an unofficial fork of tunlit and not an official distribution. +- Linux arm64 (aarch64) artifacts: a static headless CLI, `frislit-cli-arm64.deb` / + `frislit-cli-aarch64.rpm` and a multi-arch container image (`linux/amd64`, `linux/arm64`). +- PROXY protocol v2 support: when a proxy passes the client address in the PROXY header, frislit + uses it for the visitor list, IP rules and forwarded headers. Direct connections are detected and + untouched. +- Unit tests for the PROXY protocol parser and the TLS front (`npm test`), run in CI. +- Per-tunnel forwarding style: `frislit http --mode path|subdomain` (and `frislit serve --mode`) + overrides the server's forwarding setting for one tunnel. Without the flag the server default is + used, so existing behaviour is unchanged. +- Subdomain tunnels are rejected with a clear error when the server manages TLS but has no wildcard + certificate, instead of producing a URL that cannot serve HTTPS. +- The tunnel page shows the forwarding style as a badge and lets you switch between path and + subdomain while the tunnel runs. Persistent tunnels remember the choice, and the CLI falls back to + it when `--mode` is not passed. +- Account allowlist for tunnels protected by a frislit account: pick accounts under Access → + Sign-in. No selection means any account, and the tunnel owner is always allowed. The allowlist + also applies to `curl -u` access. +- A data directory served by tunlit is adopted on startup: `tunlit.db` (with its `-wal`/`-shm` + files) is renamed to `frislit.db`, or used in place if it cannot be renamed. +- The `TUNLIT_*` environment variables (`TUNLIT_BASE_DOMAIN`, `TUNLIT_DATA_DIR`, …) are still + honoured as a deprecated fallback next to their `FRISLIT_*` replacements, and log a warning. + +### Changed + +- **Renamed the project to frislit.** CLI binary and crate are `frislit`; the Windows service/task, + systemd unit and installer package are `frislit`; deep links use `frislit://`. +- Environment variables are now prefixed `FRISLIT_` (was `TUNLIT_`), config and data live under + `%APPDATA%\frislit` / `~/.config/frislit`, and the container image is `fristy/frislit`. +- Documentation links point at the files in this repository; the upstream docs site and landing page + are not published by this fork. +- The runtime image no longer contains npm, npx or corepack; they are only needed while building. + This removes ten HIGH findings that came from the npm dependencies bundled in the base image + (pacote, ip-address, brace-expansion, sigstore, picomatch) and shrinks the image. +- Dependencies refreshed: Node 26 base image, `uuid` 14, `@simplewebauthn/server` 14.1, + `lucide-react` 1.71, `sass-embedded` 1.108, `vite` 8.3.7, `@vitejs/plugin-react` 6.3, + `mmdb-lib` 3.0.5, `ws` 8.22.2, `concurrently` 10.0.7, `bufferutil` 4.2, the `ksni` crate 0.3.7, + the `global-hotkey` crate 0.10 and the `rfd` crate 0.18. +- CI now caches npm and cargo artifacts, so dependency changes rebuild much faster. The cargo check + and release caches use separate namespaces so a release build cannot reuse `cargo check` output. +- The publish pipeline runs on the current major of the official GitHub and Docker actions + (checkout/setup-node v7, cache v6, qemu/buildx v4, build-push v7). +- The Docker jobs use the buildx plugin that the runner image already ships instead of calling + `docker/setup-buildx-action` on every run. The multi-platform release image builds on the daemon's + containerd snapshotter; `docker/setup-qemu-action` stays, the arm64 half still needs binfmt. +- The account allowlist on the tunnel page is a multi-select dropdown, styled like the other selects + instead of a checkbox list. +- The three access cards on the tunnel page share the same height. +- The footer credits the original author and the fork: "Made with ♥ by GNM | forked by fristy", and + the wordmark in the top bar and the CLI header reads frislit again (both were split into two + spans, so the rename missed them). + +### Fixed + +- Behind a reverse proxy the HTTP to HTTPS redirect pointed at frislit's internal HTTPS port + (`:8443`) instead of the port in `publicUrl`. +- Renewal could fail because the DNS-01 challenge was handed to the CA before the TXT record was + resolvable; it now waits up to two minutes. +- The container could not open `/app/data/frislit.db` (`SQLITE_CANTOPEN`) when the data volume or + bind mount was created by an older, root-running image. The image now starts as root, takes + ownership of `/app/data` and drops to the `node` user through a small entrypoint. +- `frislit service install` on Windows registered a task that Windows refused to run: the quoted + binary path ended up inside the task's `` element. The task is now registered through the + ScheduledTasks PowerShell module, with battery restrictions disabled and no execution time limit. +- A tunnel protected by a password or a frislit account no longer opens the browser's basic auth + dialog on its own. Firefox shows that dialog for any 401 that carries a `WWW-Authenticate` header, + including XHR, fetch and subresource requests from a tab left open in the background, so the + prompt appeared over whatever tab was active once the tunnel's access cookie expired or the server + restarted. Browsers now get a plain 401, and the gate page on a navigation; `curl -u` still gets + the challenge. + +### Security + +- Pinned the container base image to `node:22-alpine3.24` and the container now runs as the + unprivileged `node` user instead of root. +- Updated `node-forge` to 1.4.3, which fixes five HIGH advisories in the ACME certificate client + (CVE-2026-119190, CVE-2026-119188, CVE-2026-119187, CVE-2026-118782, CVE-2026-118779). +- Added npm overrides: `follow-redirects` 1.16.1, `undici` 6.29.1, `uuid` 11.1.1 + (CVE-2026-111755, CVE-2026-111756, CVE-2026-109869, CVE-2026-109924, CVE-2026-41907). + +### Removed + +- Upstream-only release plumbing references in the README (badges, Buildkite apt repository, + release MSI links) and the marketing landing page assets from the documented install flow. + +[Unreleased]: https://git.fristy.net/fristy/frislit/commits/branch/main +[0.3.0]: https://git.fristy.net/fristy/frislit/releases diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..463822e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +iletisim@fristy.dev. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d0ddbcf --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,61 @@ +# Contributing to frislit + +Thanks for helping. This guide covers the conventions every contribution follows. + +## Before you start + +- Bugs and feature ideas: open an issue with the frislit version, the forwarding mode (path, + subdomain, direct TCP/UDP), whether a reverse proxy terminates TLS, and the steps to reproduce. +- Security problems: do not open a public issue. Follow [SECURITY.md](SECURITY.md). +- By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md). + +## Development + +Prerequisites: Node.js 26+ and a stable Rust toolchain for the CLI. + +```sh +npm install +npm test # server tests +npm run dev # server + web client +cargo check --manifest-path cli/Cargo.toml # CLI +``` + +The documentation site builds with `npm run docs:build`. + +## Branches + +Use Conventional Branch 1.1.0: `/`, with a lowercase, hyphen-separated +description. Examples: `feat/tunnel-badges`, `fix/proxy-redirect`, `docs/install-notes`. + +Types: `feat`, `fix`, `hotfix`, `chore`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, +`release`, `revert`. + +Changes reach `main` through a pull request, and CI must be green before it can merge. + +## Commits + +Use a conventional summary, `type(scope): summary` (for example +`fix(gate): stop challenging browser requests`). The whole commit message stays at or under 300 +characters; put the reason in the body, not a paragraph of history. + +## Versioning + +frislit follows Semantic Versioning 2.0.0: versions are `MAJOR.MINOR.PATCH` and releases are tagged +`vX.Y.Z`. Do not change the version in a contribution; version bumps belong to a release. + +## Changelog + +Every user-visible change gets an entry under `[Unreleased]` in [CHANGELOG.md](CHANGELOG.md), in the +matching Keep a Changelog 1.1.0 category: `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, +`Security`. Write for the person running frislit. + +## Pull requests + +- One concern per pull request, with the test that covers the change. +- Keep CI green: it runs the server tests, `cargo check` on Linux and Windows, and a container + build. +- Link the issue the change closes, or explain in the description why there is none. + +## Conduct + +Participation is covered by [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4606631 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,55 @@ +FROM node:26-alpine3.24 AS client-builder + +WORKDIR /app/client + +COPY client/package.json client/package-lock.json ./ +RUN for i in 1 2 3; do npm ci --no-audit --no-fund && break || sleep 15; done + +COPY client/ . +RUN npm run build + + +FROM node:26-alpine3.24 AS server-builder + +WORKDIR /app + +RUN apk add --no-cache python3 make g++ + +COPY package.json package-lock.json ./ +RUN for i in 1 2 3; do npm ci --omit=dev --no-audit --no-fund && break || sleep 15; done + + +FROM node:26-alpine3.24 + +ARG VERSION +WORKDIR /app + +COPY package.json ./ +RUN if [ -n "$VERSION" ]; then \ + apk add --no-cache jq && jq --arg v "$VERSION" '.version = $v' package.json > tmp.json && mv tmp.json package.json; \ + fi + +COPY --from=server-builder /app/node_modules ./node_modules +COPY server/ server/ +COPY --from=client-builder /app/client/dist ./client/dist + +ENV NODE_ENV=production \ + FRISLIT_LISTEN=0.0.0.0 \ + FRISLIT_PORT=8080 \ + FRISLIT_CONFIG=/app/data/config.yml \ + FRISLIT_DATA_DIR=/app/data + +RUN apk add --no-cache su-exec \ + && mkdir -p /app/data \ + && chown -R node:node /app \ + && rm -rf /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/corepack \ + /usr/local/bin/npm /usr/local/bin/npx /usr/local/bin/corepack + +COPY packaging/docker-entrypoint.sh /usr/local/bin/frislit-entrypoint +RUN chmod +x /usr/local/bin/frislit-entrypoint + +VOLUME ["/app/data"] +EXPOSE 8080 80 443 + +ENTRYPOINT ["/usr/local/bin/frislit-entrypoint"] +CMD ["node", "server/index.js"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f9fdc7e --- /dev/null +++ b/LICENSE @@ -0,0 +1,25 @@ +frislit is a fork of tunlit (https://github.com/gnmyt/tunlit). +Original work: Copyright (c) 2026 Mathias Wagner, MIT. +Modifications and new code: Copyright (c) 2026 the frislit contributors, MIT. + +MIT License + +Copyright (c) 2026 Mathias Wagner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..768c143 --- /dev/null +++ b/README.md @@ -0,0 +1,86 @@ +

frislit

+ +

+ frislit is a self-hosted alternative to ngrok.
+ Expose a local port to the internet on your own server, and share it with whoever needs it. +

+ +> **frislit is an unofficial fork of [tunlit](https://github.com/gnmyt/tunlit).** +> It is not affiliated with, endorsed by, or supported by the upstream project or its author. +> See [License](#license) for attribution. + +## What it does + +- **HTTP tunnels** with a public URL, either `https://.example.com` or `https://example.com/@` +- **TCP and UDP tunnels** for anything that is not HTTP, like a database or a game server +- **Share a port** with someone who has no account: they get a link, the port appears on their machine +- **Live traffic** per tunnel, with request and response bodies you can read, edit and replay in the browser +- **Breakpoints** that hold a request or response until you continue, edit or drop it +- **Visitors** grouped by address with country, network, request and blocked counts +- **IP intelligence** for every visitor: country, network, Tor, VPN and datacenter flags, all looked up offline +- **Bad network on demand**: add latency, jitter, a bandwidth cap or packet loss to any tunnel to see how your app copes +- **Persistent names** that stay yours, with your own domains on top +- **Route by path**: `/api` to one port, `/docs` to a folder, the rest to your app, all on one tunnel +- **Protect a tunnel** with a password, a frislit account, or allow and block rules by address, country, Tor, VPN and datacenter +- **Accounts** for your team, with TOTP, passkeys and OIDC single sign-on +- **HTTPS** either behind your own proxy or with certificates frislit gets from Let's Encrypt itself + +## Build the server + +```sh +git clone https://git.fristy.net/fristy/frislit.git +cd frislit +docker build -t fristy/frislit:latest . +docker run -d \ + --name frislit \ + --restart always \ + -p 127.0.0.1:8080:8080 \ + -v frislit-data:/app/data \ + -e FRISLIT_BASE_DOMAIN=frislit.example.com \ + -e FRISLIT_PUBLIC_URL=https://frislit.example.com \ + -e FRISLIT_TRUST_PROXY=true \ + fristy/frislit:latest +``` + +Open `https://frislit.example.com/@frislit` and the setup wizard takes it from there. + +## Build the CLI + +```sh +cargo build --release --manifest-path cli/Cargo.toml +# binary: cli/target/release/frislit +``` + +Platform packages are built on release: `deb`, `rpm` and the Windows `MSI`, plus a static headless +build for linux-arm64. The container image is `fristy/frislit` (`linux/amd64`, `linux/arm64`). + +## Use it + +```sh +frislit login # link this machine to your server, once +frislit http 3000 # share a local port +frislit http ./dist # or a folder, with a built-in file server +frislit tcp 5432 # share a database, or anything else that is not HTTP +``` + +Each tunnel has its access rules and live throughput on one page. A `frislit tcp` tunnel gets a share code; +whoever you send it to opens the link and gets the port on their own machine, without an account. + +## Documentation + +- [Installation](docs/installation.md) +- [Configuration](docs/configuration.md) +- [HTTPS](docs/https.md) +- [Reverse proxy](docs/reverse-proxy.md) +- [CLI](docs/cli.md) +- [Running as a service](docs/service.md) + +## Changelog + +See [CHANGELOG.md](CHANGELOG.md). This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html) +and [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). + +## License + +MIT — see [LICENSE](LICENSE). frislit is derived from tunlit, © 2026 Mathias Wagner (MIT); +modifications and new code are © 2026 the frislit contributors. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..1fc7b59 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,112 @@ +# Security Policy + +frislit is a self-hosted tunnel server and CLI. Reports about its security are welcome and taken +seriously. + +## Supported versions + +Only the latest release gets security fixes; there are no long-term support branches. A report must +reproduce on a supported version. Reports that only affect an older release are closed as out of +scope, and `main` is the development line, not a supported release. + +## Reporting a vulnerability + +Do not open a public issue. Send the report to and include: + +- what an attacker gains and who is affected; +- the forwarding mode the server runs in (path, subdomain, direct TCP/UDP) and whether a reverse + proxy terminates TLS; +- the smallest set of steps that shows the problem, with the frislit version, the relevant config + (redact secrets) and logs; +- sample code, screenshots or recordings if they help. + +Encrypt the report with the GPG key below if you prefer. + +Please keep the report private until a fix is released, and give us time to investigate. If the +report turns out to be a duplicate you will be credited in the original report. + +Do not test against servers you do not own, do not read or change data that is not yours, and do +not run denial-of-service, spam or social-engineering campaigns. + +## What frislit assumes + +A frislit server is meant to sit behind a reverse proxy that terminates TLS. Two consequences: + +- `trustProxy` decides whether `X-Forwarded-For`, `X-Forwarded-Proto` and `X-Forwarded-Host` are + believed. Turn it on only when nothing but your proxy can reach the port, because the per-tunnel + IP allowlist and the login rate limit both rest on the client address. +- Everyone who can reach a tunnel's URL can reach whatever it forwards. Per-tunnel passwords and IP + rules narrow that down; they do not replace authentication in the application behind the tunnel. + +## Our commitment + +We aim to acknowledge a report within a few days and keep you informed while a fix is prepared. We +will credit reporters in the release notes unless you ask us not to. + +## PGP public key + +Use this key to encrypt the mail body. It is valid until 2028-10-18. + +``` +Key ID: 111D9D904C11D2A2 +Type: RSA 4096 +Expires: 2028-10-18 +Fingerprint: 859C DA3B ACA7 CAD6 C997 B5B6 111D 9D90 4C11 D2A2 +User ID: fristy security +``` + +``` +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGrWUBEBEADlEoZPUpxzsmTgbc001VvqfqiYmwIBP3l5Urj56klnxpLpfrlz +PYfyFUHotqpZWOVDZ3Oa++2I0pTaGt6ZfNQkeng+7uNHISwS4zspxPxxl1mw/52X +r46ZGp4volGsG0frkaWcdBL1BKmJiOoo4fbCFgRdObw8ooMLtIoUmhQUjUoXMI0z +N7BtR3GYM9JSTzTJvBOXtf1yNue1KtDYD+vKlv7GFaavgHj2sp1SgEjoUkwA8OfG +RmbuKmyTRVvfpwK1nYbKSrwm+X3gsivL2rFKfwr/WnHalei2yxAXuO8jbOhciPnj +MTsLdY5VwOePb5DKMsYev9N1KMNgktTBg+mluumypZmrNu6MIh69Iw12sUgBMoFZ +hnpHqSlLzP55DSP6WB//8MIlRxb8nsUSP2lKlkJIFUip1+lndT5hq+xnEI4zV70q +4sK0uHJR44SSxrY5i1emBsdjxEJsW49mUNd1YUniFn4vVEWJsVIjfK8MpInBe6EB +7hnWZCN5DA+K19Uk8TYW+vEjHUA9vO8nWXQ5bRMgscCWCCcT6S2xXqJGJNlIaLT0 +pL6wB/6IM9oOOEHVrJkkuKZW1gdkpyN3SDNRoiTEjf8aE6ylHasCmMBpjICGpPLh +PW3VkHwHncCWtW4vG9kqam1xptOnFSfSYdp3lZl0HfBlDET5EH/APO9CZQARAQAB +tCVmcmlzdHkgc2VjdXJpdHkgPHNlY3VyaXR5QGZyaXN0eS5kZXY+iQJzBBMBCABd +FiEEhZzaO6ynytbJl7W2ER2dkEwR0qIFAmrWUBEbFIAAAAAABAAObWFudTIsMi41 +KzEuMTIsMiwxAhsDBQkDwmcABQsJCAcCAiICBhUKCQgLAgQWAgMBAh4HAheAAAoJ +EBEdnZBMEdKibt8P/RwxTy56xA39Mhnakln9B92Qq5Tw3nS2+GK4IlcFf15Fh4bN +b/UO2ufpL08fIEqfjvD56VjkprrT2+Wnj6w7YOiYUJP13AArFRnMQF8akXdwfkJO +9hrK7L35Clj9Q1ZxHHI1nSm+TjMPeVXiExtpa1Cr+kqbDAehmBkrkvqouwzf264y +OEV2GwF/C4BiEh/wBRevLDuuJCp75Gi3oFeSk8eWk2mVri3ndE0uYbEODcUShYBT +qWSGuYWfEqawz+pho8eJjXET/r/qvXE+AwxX+nlQNjvAflLDY6brCU6LU5YL8pPt +k/hgKp0JBs0NkOM8/wg19WGskpg/2J/1W9D/9b3TEmgEfQFi6rBL49U9S86TXigR +vLgCfcIkCvU4KcUo0Uwtgx/Zh7r12H7GhjFYV/DcnIIEzwi0SfHTvpVMD8AJZwtl +9K39alwtfd0W1ABSIUoZb7un+ee60MzwXJ2rzuTeUSJBwS2ReMNlqMbPmBvLxnMw +UP4LnFYIThR/7d7gYpCrxOpJLrlah5EXxkIw9QcNo79Je8qz1NNo7ANjcHFoyp2p +NZqtdYYpn3uQt4FVyfg+VkAnYC3ReGtcMOUmokxpdRAYHKjj+h0faSzEuFIFfhj1 +0jI1DRWICM+hTvPwUf9LPlRBVLAzK4eLzkfp3AR2BjU2+XcrfBDH0TEoHSZMuQIN +BGrWUCgBEADkgE06eLhiCoosbwMOZnIls987RynYrw96axE6mnu3MmyDusIn2owz +LVVvry8dAtT1d3m6d5hkTlqX6nDOzyV09iyhCuV4bIyNf6tzp6KFQ6yfceTvAqDG +8Zsz4ls/PN32aN6L38WT3irwxXG0fe/VN/48gkddNzf4/gowSNRHmft+Toa+b4VN +78fmvqR4qNKY2Oiur4ScASQ6+lt5W0h6I8lrPMsDF4jUOAG4zJnFRfailbBipbxA +zHwQsh6Rfup6UINujZnUg24XyoCuAATiucCI9ztt9bpx6gtz/4vZh4iR7ccMmZ37 +TZOl0ecO2sxS5llyRdZVf5bz/Jt+AzBqcigDVW+ULCfIWgwwki8D+wAE8zO28w6d +0BWJsn4jIQ/H//lUw+eHU5YzPAOB9OjS7P+OUKOb5qAC60VxEF3HsFLaJxLfkfHz +fKqRdhQpojuAe9w9Mhq3rr3nQTmdp7wV7tpDQmOl1ORkn8ug8LMCkNXLsKKotbFO +CRAV2DW/m3xq2zFXu4EZ14TU+AJRhf44NvPrLNIHabrRd2gncO6qc96EE7Taoe61 +D1VKNz0lWgCT36/4uVDsoJY2BAqEj0NBKfcN3MP18BwfO3t6q4IirAFVaOyo46jP +IDcWHZbpp828CoE2EhuR/dlD4bgxWw0KflU6XTFryC5eQ5SPoFyEqwARAQABiQJY +BBgBCABCFiEEhZzaO6ynytbJl7W2ER2dkEwR0qIFAmrWUCgbFIAAAAAABAAObWFu +dTIsMi41KzEuMTIsMiwxAhsMBQkDwmcAAAoJEBEdnZBMEdKipWgQAMdJvCJPLMX6 +Vl6A5aaNFrQTw+r6oztPhyPwFHiV6QpTCzpBuxdkHrUcYJoPDOj57/wZfVL6A95V +04DOc+SFdsgWeKiw0h93zJDKSkYYMvYlbaHgs7C7bC1kq8NBGiPx2DgWvWGgBKXq +bBYeX60F+GaVk7BxUvVwZFTHWB4R8BbLU94LNFzoyfNarw4Eton2iN1yRSo0x4RQ +X7C+Damg18rzL7hg1sMs1Mh7za3q6hULx+xSjh6BuKpzzkCleHumkqAB31caIs5g +Vyj0yS/zyxMCBSdbtyMnMpfqGBh/BvUQoibrrscTSttT3d2HBGtJGXjWMWVfvQqx +mJkFywfKp51/m57SaY3yxYcvucMNe4ONkkimfB5ZwB4iyTly1hwOVdu8siDEaDb+ +2IpBNjwK7Yjqa0p4ICygHqueJCt5VzXtAcbNiHP80MQhHbI5rfhMzJTjDA/iV5Me +09TEF7nhvbLye251GXomPY+0Nq0vBQA85+oqz6+q+Ukn3zA67PcxgPlBT+Q7hCWg +DaSwz5A3XtsGbWUNm+1whzoAMrMix4CzMdrmvf0U0iKQ15pj/cVuglwHii2i3cIf +bMpyeuVls8VVI7RjuFv0mnU5m0aqLJmf0lTNFSLxTcekTak1G+IYngc//Q/W+wDm +Qh8xAzicTfVHUgvWflysXr9jWA11QBCA +=eLZT +-----END PGP PUBLIC KEY BLOCK----- +``` diff --git a/cli/Cargo.lock b/cli/Cargo.lock new file mode 100644 index 0000000..4ac8b55 --- /dev/null +++ b/cli/Cargo.lock @@ -0,0 +1,7169 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + +[[package]] +name = "accesskit" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad442f58ee04714aaa0ba0a2768c1ea1935b29507bb22ddece8cbbc76db02932" +dependencies = [ + "uuid", +] + +[[package]] +name = "accesskit_atspi_common" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c182f9c282ac9c5638d876d551d15e5f7d397ec263349a0c6a2b61595dd5e4" +dependencies = [ + "accesskit", + "accesskit_consumer", + "atspi-common", + "phf 0.14.0", + "serde", + "zvariant", +] + +[[package]] +name = "accesskit_consumer" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a45e2bb300bea6d5f33a82c3e051c3ddc6f41c209750f68a0acbe991a284344" +dependencies = [ + "accesskit", + "hashbrown 0.17.1", +] + +[[package]] +name = "accesskit_ios" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28e539d64b27fd4c14de8f78ada8f7c944c092f52f7e49fb63316507a57f6937" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", +] + +[[package]] +name = "accesskit_macos" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5701624bf6a11efb6d4c8e922bf44126ed96250e5faa9a7a0468c979635839a4" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "accesskit_unix" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202f24df034a7476d07b7f74284de84f6d62aabd858dbe7ee9cad3b7ad6f8f9d" +dependencies = [ + "accesskit", + "accesskit_atspi_common", + "async-channel", + "async-executor", + "async-task", + "atspi", + "futures-lite", + "futures-util", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_windows" +version = "0.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce63f35d6bdcf59f26b76b3379063f738e6412cef46999cc772d46aa3de35adb" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "static_assertions", + "windows", + "windows-core", +] + +[[package]] +name = "accesskit_winit" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee96dd150375c05912d8a473f98c2fb155fb3234fac88292d396548a2460fa77" +dependencies = [ + "accesskit", + "accesskit_ios", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "raw-window-handle", + "winit", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.20", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "wl-clipboard-rs", + "x11rb 0.13.2", +] + +[[package]] +name = "arc-swap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380962b3d93b99642e50b9febf72c071e97e8b32d86eae9cf4ef582bb960ae6e" +dependencies = [ + "rustversion", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading 0.8.9", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.5", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.5", +] + +[[package]] +name = "async-recursion" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.5", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "atk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b" +dependencies = [ + "atk-sys", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "atomic" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89cbf775b137e9b968e67227ef7f775587cde3fd31b0d8599dbd0f598a48340" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atspi" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d" +dependencies = [ + "atspi-common", + "atspi-proxies", +] + +[[package]] +name = "atspi-common" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d" +dependencies = [ + "enumflags2", + "serde", + "static_assertions", + "zbus", + "zbus-lockstep", + "zbus-lockstep-macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "atspi-proxies" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc" +dependencies = [ + "atspi-common", + "serde", + "zbus", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec 0.6.3", +] + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec 0.9.1", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.2", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.4", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "by_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cairo-rs" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" +dependencies = [ + "bitflags 2.13.2", + "cairo-sys-rs", + "glib", + "libc", + "once_cell", + "thiserror 1.0.69", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.5", + "slab", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop 0.13.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.4", + "rustix 1.1.5", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54413ede23c2daf518f35156dfde027feb2374004d63bd497f983c8db9c0e313" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "clap_lex" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" + +[[package]] +name = "clipboard-win" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +dependencies = [ + "error-code", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + +[[package]] +name = "color" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "compact_str" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "console" +version = "0.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96a4956774c13c126a8b5af4daa79384f4d826534c95a02d76afb39e2ab64e3" +dependencies = [ + "encode_unicode", + "libc", + "unicode-width", + "windows-sys 0.61.2", +] + +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crossterm" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" +dependencies = [ + "bitflags 2.13.2", + "crossterm_winapi", + "derive_more", + "document-features", + "futures-core", + "mio", + "parking_lot", + "rustix 1.1.5", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "csscolorparser" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2a7d3066da2de787b7f032c736763eb7ae5d355f81a68bab2675a96008b0bf" +dependencies = [ + "lab", + "phf 0.11.3", +] + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.6", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + +[[package]] +name = "deltae" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5729f5117e208430e437df2f4843f5e5952997175992d1414f94c57d61e270b4" + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", +] + +[[package]] +name = "dialoguer" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f104b501bf2364e78d0d3974cbc774f738f5865306ed128e1e0d7499c0ad96" +dependencies = [ + "console", + "shell-words", + "tempfile", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common 0.1.7", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.1", + "const-oid", + "crypto-common 0.2.2", +] + +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "libc", + "objc2 0.6.4", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading 0.8.9", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "ecolor" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31bcbef0d4263a63eb32c4834e5d711613035ce1333468e107d928923e21e6e2" +dependencies = [ + "bytemuck", + "emath", +] + +[[package]] +name = "eframe" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c5642501a65ca657d05f00c643a5c14ff2346cb3818032bfe23d58e1f8e5f84" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "egui-wgpu", + "egui-winit", + "egui_glow", + "egui_system_font_provider", + "glutin", + "glutin-winit", + "image", + "js-sys", + "log", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "pollster", + "profiling", + "raw-window-handle", + "send_wrapper", + "static_assertions", + "wasm-bindgen", + "web-sys", + "web-time", + "wgpu", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec9144f49b7a28b5f395d3147e325b4fe3e77ba686eac11d1bdf0a7da3f375f" +dependencies = [ + "accesskit", + "ahash", + "bitflags 2.13.2", + "emath", + "epaint", + "itertools 0.15.0", + "log", + "nohash-hasher", + "profiling", + "smallvec", + "unicode-segmentation", + "web-sys", +] + +[[package]] +name = "egui-wgpu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0309cbe1febed48af5b974e4bcc424b35e9664863a4d402697147b57a488c864" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "epaint", + "log", + "profiling", + "thiserror 2.0.20", + "type-map", + "web-time", + "wgpu", + "winit", +] + +[[package]] +name = "egui-winit" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e449f4c4a2a60c7ccb4ba7fa4078417bfe1f9ddc03b5e05ce75748e33a70de" +dependencies = [ + "accesskit_winit", + "arboard", + "block2 0.6.2", + "bytemuck", + "egui", + "log", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "objc2-ui-kit 0.3.2", + "profiling", + "raw-window-handle", + "smithay-clipboard", + "web-time", + "webbrowser", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui_glow" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9275ca5cc35a6b7c94e0e8cedf22542f66cb0cf45ed8ab2657c78ff49fec7268" +dependencies = [ + "bytemuck", + "egui", + "glow", + "log", + "profiling", + "winit", +] + +[[package]] +name = "egui_system_font_provider" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2a2fdfe3c05dd9f691d2b1388b2312d6dce1af502f217c22136d22d9bd76f6" +dependencies = [ + "epaint", + "fontique", + "log", + "poll-promise", + "skrifa", + "sys-locale", + "unicode-script", +] + +[[package]] +name = "either" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" + +[[package]] +name = "emath" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e73ce90f54750be8672c02be0743fe47530e6f251e066f0ee2869b59eb297af5" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "epaint" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97bac86ae3dde93fc3951e790951caea739ff39a6c89d909cdaf1d9278dbb1bd" +dependencies = [ + "ahash", + "bytemuck", + "ecolor", + "emath", + "epaint_default_fonts", + "font-types", + "harfrust", + "log", + "nohash-hasher", + "parking_lot", + "profiling", + "self_cell", + "skrifa", + "smallvec", + "unicode-general-category", + "unicode-properties", + "unicode-segmentation", + "vello_cpu", +] + +[[package]] +name = "epaint_default_fonts" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfc1cc505827f4c23eedc297975a0fd038268d41293f389dd8ff3b574aefab19" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fancy-regex" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" +dependencies = [ + "bit-set 0.5.3", + "regex", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "fearless_simd" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "filedescriptor" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d" +dependencies = [ + "libc", + "thiserror 1.0.69", + "winapi", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25905e51abafe4dcea6c15fec58c57b601cdbd0ee53d22ea1d3016c587d39b" + +[[package]] +name = "finl_unicode" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bb028c8b4148c9ee0cca68fcd9add6044e81d3619f48577ddf13a263d047a2" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8eb065f3251655b3c90e22e5e363f310fc5332fb3402e37bbc94752283248f6" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "fontique" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6688bc1294fe7117d788937b6c53480169b29c566954af490830d4c09da9516a" +dependencies = [ + "hashbrown 0.17.1", + "linebender_resource_handle", + "memmap2", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-core-text", + "objc2-foundation 0.3.2", + "parlance", + "read-fonts", + "roxmltree", + "smallvec", + "windows", + "windows-core", + "yeslogic-fontconfig-sys", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "frislit" +version = "0.3.0" +dependencies = [ + "anyhow", + "arboard", + "bytes", + "chrono", + "clap", + "console", + "crossterm", + "dialoguer", + "dirs", + "eframe", + "fastrand", + "futures-util", + "global-hotkey", + "http-body-util", + "hyper", + "hyper-util", + "indicatif", + "ksni", + "open", + "qrcode", + "ratatui", + "reqwest", + "rfd", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "serde_yaml_ng", + "tokio", + "tokio-rustls", + "tokio-tungstenite", + "tray-icon", + "windows-sys 0.61.2", + "winresource", + "x11rb 0.14.0", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gdk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", + "once_cell", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.5", + "windows-link", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", +] + +[[package]] +name = "gio" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "once_cell", + "pin-project-lite", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "gio-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "winapi", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glib" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" +dependencies = [ + "bitflags 2.13.2", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "once_cell", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "glib-macros" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" +dependencies = [ + "heck 0.4.1", + "proc-macro-crate 2.0.2", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "glib-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "glifo" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be" +dependencies = [ + "bytemuck", + "foldhash 0.2.0", + "hashbrown 0.17.1", + "log", + "peniko", + "png", + "skrifa", + "smallvec", + "vello_common", +] + +[[package]] +name = "global-hotkey" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96daa86bdc1413406daee362a835e52c430c2193e5a5c328d1e522be140d1764" +dependencies = [ + "crossbeam-channel", + "keyboard-types", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "once_cell", + "thiserror 2.0.20", + "windows-sys 0.59.0", + "x11rb 0.13.2", + "xkeysym", +] + +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.13.2", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading 0.8.9", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", +] + +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gobject-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.20", + "windows", +] + +[[package]] +name = "gtk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a" +dependencies = [ + "atk", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk3-macros" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "guillotiere" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab" +dependencies = [ + "euclid", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "tiff", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "indicatif" +version = "0.18.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c" +dependencies = [ + "console", + "portable-atomic", + "unicode-width", + "unit-prefix", + "web-time", +] + +[[package]] +name = "indoc" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" +dependencies = [ + "rustversion", +] + +[[package]] +name = "instability" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3b5acc1e2fd9375041a388da33d1eb8aed5f7a8c0dd3543e3ea2805adfbe20" +dependencies = [ + "darling", + "indoc", + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.20", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce57d20d1ea864ce2ac172ab472d409214f4fd359f0b2a2775abdf522e2af99e" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "kasuari" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde5057d6143cc94e861d90f591b9303d6716c6b9602309150bd068853c10899" +dependencies = [ + "hashbrown 0.16.1", + "portable-atomic", + "thiserror 2.0.20", +] + +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags 2.13.2", + "serde", +] + +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading 0.8.9", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "ksni" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bcc1cb43797140f74b711f1c4a49f48a7a7429f211c5fb78264e7bcd1e99caf" +dependencies = [ + "arc-swap", + "crossbeam-queue", + "futures-util", + "pastey", + "serde", + "tokio", + "zbus", +] + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + +[[package]] +name = "lab" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf36173d4167ed999940f804952e6b08197cae5ad5d572eb4db150ce8ad5d58f" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libappindicator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" +dependencies = [ + "gtk-sys", + "libloading 0.7.4", + "once_cell", +] + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.4", +] + +[[package]] +name = "line-clipping" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e752191d037c44ad111a8caa762921926658402f01cc1253f7bef2020ece4f5e" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lru" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef9ac18847474e638e3702b76c65d4eb93428471a74778ef0f1be711717f89b5" +dependencies = [ + "hashbrown 0.17.1", +] + +[[package]] +name = "mac_address" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0aeb26bf5e836cc1c341c8106051b573f1766dfa05aa87f0b98be5e51b02303" +dependencies = [ + "nix", + "winapi", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", +] + +[[package]] +name = "memmem" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a64a92489e2744ce060c349162be1c5f33c6969234104dbd99ddb5feb08b8c15" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "muda" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4340e89c178916e62879c5c36b7f699019369be413e496178a6983ce91b8bc03" +dependencies = [ + "crossbeam-channel", + "dpi", + "gtk", + "keyboard-types", + "libc", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "png", + "thiserror 2.0.20", + "windows-sys 0.61.2", +] + +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.20", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.20", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", + "memoffset", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "libc", + "objc2 0.5.2", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-uniform-type-identifiers 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.4", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.13.2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.2", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.4", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.4", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.4", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core 0.2.2", + "objc2-symbols", + "objc2-uniform-type-identifiers 0.2.2", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7902ac02859fc1f7045f8b598c63f1ae0cc7efeaa06a9bc9f3d9a3c955974fa4" +dependencies = [ + "objc2 0.6.4", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "open" +version = "5.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d8c8b8e725ad26404d6896eb2f064294a0a7b4f1d9120210d85544684c4ca95" +dependencies = [ + "is-wsl", + "libc", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-float" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-float" +version = "5.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "palette" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddeed8580d347d2abf3dcf06a5f0b3dc020258338526b277847cd4248a70fc64" +dependencies = [ + "approx", + "libm", + "palette_derive", + "palette_math", +] + +[[package]] +name = "palette_derive" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88537020289b719d81be994ccf1bbf4990f477e2f69ee52fe3e45f43a02e56be" +dependencies = [ + "by_address", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "palette_math" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e6eb142958d64335fb0e345c5b9ead2ecd6fc438c307e9d7d3c4fd428dbaf12" +dependencies = [ + "libm", +] + +[[package]] +name = "pango" +version = "0.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" +dependencies = [ + "gio", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "parlance" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73072a9470554c8e794778acece2312661218aaabb635600957d952cf01c716e" + +[[package]] +name = "pastey" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" + +[[package]] +name = "peniko" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "linebender_resource_handle", + "smallvec", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pest" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45d3aca230fad2e6f6317ca0a72724338c4960cb97168a85cdee66df4a9a21a8" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284b60557f2c4a2e72ad3f2d34d42685a2fa4a6a61d0d2a10c0ae2a5e916c2cf" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d9d1f08a115309ee99268cf85e5228e0e56aa9caf8841ec12866b6be07c3109" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pest_meta" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed93ba1a9ffcca32130a5188701c81c0c49cf00d4b7c5007d5148951d743adcb" +dependencies = [ + "pest", +] + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset 0.5.7", + "hashbrown 0.15.5", + "indexmap", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros 0.14.0", + "phf_shared 0.14.0", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand 0.8.8", +] + +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared 0.14.0", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "poll-promise" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6a58fecbf9da8965bcdb20ce4fd29788d1acee68ddbb64f0ba1b81bccdb7df" +dependencies = [ + "document-features", + "static_assertions", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "pollster" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336" + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +dependencies = [ + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.15+spec-1.1.0", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "qrcode" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d68782463e408eb1e668cf6152704bd856c78c5b6417adaee3203d8f4c1fc9ec" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "ratatui" +version = "0.30.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3274ba0a2c5e1bcad2a2005d20f4dc59dad26b2eb0940fb094500dba4099d57d" +dependencies = [ + "instability", + "ratatui-core", + "ratatui-crossterm", + "ratatui-macros", + "ratatui-termina", + "ratatui-termwiz", + "ratatui-widgets", + "serde", +] + +[[package]] +name = "ratatui-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbb175c433c8e28a809d1f5773a2ae96e68c0ce40db865cbab1020bf33ae479c" +dependencies = [ + "bitflags 2.13.2", + "compact_str", + "critical-section", + "hashbrown 0.17.1", + "itertools 0.14.0", + "kasuari", + "lru", + "palette", + "serde", + "strum", + "thiserror 2.0.20", + "unicode-segmentation", + "unicode-truncate", + "unicode-width", +] + +[[package]] +name = "ratatui-crossterm" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567584a3b0e6a8203c23de40b4861497266725eb5363dbfd18a1edd603cca9f0" +dependencies = [ + "cfg-if", + "crossterm", + "instability", + "ratatui-core", +] + +[[package]] +name = "ratatui-macros" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7dc68daa7498a43e4d68e0eb078427e10c38fbcfbb1e42d955f1fa2140d814" +dependencies = [ + "ratatui-core", + "ratatui-widgets", +] + +[[package]] +name = "ratatui-termina" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0bf912d9e66f057a759d92e386a280ea886b352ab757d6ac4d653c7ed2c43c2" +dependencies = [ + "instability", + "ratatui-core", + "termina", +] + +[[package]] +name = "ratatui-termwiz" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf03e0380b7744054d6cb74224fe3adf062a029754933f575ca1e3b4c2ce977" +dependencies = [ + "ratatui-core", + "termwiz", +] + +[[package]] +name = "ratatui-widgets" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66e3d19bcc9130ca376277d93b60767ff121ace3be06f5f95f81dd68956407d1" +dependencies = [ + "bitflags 2.13.2", + "hashbrown 0.17.1", + "indoc", + "instability", + "itertools 0.14.0", + "line-clipping", + "ratatui-core", + "serde", + "strum", + "time", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_users" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" +dependencies = [ + "libredox", + "thiserror 2.0.20", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "rfd" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4b9d4857b10297ffb0f64cae711e983a7aeaee561848d56d429d3858bd8ed93" +dependencies = [ + "block2 0.6.2", + "dispatch2", + "js-sys", + "libc", + "log", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-uniform-type-identifiers 0.3.2", + "percent-encoding", + "pollster", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "roxmltree" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" +dependencies = [ + "memchr", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" + +[[package]] +name = "rustls-webpki" +version = "0.103.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit 0.19.2", + "tiny-skia", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_yaml_ng" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4db627b98b36d4203a7b458cf3573730f2bb591b28871d916dfa9efabfd41f" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "sha1" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "shell-words" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891" + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.14.4", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.5", + "thiserror 2.0.20", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit 0.20.0", + "wayland-backend", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "libc", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck 0.5.0", + "pkg-config", + "toml 0.8.2", + "version-compare", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "termina" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9048a889effe34a5cddee0af7f53285198b16dca3be510858d38dfdb3e62a04e" +dependencies = [ + "bitflags 2.13.2", + "parking_lot", + "rustix 1.1.5", + "signal-hook", + "windows-sys 0.61.2", +] + +[[package]] +name = "terminfo" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ea810f0692f9f51b382fff5893887bb4580f5fa246fde546e0b13e7fcee662" +dependencies = [ + "fnv", + "nom 7.1.3", + "phf 0.11.3", + "phf_codegen", +] + +[[package]] +name = "termios" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b" +dependencies = [ + "libc", +] + +[[package]] +name = "termwiz" +version = "0.23.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4676b37242ccbd1aabf56edb093a4827dc49086c0ffd764a5705899e0f35f8f7" +dependencies = [ + "anyhow", + "base64 0.22.1", + "bitflags 2.13.2", + "fancy-regex", + "filedescriptor", + "finl_unicode", + "fixedbitset 0.4.2", + "hex", + "lazy_static", + "libc", + "log", + "memmem", + "nix", + "num-derive", + "num-traits", + "ordered-float 4.6.0", + "pest", + "pest_derive", + "phf 0.11.3", + "sha2", + "signal-hook", + "siphasher", + "terminfo", + "termios", + "thiserror 1.0.69", + "ucd-trie", + "unicode-segmentation", + "vtparse", + "wezterm-bidi", + "wezterm-blob-leases", + "wezterm-color-types", + "wezterm-dynamic", + "wezterm-input-types", + "winapi", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" +dependencies = [ + "thiserror-impl 2.0.20", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde_core", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17a073bfed563fa236697a068031408a93cd9522e08abf9933ead3e73411bd71" +dependencies = [ + "futures-util", + "log", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tungstenite", +] + +[[package]] +name = "toml" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "toml" +version = "1.1.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.1.1", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.4", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.25.15+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614" +dependencies = [ + "indexmap", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.4", +] + +[[package]] +name = "toml_parser" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" +dependencies = [ + "winnow 1.0.4", +] + +[[package]] +name = "toml_writer" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tray-icon" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5cc5858ecf9574ddd8f0032a2ff7ffd6f7724d2b81e48b9374984b3fd6ddc9" +dependencies = [ + "crossbeam-channel", + "dirs", + "libappindicator", + "muda", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "once_cell", + "png", + "thiserror 2.0.20", + "windows-sys 0.61.2", +] + +[[package]] +name = "tree_magic_mini" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +dependencies = [ + "memchr", + "nom 8.0.0", + "petgraph", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + +[[package]] +name = "tungstenite" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48ac77174b19c110a50ab2128b24215ac9cb40e0e12e093fb602d175c569d22" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.10.3", + "rustls", + "rustls-pki-types", + "sha1", + "thiserror 2.0.20", +] + +[[package]] +name = "type-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" +dependencies = [ + "rustc-hash 2.1.3", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + +[[package]] +name = "unicode-ident" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" + +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-script" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-truncate" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5" +dependencies = [ + "itertools 0.14.0", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" +dependencies = [ + "atomic", + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "vello_common" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd" +dependencies = [ + "bytemuck", + "fearless_simd", + "guillotiere", + "log", + "peniko", + "png", + "smallvec", + "thiserror 2.0.20", +] + +[[package]] +name = "vello_cpu" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9" +dependencies = [ + "bytemuck", + "glifo", + "hashbrown 0.17.1", + "png", + "vello_common", +] + +[[package]] +name = "version-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vtparse" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d9b2acfb050df409c972a37d3b8e08cdea3bddb0c09db9d53137e504cfabed0" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.6", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.5", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags 2.13.2", + "rustix 1.1.5", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.5", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbddc4a036f00ec4f18c83445bd3115cb306a91da554919a099d9222fe4a7f8" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webbrowser" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94" +dependencies = [ + "jni", + "log", + "ndk-context", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "url", + "web-sys", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wezterm-bidi" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0a6e355560527dd2d1cf7890652f4f09bb3433b6aadade4c9b5ed76de5f3ec" +dependencies = [ + "log", + "wezterm-dynamic", +] + +[[package]] +name = "wezterm-blob-leases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692daff6d93d94e29e4114544ef6d5c942a7ed998b37abdc19b17136ea428eb7" +dependencies = [ + "getrandom 0.3.4", + "mac_address", + "sha2", + "thiserror 1.0.69", + "uuid", +] + +[[package]] +name = "wezterm-color-types" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7de81ef35c9010270d63772bebef2f2d6d1f2d20a983d27505ac850b8c4b4296" +dependencies = [ + "csscolorparser", + "deltae", + "lazy_static", + "wezterm-dynamic", +] + +[[package]] +name = "wezterm-dynamic" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f2ab60e120fd6eaa68d9567f3226e876684639d22a4219b313ff69ec0ccd5ac" +dependencies = [ + "log", + "ordered-float 4.6.0", + "strsim", + "thiserror 1.0.69", + "wezterm-dynamic-derive", +] + +[[package]] +name = "wezterm-dynamic-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c0cf2d539c645b448eaffec9ec494b8b19bd5077d9e58cb1ae7efece8d575b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "wezterm-input-types" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7012add459f951456ec9d6c7e6fc340b1ce15d6fc9629f8c42853412c029e57e" +dependencies = [ + "bitflags 1.3.2", + "euclid", + "lazy_static", + "serde", + "wezterm-dynamic", +] + +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "naga", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bit-vec 0.9.1", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.20", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-wasm", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d260ca2ca8adc654f513a869bf3cac0b47f5b8d3f87803d6942015f8de597aae" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set 0.10.0", + "bitflags 2.13.2", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "hashbrown 0.17.1", + "js-sys", + "khronos-egl", + "libc", + "libloading 0.8.9", + "log", + "naga", + "naga-types", + "ndk-sys", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float 5.5.0", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.20", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge", + "wgpu-types", + "windows", + "windows-core", + "windows-result", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2 0.5.1", + "bytemuck", + "calloop 0.13.0", + "cfg_aliases", + "concurrent-queue", + "core-foundation 0.9.4", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "sctk-adwaita", + "smithay-client-toolkit 0.19.2", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb 0.13.2", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "winresource" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bc6d36480b829272a5bdabf08e6dca8004761c1da7e35efef800540c66221b" +dependencies = [ + "toml 1.1.6+spec-1.1.0", + "version_check", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d7888ccd4896447b2d14d3a9350a85df2aeb6f181e2e7a31349d104ac46cac1" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 1.1.5", + "thiserror 2.0.20", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading 0.8.9", + "once_cell", + "rustix 1.1.5", + "x11rb-protocol 0.13.2", +] + +[[package]] +name = "x11rb" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a8885a854a8bfdf87a301e53e41b17c5f8f33639903131338b997b1eb614f44" +dependencies = [ + "gethostname", + "rustix 1.1.5", + "x11rb-protocol 0.14.0", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "x11rb-protocol" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acf4d1bc32aa46eec18caa634ec3cf4c05bfa151f12b93b510b15190f69a1ca8" + +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33811428bee40dbceb6d545e95754741d17a6aef9a4849f0fd62e2ba4f412a78" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.5", + "serde", + "serde_repr", + "tokio", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow 1.0.4", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus-lockstep" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" +dependencies = [ + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus-lockstep-macros" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "zbus-lockstep", + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 3.0.6", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" +dependencies = [ + "serde", + "winnow 1.0.4", + "zvariant", +] + +[[package]] +name = "zbus_xml" +version = "5.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" +dependencies = [ + "serde", + "winnow 1.0.4", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zcheapstr" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" +dependencies = [ + "serde", +] + +[[package]] +name = "zerocopy" +version = "0.8.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d35102a9f36d089ccae9e4c6802bc118be4487b80aaffc0ab4e0cf5ce92d2873" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c01f5ab44258da43cf276c74a2763db2ff3969c9c652c3f2de07041d0b2bc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "5.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow 1.0.4", + "zcheapstr", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 3.0.6", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.6", + "winnow 1.0.4", +] diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100644 index 0000000..fc29dfe --- /dev/null +++ b/cli/Cargo.toml @@ -0,0 +1,63 @@ +[package] +name = "frislit" +version = "0.3.0" +edition = "2021" +description = "CLI client for frislit" +authors = ["fristy"] +license = "MIT" +build = "build.rs" + +[features] +default = ["gui"] +gui = ["dep:eframe", "dep:rfd", "dep:global-hotkey", "dep:tray-icon", "dep:ksni", "dep:x11rb", "dep:windows-sys"] + +[dependencies] +clap = { version = "4", features = ["derive"] } +tokio = { version = "1", features = ["full"] } +tokio-tungstenite = { version = "0.30", features = ["rustls-tls-native-roots"] } +rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] } +rustls-pki-types = "1" +rustls-platform-verifier = "0.7" +tokio-rustls = { version = "0.26", default-features = false, features = ["ring", "tls12"] } +reqwest = { version = "0.13", default-features = false, features = ["json", "rustls-no-provider", "system-proxy"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +serde_yaml_ng = "0.10" +hyper = { version = "1", features = ["http1", "server", "client"] } +hyper-util = { version = "0.1", features = ["tokio"] } +http-body-util = "0.1" +bytes = "1" +fastrand = "2" +dialoguer = "0.12" +console = "0.16" +dirs = "7" +anyhow = "1" +futures-util = "0.3" +open = "5" +indicatif = "0.18" +qrcode = { version = "0.14", default-features = false } +arboard = { version = "3", default-features = false } +eframe = { version = "0.37", optional = true } +global-hotkey = { version = "0.10", optional = true } +rfd = { version = "0.18", optional = true, default-features = false, features = ["xdg-portal"] } +ratatui = "0.30" +crossterm = { version = "0.29", features = ["event-stream"] } +chrono = { version = "0.4.45", default-features = false, features = ["clock"] } + +[target.'cfg(windows)'.dependencies] +windows-sys = { version = "0.61", optional = true, features = ["Win32_System_Console", "Win32_Foundation", "Win32_UI_WindowsAndMessaging"] } + +[target.'cfg(any(windows, target_os = "macos"))'.dependencies] +tray-icon = { version = "0.26", optional = true } + +[target.'cfg(target_os = "linux")'.dependencies] +ksni = { version = "0.3", optional = true, default-features = false, features = ["tokio"] } +x11rb = { version = "0.14", optional = true, features = ["randr"] } + +[build-dependencies] +winresource = "0.1" + +[profile.release] +strip = true +lto = "thin" +codegen-units = 1 diff --git a/cli/assets/PlusJakartaSans-Bold.ttf b/cli/assets/PlusJakartaSans-Bold.ttf new file mode 100644 index 0000000..91ab258 Binary files /dev/null and b/cli/assets/PlusJakartaSans-Bold.ttf differ diff --git a/cli/assets/PlusJakartaSans-LICENSE.txt b/cli/assets/PlusJakartaSans-LICENSE.txt new file mode 100644 index 0000000..d82b082 --- /dev/null +++ b/cli/assets/PlusJakartaSans-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Plus Jakarta Sans Project Authors (https://github.com/tokotype/PlusJakartaSans) PlusJakartaSans-Italic[wght].ttf: Copyright 2020 The Plus Jakarta Sans Project Authors (https://github.com/tokotype/PlusJakartaSans) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cli/assets/PlusJakartaSans-Medium.ttf b/cli/assets/PlusJakartaSans-Medium.ttf new file mode 100644 index 0000000..6e7af77 Binary files /dev/null and b/cli/assets/PlusJakartaSans-Medium.ttf differ diff --git a/cli/assets/PlusJakartaSans-SemiBold.ttf b/cli/assets/PlusJakartaSans-SemiBold.ttf new file mode 100644 index 0000000..609def9 Binary files /dev/null and b/cli/assets/PlusJakartaSans-SemiBold.ttf differ diff --git a/cli/assets/frislit.ico b/cli/assets/frislit.ico new file mode 100644 index 0000000..bdc869b Binary files /dev/null and b/cli/assets/frislit.ico differ diff --git a/cli/assets/icon-128.rgba b/cli/assets/icon-128.rgba new file mode 100644 index 0000000..d5cb700 Binary files /dev/null and b/cli/assets/icon-128.rgba differ diff --git a/cli/assets/icon-32.rgba b/cli/assets/icon-32.rgba new file mode 100644 index 0000000..050f047 Binary files /dev/null and b/cli/assets/icon-32.rgba differ diff --git a/cli/build.rs b/cli/build.rs new file mode 100644 index 0000000..7fe6d63 --- /dev/null +++ b/cli/build.rs @@ -0,0 +1,10 @@ +fn main() { + println!("cargo:rerun-if-changed=assets/frislit.ico"); + if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") { + let mut resource = winresource::WindowsResource::new(); + resource.set_icon("assets/frislit.ico"); + if let Err(err) = resource.compile() { + println!("cargo:warning=Could not embed the Windows icon: {err}"); + } + } +} diff --git a/cli/src/api.rs b/cli/src/api.rs new file mode 100644 index 0000000..0589b1b --- /dev/null +++ b/cli/src/api.rs @@ -0,0 +1,82 @@ +use anyhow::{bail, Result}; +use reqwest::Client; +use serde::Deserialize; + +pub struct ApiClient { + client: Client, + base_url: String, + token: Option, +} + +#[derive(Deserialize)] +pub struct ServerInfo { pub name: String, pub version: String, #[serde(rename = "baseDomain")] pub base_domain: String } + +#[derive(Deserialize)] +pub struct DeviceRequest { + pub code: String, + #[serde(rename = "pollToken")] pub poll_token: String, + #[serde(rename = "handoffUrl")] pub handoff_url: String, +} + +#[derive(Deserialize)] +pub struct DevicePoll { pub status: String, pub token: Option } + +impl ApiClient { + pub fn new(base_url: &str, token: Option<&str>, accept_invalid_certs: bool) -> Result { + Ok(Self { + client: Client::builder().danger_accept_invalid_certs(accept_invalid_certs).build()?, + base_url: base_url.trim_end_matches('/').to_string(), + token: token.map(|t| t.to_string()), + }) + } + + fn url(&self, path: &str) -> String { format!("{}/@frislit/api{}", self.base_url, path) } + + pub async fn info(&self) -> Result { + let resp = self.client.get(self.url("/info")).send().await?; + if !resp.status().is_success() { bail!("Server did not answer like a frislit server ({})", resp.status()); } + Ok(resp.json().await?) + } + + pub async fn device_create(&self, client: &str) -> Result { + let response = self.client.post(self.url("/auth/device/create")) + .json(&serde_json::json!({ "client": client })).send().await?; + if !response.status().is_success() { bail!("Could not start the login ({})", response.status()); } + Ok(response.json().await?) + } + + pub async fn device_poll(&self, poll_token: &str) -> Result { + let response = self.client.post(self.url("/auth/device/poll")) + .json(&serde_json::json!({ "pollToken": poll_token })).send().await?; + if !response.status().is_success() { bail!("Could not check the login ({})", response.status()); } + Ok(response.json().await?) + } + + pub async fn get(&self, path: &str) -> Result { + let token = self.token.as_deref().ok_or_else(|| anyhow::anyhow!("Not authenticated"))?; + let response = self.client.get(self.url(path)).header("Authorization", format!("Bearer {token}")).send().await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + 401 => bail!("This device is not linked any more. Run `frislit login`"), + other => bail!("Unexpected response from server: {other}"), + } + } + + pub async fn whoami(&self) -> Result { + self.get("/whoami").await + } +} + +#[derive(serde::Deserialize)] +pub struct Me { pub username: String, pub guest: Option } + +impl Me { + pub fn label(&self) -> String { + match &self.guest { Some(guest) => format!("{guest} (guest of {})", self.username), None => self.username.clone() } + } +} + +pub fn ws_url(base_url: &str) -> String { + let base = base_url.trim_end_matches('/').replacen("https://", "wss://", 1).replacen("http://", "ws://", 1); + format!("{base}/@frislit/ws") +} diff --git a/cli/src/auth.rs b/cli/src/auth.rs new file mode 100644 index 0000000..a31771d --- /dev/null +++ b/cli/src/auth.rs @@ -0,0 +1,93 @@ +use anyhow::{bail, Result}; +use std::time::Duration; +use crate::api::{ApiClient, Me, ServerInfo}; +use crate::connect::percent_decode; +use crate::config::{normalize_url, Config}; +use crate::session::{Events, Stop}; + +const POLL_INTERVAL: Duration = Duration::from_secs(2); + +pub enum LoginEvent { + Code { code: String, handoff_url: String }, + Linked { server_url: String, info: ServerInfo }, +} + +pub struct Invite { pub server_url: String, pub token: String } + +pub fn parse_invite(link: &str) -> Option { + let link = link.trim(); + if let Some(rest) = link.strip_prefix("frislit://invite/") { + let (token, query) = rest.split_once('?').unwrap_or((rest, "")); + let server = query.split('&').find_map(|pair| pair.strip_prefix("server=")).map(percent_decode)?; + return Some(Invite { server_url: normalize_url(&server), token: token.trim_matches('/').to_string() }); + } + let (server, token) = link.split_once("/@frislit/invite/")?; + if !server.starts_with("http://") && !server.starts_with("https://") { return None; } + Some(Invite { server_url: normalize_url(server), token: token.trim_matches('/').to_string() }) +} + +pub async fn accept_invite(invite: Invite, accept_invalid_certs: bool) -> Result<(Me, ServerInfo)> { + if invite.token.is_empty() { bail!("That invite link carries no token"); } + link_token(invite.server_url, invite.token, accept_invalid_certs).await.map_err(|_| anyhow::anyhow!("That invite link is not valid any more")) +} + +pub async fn link_token(server_url: String, token: String, accept_invalid_certs: bool) -> Result<(Me, ServerInfo)> { + let server_url = normalize_url(&server_url); + let client = ApiClient::new(&server_url, Some(&token), accept_invalid_certs)?; + let info = client.info().await?; + let me = client.whoami().await.map_err(|_| anyhow::anyhow!("The server did not accept that token"))?; + let mut cfg = Config::load()?; + cfg.server_url = Some(server_url); + cfg.device_token = Some(token); + cfg.save()?; + Ok((me, info)) +} + +pub async fn link(server_url: &str, accept_invalid_certs: bool, out: Events, mut stop: Stop) -> Result<()> { + let server_url = normalize_url(server_url); + let client = ApiClient::new(&server_url, None, accept_invalid_certs)?; + let info = client.info().await?; + let request = client.device_create(&hostname()).await?; + let _ = out.send(LoginEvent::Code { code: request.code.clone(), handoff_url: request.handoff_url.clone() }); + + let token = loop { + tokio::select! { + _ = tokio::time::sleep(POLL_INTERVAL) => {} + _ = stop.wait() => return Ok(()), + } + let poll = client.device_poll(&request.poll_token).await?; + match poll.status.as_str() { + "pending" => continue, + "authorized" => break poll.token.ok_or_else(|| anyhow::anyhow!("Approved but no token was returned"))?, + _ => bail!("The code expired or was denied. Run `frislit login` again"), + } + }; + + let linked = ApiClient::new(&server_url, Some(&token), accept_invalid_certs)?; + linked.whoami().await?; + + let mut cfg = Config::load()?; + cfg.server_url = Some(server_url.clone()); + cfg.device_token = Some(token); + cfg.save()?; + + let _ = out.send(LoginEvent::Linked { server_url, info }); + Ok(()) +} + +pub fn logout() -> Result { + let mut cfg = Config::load()?; + if cfg.device_token.is_none() { return Ok(false); } + cfg.device_token = None; + cfg.save()?; + Ok(true) +} + +fn hostname() -> String { + std::env::var("HOSTNAME") + .ok() + .or_else(|| std::env::var("COMPUTERNAME").ok()) + .or_else(|| std::fs::read_to_string("/etc/hostname").ok().map(|name| name.trim().to_string())) + .filter(|name| !name.is_empty()) + .unwrap_or_else(|| "frislit CLI".to_string()) +} diff --git a/cli/src/cli.rs b/cli/src/cli.rs new file mode 100644 index 0000000..3ab96fb --- /dev/null +++ b/cli/src/cli.rs @@ -0,0 +1,319 @@ +use anyhow::{Context, Result}; +use console::style; +use dialoguer::{Input, Select}; +use indicatif::{ProgressBar, ProgressStyle}; +use std::future::Future; +use std::io::IsTerminal; +use std::time::Duration; +use tokio::sync::mpsc::UnboundedReceiver; +use crate::auth::{self, LoginEvent}; +use crate::config::Config; +use crate::connect; +use crate::qr; +use crate::session::{self, Events, JoinEvent, Online, Request, Stop, TunnelEvent}; +use crate::shape::Shape; +use crate::tui; +use crate::tunnel::{self, Options}; +use crate::update; + +fn ok() -> console::StyledObject<&'static str> { style("✓").green().bold() } +fn warn() -> console::StyledObject<&'static str> { style("!").yellow().bold() } + +#[derive(Default)] +struct Printer { spinner: Option } + +impl Printer { + fn busy(&mut self, message: String) { + match &self.spinner { + Some(spinner) => spinner.set_message(message), + None => { + let spinner = ProgressBar::new_spinner(); + spinner.set_style(ProgressStyle::default_spinner().template("{spinner:.green} {msg}").unwrap()); + spinner.set_message(message); + spinner.enable_steady_tick(Duration::from_millis(100)); + self.spinner = Some(spinner); + } + } + } + + fn idle(&mut self) { + if let Some(spinner) = self.spinner.take() { spinner.finish_and_clear(); } + } + + fn reconnecting(&mut self, seconds: u64, reason: Option) { + match reason { + None => self.busy("Connection lost, reconnecting...".into()), + Some(text) => self.busy(format!("Reconnecting in {seconds}s... ({text})")), + } + } +} + +fn stop_on_ctrl_c() -> Stop { + let (handle, stop) = Stop::new(); + tokio::spawn(async move { + let _ = tokio::signal::ctrl_c().await; + handle.stop(); + }); + stop +} + +fn session() -> (Events, UnboundedReceiver, Stop) { + let (events, rx) = session::channel(); + (events, rx, stop_on_ctrl_c()) +} + +async fn printed( + mut rx: UnboundedReceiver, + mut print: impl FnMut(&mut Printer, E) + Send + 'static, + work: impl Future>, +) -> Result<()> { + let printer = tokio::spawn(async move { + let mut printer = Printer::default(); + while let Some(event) = rx.recv().await { print(&mut printer, event); } + printer.idle(); + }); + let result = work.await; + let _ = printer.await; + result +} + +fn print_ready(online: &Online, target_label: &str, server_url: &str, shape: &Shape) { + let kind = if online.persistent { style(" (persistent)").dim().to_string() } else { String::new() }; + println!("{} Tunnel {} is online{kind}", ok(), style(&online.id).cyan().bold()); + if let Some(url) = &online.url { + println!(" {} {} {}", style(url).cyan().bold().underlined(), style("forwards to").dim(), style(target_label).bold()); + for custom in &online.custom_urls { + println!(" {}", style(custom).cyan().underlined()); + } + println!(); + qr::print(url); + if qr::copy(url) { println!("{} Copied to clipboard", ok()); } + } else if let Some(link) = online.link(server_url) { + println!(" Forwarding {} (tcp+udp)", style(target_label).bold()); + println!(" Others run: {}", style(format!("frislit connect {link}")).cyan().bold()); + println!(); + qr::print(&link); + if qr::copy(&format!("frislit connect {link}")) { println!("{} Copied to clipboard", ok()); } + } + if let Some(summary) = &online.access { + println!(" {} {}", style("Access:").dim(), style(summary).yellow()); + } + if let Some(summary) = shape.summary() { + println!(" {} {}", style("Network:").dim(), style(summary).yellow()); + } + println!("Press {} to stop.", style("Ctrl+C").bold()); +} + +fn print_request(request: &Request) { + let status = match request.status { + 200..=299 => style(request.status).green(), + 300..=399 => style(request.status).cyan(), + 400..=499 => style(request.status).yellow(), + _ => style(request.status).red(), + }; + let label = if request.kind == "ws" { style("WS ").magenta().to_string() } else { style(format!("{:<4}", request.method)).bold().to_string() }; + let intel = request.intel().map(|text| format!(" {text}")).unwrap_or_default(); + println!("{} {} {} {}{}", label, status.bold(), style(&request.path).dim(), style(format!("{}ms", request.duration)).dim(), style(intel).dim()); +} + +pub async fn tunnel(opts: Options, plain: bool) -> Result<()> { + let cfg = Config::load()?; + let (server_url, token) = cfg.require_auth()?; + let (opts, target, label, _local) = tunnel::prepare(opts).await?; + let shape = opts.shape.clone(); + let (events, rx) = session::channel(); + let hint = events.clone(); + let _check = session::Task(tokio::spawn(async move { if let Some(version) = update::check().await { let _ = hint.send(TunnelEvent::Update(version)); } })); + + if !plain && std::io::stdout().is_terminal() { + let api = crate::api::ApiClient::new(&server_url, Some(&token), cfg.accept_invalid_certs)?; + let me = api.whoami().await?; + let ctx = tui::Context { server_url, account: me.label(), target: label, network: shape.summary(), tcp: opts.mode == "tcp" }; + let (handle, stop) = Stop::new(); + let ui = tokio::spawn(tui::run(rx, handle, ctx)); + let result = tunnel::run(opts, target, events, stop).await; + match ui.await?? { + Some(reason) => println!("{} Tunnel ended: {}", warn(), style(reason).dim()), + None => println!("{} Tunnel closed", ok()), + } + return result; + } + + let stop = stop_on_ctrl_c(); + printed(rx, move |printer, event| match event { + TunnelEvent::Connecting => printer.busy("Connecting to server...".into()), + TunnelEvent::Online(online) => { printer.idle(); print_ready(&online, &label, &server_url, &shape); } + TunnelEvent::Resumed(online) => { printer.idle(); println!("{} Reconnected, tunnel {} is back online", ok(), style(&online.id).cyan()); } + TunnelEvent::Replaced(online) => { + printer.idle(); + println!("{} The old tunnel expired, a new one was created", warn()); + print_ready(&online, &label, &server_url, &shape); + } + TunnelEvent::Request(request) => print_request(&request), + TunnelEvent::Connection(connection) => println!("{}", style(connection.line()).dim()), + TunnelEvent::Access(summary) => println!("{} {}", style("Access:").dim(), style(summary).yellow()), + TunnelEvent::Reconnecting { seconds, reason } => printer.reconnecting(seconds, reason), + TunnelEvent::Update(version) => println!("{} frislit {version} is available, run {}", style("↑").cyan(), style("frislit update").cyan()), + TunnelEvent::Stopped => { printer.idle(); println!("\n{} Tunnel closed", ok()); } + TunnelEvent::Ended(reason) => { printer.idle(); println!("{} Tunnel ended: {}", ok(), style(reason).dim()); } + }, tunnel::run(opts, target, events, stop)).await +} + +pub async fn connect(target: String, port: Option, bind: String, server: Option) -> Result<()> { + let explicit = port.is_some(); + let pick_port: connect::PortPicker = Box::new(move |taken| { + println!("{} Port {} is already in use", warn(), style(taken).bold()); + if explicit || !console::user_attended() { anyhow::bail!("Choose another port with --port"); } + Ok(Input::new().with_prompt("Local port to use instead").default(taken + 1).interact_text()?) + }); + let opts = connect::Options { target, port, bind, server, pick_port: Some(pick_port) }; + let (events, rx, stop) = session(); + + printed(rx, |printer, event| match event { + JoinEvent::Connecting => printer.busy("Connecting to server...".into()), + JoinEvent::Forwarding { bind, port, tunnel_id, owner_online } => { + printer.idle(); + println!("{} Forwarding {} (tcp+udp) to {}", ok(), style(format!("{bind}:{port}")).cyan().bold(), style(&tunnel_id).bold().green()); + if !owner_online { println!("{} The owner is currently offline, connections will work once it is back", warn()); } + println!("Press {} to stop.", style("Ctrl+C").bold()); + } + JoinEvent::Reconnecting { seconds, reason } => printer.reconnecting(seconds, reason), + JoinEvent::Reconnected => { printer.idle(); println!("{} Reconnected", ok()); } + JoinEvent::Stopped => { printer.idle(); println!("\n{} Stopped", ok()); } + JoinEvent::Ended(reason) => { printer.idle(); println!("{} Disconnected: {}", ok(), style(reason).dim()); } + }, connect::run(opts, events, stop)).await +} + +#[derive(serde::Deserialize)] +struct Listed { + id: String, + target: String, + url: Option, + online: bool, + #[serde(rename = "graceUntil")] grace_until: Option, + joiners: u64, + persistent: bool, + #[serde(rename = "customUrls")] custom_urls: Vec, +} + +#[derive(serde::Deserialize)] +struct Tunnels { tunnels: Vec, now: u64 } + +#[derive(serde::Deserialize)] +struct Saved { name: String, url: String, live: bool } + +#[derive(serde::Deserialize)] +struct Persistent { tunnels: Vec } + +fn mark(name: &str, persistent: bool) -> String { if persistent { format!("{name} *") } else { name.to_string() } } + +pub async fn list() -> Result<()> { + let cfg = Config::load()?; + let (server_url, token) = cfg.require_auth()?; + let api = crate::api::ApiClient::new(&server_url, Some(&token), cfg.accept_invalid_certs)?; + let (live, saved): (Tunnels, Persistent) = tokio::try_join!(api.get("/tunnels"), api.get("/persistent"))?; + + let mut rows: Vec<[String; 4]> = live.tunnels.iter().map(|tunnel| { + let state = if tunnel.online { style("● online").green().to_string() } + else if let Some(until) = tunnel.grace_until { style(format!("○ closes in {}s", until.saturating_sub(live.now) / 1000)).yellow().to_string() } + else { style("○ offline").yellow().to_string() }; + let address = match &tunnel.url { + Some(url) => std::iter::once(url.as_str()).chain(tunnel.custom_urls.iter().map(String::as_str)).collect::>().join(", "), + None => format!("tcp+udp · {} connected", tunnel.joiners), + }; + [mark(&tunnel.id, tunnel.persistent), state, address, tunnel.target.clone()] + }).collect(); + rows.extend(saved.tunnels.iter().filter(|saved| !saved.live) + .map(|saved| [mark(&saved.name, true), style("○ offline").dim().to_string(), saved.url.clone(), String::new()])); + + if rows.is_empty() { + println!("No tunnels. Start one with {}", style("frislit http 3000").cyan()); + return Ok(()); + } + let widths: Vec = (0..3).map(|column| rows.iter().map(|row| console::measure_text_width(&row[column])).max().unwrap()).collect(); + for [name, state, address, target] in &rows { + println!("{} {} {} {}", + style(console::pad_str(name, widths[0], console::Alignment::Left, None)).bold(), + console::pad_str(state, widths[1], console::Alignment::Left, None), + style(console::pad_str(address, widths[2], console::Alignment::Left, None)).cyan(), + style(target).dim()); + } + if rows.iter().any(|row| row[0].ends_with('*')) { println!("{}", style("* persistent").dim()); } + Ok(()) +} + +pub async fn update() -> Result<()> { + let install = update::detect(); + let latest = update::latest().await.context("Could not reach GitHub to look for releases")?; + if !update::newer(&latest) { + println!("{} frislit {} is the latest version", ok(), style(update::CURRENT).cyan()); + return Ok(()); + } + println!("Updating frislit {} to {}", style(update::CURRENT).dim(), style(&latest).cyan().bold()); + if install == update::Install::Managed { + println!(" This frislit was installed by a package manager and is updated through it."); + return Ok(()); + } + update::apply(&latest, &install, false).await?; + if install == update::Install::Msi { println!("{} The installer is running, frislit {latest} is ready in a moment", ok()); } + else { println!("{} Updated to frislit {latest}", ok()); } + Ok(()) +} + +pub async fn login(link: Option, token: Option, server: Option) -> Result<()> { + let cfg = Config::load()?; + + if let Some(token) = token { + let server_url = server.or_else(|| cfg.server_url()).context("Pass --server along with the key")?; + let (me, info) = auth::link_token(server_url, token, cfg.accept_invalid_certs).await?; + println!("{} Linked to {} as {}", ok(), style(info.name).cyan().bold(), style(me.label()).cyan()); + println!(" Tunnels will be created under {}", style(&info.base_domain).cyan()); + return Ok(()); + } + + if let Some(link) = link { + let invite = auth::parse_invite(&link).ok_or_else(|| anyhow::anyhow!("That is not an invite link. Run `frislit login` without arguments to link with your account"))?; + let (me, info) = auth::accept_invite(invite, cfg.accept_invalid_certs).await?; + println!("{} Linked to {} as {}", ok(), style(info.name).cyan().bold(), style(me.label()).cyan()); + println!(" Tunnels will be created under {}", style(&info.base_domain).cyan()); + return Ok(()); + } + + let server_url: String = if let Some(ref url) = cfg.server_url { + println!("Current server: {}", style(url).cyan()); + let choice = Select::new().with_prompt("Server URL") + .items(["Keep current server", "Enter a new server URL"]).default(0).interact()?; + if choice == 0 { url.clone() } else { Input::new().with_prompt("Server URL").interact_text()? } + } else { + Input::new().with_prompt("Server URL (e.g. https://frislit.example.com)").interact_text()? + }; + let (events, rx, stop) = session(); + + printed(rx, |printer, event| match event { + LoginEvent::Code { code, handoff_url } => { + println!(); + println!(" Approve this device at {}", style(&handoff_url).cyan().bold().underlined()); + println!(" Code: {}", style(&code).bold().green()); + if open::that_detached(&handoff_url).is_ok() { + println!(" {}", style("Opened in your browser.").dim()); + } + println!(); + printer.busy("Waiting for approval...".into()); + } + LoginEvent::Linked { server_url, info } => { + printer.idle(); + println!("{} This device is linked to {} ({} {})", ok(), style(&server_url).cyan().bold(), info.name, info.version); + println!(" Tunnels will be created under {}", style(&info.base_domain).cyan()); + } + }, auth::link(&server_url, cfg.accept_invalid_certs, events, stop)).await +} + +pub fn logout() -> Result<()> { + if !auth::logout()? { + println!("This device is not linked."); + return Ok(()); + } + println!("{} Token removed from this device", ok()); + println!(" {}", style("Revoke it on the server too, on the Devices settings page.").dim()); + Ok(()) +} diff --git a/cli/src/config.rs b/cli/src/config.rs new file mode 100644 index 0000000..1cb0f8c --- /dev/null +++ b/cli/src/config.rs @@ -0,0 +1,87 @@ +use anyhow::{bail, Context, Result}; +use serde::{Deserialize, Serialize}; +use std::{fs, path::PathBuf}; + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct Config { + #[serde(default)] pub server_url: Option, + #[serde(default)] pub device_token: Option, + #[serde(default)] pub accept_invalid_certs: bool, + #[serde(default)] pub update_checked_at: u64, + #[serde(default)] pub update_latest: Option, +} + +impl Config { + fn path() -> Result { + let dir = dirs::config_dir().context("No config directory")?.join("frislit"); + fs::create_dir_all(&dir)?; + Ok(dir.join("config.json")) + } + + pub fn load() -> Result { + let path = Self::path()?; + if !path.exists() { return Ok(Self::default()); } + serde_json::from_str(&fs::read_to_string(&path)?).context("Failed to parse config") + } + + pub fn save(&self) -> Result<()> { + Ok(fs::write(Self::path()?, serde_json::to_string_pretty(self)?)?) + } + + pub fn server_url(&self) -> Option { + std::env::var("FRISLIT_SERVER").ok().filter(|v| !v.trim().is_empty()) + .or_else(|| self.server_url.clone()) + .map(|v| normalize_url(&v)) + } + + pub fn token(&self) -> Option { + std::env::var("FRISLIT_TOKEN").ok().filter(|v| !v.trim().is_empty()).or_else(|| self.device_token.clone()) + } + + pub fn require_server(&self) -> Result { + self.server_url().ok_or_else(|| anyhow::anyhow!("No server configured. Run `frislit login` or pass --server / FRISLIT_SERVER")) + } + + pub fn require_auth(&self) -> Result<(String, String)> { + let url = self.require_server()?; + let token = self.token().ok_or_else(|| anyhow::anyhow!("This device is not linked. Run `frislit login` first"))?; + Ok((url, token)) + } +} + +pub fn normalize_url(url: &str) -> String { + let trimmed = url.trim().trim_end_matches('/'); + if trimmed.starts_with("http://") || trimmed.starts_with("https://") { trimmed.to_string() } else { format!("https://{trimmed}") } +} + +pub fn set(key: &str, value: &str) -> Result<()> { + let mut cfg = Config::load()?; + match key { + "server-url" => cfg.server_url = Some(normalize_url(value)), + "device-token" => cfg.device_token = Some(value.to_string()), + "accept-invalid-certs" => cfg.accept_invalid_certs = value.parse().context("Must be 'true' or 'false'")?, + _ => bail!("Unknown key: {key}. Valid: server-url, device-token, accept-invalid-certs"), + } + cfg.save()?; + println!("Set {key} = {}", if key == "device-token" { "(set)" } else { value }); + Ok(()) +} + +pub fn get(key: &str) -> Result<()> { + let cfg = Config::load()?; + println!("{}", match key { + "server-url" => cfg.server_url.unwrap_or_default(), + "accept-invalid-certs" => cfg.accept_invalid_certs.to_string(), + "device-token" => cfg.device_token.map(|_| "(set)".into()).unwrap_or_default(), + _ => bail!("Unknown key: {key}"), + }); + Ok(()) +} + +pub fn show() -> Result<()> { + let cfg = Config::load()?; + println!("server-url: {}", cfg.server_url.as_deref().unwrap_or("(not set)")); + println!("accept-invalid-certs: {}", cfg.accept_invalid_certs); + println!("device-token: {}", if cfg.device_token.is_some() { "(set)" } else { "(not set)" }); + Ok(()) +} diff --git a/cli/src/connect.rs b/cli/src/connect.rs new file mode 100644 index 0000000..5811c04 --- /dev/null +++ b/cli/src/connect.rs @@ -0,0 +1,294 @@ +use anyhow::{bail, Context, Result}; +use serde_json::json; +use std::collections::HashMap; +use std::net::SocketAddr; +use std::sync::{Arc, Mutex}; +use std::time::{Duration, Instant}; +use tokio::net::{TcpListener, UdpSocket}; +use crate::api::ws_url; +use crate::config::{normalize_url, Config}; +use crate::mux::{expect, Incoming, Mux, MuxEvents, MuxWriter, OpenMeta}; +use crate::session::{Events, JoinEvent, Stop, Task}; +use crate::shape::Shape; +use crate::tcp::{pump_tcp, UDP_IDLE}; +use crate::tunnel::server_hello; + +pub type PortPicker = Box Result + Send + Sync>; + +#[derive(Debug)] +pub struct PortInUse { pub port: u16, pub bind: String } + +impl std::fmt::Display for PortInUse { + fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "Port {} is already in use on {}", self.port, self.bind) + } +} + +impl std::error::Error for PortInUse {} + +pub struct Options { + pub target: String, + pub port: Option, + pub bind: String, + pub server: Option, + pub pick_port: Option, +} + +type Current = Arc>>>; + +async fn join(url: &str, code: &str, accept_invalid_certs: bool) -> Result<(Arc, MuxEvents, u16, bool)> { + let (mux, mut events) = Mux::connect(url, None, accept_invalid_certs).await?; + mux.send_control(server_hello("joiner", None)).await?; + expect(&mut events, "hello").await?; + mux.send_control(json!({ "type": "join", "code": code })).await?; + let msg = expect(&mut events, "joined").await?; + let port = msg.get("port").and_then(|p| p.as_u64()).context("joined without port")? as u16; + let online = msg.get("online").and_then(|o| o.as_bool()).unwrap_or(true); + Ok((mux, events, port, online)) +} + +async fn bind(bind_addr: &str, port: u16, pick_port: Option<&PortPicker>) -> Result<(TcpListener, UdpSocket, u16)> { + let mut port = port; + loop { + let addr: SocketAddr = format!("{bind_addr}:{port}").parse().with_context(|| format!("Invalid bind address {bind_addr}"))?; + match (TcpListener::bind(addr).await, UdpSocket::bind(addr).await) { + (Ok(tcp), Ok(udp)) => return Ok((tcp, udp, port)), + _ => match pick_port { + Some(pick) => port = pick(port)?, + None => return Err(PortInUse { port, bind: bind_addr.to_string() }.into()), + }, + } + } +} + +fn parse_scheme(rest: &str) -> Result<(String, Option)> { + let (path, query) = rest.split_once('?').unwrap_or((rest, "")); + let code = path.trim_start_matches("connect").trim_matches('/').to_string(); + if code.is_empty() { bail!("That link carries no share code"); } + + let mut server = None; + for pair in query.split('&') { + let Some((key, value)) = pair.split_once('=') else { continue }; + if key != "server" { continue } + let decoded = percent_decode(value); + if !decoded.starts_with("http://") && !decoded.starts_with("https://") { + bail!("The server in that link is not an http(s) address"); + } + server = Some(decoded.trim_end_matches('/').to_string()); + } + Ok((code, server)) +} + +pub fn percent_decode(value: &str) -> String { + let bytes = value.as_bytes(); + let mut out = Vec::with_capacity(bytes.len()); + let mut i = 0; + while i < bytes.len() { + if bytes[i] == b'%' && i + 2 < bytes.len() { + if let Ok(byte) = u8::from_str_radix(&value[i + 1..i + 3], 16) { + out.push(byte); + i += 3; + continue; + } + } + out.push(if bytes[i] == b'+' { b' ' } else { bytes[i] }); + i += 1; + } + String::from_utf8_lossy(&out).to_string() +} + +fn parse_target(target: &str) -> Result<(String, Option)> { + let target = target.trim(); + if let Some(rest) = target.strip_prefix("frislit://") { + return parse_scheme(rest); + } + if let Some(rest) = target.strip_prefix("http://").or_else(|| target.strip_prefix("https://")) { + let scheme = if target.starts_with("https://") { "https" } else { "http" }; + let (authority, path) = rest.split_once('/').unwrap_or((rest, "")); + if authority.is_empty() { bail!("\"{target}\" has no server in it"); } + let code = path.rsplit('/').find(|part| !part.is_empty()).unwrap_or(""); + if code.is_empty() { bail!("\"{target}\" has no share code in it"); } + return Ok((code.to_string(), Some(format!("{scheme}://{authority}")))); + } + Ok((target.to_string(), None)) +} + +pub fn resolve(target: &str, server: Option<&str>) -> Result<(String, String, String)> { + if crate::auth::parse_invite(target).is_some() { bail!("That is an invite link. Run `frislit login {target}` instead"); } + let (code, from_link) = parse_target(target)?; + if code.is_empty() || !code.chars().all(|c| c.is_ascii_alphanumeric() || c == '-') { bail!("The share code must be alphanumeric"); } + if code.len() <= 26 { bail!("That share code is too short"); } + let cfg = Config::load()?; + let server_url = server.map(normalize_url).or(from_link).or_else(|| cfg.server_url()) + .ok_or_else(|| anyhow::anyhow!("No server in that code. Paste the whole link, or use --server "))?; + let tunnel_id = code[..code.len() - 26].to_string(); + Ok((code, tunnel_id, server_url)) +} + +const INVALID_RETRIES: u32 = 6; + +pub async fn run(opts: Options, out: Events, mut stop: Stop) -> Result<()> { + let (code, tunnel_id, server_url) = resolve(&opts.target, opts.server.as_deref())?; + let cfg = Config::load()?; + let url = ws_url(&server_url); + + let _ = out.send(JoinEvent::Connecting); + let joined = tokio::select! { + result = join(&url, &code, cfg.accept_invalid_certs) => result, + _ = stop.wait() => return Ok(()), + }; + let (mux, mut events, remote_port, online) = joined?; + + let bound = bind(&opts.bind, opts.port.unwrap_or(remote_port), opts.pick_port.as_ref()).await; + let (tcp, udp, local_port) = match bound { + Ok(bound) => bound, + Err(err) => { + let _ = mux.send_control(json!({ "type": "bye" })).await; + mux.close().await; + return Err(err); + } + }; + let _ = out.send(JoinEvent::Forwarding { bind: opts.bind.clone(), port: local_port, tunnel_id, owner_online: online }); + + let current: Current = Arc::new(Mutex::new(Some(mux.clone()))); + let _listeners = (Task(tokio::spawn(accept_tcp(tcp, current.clone()))), Task(tokio::spawn(accept_udp(udp, current.clone())))); + + let mut backoff = 1u64; + loop { + let lost = tokio::select! { + ended = drain(&mut events) => { + if let Some(reason) = ended { + *current.lock().unwrap() = None; + let _ = out.send(JoinEvent::Ended(reason)); + return Ok(()); + } + true + } + _ = stop.wait() => false, + }; + if !lost { + let session = current.lock().unwrap().take(); + if let Some(session) = session { + let _ = session.send_control(json!({ "type": "bye" })).await; + session.close().await; + } + let _ = out.send(JoinEvent::Stopped); + return Ok(()); + } + *current.lock().unwrap() = None; + + let mut reason = None; + let mut invalid = 0; + loop { + let _ = out.send(JoinEvent::Reconnecting { seconds: backoff, reason: reason.take() }); + tokio::select! { + _ = tokio::time::sleep(Duration::from_secs(backoff)) => {} + _ = stop.wait() => { let _ = out.send(JoinEvent::Stopped); return Ok(()); } + } + let attempt = tokio::select! { + result = join(&url, &code, cfg.accept_invalid_certs) => result, + _ = stop.wait() => { let _ = out.send(JoinEvent::Stopped); return Ok(()); } + }; + match attempt { + Ok((new_mux, new_events, _, _)) => { + let _ = out.send(JoinEvent::Reconnected); + *current.lock().unwrap() = Some(new_mux); + events = new_events; + backoff = 1; + break; + } + Err(err) => { + let text = err.to_string(); + if text.contains("(invalid_code)") { invalid += 1; } + if text.contains("(not_found)") || invalid > INVALID_RETRIES { bail!("{text}"); } + backoff = (backoff * 2).min(30); + reason = Some(text); + } + } + } + } +} + +async fn drain(events: &mut MuxEvents) -> Option { + loop { + tokio::select! { + msg = events.control.recv() => match msg { + None => return None, + Some(msg) => { + if msg.get("type").and_then(|t| t.as_str()) == Some("bye") { + return Some(msg.get("reason").and_then(|r| r.as_str()).unwrap_or("closed by the server").to_string()); + } + } + }, + stream = events.streams.recv() => { if stream.is_none() { return None; } } + } + } +} + +async fn accept_tcp(listener: TcpListener, current: Current) { + loop { + let Ok((socket, peer)) = listener.accept().await else { continue }; + let _ = socket.set_nodelay(true); + let mux = current.lock().unwrap().clone(); + let Some(mux) = mux else { drop(socket); continue }; + tokio::spawn(async move { + match mux.open(&OpenMeta::tcp(peer.to_string())).await { + Ok((writer, reader)) => pump_tcp(socket, writer, reader, &Shape::default()).await, + Err(_) => drop(socket), + } + }); + } +} + +struct Flow { writer: MuxWriter, last_active: Arc> } + +async fn accept_udp(socket: UdpSocket, current: Current) { + let socket = Arc::new(socket); + let flows: Arc>> = Arc::new(Mutex::new(HashMap::new())); + let mut sweep = tokio::time::interval(Duration::from_secs(10)); + let mut buf = vec![0u8; 65535]; + loop { + let (n, src) = tokio::select! { + received = socket.recv_from(&mut buf) => match received { Ok(pair) => pair, Err(_) => continue }, + _ = sweep.tick() => { + let expired: Vec = { + let mut map = flows.lock().unwrap(); + let dead: Vec = map.iter().filter(|(_, f)| f.last_active.lock().unwrap().elapsed() > UDP_IDLE).map(|(a, _)| *a).collect(); + dead.into_iter().filter_map(|a| map.remove(&a)).collect() + }; + for flow in expired { flow.writer.close().await; } + continue; + } + }; + let existing = { + let map = flows.lock().unwrap(); + map.get(&src).map(|f| { *f.last_active.lock().unwrap() = Instant::now(); f.writer.clone() }) + }; + let writer = match existing { + Some(w) => w, + None => { + let mux = current.lock().unwrap().clone(); + let Some(mux) = mux else { continue }; + let Ok((writer, mut reader)) = mux.open(&OpenMeta::udp(src.to_string())).await else { continue }; + let last_active = Arc::new(Mutex::new(Instant::now())); + let handle = writer.clone(); + flows.lock().unwrap().insert(src, Flow { writer, last_active: last_active.clone() }); + + let socket = socket.clone(); + let flows = flows.clone(); + tokio::spawn(async move { + loop { + match reader.recv().await { + Incoming::Datagram(data) => { *last_active.lock().unwrap() = Instant::now(); let _ = socket.send_to(&data, src).await; } + Incoming::Close | Incoming::Reset => break, + Incoming::Data(_) => {} + } + } + flows.lock().unwrap().remove(&src); + }); + handle + } + }; + let _ = writer.send_datagram(&buf[..n]).await; + } +} diff --git a/cli/src/gui/app.rs b/cli/src/gui/app.rs new file mode 100644 index 0000000..cb10642 --- /dev/null +++ b/cli/src/gui/app.rs @@ -0,0 +1,770 @@ +use eframe::egui::{self, Align, Color32, CursorIcon, Frame, Layout, Margin, RichText, Sense, Stroke, TextureHandle, TextureOptions, Ui, UiBuilder}; +use std::collections::{HashMap, VecDeque}; +use std::path::PathBuf; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::mpsc::{self, Receiver, Sender}; +use std::sync::Arc; +use tokio::sync::mpsc::UnboundedReceiver; +use std::time::{Duration, Instant}; +use tokio::runtime::Handle; +use crate::api::{ApiClient, Me, ServerInfo}; +use crate::auth::{self, LoginEvent}; +use crate::config::Config; +use crate::connect; +use crate::qr; +use crate::session::{self, Connection, JoinEvent, Online, Request, Stop, StopHandle, Task, TunnelEvent}; +use crate::tunnel::{self, connect_target, Options, Target}; +use crate::update; +use super::ports::{self, Listener}; +use super::{format, hide_by_closing, theme, widgets, Repaint, Wake}; + +const MAX_REQUESTS: usize = 500; +const TOAST_FOR: Duration = Duration::from_secs(3); +const UNDO_FOR: Duration = Duration::from_secs(8); +const PROBE_TIMEOUT: Duration = Duration::from_secs(1); +const PROBE_INTERVAL: Duration = Duration::from_secs(5); +const SCAN_INTERVAL: Duration = Duration::from_secs(4); + +#[derive(Clone, Copy, PartialEq)] +pub enum Page { Tunnels, NewTunnel, Tunnel(u64), Connect, Settings } + +pub enum Msg { + TunnelReady(u64, String), + Tunnel(u64, TunnelEvent), + TunnelFailed(u64, String), + Join(u64, JoinEvent), + JoinFailed(u64, String, Option), + Login(LoginEvent), + LoginFailed(String), + Info(Result), + Me(Option), + Linked(Result), + Update(Option), + Updated(Result<(), String>), + TunnelProbe(u64, Option), + Listeners(Vec), + FolderPicked(Option), +} + +#[derive(Clone, Copy, PartialEq)] +pub enum TunnelKind { Http, Files, Tcp } + +impl TunnelKind { + pub fn label(self) -> &'static str { match self { Self::Http => "http", Self::Files => "files", Self::Tcp => "tcp" } } +} + +#[derive(PartialEq)] +pub enum TunnelState { Connecting, Online, Reconnecting { seconds: u64, reason: Option } } + +pub struct LoggedRequest { pub request: Request, pub at: Instant } + +pub struct TunnelCard { + pub id: u64, + pub kind: TunnelKind, + pub opts: Options, + pub target_label: String, + pub access: Option, + pub probe: Option, + pub state: TunnelState, + pub online: Option, + pub requests: VecDeque, + pub connections: VecDeque, + pub request_count: u64, + pub started: Instant, + pub stop: StopHandle, + pub show_qr: bool, + pub copied_at: Option, +} + +impl TunnelCard { + pub fn link(&self, server_url: &str) -> Option { self.online.as_ref().and_then(|online| online.link(server_url)) } + pub fn title(&self) -> String { self.online.as_ref().map(|online| online.id.clone()).unwrap_or_else(|| self.target_label.clone()) } +} + +pub enum JoinState { Connecting, Forwarding, Reconnecting { seconds: u64, reason: Option } } + +pub struct Forwarding { pub port: u16, pub tunnel_id: String, pub owner_online: bool } + +pub struct JoinCard { + pub id: u64, + pub target: String, + pub code: String, + pub server: String, + pub state: JoinState, + pub forwarding: Option, + pub started: Instant, + pub stop: StopHandle, +} + +pub enum LoginStage { Idle, Starting, Waiting { code: String, url: String }, Failed(String) } + +pub struct LoginForm { pub server: String, pub accept_invalid: bool, pub key: String, pub use_key: bool, pub stage: LoginStage, pub stop: Option } + +#[derive(Clone, Copy, PartialEq)] +pub enum AuthChoice { Open, Password, Login } + +pub struct NewTunnelForm { + pub kind: TunnelKind, + pub target: String, + pub dir: String, + pub picking_dir: bool, + pub name: String, + pub keep_host: bool, + pub auth: AuthChoice, + pub password: String, + pub allow: Vec, + pub allow_input: String, + pub error: Option, +} + +impl Default for NewTunnelForm { + fn default() -> Self { + Self { kind: TunnelKind::Http, target: String::new(), dir: String::new(), picking_dir: false, name: String::new(), keep_host: false, + auth: AuthChoice::Open, password: String::new(), allow: Vec::new(), allow_input: String::new(), error: None } + } +} + +#[derive(Default)] +pub struct ConnectForm { pub link: String, pub error: Option, pub retry_port: Option } + +pub enum ToastAction { Reopen(TunnelKind, Options) } + +pub struct Toast { pub text: String, pub at: Instant, pub error: bool, pub action: Option } + +impl Toast { + pub fn expired(&self) -> bool { self.at.elapsed() > if self.action.is_some() { UNDO_FOR } else { TOAST_FOR } } +} + +#[derive(Clone)] +struct Mailbox { tx: Sender, repaint: Repaint } + +impl Mailbox { + fn send(&self, msg: Msg) { + let _ = self.tx.send(msg); + self.repaint.ping(); + } +} + +pub struct State { + pub runtime: Handle, + mailbox: Mailbox, + rx: Receiver, + pub page: Page, + pub cfg: Config, + pub server_info: Option>, + pub tunnels: Vec, + pub joins: Vec, + next_id: u64, + pub me: Option, + pub listeners: Vec, + pub scan_ports: Arc, + pub update: Option, + pub updating: bool, + pub checked_update: bool, + pub managed: bool, + pub relaunch: bool, + pub start_hidden: bool, + pub hotkey: bool, + pub autostart: bool, + pub login: LoginForm, + pub new_tunnel: NewTunnelForm, + pub connect: ConnectForm, + pub toasts: Vec, + pub has_tray: bool, + pub quitting: bool, + monitor: Option, +} + +impl State { + pub fn new(runtime: Handle, repaint: Repaint, has_tray: bool) -> Self { + let (tx, rx) = mpsc::channel(); + let cfg = Config::load().unwrap_or_default(); + let login = LoginForm { server: cfg.server_url.clone().unwrap_or_default(), accept_invalid: cfg.accept_invalid_certs, key: String::new(), use_key: false, stage: LoginStage::Idle, stop: None }; + let mut state = Self { + runtime, mailbox: Mailbox { tx, repaint }, rx, page: Page::Tunnels, cfg, server_info: None, tunnels: Vec::new(), joins: Vec::new(), next_id: 1, + login, new_tunnel: NewTunnelForm::default(), connect: ConnectForm::default(), + me: None, listeners: Vec::new(), scan_ports: Arc::new(AtomicBool::new(false)), update: None, updating: false, checked_update: false, managed: update::detect() == update::Install::Managed, relaunch: false, start_hidden: false, hotkey: false, autostart: super::autostart::enabled(), toasts: Vec::new(), has_tray, quitting: false, monitor: None, + }; + state.fetch_info(); + state.fetch_me(); + let mailbox = state.mailbox.clone(); + state.runtime.spawn(async move { mailbox.send(Msg::Update(update::check().await)); }); + let (mailbox, scan) = (state.mailbox.clone(), state.scan_ports.clone()); + state.runtime.spawn(async move { + loop { + if scan.load(Ordering::Relaxed) { + if let Ok(found) = tokio::task::spawn_blocking(ports::scan).await { mailbox.send(Msg::Listeners(found)); } + } + tokio::time::sleep(SCAN_INTERVAL).await; + } + }); + state + } + + pub fn expose(&mut self, listener: &Listener) { + let target = Target { host: "127.0.0.1".into(), port: listener.port, tls: false }; + if listener.is_tcp() { + self.start_tunnel(TunnelKind::Tcp, Options::tcp(target, None, tunnel::Access::default())); + } else { + self.start_tunnel(TunnelKind::Http, Options::http(tunnel::TargetSpec::Addr(target), None, false, tunnel::Access::default())); + } + } + + pub fn suggestions(&self) -> Vec { + self.listeners.iter().filter(|listener| !self.tunnels.iter().any(|card| card.target_label.ends_with(&format!(":{}", listener.port)))).cloned().collect() + } + + pub fn start_update(&mut self) { + let Some(version) = self.update.clone() else { return }; + self.updating = true; + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + let result = update::apply(&version, &update::detect(), true).await.map_err(|err| format!("{err:#}")); + mailbox.send(Msg::Updated(result)); + }); + } + + pub fn linked(&self) -> bool { self.cfg.device_token.is_some() && self.cfg.server_url().is_some() } + + pub fn server_url(&self) -> String { self.cfg.server_url().unwrap_or_default() } + + pub fn corner_position(&self) -> Option { self.monitor.map(super::corner_for) } + + fn next_id(&mut self) -> u64 { let id = self.next_id; self.next_id += 1; id } + + fn forward(&self, mut rx: UnboundedReceiver, wrap: impl Fn(E) -> Msg + Send + 'static) { + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + while let Some(event) = rx.recv().await { mailbox.send(wrap(event)); } + }); + } + + pub fn toast(&mut self, text: impl Into) { self.toasts.push(Toast { text: text.into(), at: Instant::now(), error: false, action: None }); } + pub fn toast_error(&mut self, text: impl Into) { self.toasts.push(Toast { text: text.into(), at: Instant::now(), error: true, action: None }); } + + pub fn fetch_me(&mut self) { + let (Some(url), Some(token)) = (self.cfg.server_url(), self.cfg.device_token.clone()) else { self.me = None; return }; + let accept = self.cfg.accept_invalid_certs; + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + let me = async { ApiClient::new(&url, Some(&token), accept)?.whoami().await }.await.ok(); + mailbox.send(Msg::Me(me)); + }); + } + + pub fn reload_config(&mut self) { + self.cfg = Config::load().unwrap_or_default(); + self.fetch_me(); + } + + pub fn stop_all(&self) { + for card in &self.tunnels { card.stop.stop(); } + for join in &self.joins { join.stop.stop(); } + if let Some(stop) = &self.login.stop { stop.stop(); } + } + + pub fn open_link(&mut self, link: String) { + if let Some(invite) = auth::parse_invite(&link) { + self.page = Page::Tunnels; + let accept = self.cfg.accept_invalid_certs; + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + let result = linked(auth::accept_invite(invite, accept).await); + mailbox.send(Msg::Linked(result)); + }); + return; + } + self.page = Page::Connect; + self.start_join(link, None, "127.0.0.1".into()); + } + + pub fn fetch_info(&mut self) { + let Some(url) = self.cfg.server_url() else { self.server_info = None; return }; + let accept = self.cfg.accept_invalid_certs; + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + let result = async { ApiClient::new(&url, None, accept)?.info().await }.await.map_err(|err| format!("{err:#}")); + mailbox.send(Msg::Info(result)); + }); + } + + pub fn link_with_key(&mut self) { + let server = self.login.server.trim().to_string(); + let key = self.login.key.trim().to_string(); + if server.is_empty() || key.is_empty() { self.login.stage = LoginStage::Failed("Enter the server URL and the API key".into()); return; } + self.login.stage = LoginStage::Starting; + let accept = self.login.accept_invalid; + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + let result = linked(auth::link_token(server, key, accept).await); + mailbox.send(Msg::Linked(result)); + }); + } + + pub fn start_login(&mut self) { + let server = self.login.server.trim().to_string(); + if server.is_empty() { self.login.stage = LoginStage::Failed("Enter the URL of your frislit server".into()); return; } + let (events, rx) = session::channel(); + let (handle, stop) = Stop::new(); + self.login.stop = Some(handle); + self.login.stage = LoginStage::Starting; + let accept = self.login.accept_invalid; + self.forward(rx, Msg::Login); + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + if let Err(err) = auth::link(&server, accept, events, stop).await { + mailbox.send(Msg::LoginFailed(format!("{err:#}"))); + } + }); + } + + pub fn cancel_login(&mut self) { + if let Some(stop) = self.login.stop.take() { stop.stop(); } + self.login.stage = LoginStage::Idle; + } + + pub fn pick_folder(&mut self) { + if self.new_tunnel.picking_dir { return; } + self.new_tunnel.picking_dir = true; + let start = Some(self.new_tunnel.dir.trim().to_string()).filter(|dir| !dir.is_empty()).map(PathBuf::from); + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + let mut dialog = rfd::AsyncFileDialog::new().set_title("Folder to share"); + if let Some(start) = start { dialog = dialog.set_directory(start); } + let picked = dialog.pick_folder().await.map(|handle| handle.path().to_path_buf()); + mailbox.send(Msg::FolderPicked(picked)); + }); + } + + pub fn start_tunnel(&mut self, kind: TunnelKind, opts: Options) { + let id = self.next_id(); + let target_label = opts.target.label(); + let (events, rx) = session::channel(); + let (handle, stop) = Stop::new(); + self.tunnels.push(TunnelCard { + id, kind, opts: opts.clone(), target_label, access: None, probe: None, state: TunnelState::Connecting, online: None, + requests: VecDeque::new(), connections: VecDeque::new(), request_count: 0, started: Instant::now(), stop: handle, show_qr: false, copied_at: None, + }); + self.forward(rx, move |event| Msg::Tunnel(id, event)); + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + let result = async { + let (opts, target, label, _local) = tunnel::prepare(opts).await?; + mailbox.send(Msg::TunnelReady(id, label)); + let _probe = (kind != TunnelKind::Files).then(|| Task(tokio::spawn(probe(mailbox.clone(), id, target.clone())))); + tunnel::run(opts, target, events, stop).await + }.await; + if let Err(err) = result { mailbox.send(Msg::TunnelFailed(id, format!("{err:#}"))); } + }); + self.page = Page::Tunnel(id); + } + + pub fn start_join(&mut self, target: String, port: Option, bind: String) { + let (code, server) = match connect::resolve(&target, None) { + Ok((code, _, server)) => (code, server), + Err(err) => { self.connect.error = Some(format!("{err:#}")); self.connect.link = target; return; } + }; + self.connect = ConnectForm::default(); + if self.joins.iter().any(|join| join.code == code) { + self.toast("That share is already connected"); + return; + } + let id = self.next_id(); + let (events, rx) = session::channel(); + let (handle, stop) = Stop::new(); + self.joins.insert(0, JoinCard { + id, target: target.clone(), code, server, + state: JoinState::Connecting, forwarding: None, started: Instant::now(), stop: handle, + }); + let opts = connect::Options { target, port, bind, server: None, pick_port: None }; + self.forward(rx, move |event| Msg::Join(id, event)); + let mailbox = self.mailbox.clone(); + self.runtime.spawn(async move { + if let Err(err) = connect::run(opts, events, stop).await { + let port_in_use = err.downcast_ref::().map(|taken| taken.port); + mailbox.send(Msg::JoinFailed(id, format!("{err:#}"), port_in_use)); + } + }); + } + + fn fail_join(&mut self, id: u64, message: String, port_in_use: Option) { + let Some(index) = self.joins.iter().position(|join| join.id == id) else { return }; + let join = self.joins.remove(index); + if let Some(port) = port_in_use { + self.connect.link = join.target; + self.connect.retry_port = Some(port.saturating_add(1).to_string()); + self.connect.error = Some(message); + } else { + self.toast_error(message); + } + } + + pub fn stop_tunnel(&mut self, id: u64) { + if let Some(index) = self.tunnels.iter().position(|card| card.id == id) { + self.tunnels.remove(index).stop.stop(); + } + if self.page == Page::Tunnel(id) { self.page = Page::Tunnels; } + } + + pub fn stop_tunnel_by_user(&mut self, id: u64) { + let Some(card) = self.tunnels.iter().find(|card| card.id == id) else { return }; + let (kind, opts, name) = (card.kind, card.opts.clone(), card.title()); + self.stop_tunnel(id); + self.toasts.push(Toast { text: format!("{name} stopped"), at: Instant::now(), error: false, action: Some(ToastAction::Reopen(kind, opts)) }); + } + + pub fn stop_join(&mut self, id: u64) { + if let Some(index) = self.joins.iter().position(|join| join.id == id) { + self.joins.remove(index).stop.stop(); + } + } + + pub fn tunnel_mut(&mut self, id: u64) -> Option<&mut TunnelCard> { self.tunnels.iter_mut().find(|card| card.id == id) } + + pub fn drain(&mut self, ctx: &egui::Context) { + while let Ok(msg) = self.rx.try_recv() { self.handle(ctx, msg); } + } + + fn handle(&mut self, ctx: &egui::Context, msg: Msg) { + match msg { + Msg::TunnelReady(id, label) => { if let Some(card) = self.tunnel_mut(id) { card.target_label = label; } } + Msg::Tunnel(id, event) => self.handle_tunnel(id, event), + Msg::TunnelFailed(id, message) => { + let fresh = self.tunnel_mut(id).is_some_and(|card| card.online.is_none()); + self.stop_tunnel(id); + if fresh { self.new_tunnel.error = Some(message); self.page = Page::NewTunnel; } else { self.toast_error(message); } + } + Msg::Me(me) => self.me = me, + Msg::Linked(Ok(message)) => { self.login.stage = LoginStage::Idle; self.login.key.clear(); self.reload_config(); self.fetch_info(); self.toast(message); } + Msg::Linked(Err(message)) => { self.login.stage = LoginStage::Failed(message); } + Msg::Update(version) => { self.update = version; self.checked_update = true; } + Msg::Updated(Ok(_)) => { self.relaunch = true; self.quitting = true; ctx.send_viewport_cmd(egui::ViewportCommand::Close); } + Msg::Updated(Err(message)) => { self.updating = false; self.toast_error(message); } + Msg::TunnelProbe(id, warning) => { if let Some(card) = self.tunnel_mut(id) { card.probe = warning; } } + Msg::Listeners(found) => self.listeners = found, + Msg::Join(id, event) => self.handle_join(id, event), + Msg::JoinFailed(id, message, port_in_use) => self.fail_join(id, message, port_in_use), + Msg::Login(LoginEvent::Code { code, handoff_url }) => { + ctx.open_url(egui::OpenUrl::new_tab(&handoff_url)); + self.login.stage = LoginStage::Waiting { code, url: handoff_url }; + } + Msg::Login(LoginEvent::Linked { server_url, info }) => { + self.login.stage = LoginStage::Idle; + self.login.stop = None; + self.reload_config(); + self.server_info = Some(Ok(info)); + self.toast(format!("This device is linked to {}", format::host_of(&server_url))); + } + Msg::LoginFailed(message) => { self.login.stage = LoginStage::Failed(message); self.login.stop = None; } + Msg::Info(result) => self.server_info = Some(result), + Msg::FolderPicked(path) => { + self.new_tunnel.picking_dir = false; + if let Some(path) = path { self.new_tunnel.dir = path.display().to_string(); } + } + } + } + + fn handle_tunnel(&mut self, id: u64, event: TunnelEvent) { + let server_url = self.server_url(); + let Some(card) = self.tunnel_mut(id) else { return }; + let mut toast = None; + match event { + TunnelEvent::Connecting => card.state = TunnelState::Connecting, + TunnelEvent::Online(online) | TunnelEvent::Resumed(online) | TunnelEvent::Replaced(online) => { + let fresh = card.online.as_ref().is_none_or(|current| current.id != online.id); + card.state = TunnelState::Online; + card.access = online.access.clone(); + if fresh { + let copied = online.link(&server_url).is_some_and(|link| qr::copy(&link)); + toast = Some(if copied { format!("{} is online, link copied", online.id) } else { format!("{} is online", online.id) }); + } + card.online = Some(online); + } + TunnelEvent::Connection(connection) => { + if connection.opened { + card.connections.push_front(connection); + card.connections.truncate(MAX_REQUESTS); + } else if let Some(existing) = card.connections.iter_mut().find(|entry| entry.key == connection.key) { + *existing = connection; + } + } + TunnelEvent::Access(summary) => card.access = Some(summary), + TunnelEvent::Request(request) => { + card.request_count += 1; + if card.requests.len() == MAX_REQUESTS { card.requests.pop_back(); } + card.requests.push_front(LoggedRequest { request, at: Instant::now() }); + } + TunnelEvent::Reconnecting { seconds, reason } => card.state = TunnelState::Reconnecting { seconds, reason }, + TunnelEvent::Update(version) => self.update = Some(version), + TunnelEvent::Stopped => self.stop_tunnel(id), + TunnelEvent::Ended(reason) => { self.stop_tunnel(id); toast = Some(format!("Tunnel ended: {reason}")); } + } + if let Some(text) = toast { self.toast(text); } + } + + fn handle_join(&mut self, id: u64, event: JoinEvent) { + let Some(join) = self.joins.iter_mut().find(|join| join.id == id) else { return }; + match event { + JoinEvent::Connecting => join.state = JoinState::Connecting, + JoinEvent::Forwarding { port, tunnel_id, owner_online, .. } => { + join.state = JoinState::Forwarding; + join.forwarding = Some(Forwarding { port, tunnel_id, owner_online }); + } + JoinEvent::Reconnecting { seconds, reason } => join.state = JoinState::Reconnecting { seconds, reason }, + JoinEvent::Reconnected => join.state = JoinState::Forwarding, + JoinEvent::Stopped => self.stop_join(id), + JoinEvent::Ended(reason) => { self.stop_join(id); self.toast(format!("Disconnected: {reason}")); } + } + } +} + +pub struct Window<'a> { + pub state: &'a mut State, + wake: &'a Receiver, + pub logo: TextureHandle, + qr: HashMap, + visible: bool, + focused: bool, + was_focused: bool, + needs_show: bool, + place_frames: u8, +} + +impl<'a> Window<'a> { + pub fn new(cc: &eframe::CreationContext<'_>, state: &'a mut State, wake: &'a Receiver) -> Self { + let logo = cc.egui_ctx.load_texture("logo", + egui::ColorImage::from_rgba_unmultiplied([super::ICON_SIZE as usize; 2], super::ICON_RGBA), TextureOptions::LINEAR); + let start_hidden = std::mem::take(&mut state.start_hidden); + let needs_show = !start_hidden && state.corner_position().is_none() && !hide_by_closing(); + Self { state, wake, logo, qr: HashMap::new(), visible: !start_hidden && !needs_show, focused: false, was_focused: false, needs_show, place_frames: 3 } + } + + pub fn qr_for(&mut self, ctx: &egui::Context, card_id: u64, link: &str) -> Option { + if let Some((known, texture)) = self.qr.get(&card_id) { + if known == link { return Some(texture.clone()); } + } + let texture = qr_texture(ctx, &format!("qr-{card_id}"), link)?; + self.qr.insert(card_id, (link.to_string(), texture.clone())); + Some(texture) + } + + fn place(&mut self, ctx: &egui::Context) { + let area = super::work_area(ctx.pixels_per_point()) + .or_else(|| ctx.input(|input| input.viewport().monitor_size).map(|monitor| { + egui::Rect::from_min_max(egui::pos2(0.0, 0.0), egui::pos2(monitor.x, monitor.y - 48.0)) + })); + let Some(area) = area else { return }; + if area.width() <= super::WINDOW_WIDTH || area.height() <= super::WINDOW_HEIGHT { return; } + self.state.monitor = Some(area); + ctx.send_viewport_cmd(egui::ViewportCommand::OuterPosition(super::corner_for(area))); + } + + fn show(&mut self, ctx: &egui::Context) { + ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false)); + ctx.send_viewport_cmd(egui::ViewportCommand::Visible(true)); + ctx.send_viewport_cmd(egui::ViewportCommand::Focus); + self.visible = true; + self.place_frames = 3; + ctx.request_repaint(); + } + + pub fn minimize(&mut self, ctx: &egui::Context) { + if !self.state.has_tray { + ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(true)); + } else if hide_by_closing() { + ctx.send_viewport_cmd(egui::ViewportCommand::Close); + } else { + ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false)); + self.visible = false; + } + } + + pub fn quit(&mut self, ctx: &egui::Context) { + self.state.quitting = true; + ctx.send_viewport_cmd(egui::ViewportCommand::Close); + } + + fn wake_events(&mut self, ctx: &egui::Context) { + while let Ok(wake) = self.wake.try_recv() { + match wake { + Wake::Toggle => if self.visible && self.focused { self.minimize(ctx) } else { self.show(ctx) }, + Wake::Show => self.show(ctx), + Wake::OpenLink(link) => { if let Some(link) = link { self.state.open_link(link); } self.show(ctx); } + Wake::Quit => self.quit(ctx), + } + } + } + + fn nav(&mut self, root: &mut Ui) { + let ctx = root.ctx().clone(); + let frame = Frame::new().fill(theme::BACKGROUND).inner_margin(Margin::symmetric(theme::GUTTER as i8, 0)); + egui::Panel::top("nav").frame(frame).exact_size(52.0).resizable(false).show_separator_line(false).show(root, |ui| { + ui.with_layout(Layout::left_to_right(Align::Center), |ui| { + ui.spacing_mut().item_spacing.x = 6.0; + ui.image((self.logo.id(), egui::vec2(22.0, 22.0))); + widgets::text_family(ui, "frislit", 15.0, theme::TEXT, theme::bold()); + ui.add_space(6.0); + for (page, label) in [(Page::Tunnels, "Tunnels"), (Page::Connect, "Connect"), (Page::Settings, "Settings")] { + let active = match (self.state.page, page) { + (Page::Tunnels | Page::NewTunnel | Page::Tunnel(_), Page::Tunnels) => true, + (current, target) => current == target, + }; + if nav_link(ui, label, active).clicked() { self.state.page = page; } + } + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if widgets::minimize_button(ui).clicked() { self.minimize(&ctx); } + }); + }); + let rect = ui.max_rect(); + let y = rect.bottom() + 0.5; + ui.painter().line_segment([egui::pos2(rect.left() - theme::GUTTER, y), egui::pos2(rect.right() + theme::GUTTER, y)], Stroke::new(1.0, theme::BORDER)); + }); + } + + fn toasts(&mut self, ctx: &egui::Context) { + self.state.toasts.retain(|toast| !toast.expired()); + if self.state.toasts.is_empty() { return; } + ctx.request_repaint_after(Duration::from_millis(250)); + let mut acted = None; + egui::Area::new(egui::Id::new("toasts")).anchor(egui::Align2::CENTER_BOTTOM, egui::vec2(0.0, -16.0)).order(egui::Order::Foreground).show(ctx, |ui| { + ui.set_max_width(super::WINDOW_WIDTH - 32.0); + ui.vertical(|ui| { + for (index, toast) in self.state.toasts.iter().enumerate() { + let (color, dot) = if toast.error { (theme::ERROR, theme::ERROR) } else { (theme::TEXT, theme::SUCCESS) }; + Frame::new().fill(theme::SURFACE_RAISED).stroke(Stroke::new(1.0, theme::BORDER_STRONG)) + .corner_radius(theme::corner(theme::RADIUS_INPUT)).inner_margin(Margin::symmetric(14, 10)) + .shadow(egui::epaint::Shadow { offset: [0, 6], blur: 24, spread: 0, color: Color32::from_black_alpha(140) }) + .show(ui, |ui| { + ui.horizontal(|ui| { + widgets::dot(ui, dot); + ui.add(egui::Label::new(RichText::new(&toast.text).size(13.0).color(color)).wrap()); + if toast.action.is_some() && widgets::button(ui, "Reopen", widgets::ButtonKind::Ghost).clicked() { acted = Some(index); } + }); + }); + } + }); + }); + if let Some(ToastAction::Reopen(kind, opts)) = acted.and_then(|index| self.state.toasts.remove(index).action) { self.state.start_tunnel(kind, opts); } + } + + pub fn content(ui: &mut Ui, add: impl FnOnce(&mut Ui)) { + let total = ui.available_width(); + let width = total - theme::GUTTER * 2.0; + let outer = ui.available_rect_before_wrap(); + let rect = egui::Rect::from_min_size(egui::pos2(outer.left() + theme::GUTTER, outer.top() + 20.0), egui::vec2(width, f32::INFINITY)); + let mut child = ui.new_child(UiBuilder::new().max_rect(rect).layout(Layout::top_down(Align::Min))); + child.set_width(width); + add(&mut child); + ui.allocate_space(egui::vec2(total, child.min_rect().height() + 20.0 + 40.0)); + } +} + +fn nav_link(ui: &mut Ui, label: &str, active: bool) -> egui::Response { + let galley = ui.painter().layout_no_wrap(label.to_string(), theme::font(13.0, theme::medium()), Color32::WHITE); + let size = galley.size() + egui::vec2(18.0, 10.0); + let (rect, response) = ui.allocate_exact_size(size, Sense::click()); + let fill = if active { theme::SURFACE_HOVER } else { Color32::TRANSPARENT }; + let color = if active || response.hovered() { theme::TEXT } else { theme::MUTED }; + ui.painter().rect_filled(rect, theme::corner(theme::RADIUS_SMALL), fill); + ui.painter().galley(rect.center() - galley.size() / 2.0, galley, color); + if response.hovered() { ui.ctx().set_cursor_icon(CursorIcon::PointingHand); } + response +} + +pub fn qr_texture(ctx: &egui::Context, name: &str, text: &str) -> Option { + let code = qrcode::QrCode::new(text.as_bytes()).ok()?; + let width = code.width(); + let quiet = 2; + let size = width + quiet * 2; + let colors = code.to_colors(); + let mut rgba = vec![0u8; size * size * 4]; + for y in 0..size { + for x in 0..size { + let inside = quiet..width + quiet; + let dark = inside.contains(&x) && inside.contains(&y) && colors[(y - quiet) * width + (x - quiet)] == qrcode::Color::Dark; + let color = if dark { theme::BACKGROUND } else { theme::TEXT }; + let offset = (y * size + x) * 4; + rgba[offset..offset + 4].copy_from_slice(&[color.r(), color.g(), color.b(), 255]); + } + } + let image = egui::ColorImage::from_rgba_unmultiplied([size, size], &rgba); + Some(ctx.load_texture(name, image, TextureOptions::NEAREST)) +} + +impl eframe::App for Window<'_> { + fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + self.was_focused = self.focused; + self.focused = ctx.input(|input| input.viewport().focused.unwrap_or(false)); + self.wake_events(ctx); + self.state.drain(ctx); + if !self.visible || !self.state.has_tray || self.place_frames > 0 { return; } + let lost_focus = self.was_focused && !self.focused && !self.state.new_tunnel.picking_dir; + let escaped = self.focused && ctx.memory(|memory| memory.focused().is_none()) && ctx.input(|input| input.key_pressed(egui::Key::Escape)); + if lost_focus || escaped { self.minimize(ctx); } + } + + fn ui(&mut self, root: &mut Ui, _frame: &mut eframe::Frame) { + let ctx = root.ctx().clone(); + let closing = ctx.input(|input| input.viewport().close_requested()); + if closing && !self.state.quitting && self.state.has_tray && !hide_by_closing() { + ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose); + self.minimize(&ctx); + } + if self.needs_show { self.needs_show = false; self.show(&ctx); } + if self.place_frames > 0 { + self.place_frames -= 1; + self.place(&ctx); + ctx.request_repaint_after(Duration::from_millis(30)); + } + self.state.scan_ports.store(self.visible && self.state.page == Page::Tunnels && self.state.linked(), Ordering::Relaxed); + let rect = ctx.content_rect(); + ctx.layer_painter(egui::LayerId::background()).rect_stroke(rect, 0.0, Stroke::new(1.0, theme::BORDER_STRONG), egui::StrokeKind::Inside); + self.nav(root); + egui::CentralPanel::default().frame(Frame::new().fill(theme::BACKGROUND)).show(root, |ui| { + let scroll_id = match self.state.page { Page::Tunnels => 0u64, Page::NewTunnel => 1, Page::Tunnel(id) => 100 + id, Page::Connect => 2, Page::Settings => 3 }; + egui::ScrollArea::vertical().id_salt(("page", scroll_id)).auto_shrink([false, false]).show(ui, |ui| { + match self.state.page { + Page::Tunnels => self.tunnels_page(ui), + Page::NewTunnel => self.new_tunnel_page(ui), + Page::Tunnel(id) => self.tunnel_page(ui, id), + Page::Connect => self.connect_page(ui), + Page::Settings => self.settings_page(ui), + } + }); + }); + self.toasts(&ctx); + } +} + +fn linked(result: anyhow::Result<(Me, ServerInfo)>) -> Result { + result.map(|(me, info)| format!("Linked to {} as {}", info.name, me.label())).map_err(|err| format!("{err:#}")) +} + +async fn reachable(target: &Target) -> bool { + let Ok(addrs) = target.resolve().await else { return false }; + tokio::time::timeout(PROBE_TIMEOUT, connect_target(&addrs)).await.is_ok_and(|result| result.is_ok()) +} + +async fn probe(mailbox: Mailbox, id: u64, target: Target) { + while !reachable(&target).await { + mailbox.send(Msg::TunnelProbe(id, Some(format!("Nothing is listening on {} yet", target.authority())))); + tokio::time::sleep(PROBE_INTERVAL).await; + } + mailbox.send(Msg::TunnelProbe(id, None)); +} + +pub fn state_label(state: &TunnelState) -> &'static str { + match state { + TunnelState::Connecting => "Connecting", + TunnelState::Online => "Online", + TunnelState::Reconnecting { .. } => "Reconnecting", + } +} + +pub fn state_dot(state: &TunnelState) -> Color32 { + match state { + TunnelState::Connecting => theme::MUTED, + TunnelState::Online => theme::SUCCESS, + TunnelState::Reconnecting { .. } => theme::WARNING, + } +} diff --git a/cli/src/gui/autostart.rs b/cli/src/gui/autostart.rs new file mode 100644 index 0000000..a298efe --- /dev/null +++ b/cli/src/gui/autostart.rs @@ -0,0 +1,53 @@ +use anyhow::Result; + +#[cfg(unix)] +fn entry() -> Result { + use anyhow::Context; + #[cfg(target_os = "linux")] + let path = dirs::config_dir().context("No config directory")?.join("autostart/frislit.desktop"); + #[cfg(target_os = "macos")] + let path = dirs::home_dir().context("No home directory")?.join("Library/LaunchAgents/dev.frislit.gui.plist"); + Ok(path) +} + +#[cfg(unix)] +pub fn enabled() -> bool { + entry().is_ok_and(|path| path.exists()) +} + +#[cfg(unix)] +pub fn set(on: bool) -> Result<()> { + let path = entry()?; + if !on { let _ = std::fs::remove_file(&path); return Ok(()); } + std::fs::create_dir_all(path.parent().unwrap())?; + let exe = std::env::current_exe()?; + #[cfg(target_os = "linux")] + let body = format!("[Desktop Entry]\nType=Application\nName=frislit\nExec={} gui --hidden\nX-GNOME-Autostart-enabled=true\n", exe.display()); + #[cfg(target_os = "macos")] + let body = format!( + "\n\n\nLabeldev.frislit.gui\nProgramArguments{}gui--hidden\nRunAtLoad\n\n", + exe.display()); + std::fs::write(&path, body)?; + Ok(()) +} + +#[cfg(windows)] +const RUN_KEY: &str = r"HKCU\Software\Microsoft\Windows\CurrentVersion\Run"; + +#[cfg(windows)] +fn reg(args: &[&str]) -> Result { + Ok(std::process::Command::new("reg").args(args).output()?.status.success()) +} + +#[cfg(windows)] +pub fn enabled() -> bool { + reg(&["query", RUN_KEY, "/v", "frislit"]).unwrap_or(false) +} + +#[cfg(windows)] +pub fn set(on: bool) -> Result<()> { + let command = format!("\"{}\" gui --hidden", std::env::current_exe()?.display()); + let done = if on { reg(&["add", RUN_KEY, "/v", "frislit", "/t", "REG_SZ", "/d", &command, "/f"])? } else { reg(&["delete", RUN_KEY, "/v", "frislit", "/f"])? }; + anyhow::ensure!(done, "Could not update the autostart entry"); + Ok(()) +} diff --git a/cli/src/gui/format.rs b/cli/src/gui/format.rs new file mode 100644 index 0000000..3431565 --- /dev/null +++ b/cli/src/gui/format.rs @@ -0,0 +1,15 @@ +use std::time::Instant; + +pub fn ago(since: Instant) -> String { + let secs = since.elapsed().as_secs(); + if secs < 5 { "just now".into() } + else if secs < 60 { format!("{secs}s ago") } + else if secs < 3600 { format!("{}m ago", secs / 60) } + else if secs < 86_400 { format!("{}h ago", secs / 3600) } + else { format!("{}d ago", secs / 86_400) } +} + +pub fn host_of(url: &str) -> String { + let rest = url.split("://").nth(1).unwrap_or(url); + rest.split('/').next().unwrap_or(rest).to_string() +} diff --git a/cli/src/gui/instance.rs b/cli/src/gui/instance.rs new file mode 100644 index 0000000..639ca32 --- /dev/null +++ b/cli/src/gui/instance.rs @@ -0,0 +1,64 @@ +use anyhow::{Context, Result}; +use std::io::{BufRead, BufReader, Write}; +use std::net::TcpStream; +use std::path::PathBuf; +use std::time::Duration; +use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader as AsyncBufReader}; +use tokio::net::TcpListener; +use tokio::runtime::Handle; + +const TIMEOUT: Duration = Duration::from_millis(800); + +fn lock_file() -> Result { + let dir = dirs::config_dir().context("No config directory")?.join("frislit"); + std::fs::create_dir_all(&dir)?; + Ok(dir.join("gui.instance")) +} + +pub fn hand_over(link: Option<&str>) -> bool { + let Ok(path) = lock_file() else { return false }; + let Ok(contents) = std::fs::read_to_string(&path) else { return false }; + let mut lines = contents.lines(); + let (Some(port), Some(secret)) = (lines.next().and_then(|p| p.parse::().ok()), lines.next()) else { return false }; + let addr = std::net::SocketAddr::from(([127, 0, 0, 1], port)); + let Ok(mut stream) = TcpStream::connect_timeout(&addr, TIMEOUT) else { return false }; + let _ = stream.set_read_timeout(Some(TIMEOUT)); + if writeln!(stream, "{secret} {}", link.unwrap_or("")).is_err() { return false; } + let mut reply = String::new(); + BufReader::new(stream).read_line(&mut reply).is_ok() && reply.trim() == "ok" +} + +pub fn serve(runtime: &Handle, on_link: impl Fn(Option) + Send + Sync + 'static) -> Result<()> { + let listener = runtime.block_on(TcpListener::bind("127.0.0.1:0"))?; + let port = listener.local_addr()?.port(); + let secret: String = (0..32).map(|_| { let n = rand_byte() % 36; (if n < 10 { b'0' + n } else { b'a' + n - 10 }) as char }).collect(); + let path = lock_file()?; + std::fs::write(&path, format!("{port}\n{secret}\n"))?; + #[cfg(unix)] + { use std::os::unix::fs::PermissionsExt; let _ = std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600)); } + + runtime.spawn(async move { + loop { + let Ok((stream, _)) = listener.accept().await else { continue }; + let mut reader = AsyncBufReader::new(stream); + let mut line = String::new(); + let Ok(Ok(_)) = tokio::time::timeout(TIMEOUT, reader.read_line(&mut line)).await else { continue }; + let Some((given, link)) = line.trim_end().split_once(' ') else { continue }; + if given != secret { continue; } + let link = link.trim().to_string(); + on_link(if link.is_empty() { None } else { Some(link) }); + let _ = reader.get_mut().write_all(b"ok\n").await; + } + }); + Ok(()) +} + +pub fn release() { + if let Ok(path) = lock_file() { let _ = std::fs::remove_file(path); } +} + +fn rand_byte() -> u8 { + use std::collections::hash_map::RandomState; + use std::hash::{BuildHasher, Hasher}; + (RandomState::new().build_hasher().finish() >> 24) as u8 +} diff --git a/cli/src/gui/linux.rs b/cli/src/gui/linux.rs new file mode 100644 index 0000000..561254d --- /dev/null +++ b/cli/src/gui/linux.rs @@ -0,0 +1,43 @@ +use eframe::egui; +use x11rb::connection::Connection; +use x11rb::protocol::randr; +use x11rb::protocol::xproto::{AtomEnum, ConnectionExt}; + +#[derive(PartialEq)] +pub enum Backend { X11, Wayland } + +pub fn choose_backend() -> Backend { + let has_x11 = std::env::var_os("DISPLAY").is_some_and(|value| !value.is_empty()); + let has_wayland = std::env::var_os("WAYLAND_DISPLAY").is_some_and(|value| !value.is_empty()); + if has_x11 { + if has_wayland { std::env::remove_var("WAYLAND_DISPLAY"); } + Backend::X11 + } else { + Backend::Wayland + } +} + +pub fn primary_work_area(pixels_per_point: f32) -> Option { + let (connection, screen_number) = x11rb::connect(None).ok()?; + let root = connection.setup().roots.get(screen_number)?.root; + + let monitors = randr::get_monitors(&connection, root, true).ok()?.reply().ok()?.monitors; + let monitor = monitors.iter().find(|monitor| monitor.primary).or_else(|| monitors.first())?; + let mut area = egui::Rect::from_min_size( + egui::pos2(monitor.x as f32, monitor.y as f32), + egui::vec2(monitor.width as f32, monitor.height as f32), + ); + + let atom = connection.intern_atom(false, b"_NET_WORKAREA").ok()?.reply().ok()?.atom; + let reply = connection.get_property(false, root, atom, AtomEnum::CARDINAL, 0, 4).ok()?.reply().ok()?; + if let Some(mut values) = reply.value32() { + if let (Some(x), Some(y), Some(width), Some(height)) = (values.next(), values.next(), values.next(), values.next()) { + let work = egui::Rect::from_min_size(egui::pos2(x as f32, y as f32), egui::vec2(width as f32, height as f32)); + area = area.intersect(work); + } + } + if area.width() <= 0.0 || area.height() <= 0.0 { return None; } + + let scale = 1.0 / pixels_per_point; + Some(egui::Rect::from_min_max(egui::pos2(area.left() * scale, area.top() * scale), egui::pos2(area.right() * scale, area.bottom() * scale))) +} diff --git a/cli/src/gui/mod.rs b/cli/src/gui/mod.rs new file mode 100644 index 0000000..f901fd9 --- /dev/null +++ b/cli/src/gui/mod.rs @@ -0,0 +1,157 @@ +mod app; +mod autostart; +mod format; +mod instance; +#[cfg(target_os = "linux")] +mod linux; +mod pages; +mod ports; +mod theme; +mod tray; +mod widgets; + +use anyhow::{Context, Result}; +use eframe::egui; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{mpsc, Arc, Mutex}; +use tokio::runtime::Handle; + +const ICON_SIZE: u32 = 128; +const ICON_RGBA: &[u8] = include_bytes!("../../assets/icon-128.rgba"); + +pub const WINDOW_WIDTH: f32 = 396.0; +pub const WINDOW_HEIGHT: f32 = 704.0; +const CORNER_MARGIN: f32 = 12.0; + +static WAYLAND: AtomicBool = AtomicBool::new(false); + +pub fn hide_by_closing() -> bool { WAYLAND.load(Ordering::Relaxed) } + +pub const HOTKEY_LABEL: &str = "Super+Shift+T"; + +pub enum Wake { Toggle, Show, OpenLink(Option), Quit } + +#[derive(Clone, Default)] +pub struct Repaint(Arc>>); + +impl Repaint { + pub fn attach(&self, ctx: &egui::Context) { *self.0.lock().unwrap() = Some(ctx.clone()); } + pub fn detach(&self) { *self.0.lock().unwrap() = None; } + pub fn ping(&self) { if let Some(ctx) = self.0.lock().unwrap().as_ref() { ctx.request_repaint(); } } +} + +pub fn launch(runtime: Handle, link: Option, hidden: bool) -> Result<()> { + detach_console(); + if instance::hand_over(link.as_deref()) { return Ok(()); } + #[cfg(target_os = "linux")] + WAYLAND.store(linux::choose_backend() == linux::Backend::Wayland, Ordering::Relaxed); + + let (wake_tx, wake_rx) = mpsc::channel::(); + let repaint = Repaint::default(); + let tray = tray::start(wake_tx.clone(), repaint.clone(), &runtime).ok(); + { + let (wake_tx, repaint) = (wake_tx.clone(), repaint.clone()); + instance::serve(&runtime, move |link| { let _ = wake_tx.send(Wake::OpenLink(link)); repaint.ping(); }) + .context("Could not listen for links from the browser")?; + } + + let hotkey = hotkey(wake_tx.clone(), repaint.clone()); + let mut state = app::State::new(runtime, repaint.clone(), tray.is_some()); + state.start_hidden = hidden && tray.is_some(); + state.hotkey = hotkey.is_some(); + if let Some(link) = link { state.open_link(link); } + + let mut open = !(state.start_hidden && hide_by_closing()); + let result = loop { + if open { + if let Err(err) = run_window(&mut state, &wake_rx, &repaint) { break Err(err); } + if state.quitting { break Ok(()); } + } + open = true; + match wake_rx.recv() { + Ok(Wake::Toggle | Wake::Show) => {} + Ok(Wake::OpenLink(link)) => { if let Some(link) = link { state.open_link(link); } } + Ok(Wake::Quit) | Err(_) => break Ok(()), + } + }; + state.stop_all(); + instance::release(); + if state.relaunch { let _ = std::process::Command::new(std::env::current_exe()?).arg("gui").spawn(); } + result +} + +fn run_window(state: &mut app::State, wake_rx: &mpsc::Receiver, repaint: &Repaint) -> Result<()> { + let icon = egui::IconData { rgba: ICON_RGBA.to_vec(), width: ICON_SIZE, height: ICON_SIZE }; + let viewport = egui::ViewportBuilder::default() + .with_title("frislit") + .with_app_id("dev.frislit.cli") + .with_inner_size([WINDOW_WIDTH, WINDOW_HEIGHT]) + .with_min_inner_size([WINDOW_WIDTH, WINDOW_HEIGHT]) + .with_max_inner_size([WINDOW_WIDTH, WINDOW_HEIGHT]) + .with_resizable(false) + .with_decorations(false) + .with_taskbar(false) + .with_icon(Arc::new(icon)); + let viewport = match state.corner_position() { + Some(position) => viewport.with_position(position), + None => viewport.with_visible(hide_by_closing()), + }; + let viewport = if state.start_hidden { viewport.with_visible(false) } else { viewport }; + let options = eframe::NativeOptions { viewport, ..Default::default() }; + + let outcome = eframe::run_native("frislit", options, Box::new(|cc| { + theme::install(&cc.egui_ctx); + repaint.attach(&cc.egui_ctx); + Ok(Box::new(app::Window::new(cc, state, wake_rx))) + })); + repaint.detach(); + outcome.map_err(|err| anyhow::anyhow!("{err}")).context("Could not open the frislit window") +} + +fn hotkey(wake: mpsc::Sender, repaint: Repaint) -> Option { + use global_hotkey::{hotkey::{Code, HotKey, Modifiers}, GlobalHotKeyEvent, GlobalHotKeyManager, HotKeyState}; + let manager = GlobalHotKeyManager::new().ok()?; + manager.register(HotKey::new(Some(Modifiers::SUPER | Modifiers::SHIFT), Code::KeyT)).ok()?; + GlobalHotKeyEvent::set_event_handler(Some(move |event: GlobalHotKeyEvent| { + if event.state == HotKeyState::Pressed { let _ = wake.send(Wake::Toggle); repaint.ping(); } + })); + Some(manager) +} + +pub fn corner_for(area: egui::Rect) -> egui::Pos2 { + egui::pos2(area.right() - WINDOW_WIDTH - CORNER_MARGIN, area.bottom() - WINDOW_HEIGHT - CORNER_MARGIN) +} + +#[cfg(windows)] +fn detach_console() { + use windows_sys::Win32::System::Console::{FreeConsole, GetConsoleProcessList}; + let mut processes = [0u32; 2]; + let count = unsafe { GetConsoleProcessList(processes.as_mut_ptr(), processes.len() as u32) }; + if count <= 1 { unsafe { FreeConsole(); } } +} + +#[cfg(not(windows))] +fn detach_console() {} + +#[cfg(target_os = "linux")] +pub fn work_area(pixels_per_point: f32) -> Option { + if hide_by_closing() { return None; } + linux::primary_work_area(pixels_per_point) +} + +#[cfg(windows)] +pub fn work_area(pixels_per_point: f32) -> Option { + use windows_sys::Win32::Foundation::RECT; + use windows_sys::Win32::UI::WindowsAndMessaging::{SystemParametersInfoW, SPI_GETWORKAREA}; + let mut rect = RECT { left: 0, top: 0, right: 0, bottom: 0 }; + let ok = unsafe { SystemParametersInfoW(SPI_GETWORKAREA, 0, &mut rect as *mut RECT as *mut _, 0) }; + if ok == 0 { return None; } + let scale = 1.0 / pixels_per_point; + Some(egui::Rect::from_min_max( + egui::pos2(rect.left as f32 * scale, rect.top as f32 * scale), + egui::pos2(rect.right as f32 * scale, rect.bottom as f32 * scale), + )) +} + +#[cfg(not(any(windows, target_os = "linux")))] +pub fn work_area(_pixels_per_point: f32) -> Option { None } diff --git a/cli/src/gui/pages/connect.rs b/cli/src/gui/pages/connect.rs new file mode 100644 index 0000000..82a3965 --- /dev/null +++ b/cli/src/gui/pages/connect.rs @@ -0,0 +1,92 @@ +use eframe::egui::{self, Align, Layout, Ui}; +use crate::gui::app::{JoinState, Window}; +use crate::gui::widgets::{self, ButtonKind, FieldOptions}; +use crate::gui::{format, theme}; + +impl Window<'_> { + pub fn connect_page(&mut self, ui: &mut Ui) { + let logo = self.logo.id(); + let state = &mut self.state; + Window::content(ui, |ui| { + let mut start = None; + ui.vertical_centered(|ui| { + ui.add_space(if state.joins.is_empty() { 96.0 } else { 24.0 }); + ui.image((logo, egui::vec2(56.0, 56.0))); + ui.add_space(14.0); + widgets::text_family(ui, "Paste a share link.", 24.0, theme::TEXT, theme::semibold()); + ui.add_space(20.0); + ui.with_layout(Layout::top_down(Align::Min), |ui| { + let form = &mut state.connect; + let mut submit = widgets::field(ui, "connect-link", &mut form.link, FieldOptions { hint: "https://frislit.example.com/@frislit/connect/…", mono: true, ..Default::default() }).lost_focus() + && ui.input(|input| input.key_pressed(egui::Key::Enter)); + ui.add_space(10.0); + if let Some(error) = &form.error { widgets::error_notice(ui, error); ui.add_space(10.0); } + if let Some(port) = &mut form.retry_port { + widgets::field(ui, "connect-port", port, FieldOptions { label: Some("Local port"), hint: "4000", mono: true, ..Default::default() }); + ui.add_space(10.0); + } + if widgets::button_sized(ui, "Connect", ButtonKind::Primary, ui.available_width()).clicked() { submit = true; } + if submit { + let link = form.link.trim().to_string(); + let port = form.retry_port.as_ref().map(|port| port.trim().parse::()).transpose(); + if link.is_empty() { + form.error = Some("Paste a share link first".into()); + } else if let Ok(port) = port { + start = Some((link, port)); + } else { + form.error = Some("The local port must be a number between 1 and 65535".into()); + } + } + }); + }); + if let Some((link, port)) = start { state.start_join(link, port, "127.0.0.1".into()); } + + if state.joins.is_empty() { return; } + ui.add_space(36.0); + + let mut stop = None; + ui.spacing_mut().item_spacing.y = 8.0; + for join in &state.joins { + widgets::card(ui, |ui| { + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 8.0; + match &join.state { + JoinState::Connecting => widgets::dot(ui, theme::MUTED), + JoinState::Forwarding => widgets::dot(ui, theme::SUCCESS), + JoinState::Reconnecting { .. } => widgets::dot(ui, theme::WARNING), + } + ui.scope(|ui| { + ui.set_max_width(ui.available_width() - 84.0); + if let Some(forwarding) = &join.forwarding { + widgets::mono(ui, format!("Port {}", forwarding.port), 14.0, theme::TEXT); + widgets::arrow_right(ui, theme::MUTED); + ui.add(egui::Label::new(egui::RichText::new(&forwarding.tunnel_id).size(13.0).color(theme::PRIMARY_BRIGHT).family(theme::mono())).truncate()); + } else { + ui.add(egui::Label::new(egui::RichText::new(&join.target).size(12.5).color(theme::SUBTEXT).family(theme::mono())).truncate()); + } + }); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if widgets::button(ui, "Stop", ButtonKind::Danger).clicked() { stop = Some(join.id); } + }); + }); + ui.add_space(2.0); + widgets::text(ui, format!("{} · {}", format::host_of(&join.server), format::ago(join.started)), 12.0, theme::MUTED); + + match &join.state { + JoinState::Reconnecting { seconds, reason } => { + ui.add_space(8.0); + let text = match reason { Some(reason) => format!("Connection lost, retrying in {seconds}s ({reason})"), None => "Connection lost, reconnecting...".to_string() }; + widgets::warning_notice(ui, &text); + } + JoinState::Forwarding if join.forwarding.as_ref().is_some_and(|f| !f.owner_online) => { + ui.add_space(8.0); + widgets::warning_notice(ui, "The owner is offline right now."); + } + _ => {} + } + }); + } + if let Some(id) = stop { state.stop_join(id); } + }); + } +} diff --git a/cli/src/gui/pages/detail.rs b/cli/src/gui/pages/detail.rs new file mode 100644 index 0000000..d978303 --- /dev/null +++ b/cli/src/gui/pages/detail.rs @@ -0,0 +1,155 @@ +use eframe::egui::{self, Align, Layout, Ui}; +use crate::gui::app::{state_dot, state_label, Page, TunnelKind, TunnelState, Window}; +use crate::gui::widgets::{self, ButtonKind}; +use crate::gui::{format, theme}; +use crate::session::{bytes, took}; + +impl Window<'_> { + pub fn tunnel_page(&mut self, ui: &mut Ui, id: u64) { + let server_url = self.state.server_url(); + let Some(index) = self.state.tunnels.iter().position(|card| card.id == id) else { self.state.page = Page::Tunnels; return }; + let link = self.state.tunnels[index].link(&server_url); + let qr = match (&link, self.state.tunnels[index].show_qr) { + (Some(link), true) => self.qr_for(&ui.ctx().clone(), id, link), + _ => None, + }; + let mut go_back = false; + let mut stop = false; + + Window::content(ui, |ui| { + let card = &mut self.state.tunnels[index]; + if widgets::back_link(ui, "Tunnels").clicked() { go_back = true; } + ui.add_space(12.0); + + ui.add(egui::Label::new(egui::RichText::new(card.title()).size(20.0).color(theme::TEXT).family(theme::semibold())).truncate()); + ui.add_space(6.0); + ui.horizontal_wrapped(|ui| { + ui.spacing_mut().item_spacing = egui::vec2(6.0, 4.0); + widgets::dot(ui, state_dot(&card.state)); + widgets::text(ui, state_label(&card.state), 12.5, theme::SUBTEXT); + widgets::text(ui, "·", 12.5, theme::MUTED); + widgets::text(ui, card.kind.label(), 12.5, theme::SUBTEXT); + widgets::text(ui, "·", 12.5, theme::MUTED); + widgets::mono(ui, &card.target_label, 12.5, theme::SUBTEXT); + widgets::text(ui, "·", 12.5, theme::MUTED); + widgets::text(ui, format!("started {}", format::ago(card.started)), 12.5, theme::MUTED); + }); + if let Some(access) = &card.access { + ui.add_space(4.0); + widgets::text(ui, format!("Access: {access}"), 12.5, theme::SUBTEXT); + } + if let Some(warning) = &card.probe { + ui.add_space(4.0); + widgets::text(ui, warning, 12.5, theme::WARNING); + } + ui.add_space(12.0); + ui.horizontal(|ui| { + if let Some(online) = &card.online { + if let Some(url) = &online.url { + if widgets::button(ui, "Open in browser", ButtonKind::Secondary).clicked() { ui.ctx().open_url(egui::OpenUrl::new_tab(url)); } + } + if widgets::button(ui, "Dashboard", ButtonKind::Secondary).clicked() { + ui.ctx().open_url(egui::OpenUrl::new_tab(format!("{server_url}/@frislit/tunnels/{}", online.id))); + } + } + if widgets::button(ui, "Stop", ButtonKind::Danger).clicked() { stop = true; } + }); + ui.add_space(12.0); + + if let TunnelState::Reconnecting { seconds, reason } = &card.state { + let text = match reason { Some(reason) => format!("Connection lost, retrying in {seconds}s ({reason})"), None => "Connection lost, reconnecting...".to_string() }; + widgets::warning_notice(ui, &text); + ui.add_space(12.0); + } + + if let Some(link) = &link { + let is_share = card.online.as_ref().is_some_and(|online| online.url.is_none()); + let shown = if is_share { format!("frislit connect {link}") } else { link.clone() }; + widgets::copy_row(ui, ("copy", card.id), &shown, &mut card.copied_at); + ui.add_space(8.0); + let label = if card.show_qr { "Hide QR code" } else { "Show QR code" }; + if widgets::button(ui, label, ButtonKind::Ghost).clicked() { card.show_qr = !card.show_qr; } + if let Some(qr) = &qr { + ui.vertical_centered(|ui| { + egui::Frame::new().fill(theme::TEXT).corner_radius(theme::corner(theme::RADIUS_INPUT)).inner_margin(egui::Margin::same(8)).show(ui, |ui| { + ui.image((qr.id(), egui::vec2(176.0, 176.0))); + }); + }); + } + } else if card.state == TunnelState::Connecting { + ui.horizontal(|ui| { ui.spinner(); widgets::text(ui, "Connecting to the server...", 14.0, theme::SUBTEXT); }); + } + + ui.add_space(20.0); + if card.kind == TunnelKind::Tcp { + let open = card.connections.iter().filter(|connection| connection.opened).count(); + widgets::section(ui, "Connections", Some(&format!("{open} open"))); + widgets::card(ui, |ui| { + if card.connections.is_empty() { + widgets::text(ui, "No connections yet.", 13.0, theme::MUTED); + return; + } + ui.spacing_mut().item_spacing.y = 8.0; + for connection in card.connections.iter().take(100) { + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 2.0; + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 8.0; + widgets::dot(ui, if connection.opened { theme::SUCCESS } else { theme::MUTED }); + widgets::mono(ui, &connection.protocol, 12.0, theme::TEXT); + widgets::mono(ui, &connection.ip, 12.0, theme::SUBTEXT); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + let right = if connection.opened { connection.detail.clone().unwrap_or_default() } else { format!("{} in · {} out · {}", bytes(connection.bytes_in), bytes(connection.bytes_out), took(connection.duration)) }; + widgets::mono(ui, right, 11.5, theme::MUTED); + }); + }); + let note = if connection.opened { connection.intel() } else { connection.reason.clone() }; + if let Some(note) = note { + ui.horizontal(|ui| { + ui.add_space(16.0); + ui.add(egui::Label::new(egui::RichText::new(note).size(11.5).color(theme::MUTED)).truncate()); + }); + } + }); + } + }); + } else { + widgets::section(ui, "Requests", Some(&format!("{} so far", card.request_count))); + widgets::card(ui, |ui| { + if card.requests.is_empty() { + widgets::text(ui, "No requests yet.", 13.0, theme::MUTED); + return; + } + ui.spacing_mut().item_spacing.y = 8.0; + for logged in card.requests.iter().take(100) { + let request = &logged.request; + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 2.0; + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 8.0; + let method = if request.kind == "ws" { "WS".to_string() } else { request.method.clone() }; + ui.allocate_ui_with_layout(egui::vec2(44.0, 18.0), Layout::left_to_right(Align::Center), |ui| { widgets::mono(ui, method, 12.0, theme::TEXT); }); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + ui.allocate_ui_with_layout(egui::vec2(48.0, 18.0), Layout::right_to_left(Align::Center), |ui| { widgets::mono(ui, format!("{}ms", request.duration), 11.5, theme::MUTED); }); + widgets::mono(ui, request.status.to_string(), 12.0, widgets::status_color(request.status)); + ui.with_layout(Layout::left_to_right(Align::Center), |ui| { + ui.add(egui::Label::new(egui::RichText::new(&request.path).size(12.0).color(theme::SUBTEXT).family(theme::mono())).truncate()); + }); + }); + }); + ui.horizontal(|ui| { + ui.add_space(52.0); + let mut note = request.ip.clone(); + if let Some(intel) = request.intel() { note = format!("{note} · {intel}"); } + ui.add(egui::Label::new(egui::RichText::new(format!("{note} · {}", format::ago(logged.at))).size(11.5).color(theme::MUTED)).truncate()); + }); + }); + } + }); + } + }); + + if stop { self.state.stop_tunnel_by_user(id); } + if go_back { self.state.page = Page::Tunnels; } + } +} diff --git a/cli/src/gui/pages/mod.rs b/cli/src/gui/pages/mod.rs new file mode 100644 index 0000000..f6f0f37 --- /dev/null +++ b/cli/src/gui/pages/mod.rs @@ -0,0 +1,5 @@ +mod connect; +mod detail; +mod new_tunnel; +mod settings; +mod tunnels; diff --git a/cli/src/gui/pages/new_tunnel.rs b/cli/src/gui/pages/new_tunnel.rs new file mode 100644 index 0000000..963485c --- /dev/null +++ b/cli/src/gui/pages/new_tunnel.rs @@ -0,0 +1,137 @@ +use eframe::egui::{self, Align, Layout, Ui}; +use crate::gui::app::{AuthChoice, NewTunnelForm, Page, TunnelKind, Window}; +use crate::gui::widgets::{self, ButtonKind, FieldOptions}; +use crate::gui::theme; +use crate::tunnel::{Access, Options, Rules, Target, TargetSpec}; + +impl Window<'_> { + pub fn new_tunnel_page(&mut self, ui: &mut Ui) { + let state = &mut self.state; + Window::content(ui, |ui| { + if widgets::back_link(ui, "Tunnels").clicked() { state.page = Page::Tunnels; } + ui.add_space(12.0); + widgets::text_family(ui, "New tunnel", 22.0, theme::TEXT, theme::semibold()); + ui.add_space(16.0); + + let mut submit = false; + ui.horizontal(|ui| { + widgets::segmented(ui, &mut state.new_tunnel.kind, &[(TunnelKind::Http, "HTTP"), (TunnelKind::Files, "Folder"), (TunnelKind::Tcp, "TCP + UDP")]); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if widgets::button(ui, "Open", ButtonKind::Primary).clicked() { submit = true; } + }); + }); + if let Some(error) = &state.new_tunnel.error { + ui.add_space(10.0); + widgets::error_notice(ui, error); + } + ui.add_space(14.0); + + let mut browse = false; + let form = &mut state.new_tunnel; + widgets::card(ui, |ui| { + ui.spacing_mut().item_spacing.y = 14.0; + match form.kind { + TunnelKind::Http => { + widgets::field(ui, "nt-target", &mut form.target, FieldOptions { label: Some("Local target"), hint: "3000, 192.168.1.5:8080 or https://localhost:8443", mono: true, ..Default::default() }); + } + TunnelKind::Files => { + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 6.0; + widgets::field_label(ui, "Folder"); + ui.horizontal(|ui| { + let width = ui.available_width() - 96.0; + widgets::field(ui, "nt-dir", &mut form.dir, FieldOptions { hint: "/path/to/dist", mono: true, width: Some(width), ..Default::default() }); + ui.add_enabled_ui(!form.picking_dir, |ui| { + if widgets::button(ui, "Browse", ButtonKind::Secondary).clicked() { browse = true; } + }); + }); + }); + } + TunnelKind::Tcp => { + widgets::field(ui, "nt-tcp", &mut form.target, FieldOptions { label: Some("Local port"), hint: "25565 or 192.168.1.5:5432", mono: true, ..Default::default() }); + } + } + widgets::field(ui, "nt-name", &mut form.name, FieldOptions { label: Some("Name (optional)"), hint: "myapp", mono: true, ..Default::default() }); + if form.kind == TunnelKind::Http { + widgets::toggle_row(ui, "Keep the public host", "Send the public hostname as the Host header", &mut form.keep_host); + } + }); + + ui.add_space(16.0); + widgets::section(ui, "Access", None); + widgets::card(ui, |ui| { + ui.spacing_mut().item_spacing.y = 14.0; + if form.kind != TunnelKind::Tcp { + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 6.0; + widgets::field_label(ui, "Sign-in"); + let label = match form.auth { AuthChoice::Open => "Open to everyone", AuthChoice::Password => "Ask for a password", AuthChoice::Login => "Require a frislit account" }; + egui::ComboBox::from_id_salt("nt-auth").selected_text(label).width(ui.available_width()).show_ui(ui, |ui| { + ui.selectable_value(&mut form.auth, AuthChoice::Open, "Open to everyone"); + ui.selectable_value(&mut form.auth, AuthChoice::Password, "Ask for a password"); + ui.selectable_value(&mut form.auth, AuthChoice::Login, "Require a frislit account"); + }); + }); + if form.auth == AuthChoice::Password { + widgets::field(ui, "nt-password", &mut form.password, FieldOptions { label: Some("Password"), hint: "hunter2", secret: true, ..Default::default() }); + } + } + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 6.0; + widgets::field_label(ui, "Allowed addresses"); + ui.horizontal(|ui| { + let width = ui.available_width() - 80.0; + let entered = widgets::field(ui, "nt-allow", &mut form.allow_input, FieldOptions { hint: "203.0.113.5 or 10.0.0.0/8", mono: true, width: Some(width), ..Default::default() }).lost_focus() + && ui.input(|input| input.key_pressed(egui::Key::Enter)); + if widgets::button(ui, "Add", ButtonKind::Secondary).clicked() || entered { + let value = form.allow_input.trim().to_string(); + if !value.is_empty() && !form.allow.contains(&value) { form.allow.push(value); } + form.allow_input.clear(); + } + }); + let mut drop = None; + for (index, cidr) in form.allow.iter().enumerate() { + ui.horizontal(|ui| { + widgets::mono(ui, cidr, 13.0, theme::SUBTEXT); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if widgets::button(ui, "Remove", ButtonKind::Ghost).clicked() { drop = Some(index); } + }); + }); + } + if let Some(index) = drop { form.allow.remove(index); } + }); + }); + + if browse { state.pick_folder(); } + if submit { + match build_options(&state.new_tunnel) { + Ok(opts) => { + let kind = state.new_tunnel.kind; + state.new_tunnel.error = None; + state.start_tunnel(kind, opts); + } + Err(err) => state.new_tunnel.error = Some(format!("{err:#}")), + } + } + }); + } +} + +fn build_options(form: &NewTunnelForm) -> anyhow::Result { + let name = Some(form.name.trim().to_string()).filter(|name| !name.is_empty()); + let auth = if form.kind == TunnelKind::Tcp { AuthChoice::Open } else { form.auth }; + let password = (auth == AuthChoice::Password).then(|| form.password.clone()); + if password.as_deref() == Some("") { anyhow::bail!("Enter a password, or pick another sign-in option"); } + let access = Access::new(Rules::ips(form.allow.clone()), password, auth == AuthChoice::Login)?; + let target = form.target.trim(); + if form.kind != TunnelKind::Files && target.is_empty() { anyhow::bail!("Enter a port or host:port to share"); } + Ok(match form.kind { + TunnelKind::Http => Options::http(TargetSpec::parse(target)?, name, form.keep_host, access), + TunnelKind::Files => { + let dir = form.dir.trim(); + if dir.is_empty() { anyhow::bail!("Pick the folder to share"); } + Options::http(TargetSpec::dir(dir)?, name, false, access) + } + TunnelKind::Tcp => Options::tcp(Target::parse(target)?, name, access), + }) +} diff --git a/cli/src/gui/pages/settings.rs b/cli/src/gui/pages/settings.rs new file mode 100644 index 0000000..171809f --- /dev/null +++ b/cli/src/gui/pages/settings.rs @@ -0,0 +1,115 @@ +use eframe::egui::{self, Align, Layout, Ui}; +use crate::auth; +use crate::gui::app::Window; +use crate::gui::widgets::{self, ButtonKind}; +use crate::gui::{autostart, theme, HOTKEY_LABEL}; + +impl Window<'_> { + pub fn settings_page(&mut self, ui: &mut Ui) { + let logo = self.logo.id(); + let mut quit = false; + let state = &mut self.state; + let server_url = state.cfg.server_url(); + Window::content(ui, |ui| { + widgets::heading(ui, "Settings"); + ui.add_space(16.0); + + widgets::section(ui, "Server", None); + widgets::card(ui, |ui| { + ui.horizontal(|ui| { + ui.scope(|ui| { + ui.set_max_width(ui.available_width() - 90.0); + match &server_url { + Some(url) => { ui.add(egui::Label::new(egui::RichText::new(url).size(14.0).color(theme::TEXT).family(theme::mono())).truncate()); } + None => { widgets::text(ui, "No server yet", 14.0, theme::SUBTEXT); } + } + }); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if state.linked() { widgets::text(ui, "Linked", 12.5, theme::SUCCESS); } + else if server_url.is_some() { widgets::text(ui, "Not linked", 12.5, theme::WARNING); } + }); + }); + ui.add_space(4.0); + match (&server_url, &state.server_info) { + (None, _) => {} + (Some(_), Some(Ok(info))) => { ui.add(egui::Label::new(egui::RichText::new(format!("{} {} · tunnels under {}", info.name, info.version, info.base_domain)).size(12.5).color(theme::SUBTEXT)).wrap()); } + (Some(_), Some(Err(err))) => { ui.add(egui::Label::new(egui::RichText::new(format!("Not reachable: {err}")).size(12.5).color(theme::ERROR)).wrap()); } + (Some(_), None) => { widgets::text(ui, "Checking...", 12.5, theme::MUTED); } + } + if let Some(me) = &state.me { + ui.add_space(2.0); + widgets::text(ui, format!("Signed in as {}", me.label()), 12.5, theme::SUBTEXT); + } + if state.linked() { + ui.add_space(10.0); + if widgets::button(ui, "Unlink this device", ButtonKind::Danger).clicked() { + match auth::logout() { + Ok(_) => { state.reload_config(); state.toast("Device unlinked"); } + Err(err) => state.toast_error(format!("{err:#}")), + } + } + } + ui.add_space(12.0); + widgets::divider(ui); + ui.add_space(12.0); + let mut accept = state.cfg.accept_invalid_certs; + if widgets::toggle_row(ui, "Accept self-signed certificates", "", &mut accept).changed() { + state.cfg.accept_invalid_certs = accept; + state.login.accept_invalid = accept; + match state.cfg.save() { Ok(_) => state.fetch_info(), Err(err) => state.toast_error(format!("{err:#}")) } + } + }); + + if state.has_tray { + ui.add_space(24.0); + widgets::section(ui, "Window", None); + widgets::card(ui, |ui| { + ui.spacing_mut().item_spacing.y = 14.0; + let mut autostart_on = state.autostart; + if widgets::toggle_row(ui, "Launch at login", "Starts hidden in the tray", &mut autostart_on).changed() { + match autostart::set(autostart_on) { + Ok(_) => state.autostart = autostart_on, + Err(err) => state.toast_error(format!("{err:#}")), + } + } + if state.hotkey { widgets::text(ui, format!("{HOTKEY_LABEL} shows or hides the window"), 12.5, theme::MUTED); } + }); + } + + ui.add_space(24.0); + widgets::section(ui, "About", None); + widgets::card(ui, |ui| { + ui.horizontal(|ui| { + ui.image((logo, egui::vec2(32.0, 32.0))); + widgets::text_family(ui, format!("frislit {}", env!("CARGO_PKG_VERSION")), 14.0, theme::TEXT, theme::semibold()); + if state.has_tray { + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if widgets::button(ui, "Quit", ButtonKind::Danger).clicked() { quit = true; } + }); + } + }); + ui.add_space(4.0); + let mut start_update = false; + match (state.update.clone(), state.managed) { + (Some(version), true) => { widgets::text(ui, format!("{version} is available through your package manager"), 12.5, theme::WARNING); } + (Some(version), false) => { + ui.horizontal(|ui| { + widgets::text(ui, format!("{version} is available"), 12.5, theme::WARNING); + ui.add_enabled_ui(!state.updating, |ui| { + if widgets::button(ui, if state.updating { "Updating..." } else { "Update and restart" }, ButtonKind::Primary).clicked() { start_update = true; } + }); + }); + } + (None, _) => { widgets::text(ui, if state.checked_update { "Up to date" } else { "Checking for updates..." }, 12.5, theme::MUTED); } + } + if start_update { state.start_update(); } + ui.add_space(8.0); + ui.horizontal(|ui| { + if widgets::button(ui, "Documentation", ButtonKind::Ghost).clicked() { ui.ctx().open_url(egui::OpenUrl::new_tab("https://git.fristy.net/fristy/frislit/blob/main/docs/cli.md")); } + if widgets::button(ui, "GitHub", ButtonKind::Ghost).clicked() { ui.ctx().open_url(egui::OpenUrl::new_tab("https://git.fristy.net/fristy/frislit")); } + }); + }); + }); + if quit { self.quit(&ui.ctx().clone()); } + } +} diff --git a/cli/src/gui/pages/tunnels.rs b/cli/src/gui/pages/tunnels.rs new file mode 100644 index 0000000..d5b4106 --- /dev/null +++ b/cli/src/gui/pages/tunnels.rs @@ -0,0 +1,151 @@ +use eframe::egui::{self, Align, Layout, Ui}; +use crate::gui::app::{state_dot, LoginStage, Page, TunnelState, Window}; +use crate::gui::widgets::{self, ButtonKind, FieldOptions}; +use crate::gui::{format, theme}; + +impl Window<'_> { + pub fn tunnels_page(&mut self, ui: &mut Ui) { + Window::content(ui, |ui| { + if !self.state.linked() { + self.login_card(ui); + return; + } + + let state = &mut self.state; + let online = state.tunnels.iter().filter(|card| matches!(card.state, TunnelState::Online)).count(); + ui.horizontal(|ui| { + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 2.0; + widgets::heading(ui, "Tunnels"); + widgets::text(ui, format!("{online} of {} online", state.tunnels.len()), 12.5, theme::MUTED); + }); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if widgets::button(ui, "New tunnel", ButtonKind::Primary).clicked() { + state.new_tunnel.error = None; + state.page = Page::NewTunnel; + } + }); + }); + ui.add_space(16.0); + + if state.tunnels.is_empty() { + widgets::empty_state(ui, "No tunnels yet", "Share a port, a folder or a TCP service.", |ui| { + if widgets::button(ui, "Open your first tunnel", ButtonKind::Secondary).clicked() { state.page = Page::NewTunnel; } + }); + } + + let server_url = state.server_url(); + let mut open = None; + ui.spacing_mut().item_spacing.y = 8.0; + for card in &state.tunnels { + let response = widgets::clickable_card(ui, ("tunnel-row", card.id), |ui| { + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 4.0; + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 8.0; + widgets::dot(ui, state_dot(&card.state)); + widgets::mono(ui, card.title(), 14.0, theme::TEXT); + widgets::text(ui, card.kind.label(), 12.0, theme::MUTED); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + widgets::chevron_right(ui, theme::MUTED); + widgets::text(ui, format::ago(card.started), 12.0, theme::MUTED); + }); + }); + let link = card.link(&server_url).unwrap_or_else(|| "connecting...".into()); + ui.horizontal(|ui| { + ui.add_space(16.0); + ui.add(egui::Label::new(egui::RichText::new(format!("{link} · {}", card.target_label)).size(12.5).color(theme::SUBTEXT)).truncate()); + }); + }); + }); + if response.clicked() { open = Some(card.id); } + } + if let Some(id) = open { state.page = Page::Tunnel(id); } + + let suggestions = state.suggestions(); + if suggestions.is_empty() { return; } + ui.add_space(24.0); + widgets::section(ui, "Listening on this machine", None); + let mut expose = None; + widgets::card(ui, |ui| { + ui.spacing_mut().item_spacing.y = 10.0; + for listener in &suggestions { + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 10.0; + widgets::mono(ui, format!("localhost:{}", listener.port), 14.0, theme::TEXT); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if widgets::button(ui, "Open", ButtonKind::Secondary).clicked() { expose = Some(listener.clone()); } + widgets::text(ui, if listener.is_tcp() { "tcp" } else { "http" }, 12.5, theme::MUTED); + ui.with_layout(Layout::left_to_right(Align::Center), |ui| { + ui.add(egui::Label::new(egui::RichText::new(&listener.process).size(12.5).color(theme::MUTED)).truncate()); + }); + }); + }); + } + }); + if let Some(listener) = expose { state.expose(&listener); } + }); + } + + fn login_card(&mut self, ui: &mut Ui) { + let logo = self.logo.id(); + let state = &mut self.state; + ui.vertical_centered(|ui| { + ui.add_space(28.0); + ui.image((logo, egui::vec2(56.0, 56.0))); + ui.add_space(12.0); + widgets::text_family(ui, "Link this device.", 24.0, theme::TEXT, theme::semibold()); + ui.add_space(24.0); + + ui.with_layout(Layout::top_down(Align::Min), |ui| { + match &state.login.stage { + LoginStage::Idle | LoginStage::Failed(_) => { + let mut submit = widgets::field(ui, "login-server", &mut state.login.server, + FieldOptions { label: Some("Server URL"), hint: "https://frislit.example.com", ..Default::default() }).lost_focus() + && ui.input(|input| input.key_pressed(egui::Key::Enter)); + ui.add_space(10.0); + if state.login.use_key { + submit |= widgets::field(ui, "login-key", &mut state.login.key, + FieldOptions { label: Some("API key"), hint: "Created under Devices in the web UI", mono: true, secret: true, ..Default::default() }).lost_focus() + && ui.input(|input| input.key_pressed(egui::Key::Enter)); + ui.add_space(10.0); + } + widgets::toggle_row(ui, "Accept self-signed certificates", "", &mut state.login.accept_invalid); + ui.add_space(8.0); + if let LoginStage::Failed(message) = &state.login.stage { + widgets::error_notice(ui, message); + ui.add_space(8.0); + } + let label = if state.login.use_key { "Link with key" } else { "Continue" }; + if widgets::button_sized(ui, label, ButtonKind::Primary, ui.available_width()).clicked() { submit = true; } + if submit { if state.login.use_key { state.link_with_key() } else { state.start_login() } } + ui.add_space(4.0); + let other = if state.login.use_key { "Approve in the browser instead" } else { "Use an API key instead" }; + if widgets::button(ui, other, ButtonKind::Ghost).clicked() { state.login.use_key = !state.login.use_key; state.login.stage = LoginStage::Idle; } + } + LoginStage::Starting => { + ui.horizontal(|ui| { ui.spinner(); widgets::text(ui, "Contacting the server...", 14.0, theme::SUBTEXT); }); + } + LoginStage::Waiting { code, url } => { + let code = code.clone(); + let url = url.clone(); + widgets::card(ui, |ui| { + ui.vertical_centered(|ui| { + widgets::text(ui, "Approve this device in your browser", 14.0, theme::SUBTEXT); + ui.add_space(8.0); + widgets::text_family(ui, &code, 30.0, theme::PRIMARY_BRIGHT, theme::bold()); + ui.add_space(8.0); + ui.horizontal(|ui| { ui.spinner(); widgets::text(ui, "Waiting for approval...", 13.0, theme::MUTED); }); + }); + }); + ui.add_space(10.0); + ui.horizontal(|ui| { + if widgets::button(ui, "Open approval page", ButtonKind::Secondary).clicked() { ui.ctx().open_url(egui::OpenUrl::new_tab(&url)); } + if widgets::button(ui, "Cancel", ButtonKind::Ghost).clicked() { state.cancel_login(); } + }); + } + } + }); + }); + } +} diff --git a/cli/src/gui/ports.rs b/cli/src/gui/ports.rs new file mode 100644 index 0000000..a316fc1 --- /dev/null +++ b/cli/src/gui/ports.rs @@ -0,0 +1,79 @@ +use std::collections::BTreeMap; + +#[derive(Clone)] +pub struct Listener { pub port: u16, pub process: String } + +const TCP_SERVICES: [&str; 10] = ["postgres", "postmaster", "redis-server", "mysqld", "mariadbd", "mongod", "sshd", "memcached", "valkey-server", "beam.smp"]; + +impl Listener { + pub fn is_tcp(&self) -> bool { TCP_SERVICES.contains(&self.process.as_str()) } +} + +pub fn scan() -> Vec { + let own = std::process::id(); + let mut found: BTreeMap = BTreeMap::new(); + for (port, pid, process) in listeners() { + if !(1024..32768).contains(&port) || pid == own || process == "frislit" { continue; } + found.entry(port).or_insert(process); + } + found.into_iter().map(|(port, process)| Listener { port, process }).collect() +} + +#[cfg(target_os = "linux")] +fn listeners() -> Vec<(u16, u32, String)> { + let mut inodes: BTreeMap = BTreeMap::new(); + for table in ["/proc/net/tcp", "/proc/net/tcp6"] { + let Ok(text) = std::fs::read_to_string(table) else { continue }; + for line in text.lines().skip(1) { + let fields: Vec<&str> = line.split_whitespace().collect(); + if fields.len() < 10 || fields[3] != "0A" { continue; } + let (Some(port), Ok(inode)) = (fields[1].rsplit(':').next().and_then(|hex| u16::from_str_radix(hex, 16).ok()), fields[9].parse::()) else { continue }; + inodes.insert(inode, port); + } + } + let mut out = Vec::new(); + let Ok(procs) = std::fs::read_dir("/proc") else { return out }; + for entry in procs.flatten() { + let Ok(pid) = entry.file_name().to_string_lossy().parse::() else { continue }; + let Ok(fds) = std::fs::read_dir(entry.path().join("fd")) else { continue }; + let cmdline = std::fs::read(entry.path().join("cmdline")).unwrap_or_default(); + let argv0 = String::from_utf8_lossy(cmdline.split(|byte| *byte == 0).next().unwrap_or_default()).into_owned(); + let name = argv0.rsplit('/').next().unwrap_or_default().to_string(); + for fd in fds.flatten() { + let Ok(link) = std::fs::read_link(fd.path()) else { continue }; + let text = link.to_string_lossy(); + let Some(inode) = text.strip_prefix("socket:[").and_then(|rest| rest.strip_suffix(']')).and_then(|inode| inode.parse::().ok()) else { continue }; + if let Some(port) = inodes.get(&inode) { out.push((*port, pid, name.clone())); } + } + } + out +} + +#[cfg(target_os = "macos")] +fn listeners() -> Vec<(u16, u32, String)> { + let Ok(output) = std::process::Command::new("lsof").args(["-nP", "-iTCP", "-sTCP:LISTEN"]).output() else { return Vec::new() }; + String::from_utf8_lossy(&output.stdout).lines().skip(1).filter_map(|line| { + let fields: Vec<&str> = line.split_whitespace().collect(); + let port = fields.get(8)?.rsplit(':').next()?.parse().ok()?; + Some((port, fields.get(1)?.parse().ok()?, fields[0].to_string())) + }).collect() +} + +#[cfg(windows)] +fn listeners() -> Vec<(u16, u32, String)> { + let Ok(netstat) = std::process::Command::new("netstat").args(["-ano", "-p", "TCP"]).output() else { return Vec::new() }; + let names: BTreeMap = std::process::Command::new("tasklist").args(["/FO", "CSV", "/NH"]).output().map(|output| { + String::from_utf8_lossy(&output.stdout).lines().filter_map(|line| { + let mut cells = line.split("\",\""); + let name = cells.next()?.trim_start_matches('"').trim_end_matches(".exe").to_string(); + Some((cells.next()?.parse().ok()?, name)) + }).collect() + }).unwrap_or_default(); + String::from_utf8_lossy(&netstat.stdout).lines().filter_map(|line| { + let fields: Vec<&str> = line.split_whitespace().collect(); + if fields.get(3) != Some(&"LISTENING") { return None; } + let port = fields.get(1)?.rsplit(':').next()?.parse().ok()?; + let pid: u32 = fields.get(4)?.parse().ok()?; + Some((port, pid, names.get(&pid).cloned().unwrap_or_default())) + }).collect() +} diff --git a/cli/src/gui/theme.rs b/cli/src/gui/theme.rs new file mode 100644 index 0000000..8cfc5cc --- /dev/null +++ b/cli/src/gui/theme.rs @@ -0,0 +1,102 @@ +use eframe::egui::{self, Color32, CornerRadius, FontData, FontDefinitions, FontFamily, FontId, Stroke, TextStyle, Visuals}; +use std::sync::Arc; + +pub const BACKGROUND: Color32 = Color32::from_rgb(0x11, 0x10, 0x0E); +pub const SURFACE: Color32 = Color32::from_rgb(0x17, 0x16, 0x13); +pub const SURFACE_RAISED: Color32 = Color32::from_rgb(0x1C, 0x1A, 0x17); +pub const SURFACE_HOVER: Color32 = Color32::from_rgb(0x22, 0x1F, 0x1B); +pub const BORDER: Color32 = Color32::from_rgba_premultiplied(18, 18, 18, 18); +pub const BORDER_STRONG: Color32 = Color32::from_rgba_premultiplied(33, 33, 33, 33); + +pub const PRIMARY: Color32 = Color32::from_rgb(0x14, 0xB8, 0xA6); +pub const PRIMARY_BRIGHT: Color32 = Color32::from_rgb(0x2D, 0xD4, 0xBF); +pub const PRIMARY_HOVER: Color32 = Color32::from_rgb(0x5E, 0xEA, 0xD4); +pub const PRIMARY_TINT: Color32 = Color32::from_rgba_premultiplied(3, 26, 23, 36); +pub const ON_PRIMARY: Color32 = Color32::from_rgb(0x05, 0x20, 0x1C); + +pub const TEXT: Color32 = Color32::from_rgb(0xFA, 0xFA, 0xF9); +pub const SUBTEXT: Color32 = Color32::from_rgb(0xA8, 0xA2, 0x9E); +pub const MUTED: Color32 = Color32::from_rgb(0x79, 0x71, 0x6B); + +pub const ERROR: Color32 = Color32::from_rgb(0xF8, 0x71, 0x71); +pub const ERROR_TINT: Color32 = Color32::from_rgba_premultiplied(32, 15, 15, 33); +pub const SUCCESS: Color32 = Color32::from_rgb(0x34, 0xD3, 0x99); +pub const WARNING: Color32 = Color32::from_rgb(0xFB, 0xBF, 0x24); +pub const WARNING_TINT: Color32 = Color32::from_rgba_premultiplied(32, 25, 5, 33); + +pub const RADIUS_INPUT: u8 = 12; +pub const RADIUS_CARD: u8 = 14; +pub const RADIUS_SMALL: u8 = 10; + +pub const GUTTER: f32 = 16.0; + +pub fn medium() -> FontFamily { FontFamily::Proportional } +pub fn semibold() -> FontFamily { FontFamily::Name("semibold".into()) } +pub fn bold() -> FontFamily { FontFamily::Name("bold".into()) } +pub fn mono() -> FontFamily { FontFamily::Monospace } + +pub fn font(size: f32, family: FontFamily) -> FontId { FontId::new(size, family) } + +pub fn corner(radius: u8) -> CornerRadius { CornerRadius::same(radius) } + +pub fn install(ctx: &egui::Context) { + let mut fonts = FontDefinitions::default(); + fonts.font_data.insert("jakarta-medium".into(), Arc::new(FontData::from_static(include_bytes!("../../assets/PlusJakartaSans-Medium.ttf")))); + fonts.font_data.insert("jakarta-semibold".into(), Arc::new(FontData::from_static(include_bytes!("../../assets/PlusJakartaSans-SemiBold.ttf")))); + fonts.font_data.insert("jakarta-bold".into(), Arc::new(FontData::from_static(include_bytes!("../../assets/PlusJakartaSans-Bold.ttf")))); + + let fallback = fonts.families.get(&FontFamily::Proportional).cloned().unwrap_or_default(); + let with_fallback = |first: &str| std::iter::once(first.to_string()).chain(fallback.iter().cloned()).collect::>(); + fonts.families.insert(FontFamily::Proportional, with_fallback("jakarta-medium")); + fonts.families.insert(semibold(), with_fallback("jakarta-semibold")); + fonts.families.insert(bold(), with_fallback("jakarta-bold")); + ctx.set_fonts(fonts); + + let mut visuals = Visuals::dark(); + visuals.panel_fill = BACKGROUND; + visuals.window_fill = SURFACE_RAISED; + visuals.window_stroke = Stroke::new(1.0, BORDER_STRONG); + visuals.window_corner_radius = corner(RADIUS_CARD); + visuals.menu_corner_radius = corner(RADIUS_INPUT); + visuals.extreme_bg_color = SURFACE; + visuals.faint_bg_color = SURFACE_RAISED; + visuals.code_bg_color = SURFACE_HOVER; + visuals.override_text_color = Some(TEXT); + visuals.hyperlink_color = PRIMARY_BRIGHT; + visuals.selection.bg_fill = PRIMARY_TINT; + visuals.selection.stroke = Stroke::new(1.0, PRIMARY); + visuals.text_cursor.stroke.color = PRIMARY_BRIGHT; + + let widgets = &mut visuals.widgets; + for (widget, fill, border, text) in [ + (&mut widgets.noninteractive, SURFACE, BORDER, SUBTEXT), + (&mut widgets.inactive, SURFACE_RAISED, BORDER_STRONG, TEXT), + (&mut widgets.hovered, SURFACE_HOVER, BORDER_STRONG, TEXT), + (&mut widgets.active, SURFACE_HOVER, PRIMARY, TEXT), + (&mut widgets.open, SURFACE_RAISED, PRIMARY, TEXT), + ] { + widget.bg_fill = fill; + widget.weak_bg_fill = fill; + widget.bg_stroke = Stroke::new(1.0, border); + widget.fg_stroke = Stroke::new(1.0, text); + widget.corner_radius = corner(RADIUS_SMALL); + widget.expansion = 0.0; + } + ctx.set_visuals(visuals); + + ctx.all_styles_mut(|style| { + style.text_styles.insert(TextStyle::Body, font(14.0, medium())); + style.text_styles.insert(TextStyle::Button, font(14.0, medium())); + style.text_styles.insert(TextStyle::Small, font(12.0, medium())); + style.text_styles.insert(TextStyle::Heading, font(22.0, semibold())); + style.text_styles.insert(TextStyle::Monospace, font(13.0, mono())); + style.spacing.item_spacing = egui::vec2(8.0, 8.0); + style.spacing.button_padding = egui::vec2(12.0, 6.0); + style.spacing.interact_size = egui::vec2(40.0, 30.0); + style.spacing.combo_width = 160.0; + style.spacing.scroll.bar_width = 8.0; + style.spacing.scroll.floating = true; + style.visuals.striped = false; + style.interaction.selectable_labels = false; + }); +} diff --git a/cli/src/gui/tray.rs b/cli/src/gui/tray.rs new file mode 100644 index 0000000..c3e4f84 --- /dev/null +++ b/cli/src/gui/tray.rs @@ -0,0 +1,88 @@ +use anyhow::Result; +use std::sync::mpsc::Sender; +use tokio::runtime::Handle; +use super::{Repaint, Wake}; + +const ICON_SIZE: u32 = 32; +const ICON_RGBA: &[u8] = include_bytes!("../../assets/icon-32.rgba"); + +pub struct Tray { _keep: Box } + +#[derive(Clone)] +struct Notifier { wake: Sender, repaint: Repaint } + +impl Notifier { + fn send(&self, wake: Wake) { + let _ = self.wake.send(wake); + self.repaint.ping(); + } +} + +#[cfg(target_os = "linux")] +pub fn start(wake: Sender, repaint: Repaint, runtime: &Handle) -> Result { + use ksni::{menu::{MenuItem, StandardItem}, Icon, ToolTip, TrayMethods}; + + struct FrislitTray { notify: Notifier } + + impl ksni::Tray for FrislitTray { + fn id(&self) -> String { "frislit".into() } + fn title(&self) -> String { "frislit".into() } + fn tool_tip(&self) -> ToolTip { ToolTip { title: "frislit".into(), ..Default::default() } } + fn icon_pixmap(&self) -> Vec { + let mut data = Vec::with_capacity(ICON_RGBA.len()); + for pixel in ICON_RGBA.chunks(4) { data.extend_from_slice(&[pixel[3], pixel[0], pixel[1], pixel[2]]); } + vec![Icon { width: ICON_SIZE as i32, height: ICON_SIZE as i32, data }] + } + fn activate(&mut self, _x: i32, _y: i32) { self.notify.send(Wake::Toggle); } + fn menu(&self) -> Vec> { + vec![ + StandardItem { label: "Open frislit".into(), activate: Box::new(|tray: &mut Self| tray.notify.send(Wake::Show)), ..Default::default() }.into(), + MenuItem::Separator, + StandardItem { label: "Quit".into(), activate: Box::new(|tray: &mut Self| tray.notify.send(Wake::Quit)), ..Default::default() }.into(), + ] + } + } + + let tray = FrislitTray { notify: Notifier { wake, repaint } }; + let handle = runtime.block_on(tray.spawn()).map_err(|err| anyhow::anyhow!("No tray available: {err}"))?; + Ok(Tray { _keep: Box::new(handle) }) +} + +#[cfg(any(windows, target_os = "macos"))] +pub fn start(wake: Sender, repaint: Repaint, _runtime: &Handle) -> Result { + use tray_icon::{menu::{Menu, MenuEvent, MenuItem, PredefinedMenuItem}, Icon, MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent}; + + let notify = Notifier { wake, repaint }; + + let menu = Menu::new(); + let open = MenuItem::new("Open frislit", true, None); + let quit = MenuItem::new("Quit", true, None); + menu.append_items(&[&open, &PredefinedMenuItem::separator(), &quit])?; + let (open_id, quit_id) = (open.id().clone(), quit.id().clone()); + + let icon = Icon::from_rgba(ICON_RGBA.to_vec(), ICON_SIZE, ICON_SIZE)?; + let tray = TrayIconBuilder::new() + .with_menu(Box::new(menu)) + .with_tooltip("frislit") + .with_icon(icon) + .with_icon_as_template(cfg!(target_os = "macos")) + .with_menu_on_left_click(false) + .build()?; + + let clicks = notify.clone(); + TrayIconEvent::set_event_handler(Some(move |event: TrayIconEvent| { + if let TrayIconEvent::Click { button: MouseButton::Left, button_state: MouseButtonState::Up, .. } = event { + clicks.send(Wake::Toggle); + } + })); + MenuEvent::set_event_handler(Some(move |event: MenuEvent| { + if *event.id() == open_id { notify.send(Wake::Show); } + else if *event.id() == quit_id { notify.send(Wake::Quit); } + })); + Ok(Tray { _keep: Box::new(tray) }) +} + +#[cfg(not(any(windows, target_os = "macos", target_os = "linux")))] +pub fn start(_wake: Sender, _repaint: Repaint, _runtime: &Handle) -> Result { + anyhow::bail!("No tray on this platform") +} diff --git a/cli/src/gui/widgets.rs b/cli/src/gui/widgets.rs new file mode 100644 index 0000000..3d149a4 --- /dev/null +++ b/cli/src/gui/widgets.rs @@ -0,0 +1,319 @@ + +use eframe::egui::{self, Align, Color32, CursorIcon, Frame, Id, Layout, Margin, Response, RichText, Sense, Stroke, StrokeKind, TextEdit, Ui, Vec2}; +use std::time::Instant; +use super::theme::{self, corner}; + +#[derive(Clone, Copy, PartialEq)] +pub enum ButtonKind { Primary, Secondary, Ghost, Danger } + +pub fn button(ui: &mut Ui, text: &str, kind: ButtonKind) -> Response { + button_sized(ui, text, kind, 0.0) +} + +pub fn button_sized(ui: &mut Ui, text: &str, kind: ButtonKind, min_width: f32) -> Response { + let family = if kind == ButtonKind::Primary { theme::semibold() } else { theme::medium() }; + let galley = ui.painter().layout_no_wrap(text.to_string(), theme::font(14.0, family), Color32::WHITE); + let padding = egui::vec2(16.0, 7.0); + let size = Vec2::new((galley.size().x + padding.x * 2.0).max(min_width), (galley.size().y + padding.y * 2.0).max(34.0)); + let (rect, response) = ui.allocate_exact_size(size, Sense::click()); + if !ui.is_rect_visible(rect) { return response; } + + let enabled = ui.is_enabled(); + let hovered = response.hovered() && enabled; + let (fill, stroke, color) = match kind { + ButtonKind::Primary => (if hovered { theme::PRIMARY_HOVER } else { theme::PRIMARY_BRIGHT }, Stroke::NONE, theme::ON_PRIMARY), + ButtonKind::Secondary => (if hovered { theme::SURFACE_HOVER } else { Color32::TRANSPARENT }, Stroke::new(1.0, theme::BORDER_STRONG), theme::TEXT), + ButtonKind::Ghost => (if hovered { theme::SURFACE_HOVER } else { Color32::TRANSPARENT }, Stroke::NONE, if hovered { theme::TEXT } else { theme::SUBTEXT }), + ButtonKind::Danger => if hovered { (theme::ERROR_TINT, Stroke::NONE, theme::ERROR) } else { (Color32::TRANSPARENT, Stroke::new(1.0, theme::BORDER_STRONG), theme::SUBTEXT) }, + }; + let (fill, color) = if enabled { (fill, color) } else if kind == ButtonKind::Primary { (theme::SURFACE_HOVER, theme::MUTED) } else { (fill, theme::MUTED) }; + + let painter = ui.painter(); + painter.rect(rect, corner(theme::RADIUS_INPUT), fill, stroke, StrokeKind::Inside); + let text_pos = rect.center() - galley.size() / 2.0; + painter.galley(text_pos, galley, color); + if hovered { ui.ctx().set_cursor_icon(CursorIcon::PointingHand); } + response +} + +pub fn text(ui: &mut Ui, value: impl Into, size: f32, color: Color32) -> Response { + ui.label(RichText::new(value).size(size).color(color)) +} + +pub fn text_family(ui: &mut Ui, value: impl Into, size: f32, color: Color32, family: egui::FontFamily) -> Response { + ui.label(RichText::new(value).size(size).color(color).family(family)) +} + +pub fn mono(ui: &mut Ui, value: impl Into, size: f32, color: Color32) -> Response { + ui.label(RichText::new(value).size(size).color(color).family(theme::mono())) +} + +pub fn heading(ui: &mut Ui, value: &str) { + text_family(ui, value, 24.0, theme::TEXT, theme::semibold()); +} + +pub fn field_label(ui: &mut Ui, label: &str) { + text(ui, label, 13.0, theme::SUBTEXT); +} + +#[derive(Default)] +pub struct FieldOptions<'a> { + pub label: Option<&'a str>, + pub hint: &'a str, + pub mono: bool, + pub secret: bool, + pub width: Option, +} + +pub fn field(ui: &mut Ui, id: impl std::hash::Hash + std::fmt::Debug, value: &mut String, options: FieldOptions) -> Response { + let id = Id::new(id); + let edit_id = id.with("edit"); + let focused = ui.memory(|memory| memory.has_focus(edit_id)); + let width = options.width.unwrap_or_else(|| ui.available_width()); + + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 6.0; + if let Some(label) = options.label { field_label(ui, label); } + ui.set_width(width); + let frame = Frame::new() + .fill(theme::SURFACE) + .stroke(Stroke::new(1.0, if focused { theme::PRIMARY } else { theme::BORDER })) + .corner_radius(corner(theme::RADIUS_INPUT)) + .inner_margin(Margin::symmetric(14, 9)); + let inner = frame.show(ui, |ui| { + let family = if options.mono { theme::mono() } else { theme::medium() }; + let mut edit = TextEdit::singleline(value) + .id(edit_id) + .frame(Frame::NONE) + .background_color(Color32::TRANSPARENT) + .font(theme::font(15.0, family)) + .text_color(theme::TEXT) + .hint_text(RichText::new(options.hint).color(theme::MUTED).size(15.0)) + .desired_width(f32::INFINITY) + .margin(Margin::ZERO); + if options.secret { edit = edit.password(true); } + ui.add(edit) + }); + let response = inner.inner; + if inner.response.hovered() { ui.ctx().set_cursor_icon(CursorIcon::Text); } + if inner.response.clicked() { ui.memory_mut(|memory| memory.request_focus(edit_id)); } + response + }).inner +} + +pub fn dot(ui: &mut Ui, color: Color32) { + let (rect, _) = ui.allocate_exact_size(egui::vec2(8.0, 8.0), Sense::hover()); + ui.painter().circle_filled(rect.center(), 3.5, color); +} + +pub fn card(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> egui::InnerResponse { + Frame::new() + .fill(theme::SURFACE) + .stroke(Stroke::new(1.0, theme::BORDER)) + .corner_radius(corner(theme::RADIUS_CARD)) + .inner_margin(Margin::same(18)) + .show(ui, |ui| { + ui.set_width(ui.available_width()); + add(ui) + }) +} + +pub fn clickable_card(ui: &mut Ui, id: impl std::hash::Hash + std::fmt::Debug, add: impl FnOnce(&mut Ui)) -> Response { + let id = Id::new(id); + let hovered = ui.ctx().read_response(id).is_some_and(|response| response.hovered()); + let fill = if hovered { theme::SURFACE_HOVER } else { theme::SURFACE }; + let frame = Frame::new() + .fill(fill) + .stroke(Stroke::new(1.0, if hovered { theme::BORDER_STRONG } else { theme::BORDER })) + .corner_radius(corner(theme::RADIUS_CARD)) + .inner_margin(Margin::symmetric(18, 14)); + let inner = frame.show(ui, |ui| { + ui.set_width(ui.available_width()); + ui.horizontal(|ui| add(ui)); + }); + let response = ui.interact(inner.response.rect, id, Sense::click()); + if response.hovered() { ui.ctx().set_cursor_icon(CursorIcon::PointingHand); } + response +} + +pub fn section(ui: &mut Ui, title: &str, hint: Option<&str>) { + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 10.0; + text_family(ui, title, 16.0, theme::TEXT, theme::semibold()); + if let Some(hint) = hint { text(ui, hint, 13.0, theme::MUTED); } + }); + ui.add_space(4.0); +} + +pub fn toggle(ui: &mut Ui, on: &mut bool) -> Response { + let size = egui::vec2(36.0, 20.0); + let (rect, mut response) = ui.allocate_exact_size(size, Sense::click()); + if response.clicked() { *on = !*on; response.mark_changed(); } + let how_on = ui.ctx().animate_bool(response.id, *on); + let fill = if *on { theme::PRIMARY } else { theme::SURFACE_HOVER }; + let stroke = if *on { Stroke::NONE } else { Stroke::new(1.0, theme::BORDER_STRONG) }; + ui.painter().rect(rect, corner(10), fill, stroke, StrokeKind::Inside); + let radius = 7.0; + let x = egui::lerp((rect.left() + radius + 3.0)..=(rect.right() - radius - 3.0), how_on); + ui.painter().circle_filled(egui::pos2(x, rect.center().y), radius, if *on { theme::ON_PRIMARY } else { theme::SUBTEXT }); + if response.hovered() { ui.ctx().set_cursor_icon(CursorIcon::PointingHand); } + response +} + +pub fn status_color(status: u16) -> Color32 { + match status { + 200..=299 => theme::SUCCESS, + 300..=399 => theme::PRIMARY, + 400..=499 => theme::WARNING, + _ => theme::ERROR, + } +} + +pub fn toggle_row(ui: &mut Ui, label: &str, hint: &str, on: &mut bool) -> Response { + ui.horizontal(|ui| { + let text_width = ui.available_width() - 52.0; + ui.vertical(|ui| { + ui.set_max_width(text_width); + ui.spacing_mut().item_spacing.y = 2.0; + text(ui, label, 14.0, theme::TEXT); + if !hint.is_empty() { ui.add(egui::Label::new(RichText::new(hint).size(12.5).color(theme::MUTED)).wrap()); } + }); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| toggle(ui, on)).inner + }).inner +} + +pub fn copy_row(ui: &mut Ui, id: impl std::hash::Hash + std::fmt::Debug, value: &str, copied_at: &mut Option) -> bool { + let mut copied = false; + let frame = Frame::new() + .fill(theme::SURFACE) + .stroke(Stroke::new(1.0, theme::BORDER)) + .corner_radius(corner(theme::RADIUS_SMALL)) + .inner_margin(Margin::symmetric(12, 6)); + frame.show(ui, |ui| { + ui.set_width(ui.available_width()); + ui.horizontal(|ui| { + let recently = copied_at.is_some_and(|at| at.elapsed().as_secs_f32() < 1.6); + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + let label = if recently { "Copied" } else { "Copy" }; + let response = ui.push_id(Id::new(&id).with("copy"), |ui| button(ui, label, ButtonKind::Ghost)).inner; + if response.clicked() { + ui.ctx().copy_text(value.to_string()); + *copied_at = Some(Instant::now()); + copied = true; + } + ui.with_layout(Layout::left_to_right(Align::Center), |ui| { + ui.add(egui::Label::new(RichText::new(value).size(13.0).color(theme::SUBTEXT).family(theme::mono())).truncate()); + }); + }); + }); + }); + copied +} + +pub fn notice(ui: &mut Ui, message: &str, color: Color32, tint: Color32) { + Frame::new() + .fill(tint) + .corner_radius(corner(theme::RADIUS_SMALL)) + .inner_margin(Margin::symmetric(14, 10)) + .show(ui, |ui| { + ui.set_width(ui.available_width()); + ui.add(egui::Label::new(RichText::new(message).size(13.5).color(color)).wrap()); + }); +} + +pub fn error_notice(ui: &mut Ui, message: &str) { notice(ui, message, theme::ERROR, theme::ERROR_TINT); } +pub fn warning_notice(ui: &mut Ui, message: &str) { notice(ui, message, theme::WARNING, theme::WARNING_TINT); } + +pub fn empty_state(ui: &mut Ui, title: &str, body: &str, add: impl FnOnce(&mut Ui)) { + Frame::new() + .stroke(Stroke::new(1.0, theme::BORDER_STRONG)) + .corner_radius(corner(theme::RADIUS_CARD)) + .inner_margin(Margin::symmetric(32, 40)) + .show(ui, |ui| { + ui.set_width(ui.available_width()); + ui.vertical_centered(|ui| { + ui.spacing_mut().item_spacing.y = 8.0; + text_family(ui, title, 17.0, theme::TEXT, theme::semibold()); + ui.add(egui::Label::new(RichText::new(body).size(14.0).color(theme::SUBTEXT)).wrap()); + ui.add_space(12.0); + add(ui); + }); + }); +} + +pub fn segmented(ui: &mut Ui, current: &mut T, options: &[(T, &str)]) { + Frame::new() + .fill(theme::SURFACE) + .stroke(Stroke::new(1.0, theme::BORDER)) + .corner_radius(corner(theme::RADIUS_INPUT)) + .inner_margin(Margin::same(3)) + .show(ui, |ui| { + ui.spacing_mut().item_spacing.x = 3.0; + ui.horizontal(|ui| { + for (value, label) in options { + let selected = *current == *value; + let galley = ui.painter().layout_no_wrap(label.to_string(), theme::font(13.5, theme::medium()), Color32::WHITE); + let size = galley.size() + egui::vec2(24.0, 12.0); + let (rect, response) = ui.allocate_exact_size(size, Sense::click()); + let fill = if selected { theme::SURFACE_HOVER } else if response.hovered() { theme::SURFACE_RAISED } else { Color32::TRANSPARENT }; + let stroke = if selected { Stroke::new(1.0, theme::BORDER_STRONG) } else { Stroke::NONE }; + ui.painter().rect(rect, corner(theme::RADIUS_SMALL), fill, stroke, StrokeKind::Inside); + let color = if selected { theme::TEXT } else { theme::SUBTEXT }; + ui.painter().galley(rect.center() - galley.size() / 2.0, galley, color); + if response.hovered() { ui.ctx().set_cursor_icon(CursorIcon::PointingHand); } + if response.clicked() { *current = *value; } + } + }); + }); +} + +fn paint_arrow(painter: &egui::Painter, center: egui::Pos2, size: f32, pointing: f32, stroke: Stroke) { + let half = size / 2.0; + let wing = size * 0.32; + let tip = center + egui::vec2(half * pointing, 0.0); + painter.line_segment([center - egui::vec2(half * pointing, 0.0), tip], stroke); + painter.line_segment([tip, tip + egui::vec2(-wing * pointing, -wing)], stroke); + painter.line_segment([tip, tip + egui::vec2(-wing * pointing, wing)], stroke); +} + +pub fn arrow_right(ui: &mut Ui, color: Color32) { + let (rect, _) = ui.allocate_exact_size(egui::vec2(14.0, 14.0), Sense::hover()); + paint_arrow(ui.painter(), rect.center(), 10.0, 1.0, Stroke::new(1.4, color)); +} + +pub fn chevron_right(ui: &mut Ui, color: Color32) { + let (rect, _) = ui.allocate_exact_size(egui::vec2(12.0, 14.0), Sense::hover()); + let center = rect.center(); + let stroke = Stroke::new(1.5, color); + ui.painter().line_segment([center + egui::vec2(-2.0, -4.0), center + egui::vec2(2.0, 0.0)], stroke); + ui.painter().line_segment([center + egui::vec2(2.0, 0.0), center + egui::vec2(-2.0, 4.0)], stroke); +} + +pub fn back_link(ui: &mut Ui, label: &str) -> Response { + let galley = ui.painter().layout_no_wrap(label.to_string(), theme::font(13.0, theme::medium()), Color32::WHITE); + let (rect, response) = ui.allocate_exact_size(egui::vec2(galley.size().x + 20.0, galley.size().y.max(14.0)), Sense::click()); + let color = if response.hovered() { theme::TEXT } else { theme::MUTED }; + if response.hovered() { ui.ctx().set_cursor_icon(CursorIcon::PointingHand); } + paint_arrow(ui.painter(), egui::pos2(rect.left() + 6.0, rect.center().y), 10.0, -1.0, Stroke::new(1.4, color)); + ui.painter().galley(egui::pos2(rect.left() + 20.0, rect.center().y - galley.size().y / 2.0), galley, color); + response +} + +pub fn divider(ui: &mut Ui) { + let (rect, _) = ui.allocate_exact_size(egui::vec2(ui.available_width(), 1.0), Sense::hover()); + ui.painter().rect_filled(rect, 0.0, theme::BORDER); +} + +pub fn minimize_button(ui: &mut Ui) -> Response { + let (rect, response) = ui.allocate_exact_size(egui::vec2(30.0, 30.0), Sense::click()); + let hovered = response.hovered(); + if hovered { + ui.painter().rect_filled(rect, corner(theme::RADIUS_SMALL), theme::SURFACE_HOVER); + ui.ctx().set_cursor_icon(CursorIcon::PointingHand); + } + let color = if hovered { theme::TEXT } else { theme::SUBTEXT }; + let center = rect.center(); + let arm = 5.0; + ui.painter().line_segment([center + egui::vec2(-arm, 0.0), center + egui::vec2(arm, 0.0)], Stroke::new(1.6, color)); + response +} diff --git a/cli/src/handler.rs b/cli/src/handler.rs new file mode 100644 index 0000000..707a952 --- /dev/null +++ b/cli/src/handler.rs @@ -0,0 +1,150 @@ +use anyhow::{bail, Context, Result}; +use std::fs; +use std::path::PathBuf; +use std::process::Command; + +pub const SCHEME: &str = "frislit"; +const ICON_SVG: &[u8] = include_bytes!("../../packaging/frislit.svg"); + +pub fn exe() -> Result { + let path = std::env::current_exe().context("Could not find the frislit binary")?; + Ok(path.to_string_lossy().to_string()) +} + +fn home() -> Result { + dirs::home_dir().context("Could not find your home directory") +} + +fn data_dir() -> Result { + dirs::data_dir().context("Could not find your data directory") +} + +fn desktop_file() -> Result { + Ok(data_dir()?.join("applications").join("frislit.desktop")) +} + +fn icon_file() -> Result { + Ok(data_dir()?.join("icons").join("hicolor").join("scalable").join("apps").join("frislit.svg")) +} + +fn app_bundle() -> Result { + Ok(home()?.join("Applications").join("frislit.app")) +} + +fn install_linux() -> Result { + let icon = icon_file()?; + fs::create_dir_all(icon.parent().unwrap())?; + fs::write(&icon, ICON_SVG)?; + + let file = desktop_file()?; + fs::create_dir_all(file.parent().unwrap())?; + fs::write(&file, format!( + "[Desktop Entry]\n\ + Type=Application\n\ + Name=frislit\n\ + Comment=Share local ports through your own frislit server\n\ + Exec={} gui %u\n\ + Icon=frislit\n\ + Terminal=false\n\ + Categories=Network;Utility;\n\ + MimeType=x-scheme-handler/{};\n", + exe()?, SCHEME, + ))?; + + let dir = file.parent().unwrap().to_string_lossy().to_string(); + let _ = Command::new("update-desktop-database").arg(&dir).status(); + let _ = Command::new("xdg-mime") + .args(["default", "frislit.desktop", &format!("x-scheme-handler/{SCHEME}")]) + .status(); + Ok(file) +} + +fn install_macos() -> Result { + let bundle = app_bundle()?; + if bundle.exists() { fs::remove_dir_all(&bundle)?; } + fs::create_dir_all(bundle.parent().unwrap())?; + + let exe = exe()?; + let script = std::env::temp_dir().join("frislit-handler.applescript"); + fs::write(&script, format!( + "on run\n\ + \tdo shell script quoted form of \"{exe}\" & \" gui > /dev/null 2>&1 &\"\n\ + end run\n\ + on open location this_URL\n\ + \tdo shell script quoted form of \"{exe}\" & \" gui \" & quoted form of this_URL & \" > /dev/null 2>&1 &\"\n\ + end open location\n", + ))?; + + let status = Command::new("osacompile") + .args(["-o", &bundle.to_string_lossy(), &script.to_string_lossy()]) + .status() + .context("osacompile is not available")?; + let _ = fs::remove_file(&script); + if !status.success() { bail!("osacompile could not build the handler app"); } + + let plist = bundle.join("Contents").join("Info.plist"); + for args in [ + vec!["-insert", "CFBundleURLTypes", "-json", "[]"], + vec!["-insert", "CFBundleURLTypes.0", "-json", "{}"], + vec!["-insert", "CFBundleURLTypes.0.CFBundleURLName", "-string", "frislit"], + vec!["-insert", "CFBundleURLTypes.0.CFBundleURLSchemes", "-json", "[\"frislit\"]"], + vec!["-replace", "CFBundleIdentifier", "-string", "dev.frislit.cli"], + ] { + let _ = Command::new("plutil").args(&args).arg(&plist).status(); + } + + let _ = Command::new("/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister") + .args(["-f", &bundle.to_string_lossy()]) + .status(); + Ok(bundle) +} + +fn install_windows() -> Result { + let key = format!("HKCU\\Software\\Classes\\{SCHEME}"); + let exe = exe()?; + let command = format!("\"{exe}\" gui \"%1\""); + + for args in [ + vec![key.clone(), "/ve".into(), "/d".into(), format!("URL:{SCHEME}"), "/f".into()], + vec![key.clone(), "/v".into(), "URL Protocol".into(), "/d".into(), String::new(), "/f".into()], + vec![format!("{key}\\DefaultIcon"), "/ve".into(), "/d".into(), format!("{exe},0"), "/f".into()], + vec![format!("{key}\\shell\\open\\command"), "/ve".into(), "/d".into(), command.clone(), "/f".into()], + ] { + let status = Command::new("reg").arg("add").args(&args).status() + .context("Could not run reg.exe")?; + if !status.success() { bail!("reg.exe refused to write {key}"); } + } + Ok(PathBuf::from(key)) +} + +pub fn install() -> Result { + if cfg!(target_os = "macos") { + install_macos() + } else if cfg!(target_os = "windows") { + install_windows() + } else if cfg!(target_os = "linux") { + install_linux() + } else { + bail!("frislit does not know how to register links on this system") + } +} + +pub fn remove() -> Result<()> { + if cfg!(target_os = "macos") { + let bundle = app_bundle()?; + if bundle.exists() { fs::remove_dir_all(&bundle)?; } + } else if cfg!(target_os = "windows") { + let _ = Command::new("reg") + .args(["delete", &format!("HKCU\\Software\\Classes\\{SCHEME}"), "/f"]) + .status(); + } else { + let file = desktop_file()?; + if file.exists() { fs::remove_file(&file)?; } + let icon = icon_file()?; + if icon.exists() { let _ = fs::remove_file(&icon); } + let _ = Command::new("update-desktop-database") + .arg(file.parent().unwrap().to_string_lossy().to_string()) + .status(); + } + Ok(()) +} diff --git a/cli/src/headless.rs b/cli/src/headless.rs new file mode 100644 index 0000000..cafab65 --- /dev/null +++ b/cli/src/headless.rs @@ -0,0 +1,173 @@ +use anyhow::{bail, Context, Result}; +use console::style; +use serde::Deserialize; +use std::collections::BTreeMap; +use std::path::{Path, PathBuf}; +use tokio::sync::mpsc::UnboundedReceiver; +use crate::config::Config; +use crate::session::{self, Stop, StopHandle, TunnelEvent}; +use crate::shape::Shape; +use crate::router::{Route, RouteTarget}; +use crate::tunnel::{self, Access, Options, Rules, Target, TargetSpec}; + +pub const EXAMPLE: &str = "tunnels:\n myapp:\n http: 3000\n db:\n tcp: 5432\n allow: [10.0.0.0/8]\n"; + +#[derive(Deserialize)] +struct Manifest { + #[serde(default)] + tunnels: BTreeMap, +} + +#[derive(Deserialize)] +#[serde(untagged)] +enum Scalar { Number(f64), Text(String) } + +impl Scalar { + fn text(&self) -> String { + match self { Self::Number(value) => value.to_string(), Self::Text(text) => text.clone() } + } +} + +#[derive(Deserialize, Default)] +#[serde(deny_unknown_fields)] +struct ShapeSpec { + latency: Option, + jitter: Option, + bandwidth: Option, + loss: Option, +} + +impl ShapeSpec { + fn shape(&self) -> Result { + let text = |value: &Option| value.as_ref().map(Scalar::text); + Shape::parse(text(&self.latency).as_deref(), text(&self.jitter).as_deref(), text(&self.bandwidth).as_deref(), text(&self.loss).as_deref()) + } +} + +#[derive(Deserialize)] +#[serde(deny_unknown_fields)] +struct Entry { + http: Option, + serve: Option, + tcp: Option, + #[serde(default)] routes: BTreeMap, + #[serde(default)] shape: ShapeSpec, + #[serde(default)] keep_host: bool, + #[serde(default)] allow: Vec, + #[serde(default)] allow_countries: Vec, + #[serde(default)] block_ips: Vec, + #[serde(default)] block_countries: Vec, + #[serde(default)] block: Vec, + password: Option, + #[serde(default)] require_login: bool, +} + +impl Entry { + fn options(self, name: &str) -> Result { + let rules = Rules::new(self.allow, self.allow_countries, self.block_ips, self.block_countries, self.block).with_context(|| name.to_string())?; + let access = Access::new(rules, self.password, self.require_login)?; + let shape = self.shape.shape().with_context(|| name.to_string())?; + let id = Some(name.to_string()); + let root = match (self.http, self.serve, self.tcp) { + (Some(http), None, None) => RouteTarget::Addr(Target::parse(&http.text())?), + (None, Some(dir), None) => RouteTarget::dir(&dir.to_string_lossy())?, + (None, None, Some(tcp)) => { + if !self.routes.is_empty() { bail!("{name}: routes only work with http or serve"); } + return Ok(Options::tcp(Target::parse(&tcp.text())?, id, access).shaped(shape)); + } + _ => bail!("{name}: set exactly one of http, serve or tcp"), + }; + let routes = self.routes.into_iter().map(|(prefix, endpoint)| Route::new(&prefix, RouteTarget::parse(&endpoint.text())?)).collect::>()?; + Ok(Options::http(TargetSpec::routed(root, routes)?, id, self.keep_host, access).shaped(shape)) + } +} + +pub fn default_path() -> Result { + Ok(dirs::config_dir().context("No config directory")?.join("frislit").join("tunnels.yml")) +} + +pub fn load(path: &Path) -> Result> { + let text = std::fs::read_to_string(path).with_context(|| format!("Could not read {}", path.display()))?; + let manifest: Manifest = serde_yaml_ng::from_str(&text).with_context(|| format!("{} is not valid", path.display()))?; + if manifest.tunnels.is_empty() { bail!("{} defines no tunnels", path.display()); } + manifest.tunnels.into_iter().map(|(name, entry)| Ok((name.clone(), entry.options(&name)?))).collect() +} + +fn log(name: &str, message: impl std::fmt::Display) { + println!("{} {message}", style(format!("[{name}]")).cyan().bold()); +} + +async fn print(name: String, mut rx: UnboundedReceiver) { + while let Some(event) = rx.recv().await { + match event { + TunnelEvent::Connecting => {} + TunnelEvent::Online(online) | TunnelEvent::Replaced(online) => { + match &online.url { + Some(url) => log(&name, format!("online {}", style(url).underlined())), + None => log(&name, format!("online, share code {}", online.share_code.as_deref().unwrap_or(""))), + } + for url in &online.custom_urls { log(&name, format!(" {}", style(url).underlined())); } + if let Some(access) = &online.access { log(&name, format!("access: {access}")); } + } + TunnelEvent::Resumed(_) => log(&name, "reconnected"), + TunnelEvent::Request(request) => { + let intel = request.intel().map(|text| format!(" {text}")).unwrap_or_default(); + log(&name, format!("{} {} {} {}ms{intel}", request.method, request.status, request.path, request.duration)); + } + TunnelEvent::Connection(connection) => log(&name, connection.line()), + TunnelEvent::Access(summary) => log(&name, format!("access: {summary}")), + TunnelEvent::Reconnecting { seconds, reason } => match reason { + Some(reason) => log(&name, format!("reconnecting in {seconds}s ({reason})")), + None => log(&name, "connection lost, reconnecting"), + }, + TunnelEvent::Update(version) => log(&name, format!("frislit {version} is available, run frislit update")), + TunnelEvent::Stopped => log(&name, "stopped"), + TunnelEvent::Ended(reason) => log(&name, format!("ended: {reason}")), + } + } +} + +async fn wait_for_signal(stop: StopHandle) { + #[cfg(unix)] + { + use tokio::signal::unix::{signal, SignalKind}; + let mut term = signal(SignalKind::terminate()).expect("SIGTERM handler"); + tokio::select! { + _ = tokio::signal::ctrl_c() => {} + _ = term.recv() => {} + } + } + #[cfg(not(unix))] + { let _ = tokio::signal::ctrl_c().await; } + stop.stop(); +} + +pub async fn run(path: Option) -> Result<()> { + let path = match path { Some(path) => path, None => default_path()? }; + Config::load()?.require_auth()?; + let tunnels = load(&path)?; + println!("{} Starting {} tunnel{} from {}", style("✓").green().bold(), tunnels.len(), if tunnels.len() == 1 { "" } else { "s" }, style(path.display()).dim()); + + let (handle, _) = Stop::new(); + tokio::spawn(wait_for_signal(handle.clone())); + + let mut tasks = Vec::new(); + for (name, opts) in tunnels { + let (events, rx) = session::channel(); + let stop = Stop::subscribe(&handle); + let printer = tokio::spawn(print(name.clone(), rx)); + tasks.push(tokio::spawn(async move { + let result = async { + let (opts, target, _, _local) = tunnel::prepare(opts).await?; + tunnel::run(opts, target, events, stop).await + }.await; + if let Err(err) = &result { log(&name, format!("{} {err:#}", style("failed:").red())); } + let _ = printer.await; + result.is_ok() + })); + } + + let mut ok = true; + for task in tasks { ok &= task.await.unwrap_or(false); } + if ok { Ok(()) } else { bail!("Not every tunnel came up") } +} diff --git a/cli/src/main.rs b/cli/src/main.rs new file mode 100644 index 0000000..e659f72 --- /dev/null +++ b/cli/src/main.rs @@ -0,0 +1,210 @@ +mod api; +mod auth; +mod cli; +mod config; +mod connect; +#[cfg(feature = "gui")] +mod gui; +mod handler; +mod headless; +mod mux; +mod qr; +mod router; +mod serve; +mod service; +mod session; +mod shape; +mod tcp; +mod tls; +mod tui; +mod tunnel; +mod update; + +use clap::{Parser, Subcommand}; +use console::style; +use std::path::PathBuf; + +#[derive(Parser)] +#[command(name = "frislit", about = "frislit CLI - expose local ports through your own frislit server", version)] +struct Cli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + Login { + link: Option, + #[arg(long, value_name = "KEY", help = "Link with an API key instead of the browser")] token: Option, + #[arg(short, long)] server: Option, + }, + Logout, + Http { + target: String, + #[arg(short, long)] name: Option, + #[arg(long, value_name = "PATH|SUBDOMAIN", help = "Forwarding style for this tunnel (default: the server setting)")] mode: Option, + #[arg(long, value_name = "PREFIX=TARGET")] route: Vec, + #[arg(long)] keep_host: bool, + #[command(flatten)] rules: RuleArgs, + #[arg(long, value_name = "PASSWORD")] password: Option, + #[arg(long)] require_login: bool, + #[command(flatten)] shape: ShapeArgs, + #[arg(long, help = "Print plain log lines instead of the terminal UI")] plain: bool, + }, + Serve { + #[arg(default_value = ".")] dir: String, + #[arg(short, long)] name: Option, + #[arg(long, value_name = "PATH|SUBDOMAIN", help = "Forwarding style for this tunnel (default: the server setting)")] mode: Option, + #[command(flatten)] rules: RuleArgs, + #[arg(long, value_name = "PASSWORD")] password: Option, + #[arg(long)] require_login: bool, + #[command(flatten)] shape: ShapeArgs, + #[arg(long, help = "Print plain log lines instead of the terminal UI")] plain: bool, + }, + Tcp { + target: String, + #[arg(short, long)] name: Option, + #[command(flatten)] rules: RuleArgs, + #[command(flatten)] shape: ShapeArgs, + #[arg(long, help = "Print plain log lines instead of the terminal UI")] plain: bool, + }, + Connect { + target: String, + #[arg(short, long)] port: Option, + #[arg(short, long, default_value = "127.0.0.1")] bind: String, + #[arg(short, long)] server: Option, + }, + #[command(alias = "status")] + Ls, + Start { + #[arg(short, long, value_name = "FILE")] config: Option, + }, + Service { + #[command(subcommand)] + action: ServiceAction, + }, + #[cfg(feature = "gui")] + Gui { + link: Option, + #[arg(long)] hidden: bool, + }, + Config { + #[command(subcommand)] + action: ConfigAction, + }, + Update, + Links { + #[command(subcommand)] + action: LinkAction, + }, +} + +#[derive(clap::Args)] +struct RuleArgs { + #[arg(long, value_name = "CIDR")] allow: Vec, + #[arg(long, value_name = "CODE")] allow_country: Vec, + #[arg(long, value_name = "CIDR")] block_ip: Vec, + #[arg(long, value_name = "CODE")] block_country: Vec, + #[arg(long, value_name = "CATEGORY", help = "tor, vpn, datacenter or blocklist")] block: Vec, +} + +impl RuleArgs { + fn parse(self) -> anyhow::Result { + tunnel::Rules::new(self.allow, self.allow_country, self.block_ip, self.block_country, self.block) + } +} + +#[derive(clap::Args)] +struct ShapeArgs { + #[arg(long, value_name = "DURATION")] latency: Option, + #[arg(long, value_name = "DURATION")] jitter: Option, + #[arg(long, value_name = "RATE")] bandwidth: Option, + #[arg(long, value_name = "PERCENT")] loss: Option, +} + +impl ShapeArgs { + fn parse(&self) -> anyhow::Result { + shape::Shape::parse(self.latency.as_deref(), self.jitter.as_deref(), self.bandwidth.as_deref(), self.loss.as_deref()) + } +} + +#[derive(Subcommand)] +enum ServiceAction { + Install, + Uninstall, +} + +#[derive(Subcommand)] +enum LinkAction { + Register, + Forget, +} + +#[derive(Subcommand)] +enum ConfigAction { + Set { key: String, value: String }, + Get { key: String }, + Show, +} + +fn main() { + tls::install_provider(); + if cfg!(windows) { update::cleanup(); } + let cli = Cli::parse(); + let runtime = tokio::runtime::Builder::new_multi_thread().worker_threads(4).enable_all().build().unwrap_or_else(|err| fail(err.into())); + + #[cfg(feature = "gui")] + if let Commands::Gui { link, hidden } = cli.command { + gui::launch(runtime.handle().clone(), link, hidden).unwrap_or_else(|err| fail(err)); + return; + } + + runtime.block_on(run(cli)).unwrap_or_else(|err| fail(err)); +} + +fn fail(err: anyhow::Error) -> ! { + eprintln!("{} {err:#}", style("✗").red().bold()); + std::process::exit(1) +} + +async fn run(cli: Cli) -> anyhow::Result<()> { + match cli.command { + Commands::Login { link, token, server } => cli::login(link, token, server).await, + Commands::Logout => cli::logout(), + Commands::Http { target, name, mode, route, keep_host, rules, password, require_login, shape, plain } => + cli::tunnel(tunnel::Options::http(tunnel::TargetSpec::with_routes(&target, &route)?, name, keep_host, tunnel::Access::new(rules.parse()?, password, require_login)?).http_mode(mode).shaped(shape.parse()?), plain).await, + Commands::Serve { dir, name, mode, rules, password, require_login, shape, plain } => + cli::tunnel(tunnel::Options::http(tunnel::TargetSpec::dir(&dir)?, name, false, tunnel::Access::new(rules.parse()?, password, require_login)?).http_mode(mode).shaped(shape.parse()?), plain).await, + Commands::Tcp { target, name, rules, shape, plain } => + cli::tunnel(tunnel::Options::tcp(tunnel::Target::parse(&target)?, name, tunnel::Access::new(rules.parse()?, None, false)?).shaped(shape.parse()?), plain).await, + Commands::Connect { target, port, bind, server } => cli::connect(target, port, bind, server).await, + Commands::Ls => cli::list().await, + Commands::Start { config } => headless::run(config).await, + Commands::Service { action } => match action { + ServiceAction::Install => service::install(), + ServiceAction::Uninstall => service::uninstall(), + }, + #[cfg(feature = "gui")] + Commands::Gui { .. } => unreachable!("handled before the runtime starts"), + Commands::Links { action } => match action { + LinkAction::Register => { + let where_ = handler::install()?; + println!("{} {} links now open in this frislit", style("✓").green().bold(), style(format!("{}://", handler::SCHEME)).cyan().bold()); + println!(" {}", style(where_.to_string_lossy()).dim()); + println!(" Your browser will ask before it opens one."); + Ok(()) + } + LinkAction::Forget => { + handler::remove()?; + println!("{} {} links are no longer handled by frislit", style("✓").green().bold(), style(format!("{}://", handler::SCHEME)).bold()); + Ok(()) + } + }, + Commands::Update => cli::update().await, + Commands::Config { action } => match action { + ConfigAction::Set { key, value } => config::set(&key, &value), + ConfigAction::Get { key } => config::get(&key), + ConfigAction::Show => config::show(), + }, + } +} diff --git a/cli/src/mux.rs b/cli/src/mux.rs new file mode 100644 index 0000000..a3a6af7 --- /dev/null +++ b/cli/src/mux.rs @@ -0,0 +1,332 @@ +use anyhow::{anyhow, bail, Context, Result}; +use futures_util::{SinkExt, StreamExt}; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::collections::HashMap; +use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; +use std::sync::{Arc, Mutex}; +use std::time::Duration; +use tokio::sync::{mpsc, Notify}; +use tokio_tungstenite::tungstenite::client::IntoClientRequest; +use tokio_tungstenite::tungstenite::Message; +use tokio_tungstenite::{connect_async_tls_with_config, Connector}; + +pub const WINDOW: u32 = 1024 * 1024; +pub const CHUNK: usize = 64 * 1024; +const ACK_THRESHOLD: u32 = 256 * 1024; +const PING_INTERVAL: Duration = Duration::from_secs(20); +const DEAD_AFTER: Duration = Duration::from_secs(60); + +const OPEN: u8 = 0x01; +const DATA: u8 = 0x02; +const CLOSE: u8 = 0x03; +const WINDOW_UPDATE: u8 = 0x04; +const DATAGRAM: u8 = 0x05; +const RESET: u8 = 0x06; + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +pub struct OpenMeta { + #[serde(default)] pub protocol: String, + #[serde(default)] pub remote: String, +} + +impl OpenMeta { + pub fn tcp(remote: impl Into) -> Self { Self { protocol: "tcp".into(), remote: remote.into() } } + pub fn udp(remote: impl Into) -> Self { Self { protocol: "udp".into(), remote: remote.into() } } + pub fn is_udp(&self) -> bool { self.protocol == "udp" } +} + +#[derive(Debug)] +pub enum Incoming { + Data(Vec), + Datagram(Vec), + Close, + Reset, +} + +fn encode(kind: u8, id: u32, payload: &[u8]) -> Vec { + let mut frame = Vec::with_capacity(5 + payload.len()); + frame.push(kind); + frame.extend_from_slice(&id.to_be_bytes()); + frame.extend_from_slice(payload); + frame +} + +struct Credit { + available: Mutex, + notify: Notify, +} + +impl Credit { + fn new() -> Self { Self { available: Mutex::new(WINDOW as i64), notify: Notify::new() } } + fn add(&self, n: u32) { + *self.available.lock().unwrap() += n as i64; + self.notify.notify_waiters(); + } + async fn take(&self, n: usize, dead: &AtomicBool) -> bool { + loop { + if dead.load(Ordering::Relaxed) { return false; } + { + let mut avail = self.available.lock().unwrap(); + if *avail >= n as i64 { *avail -= n as i64; return true; } + } + let notified = self.notify.notified(); + if dead.load(Ordering::Relaxed) { return false; } + let _ = tokio::time::timeout(Duration::from_millis(500), notified).await; + } + } +} + +struct Shared { + id: u32, + mux: Arc, + credit: Credit, + dead: AtomicBool, + close_sent: AtomicBool, + close_received: AtomicBool, +} + +impl Drop for Shared { + fn drop(&mut self) { + self.mux.forget(self.id); + let clean = self.close_sent.load(Ordering::Relaxed) && self.close_received.load(Ordering::Relaxed); + if !self.dead.load(Ordering::Relaxed) && !clean { + self.mux.try_send(Message::Binary(encode(RESET, self.id, &[]).into())); + } + } +} + +#[derive(Clone)] +pub struct MuxWriter { shared: Arc } +pub struct MuxReader { shared: Arc, rx: mpsc::UnboundedReceiver, unacked: u32 } + +impl MuxWriter { + + pub async fn send(&self, data: &[u8]) -> Result<()> { + for chunk in data.chunks(CHUNK) { + if !self.shared.credit.take(chunk.len(), &self.shared.dead).await { bail!("stream closed"); } + self.shared.mux.send(Message::Binary(encode(DATA, self.shared.id, chunk).into())).await?; + } + Ok(()) + } + + pub async fn send_datagram(&self, data: &[u8]) -> Result<()> { + if data.len() > 65507 { return Ok(()); } + if self.shared.dead.load(Ordering::Relaxed) { bail!("stream closed"); } + self.shared.mux.send(Message::Binary(encode(DATAGRAM, self.shared.id, data).into())).await + } + + pub async fn close(&self) { + if self.shared.dead.load(Ordering::Relaxed) || self.shared.close_sent.swap(true, Ordering::Relaxed) { return; } + let _ = self.shared.mux.send(Message::Binary(encode(CLOSE, self.shared.id, &[]).into())).await; + } + + pub fn reset(&self) { + if self.shared.dead.swap(true, Ordering::Relaxed) { return; } + self.shared.mux.try_send(Message::Binary(encode(RESET, self.shared.id, &[]).into())); + } +} + +impl MuxReader { + fn ack(&mut self) { + if self.unacked == 0 || self.shared.dead.load(Ordering::Relaxed) { return; } + let n = self.unacked; + self.unacked = 0; + self.shared.mux.try_send(Message::Binary(encode(WINDOW_UPDATE, self.shared.id, &n.to_be_bytes()).into())); + } + + pub async fn recv(&mut self) -> Incoming { + if self.unacked >= ACK_THRESHOLD { self.ack(); } + match self.rx.recv().await { + Some(Incoming::Data(d)) => { + self.unacked += d.len() as u32; + Incoming::Data(d) + } + Some(Incoming::Close) => { + self.shared.close_received.store(true, Ordering::Relaxed); + Incoming::Close + } + Some(Incoming::Reset) | None => { + self.shared.dead.store(true, Ordering::Relaxed); + Incoming::Reset + } + Some(other) => other, + } + } +} + +struct Entry { + tx: mpsc::UnboundedSender, + shared: std::sync::Weak, +} + +pub struct Mux { + out: mpsc::Sender, + streams: Mutex>, + next_id: AtomicU32, + closed: AtomicBool, +} + +pub struct MuxEvents { + pub control: mpsc::Receiver, + pub streams: mpsc::Receiver<(MuxWriter, MuxReader, OpenMeta)>, +} + +impl Mux { + pub async fn connect(url: &str, token: Option<&str>, accept_invalid_certs: bool) -> Result<(Arc, MuxEvents)> { + let mut request = url.into_client_request().context("Invalid server URL")?; + if let Some(token) = token { + request.headers_mut().insert("Authorization", format!("Bearer {token}").parse()?); + } + let connector = Some(Connector::Rustls(crate::tls::client_config(accept_invalid_certs)?)); + let (ws, _) = connect_async_tls_with_config(request, None, true, connector).await + .map_err(|e| anyhow!("Could not connect to {url}: {e}"))?; + let (mut sink, mut source) = ws.split(); + + let (out_tx, mut out_rx) = mpsc::channel::(256); + let (control_tx, control_rx) = mpsc::channel::(64); + let (stream_tx, stream_rx) = mpsc::channel(64); + + let mux = Arc::new(Mux { out: out_tx, streams: Mutex::new(HashMap::new()), next_id: AtomicU32::new(1), closed: AtomicBool::new(false) }); + + tokio::spawn(async move { + while let Some(msg) = out_rx.recv().await { + if sink.send(msg).await.is_err() { break; } + } + let _ = sink.close().await; + }); + + let ping_out = mux.out.clone(); + tokio::spawn(async move { + loop { + tokio::time::sleep(PING_INTERVAL).await; + if ping_out.send(Message::Text(r#"{"type":"ping"}"#.into())).await.is_err() { break; } + } + }); + + let reader_mux = mux.clone(); + tokio::spawn(async move { + loop { + let msg = match tokio::time::timeout(DEAD_AFTER, source.next()).await { + Ok(Some(Ok(msg))) => msg, + _ => break, + }; + match msg { + Message::Text(text) => { + let Ok(value) = serde_json::from_str::(&text) else { continue }; + match value.get("type").and_then(|t| t.as_str()) { + Some("ping") => { let _ = reader_mux.out.send(Message::Text(r#"{"type":"pong"}"#.into())).await; } + Some("pong") => {} + Some(_) => { if control_tx.send(value).await.is_err() { break; } } + None => {} + } + } + Message::Binary(data) => { + if data.len() < 5 { continue; } + let kind = data[0]; + let id = u32::from_be_bytes([data[1], data[2], data[3], data[4]]); + let payload = &data[5..]; + if kind == OPEN { + let meta: OpenMeta = serde_json::from_slice(payload).unwrap_or_default(); + let (writer, reader) = reader_mux.register(id); + if stream_tx.send((writer, reader, meta)).await.is_err() { break; } + continue; + } + let (tx, shared) = { + let streams = reader_mux.streams.lock().unwrap(); + match streams.get(&id) { Some(e) => (e.tx.clone(), e.shared.upgrade()), None => continue } + }; + match kind { + DATA => { let _ = tx.send(Incoming::Data(payload.to_vec())); } + DATAGRAM => { let _ = tx.send(Incoming::Datagram(payload.to_vec())); } + CLOSE => { let _ = tx.send(Incoming::Close); } + RESET => { + if let Some(s) = shared { s.dead.store(true, Ordering::Relaxed); } + let _ = tx.send(Incoming::Reset); + reader_mux.forget(id); + } + WINDOW_UPDATE => { + if payload.len() >= 4 { + if let Some(s) = shared { s.credit.add(u32::from_be_bytes([payload[0], payload[1], payload[2], payload[3]])); } + } + } + _ => {} + } + } + Message::Close(_) => break, + _ => {} + } + } + reader_mux.shutdown(); + }); + + Ok((mux, MuxEvents { control: control_rx, streams: stream_rx })) + } + + fn register(self: &Arc, id: u32) -> (MuxWriter, MuxReader) { + let (tx, rx) = mpsc::unbounded_channel(); + let shared = Arc::new(Shared { + id, mux: self.clone(), credit: Credit::new(), + dead: AtomicBool::new(false), close_sent: AtomicBool::new(false), close_received: AtomicBool::new(false), + }); + self.streams.lock().unwrap().insert(id, Entry { tx, shared: Arc::downgrade(&shared) }); + (MuxWriter { shared: shared.clone() }, MuxReader { shared, rx, unacked: 0 }) + } + + pub async fn open(self: &Arc, meta: &OpenMeta) -> Result<(MuxWriter, MuxReader)> { + if self.closed.load(Ordering::Relaxed) { bail!("not connected"); } + let id = self.next_id.fetch_add(2, Ordering::Relaxed); + let (writer, reader) = self.register(id); + self.send(Message::Binary(encode(OPEN, id, serde_json::to_vec(meta)?.as_slice()).into())).await?; + Ok((writer, reader)) + } + + pub async fn send_control(&self, message: Value) -> Result<()> { + self.send(Message::Text(message.to_string().into())).await + } + + pub async fn close(&self) { + let _ = self.out.send(Message::Close(None)).await; + self.shutdown(); + } + + async fn send(&self, msg: Message) -> Result<()> { + if self.closed.load(Ordering::Relaxed) { bail!("connection closed"); } + self.out.send(msg).await.map_err(|_| anyhow!("connection closed")) + } + + fn try_send(&self, msg: Message) { + if self.closed.load(Ordering::Relaxed) { return; } + let out = self.out.clone(); + tokio::spawn(async move { let _ = out.send(msg).await; }); + } + + fn forget(&self, id: u32) { + self.streams.lock().unwrap().remove(&id); + } + + fn shutdown(&self) { + self.closed.store(true, Ordering::Relaxed); + let entries: Vec = self.streams.lock().unwrap().drain().map(|(_, e)| e).collect(); + for entry in entries { + if let Some(shared) = entry.shared.upgrade() { shared.dead.store(true, Ordering::Relaxed); } + let _ = entry.tx.send(Incoming::Reset); + } + } +} + +pub async fn expect(events: &mut MuxEvents, expected: &str) -> Result { + match events.control.recv().await { + Some(msg) => { + let kind = msg.get("type").and_then(|t| t.as_str()).unwrap_or(""); + if kind == "error" { + let message = msg.get("message").and_then(|m| m.as_str()).unwrap_or("unknown error"); + let code = msg.get("code").and_then(|m| m.as_str()).unwrap_or("error"); + bail!("{message} ({code})"); + } + if kind != expected { bail!("Unexpected message from server: {kind}"); } + Ok(msg) + } + None => bail!("Connection closed by server"), + } +} diff --git a/cli/src/qr.rs b/cli/src/qr.rs new file mode 100644 index 0000000..b88add6 --- /dev/null +++ b/cli/src/qr.rs @@ -0,0 +1,21 @@ +use qrcode::render::unicode; +use qrcode::QrCode; + +pub fn print(text: &str) { + let Ok(code) = QrCode::new(text.as_bytes()) else { return }; + let rendered = code.render::().dark_color(unicode::Dense1x2::Light).light_color(unicode::Dense1x2::Dark).quiet_zone(true).build(); + for line in rendered.lines() { println!(" {line}"); } +} + +pub fn copy(text: &str) -> bool { + let Ok(mut clip) = arboard::Clipboard::new() else { return false }; + let text = text.to_string(); + #[cfg(target_os = "linux")] + { + use arboard::SetExtLinux; + std::thread::spawn(move || { let _ = clip.set().wait().text(text); }); + true + } + #[cfg(not(target_os = "linux"))] + clip.set_text(text).is_ok() +} diff --git a/cli/src/router.rs b/cli/src/router.rs new file mode 100644 index 0000000..50dca0b --- /dev/null +++ b/cli/src/router.rs @@ -0,0 +1,168 @@ +use crate::session::Task; +use anyhow::{bail, Result}; +use bytes::Bytes; +use http_body_util::{combinators::BoxBody, BodyExt, Empty}; +use hyper::body::Incoming; +use hyper::header::{HeaderValue, CONNECTION, UPGRADE}; +use hyper::server::conn::http1; +use hyper::service::service_fn; +use hyper::{Request, Response, StatusCode}; +use hyper_util::rt::TokioIo; +use std::path::PathBuf; +use std::sync::Arc; +use tokio::io::{AsyncRead, AsyncWrite}; +use tokio::net::TcpListener; +use crate::serve; +use crate::tunnel::{connect_target, Target}; + +#[derive(Clone)] +pub enum RouteTarget { Addr(Target), Dir(PathBuf) } + +#[derive(Clone)] +pub struct Route { pub prefix: String, pub target: RouteTarget } + +impl Route { + pub fn parse(raw: &str) -> Result { + let Some((prefix, target)) = raw.split_once('=') else { bail!("Invalid route \"{raw}\": use =") }; + Ok(Self { prefix: normalize(prefix)?, target: RouteTarget::parse(target)? }) + } + + pub fn new(prefix: &str, target: RouteTarget) -> Result { + Ok(Self { prefix: normalize(prefix)?, target }) + } +} + +impl RouteTarget { + pub fn parse(raw: &str) -> Result { + let path = std::path::Path::new(raw); + if path.is_dir() { return Ok(Self::Dir(path.to_path_buf())); } + Ok(Self::Addr(Target::parse(raw)?)) + } + + pub fn dir(raw: &str) -> Result { + let path = std::path::Path::new(raw); + if !path.exists() { bail!("\"{raw}\" does not exist"); } + if !path.is_dir() { bail!("\"{raw}\" is not a directory - use `frislit http {raw}` for a port or host:port"); } + Ok(Self::Dir(path.to_path_buf())) + } + + pub fn label(&self) -> String { + match self { Self::Addr(target) => target.label(), Self::Dir(dir) => dir.display().to_string() } + } +} + +fn normalize(prefix: &str) -> Result { + let trimmed = prefix.trim().trim_end_matches('/'); + if trimmed.is_empty() { return Ok("/".into()); } + if !trimmed.starts_with('/') { bail!("Route prefix \"{prefix}\" must start with /"); } + Ok(trimmed.to_string()) +} + +struct Mounted { prefix: String, target: Target, strip: bool } + +impl Mounted { + fn matches(&self, path: &str) -> bool { + self.prefix == "/" || (path.starts_with(&self.prefix) && matches!(path.as_bytes().get(self.prefix.len()), None | Some(b'/'))) + } + + fn rest<'a>(&self, path: &'a str) -> &'a str { + if !self.strip || self.prefix == "/" { return path; } + match &path[self.prefix.len()..] { "" => "/", rest => rest } + } +} + +struct Table { routes: Vec } + +impl Table { + fn pick(&self, path: &str) -> &Mounted { + self.routes.iter().filter(|route| route.matches(path)).max_by_key(|route| route.prefix.len()).expect("the root route always matches") + } +} + +pub async fn start(routes: Vec) -> Result<(u16, Task)> { + let mut mounted = Vec::new(); + let mut servers = Vec::new(); + for route in routes { + let (target, strip) = match route.target { + RouteTarget::Addr(target) => (target, false), + RouteTarget::Dir(dir) => { + let (port, server) = serve::start(dir).await?; + servers.push(server); + (Target { host: "127.0.0.1".into(), port, tls: false }, true) + } + }; + mounted.push(Mounted { prefix: route.prefix, target, strip }); + } + let table = Arc::new(Table { routes: mounted }); + + let listener = TcpListener::bind("127.0.0.1:0").await?; + let port = listener.local_addr()?.port(); + let task = tokio::spawn(async move { + let _servers = servers; + loop { + let Ok((socket, _)) = listener.accept().await else { continue }; + let table = table.clone(); + tokio::spawn(async move { + let service = service_fn(move |req| handle(req, table.clone())); + let _ = http1::Builder::new().preserve_header_case(true).serve_connection(TokioIo::new(socket), service).with_upgrades().await; + }); + } + }); + Ok((port, Task(task))) +} + +type Body = BoxBody; + +fn status(code: StatusCode) -> Response { + Response::builder().status(code).body(Empty::new().map_err(|never| match never {}).boxed()).unwrap() +} + +async fn connect(target: &Target) -> Result> { + let socket = connect_target(&target.resolve().await?).await?; + if !target.tls { return Ok(Box::new(socket)); } + Ok(Box::new(crate::tls::connect_trusting(&target.host, socket).await?)) +} + +trait Stream: AsyncRead + AsyncWrite + Unpin + Send {} +impl Stream for T {} + +async fn handle(mut req: Request, table: Arc) -> Result, hyper::Error> { + let path = req.uri().path().to_string(); + let route = table.pick(&path); + if route.strip { + let rest = route.rest(&path); + let uri = match req.uri().query() { Some(query) => format!("{rest}?{query}"), None => rest.to_string() }; + let Ok(parsed) = uri.parse() else { return Ok(status(StatusCode::BAD_REQUEST)) }; + *req.uri_mut() = parsed; + } + + let Ok(stream) = connect(&route.target).await else { return Ok(status(StatusCode::BAD_GATEWAY)) }; + let Ok((mut sender, conn)) = hyper::client::conn::http1::Builder::new().preserve_header_case(true).handshake(TokioIo::new(stream)).await + else { return Ok(status(StatusCode::BAD_GATEWAY)) }; + tokio::spawn(async move { let _ = conn.with_upgrades().await; }); + + let upgrading = req.headers().get(UPGRADE).cloned(); + let client_upgrade = upgrading.as_ref().map(|_| hyper::upgrade::on(&mut req)); + + let mut response = match sender.send_request(req).await { + Ok(response) => response, + Err(_) => return Ok(status(StatusCode::BAD_GATEWAY)), + }; + + if response.status() == StatusCode::SWITCHING_PROTOCOLS { + if let (Some(client), Some(upgrade)) = (client_upgrade, upgrading) { + let upstream = hyper::upgrade::on(&mut response); + tokio::spawn(async move { + if let (Ok(a), Ok(b)) = (client.await, upstream.await) { + let mut a = TokioIo::new(a); + let mut b = TokioIo::new(b); + let _ = tokio::io::copy_bidirectional(&mut a, &mut b).await; + } + }); + response.headers_mut().insert(UPGRADE, upgrade); + response.headers_mut().insert(CONNECTION, HeaderValue::from_static("upgrade")); + } + } + + Ok(response.map(|body| body.boxed())) +} diff --git a/cli/src/serve.rs b/cli/src/serve.rs new file mode 100644 index 0000000..c476e37 --- /dev/null +++ b/cli/src/serve.rs @@ -0,0 +1,190 @@ +use anyhow::{Context, Result}; +use std::path::{Path, PathBuf}; +use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader}; +use tokio::net::{TcpListener, TcpStream}; +use crate::session::Task; + +const MAX_HEADER_BYTES: usize = 16 * 1024; + +pub async fn start(dir: PathBuf) -> Result<(u16, Task)> { + let dir = dir.canonicalize().with_context(|| format!("Cannot read directory {}", dir.display()))?; + let listener = TcpListener::bind("127.0.0.1:0").await?; + let port = listener.local_addr()?.port(); + let task = tokio::spawn(async move { + loop { + let Ok((socket, _)) = listener.accept().await else { continue }; + let dir = dir.clone(); + tokio::spawn(async move { let _ = handle(socket, &dir).await; }); + } + }); + Ok((port, Task(task))) +} + +async fn handle(socket: TcpStream, root: &Path) -> Result<()> { + let (rd, mut wr) = socket.into_split(); + let mut reader = BufReader::new(rd); + + let mut request_line = String::new(); + reader.read_line(&mut request_line).await?; + let mut parts = request_line.split_whitespace(); + let method = parts.next().unwrap_or("").to_string(); + let raw_path = parts.next().unwrap_or("/").to_string(); + + let mut total = request_line.len(); + loop { + let mut line = String::new(); + let n = reader.read_line(&mut line).await?; + total += n; + if n == 0 || line == "\r\n" || line == "\n" || total > MAX_HEADER_BYTES { break; } + } + + if method != "GET" && method != "HEAD" { + return respond(&mut wr, 405, "text/plain; charset=utf-8", b"Method Not Allowed", false).await; + } + + let path_only = raw_path.split('?').next().unwrap_or("/"); + let decoded = percent_decode(path_only); + let Some(target) = resolve(root, &decoded) else { + return respond(&mut wr, 404, "text/plain; charset=utf-8", b"Not Found", method == "HEAD").await; + }; + + if target.is_dir() { + if !path_only.ends_with('/') { + let location = format!("{}/", path_only); + let head = format!("HTTP/1.1 301 Moved Permanently\r\nLocation: {location}\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"); + wr.write_all(head.as_bytes()).await?; + return Ok(()); + } + let index = target.join("index.html"); + if index.is_file() { return send_file(&mut wr, &index, method == "HEAD").await; } + let body = listing(&target, &decoded).await; + return respond(&mut wr, 200, "text/html; charset=utf-8", body.as_bytes(), method == "HEAD").await; + } + if target.is_file() { return send_file(&mut wr, &target, method == "HEAD").await; } + respond(&mut wr, 404, "text/plain; charset=utf-8", b"Not Found", method == "HEAD").await +} + +fn resolve(root: &Path, request_path: &str) -> Option { + let mut path = root.to_path_buf(); + for segment in request_path.split('/') { + match segment { + "" | "." => {} + ".." => return None, + s if s.contains('\\') || s.contains('\0') => return None, + s => path.push(s), + } + } + let resolved = path.canonicalize().ok()?; + if resolved.starts_with(root) { Some(resolved) } else { None } +} + +async fn send_file(wr: &mut tokio::net::tcp::OwnedWriteHalf, path: &Path, head_only: bool) -> Result<()> { + let mut file = tokio::fs::File::open(path).await?; + let len = file.metadata().await?.len(); + let mime = mime_for(path); + let head = format!("HTTP/1.1 200 OK\r\nContent-Type: {mime}\r\nContent-Length: {len}\r\nCache-Control: no-cache\r\nConnection: close\r\n\r\n"); + wr.write_all(head.as_bytes()).await?; + if !head_only { tokio::io::copy(&mut file, wr).await?; } + wr.shutdown().await?; + Ok(()) +} + +async fn respond(wr: &mut tokio::net::tcp::OwnedWriteHalf, status: u16, mime: &str, body: &[u8], head_only: bool) -> Result<()> { + let reason = match status { 200 => "OK", 404 => "Not Found", 405 => "Method Not Allowed", _ => "Error" }; + let head = format!("HTTP/1.1 {status} {reason}\r\nContent-Type: {mime}\r\nContent-Length: {}\r\nCache-Control: no-cache\r\nConnection: close\r\n\r\n", body.len()); + wr.write_all(head.as_bytes()).await?; + if !head_only { wr.write_all(body).await?; } + wr.shutdown().await?; + Ok(()) +} + +async fn listing(dir: &Path, request_path: &str) -> String { + let mut entries = Vec::new(); + if let Ok(mut read) = tokio::fs::read_dir(dir).await { + while let Ok(Some(entry)) = read.next_entry().await { + let name = entry.file_name().to_string_lossy().to_string(); + let is_dir = entry.file_type().await.map(|t| t.is_dir()).unwrap_or(false); + let size = entry.metadata().await.map(|m| m.len()).unwrap_or(0); + entries.push((is_dir, name, size)); + } + } + entries.sort_by(|a, b| b.0.cmp(&a.0).then_with(|| a.1.to_lowercase().cmp(&b.1.to_lowercase()))); + + let title = escape(if request_path.is_empty() { "/" } else { request_path }); + let mut html = format!("Index of {title}

Index of {title}

"); + if request_path != "/" && !request_path.is_empty() { + html.push_str(""); + } + for (is_dir, name, size) in entries { + let href = percent_encode(&name); + let (label, suffix) = if is_dir { (format!("{}/", escape(&name)), "/") } else { (escape(&name), "") }; + let size_text = if is_dir { String::new() } else { human_size(size) }; + html.push_str(&format!("")); + } + html.push_str("
../
{label}{size_text}
"); + html +} + +fn human_size(bytes: u64) -> String { + const UNITS: [&str; 5] = ["B", "KB", "MB", "GB", "TB"]; + let mut value = bytes as f64; + let mut unit = 0; + while value >= 1024.0 && unit < UNITS.len() - 1 { value /= 1024.0; unit += 1; } + if unit == 0 { format!("{bytes} B") } else { format!("{value:.1} {}", UNITS[unit]) } +} + +fn escape(text: &str) -> String { + text.replace('&', "&").replace('<', "<").replace('>', ">").replace('"', """) +} + +fn percent_encode(text: &str) -> String { + let mut out = String::new(); + for byte in text.bytes() { + match byte { + b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => out.push(byte as char), + _ => out.push_str(&format!("%{byte:02X}")), + } + } + out +} + +fn percent_decode(text: &str) -> String { + let bytes = text.as_bytes(); + let mut out = Vec::with_capacity(bytes.len()); + let mut i = 0; + while i < bytes.len() { + if bytes[i] == b'%' && i + 2 < bytes.len() { + if let Ok(value) = u8::from_str_radix(&text[i + 1..i + 3], 16) { out.push(value); i += 3; continue; } + } + out.push(bytes[i]); + i += 1; + } + String::from_utf8_lossy(&out).to_string() +} + +fn mime_for(path: &Path) -> &'static str { + match path.extension().and_then(|e| e.to_str()).map(|e| e.to_ascii_lowercase()).as_deref() { + Some("html") | Some("htm") => "text/html; charset=utf-8", + Some("css") => "text/css; charset=utf-8", + Some("js") | Some("mjs") => "text/javascript; charset=utf-8", + Some("json") => "application/json; charset=utf-8", + Some("md") | Some("txt") | Some("log") => "text/plain; charset=utf-8", + Some("xml") => "application/xml", + Some("svg") => "image/svg+xml", + Some("png") => "image/png", + Some("jpg") | Some("jpeg") => "image/jpeg", + Some("gif") => "image/gif", + Some("webp") => "image/webp", + Some("ico") => "image/x-icon", + Some("woff") => "font/woff", + Some("woff2") => "font/woff2", + Some("ttf") => "font/ttf", + Some("pdf") => "application/pdf", + Some("zip") => "application/zip", + Some("wasm") => "application/wasm", + Some("mp4") => "video/mp4", + Some("webm") => "video/webm", + Some("mp3") => "audio/mpeg", + _ => "application/octet-stream", + } +} diff --git a/cli/src/service.rs b/cli/src/service.rs new file mode 100644 index 0000000..70e3a5e --- /dev/null +++ b/cli/src/service.rs @@ -0,0 +1,207 @@ +use crate::config::Config; +use crate::handler::exe; +use crate::headless; +use anyhow::{bail, Context, Result}; +use console::style; +use std::fs; +use std::path::PathBuf; +use std::process::Command; + +const NAME: &str = "frislit"; + +#[cfg(not(target_os = "windows"))] +fn run(program: &str, args: &[&str]) -> Result<()> { + let status = Command::new(program) + .args(args) + .status() + .with_context(|| format!("Could not run {program}"))?; + if !status.success() { + bail!("{program} {} failed", args.join(" ")); + } + Ok(()) +} + +fn ensure_manifest() -> Result { + let path = headless::default_path()?; + if path.exists() { + headless::load(&path)?; + return Ok(path); + } + fs::create_dir_all(path.parent().unwrap())?; + fs::write(&path, headless::EXAMPLE)?; + bail!( + "Wrote an example to {}. Edit it, then run `frislit service install` again", + path.display() + ); +} + +#[cfg(target_os = "linux")] +fn unit_path() -> Result { + Ok(dirs::config_dir() + .context("No config directory")? + .join("systemd") + .join("user") + .join(format!("{NAME}.service"))) +} + +#[cfg(target_os = "linux")] +fn install_platform() -> Result { + let path = unit_path()?; + fs::create_dir_all(path.parent().unwrap())?; + fs::write(&path, format!( + "[Unit]\nDescription=frislit tunnels\nAfter=network-online.target\nWants=network-online.target\n\n\ + [Service]\nExecStart={} start\nRestart=on-failure\nRestartSec=5\n\n\ + [Install]\nWantedBy=default.target\n", + exe()?, + ))?; + run("systemctl", &["--user", "daemon-reload"])?; + run("systemctl", &["--user", "enable", "--now", NAME])?; + if let Ok(user) = std::env::var("USER") { + let _ = Command::new("loginctl") + .args(["enable-linger", &user]) + .status(); + } + Ok(format!( + "systemd user unit {}\n Logs: journalctl --user -u {NAME} -f", + path.display() + )) +} + +#[cfg(target_os = "linux")] +fn uninstall_platform() -> Result<()> { + let _ = Command::new("systemctl") + .args(["--user", "disable", "--now", NAME]) + .status(); + let path = unit_path()?; + if path.exists() { + fs::remove_file(path)?; + } + let _ = Command::new("systemctl") + .args(["--user", "daemon-reload"]) + .status(); + Ok(()) +} + +#[cfg(target_os = "macos")] +fn plist_path() -> Result { + Ok(dirs::home_dir() + .context("No home directory")? + .join("Library") + .join("LaunchAgents") + .join("dev.frislit.start.plist")) +} + +#[cfg(target_os = "macos")] +fn domain() -> Result { + let output = Command::new("id") + .arg("-u") + .output() + .context("Could not run id")?; + Ok(format!( + "gui/{}", + String::from_utf8_lossy(&output.stdout).trim() + )) +} + +#[cfg(target_os = "macos")] +fn install_platform() -> Result { + let path = plist_path()?; + let log = dirs::home_dir() + .context("No home directory")? + .join("Library") + .join("Logs") + .join("frislit.log"); + fs::create_dir_all(path.parent().unwrap())?; + fs::write(&path, format!( + "\n\ + \n\ + \n\ + Labeldev.frislit.start\n\ + ProgramArguments{}start\n\ + RunAtLoad\nKeepAlive\n\ + StandardOutPath{log}\nStandardErrorPath{log}\n\ + \n", + exe()?, log = log.display(), + ))?; + let _ = Command::new("launchctl") + .args(["bootout", &domain()?, &path.to_string_lossy()]) + .status(); + run( + "launchctl", + &["bootstrap", &domain()?, &path.to_string_lossy()], + )?; + Ok(format!( + "launch agent {}\n Logs: {}", + path.display(), + log.display() + )) +} + +#[cfg(target_os = "macos")] +fn uninstall_platform() -> Result<()> { + let path = plist_path()?; + let _ = Command::new("launchctl") + .args(["bootout", &domain()?, &path.to_string_lossy()]) + .status(); + if path.exists() { + fs::remove_file(path)?; + } + Ok(()) +} + +#[cfg(target_os = "windows")] +fn install_platform() -> Result { + // schtasks /TR keeps the quotes around the exe path inside , which Windows + // cannot launch, so the task is registered through the ScheduledTasks module instead. + let exe = exe()?.replace('\'', "''"); + let script = format!( + "$ErrorActionPreference = 'Stop'\n\ + $user = \"$env:USERDOMAIN\\$env:USERNAME\"\n\ + $action = New-ScheduledTaskAction -Execute '{exe}' -Argument 'start'\n\ + $trigger = New-ScheduledTaskTrigger -AtLogOn -User $user\n\ + $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries `\n\ + -StartWhenAvailable -ExecutionTimeLimit ([TimeSpan]::Zero)\n\ + Register-ScheduledTask -TaskName '{NAME}' -Action $action -Trigger $trigger -Settings $settings -Force | Out-Null\n" + ); + let path = std::env::temp_dir().join(format!("{NAME}-service.ps1")); + fs::write(&path, script)?; + let status = Command::new("powershell") + .args(["-NoProfile", "-ExecutionPolicy", "Bypass", "-File"]) + .arg(&path) + .status() + .context("Could not run powershell")?; + let _ = fs::remove_file(&path); + if !status.success() { + bail!("Registering the scheduled task \"{NAME}\" failed"); + } + Ok(format!("scheduled task \"{NAME}\", runs at logon")) +} + +#[cfg(target_os = "windows")] +fn uninstall_platform() -> Result<()> { + let _ = Command::new("schtasks") + .args(["/End", "/TN", NAME]) + .status(); + let _ = Command::new("schtasks") + .args(["/Delete", "/F", "/TN", NAME]) + .status(); + Ok(()) +} + +pub fn install() -> Result<()> { + Config::load()?.require_auth()?; + let manifest = ensure_manifest()?; + let installed = install_platform()?; + println!( + "{} frislit starts with your session: {installed}", + style("✓").green().bold() + ); + println!(" Tunnels: {}", style(manifest.display()).dim()); + Ok(()) +} + +pub fn uninstall() -> Result<()> { + uninstall_platform()?; + println!("{} Service removed", style("✓").green().bold()); + Ok(()) +} diff --git a/cli/src/session.rs b/cli/src/session.rs new file mode 100644 index 0000000..f144057 --- /dev/null +++ b/cli/src/session.rs @@ -0,0 +1,183 @@ +use tokio::sync::{mpsc, watch}; + +pub struct Request { + pub kind: String, + pub method: String, + pub path: String, + pub status: u16, + pub duration: u64, + pub ip: String, + pub country: Option, + pub org: Option, + pub flags: Vec, +} + +impl Request { + pub fn from_control(message: &serde_json::Value) -> Self { + let field = |key: &str| message.get(key).and_then(|value| value.as_str()).unwrap_or("").to_string(); + let optional = |key: &str| message.get(key).and_then(|value| value.as_str()).map(String::from); + Self { + kind: field("kind"), + method: field("method"), + path: field("path"), + status: message.get("status").and_then(|value| value.as_u64()).unwrap_or(0) as u16, + duration: message.get("duration").and_then(|value| value.as_u64()).unwrap_or(0), + ip: field("ip"), + country: optional("country"), + org: optional("org"), + flags: message.get("flags").and_then(|value| value.as_array()).map(|list| list.iter().filter_map(|v| v.as_str().map(String::from)).collect()).unwrap_or_default(), + } + } + + pub fn intel(&self) -> Option { + let parts: Vec<&str> = self.country.iter().chain(self.org.iter()).chain(self.flags.iter()).map(String::as_str).collect(); + if parts.is_empty() { None } else { Some(parts.join(" · ")) } + } +} + +pub struct Connection { + pub key: String, + pub opened: bool, + pub protocol: String, + pub ip: String, + pub country: Option, + pub org: Option, + pub bytes_in: u64, + pub bytes_out: u64, + pub duration: u64, + pub reason: Option, + pub detail: Option, +} + +impl Connection { + pub fn from_control(message: &serde_json::Value) -> Self { + let text = |key: &str| message.get(key).and_then(|value| value.as_str()).map(String::from); + let number = |key: &str| message.get(key).and_then(|value| value.as_u64()).unwrap_or(0); + let detail = message.get("detail").filter(|value| !value.is_null()).map(|value| { + let name = value.get("name").and_then(|v| v.as_str()).unwrap_or(""); + match value.get("info").and_then(|v| v.as_str()) { Some(info) => format!("{name} {info}"), None => name.to_string() } + }); + Self { + key: text("key").unwrap_or_default(), + opened: message.get("event").and_then(|value| value.as_str()) == Some("open"), + protocol: text("protocol").unwrap_or_default().to_uppercase(), + ip: text("ip").unwrap_or_default(), + country: text("country"), + org: text("org"), + bytes_in: number("bytesIn"), + bytes_out: number("bytesOut"), + duration: number("duration"), + reason: text("reason"), + detail, + } + } + + pub fn intel(&self) -> Option { + let parts: Vec<&str> = self.country.iter().chain(self.org.iter()).map(String::as_str).collect(); + if parts.is_empty() { None } else { Some(parts.join(" · ")) } + } + + pub fn line(&self) -> String { + let mut parts = vec![format!("{:<4}", self.protocol), if self.opened { "open ".to_string() } else { "closed".to_string() }, self.ip.clone()]; + if self.opened { + if let Some(detail) = &self.detail { parts.push(detail.clone()); } + if let Some(intel) = self.intel() { parts.push(intel); } + } else { + parts.push(format!("{} in, {} out, {}", bytes(self.bytes_in), bytes(self.bytes_out), took(self.duration))); + if let Some(reason) = &self.reason { parts.push(reason.clone()); } + } + parts.join(" ") + } +} + +pub fn bytes(value: u64) -> String { + const UNITS: [&str; 4] = ["B", "kB", "MB", "GB"]; + let mut size = value as f64; + let mut unit = 0; + while size >= 1000.0 && unit < UNITS.len() - 1 { size /= 1000.0; unit += 1; } + if unit == 0 { format!("{value} B") } else { format!("{size:.1} {}", UNITS[unit]) } +} + +pub fn took(millis: u64) -> String { + if millis < 1000 { format!("{millis}ms") } else if millis < 60_000 { format!("{:.1}s", millis as f64 / 1000.0) } else { format!("{}m {}s", millis / 60_000, (millis % 60_000) / 1000) } +} + +#[derive(Clone)] +pub struct Online { + pub id: String, + pub url: Option, + pub share_code: Option, + pub connect_url: Option, + pub custom_urls: Vec, + pub persistent: bool, + pub access: Option, +} + +impl Online { + pub fn link(&self, server_url: &str) -> Option { + if let Some(url) = &self.url { return Some(url.clone()); } + let code = self.share_code.as_ref()?; + Some(self.connect_url.clone().unwrap_or_else(|| format!("{server_url}/@frislit/connect/{code}"))) + } +} + +pub enum TunnelEvent { + Connecting, + Online(Online), + Resumed(Online), + Replaced(Online), + Request(Request), + Connection(Connection), + Access(String), + Reconnecting { seconds: u64, reason: Option }, + Update(String), + Stopped, + Ended(String), +} + +pub enum JoinEvent { + Connecting, + Forwarding { bind: String, port: u16, tunnel_id: String, owner_online: bool }, + Reconnecting { seconds: u64, reason: Option }, + Reconnected, + Stopped, + Ended(String), +} + +pub type Events = mpsc::UnboundedSender; + +pub fn channel() -> (Events, mpsc::UnboundedReceiver) { mpsc::unbounded_channel() } + +pub struct Task(pub tokio::task::JoinHandle<()>); + +impl Drop for Task { + fn drop(&mut self) { self.0.abort(); } +} + +#[derive(Clone)] +pub struct StopHandle(watch::Sender); + +impl StopHandle { + pub fn stop(&self) { let _ = self.0.send(true); } +} + +pub struct Stop(watch::Receiver); + +impl Stop { + pub fn new() -> (StopHandle, Self) { + let (tx, rx) = watch::channel(false); + (StopHandle(tx), Self(rx)) + } + + pub fn subscribe(handle: &StopHandle) -> Self { + Self(handle.0.subscribe()) + } + + pub async fn wait(&mut self) { + if *self.0.borrow() { return; } + while self.0.changed().await.is_ok() { + if *self.0.borrow() { return; } + } + std::future::pending::<()>().await; + } +} diff --git a/cli/src/shape.rs b/cli/src/shape.rs new file mode 100644 index 0000000..5583d04 --- /dev/null +++ b/cli/src/shape.rs @@ -0,0 +1,105 @@ +use anyhow::{bail, Context, Result}; +use std::time::Duration; +use tokio::sync::mpsc::Receiver; +use tokio::time::Instant; + +const MIN_STALL: Duration = Duration::from_millis(200); + +#[derive(Clone, Default)] +pub struct Shape { + pub latency: Duration, + pub jitter: Duration, + pub bandwidth: Option, + pub loss: f64, +} + +fn number(text: &str, unit: &str) -> Result { + text.parse::().ok().filter(|value| *value >= 0.0).with_context(|| format!("Invalid {unit} \"{text}\"")) +} + +pub fn duration(raw: &str) -> Result { + let text = raw.trim().to_ascii_lowercase(); + let (value, factor) = match text.strip_suffix("ms") { + Some(value) => (value, 0.001), + None => match text.strip_suffix('s') { Some(value) => (value, 1.0), None => (text.as_str(), 0.001) }, + }; + Ok(Duration::from_secs_f64(number(value.trim(), "duration")? * factor)) +} + +pub fn rate(raw: &str) -> Result { + let text = raw.trim().to_ascii_lowercase().replace(' ', ""); + let units = [("gbps", 125_000_000.0), ("mbps", 125_000.0), ("kbps", 125.0), ("bps", 0.125), ("gb/s", 1e9), ("mb/s", 1e6), ("kb/s", 1e3), ("b/s", 1.0)]; + for (suffix, factor) in units { + if let Some(value) = text.strip_suffix(suffix) { + let bytes = number(value, "bandwidth")? * factor; + if bytes < 1.0 { bail!("Bandwidth \"{raw}\" is too low"); } + return Ok(bytes as u64); + } + } + bail!("Invalid bandwidth \"{raw}\": use e.g. 512kbps, 2mbps or 100kB/s") +} + +pub fn percent(raw: &str) -> Result { + let value = number(raw.trim().trim_end_matches('%').trim(), "loss")?; + if value > 100.0 { bail!("Loss must be between 0 and 100 percent"); } + Ok(value / 100.0) +} + +impl Shape { + pub fn parse(latency: Option<&str>, jitter: Option<&str>, bandwidth: Option<&str>, loss: Option<&str>) -> Result { + Ok(Self { + latency: latency.map(duration).transpose()?.unwrap_or_default(), + jitter: jitter.map(duration).transpose()?.unwrap_or_default(), + bandwidth: bandwidth.map(rate).transpose()?, + loss: loss.map(percent).transpose()?.unwrap_or_default(), + }) + } + + pub fn active(&self) -> bool { + !self.latency.is_zero() || !self.jitter.is_zero() || self.bandwidth.is_some() || self.loss > 0.0 + } + + pub fn summary(&self) -> Option { + if !self.active() { return None; } + let mut parts = Vec::new(); + if !self.latency.is_zero() || !self.jitter.is_zero() { + let mut text = format!("{} ms latency", self.latency.as_millis()); + if !self.jitter.is_zero() { text.push_str(&format!(" ±{} ms", self.jitter.as_millis())); } + parts.push(text); + } + if let Some(bytes) = self.bandwidth { + let bits = bytes * 8; + parts.push(if bits >= 1_000_000 { format!("{:.1} mbps", bits as f64 / 1e6) } else { format!("{} kbps", bits / 1000) }); + } + if self.loss > 0.0 { parts.push(format!("{}% loss", (self.loss * 100.0 * 10.0).round() / 10.0)); } + Some(parts.join(" · ")) + } + + pub fn lose(&self) -> bool { + self.loss > 0.0 && fastrand::f64() < self.loss + } + + fn release(&self, arrived: Instant, len: usize, stall: bool, last: &mut Instant) -> Instant { + let jitter = Duration::from_secs_f64(fastrand::f64() * self.jitter.as_secs_f64()); + let mut at = arrived + self.latency + jitter; + if stall && self.lose() { at += (self.latency * 3).max(MIN_STALL); } + at = at.max(*last); + if let Some(bytes) = self.bandwidth { at += Duration::from_secs_f64(len as f64 / bytes as f64); } + *last = at; + at + } + + pub async fn next(&self, queue: &mut Queue, stall: bool) -> Option> { + let (arrived, chunk) = queue.rx.recv().await?; + tokio::time::sleep_until(self.release(arrived, chunk.len(), stall, &mut queue.last)).await; + Some(chunk) + } +} + +pub struct Queue { rx: Receiver<(Instant, Vec)>, last: Instant } + +impl Queue { + pub fn new(rx: Receiver<(Instant, Vec)>) -> Self { + Self { rx, last: Instant::now() } + } +} diff --git a/cli/src/tcp.rs b/cli/src/tcp.rs new file mode 100644 index 0000000..bdc310d --- /dev/null +++ b/cli/src/tcp.rs @@ -0,0 +1,120 @@ +use anyhow::Result; +use std::net::SocketAddr; +use std::time::Duration; +use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; +use tokio::net::UdpSocket; +use tokio::sync::mpsc; +use tokio::time::Instant; +use crate::mux::{Incoming, MuxReader, MuxWriter, CHUNK}; +use crate::shape::{Queue, Shape}; + +pub const UDP_IDLE: Duration = Duration::from_secs(60); +const QUEUE: usize = 256; + +pub async fn pump_tcp(socket: S, writer: MuxWriter, mut reader: MuxReader, shape: &Shape) { + let (mut rd, mut wr) = tokio::io::split(socket); + if !shape.active() { + let to_mux = async { + let mut buf = vec![0u8; CHUNK]; + loop { + match rd.read(&mut buf).await { + Ok(0) => { writer.close().await; break; } + Ok(n) => { if writer.send(&buf[..n]).await.is_err() { break; } } + Err(_) => { writer.reset(); break; } + } + } + }; + let from_mux = async { + loop { + match reader.recv().await { + Incoming::Data(data) => { if wr.write_all(&data).await.is_err() { break; } } + Incoming::Close => { let _ = wr.shutdown().await; break; } + Incoming::Reset => break, + Incoming::Datagram(_) => {} + } + } + }; + tokio::join!(to_mux, from_mux); + return; + } + + let (to_mux_tx, to_mux_rx) = mpsc::channel::<(Instant, Vec)>(QUEUE); + let (to_socket_tx, to_socket_rx) = mpsc::channel::<(Instant, Vec)>(QUEUE); + + let read_socket = async { + let mut buf = vec![0u8; CHUNK]; + loop { + match rd.read(&mut buf).await { + Ok(0) | Err(_) => break, + Ok(n) => { if to_mux_tx.send((Instant::now(), buf[..n].to_vec())).await.is_err() { break; } } + } + } + drop(to_mux_tx); + }; + let read_mux = async { + loop { + match reader.recv().await { + Incoming::Data(data) => { if to_socket_tx.send((Instant::now(), data)).await.is_err() { break; } } + Incoming::Close | Incoming::Reset => break, + Incoming::Datagram(_) => {} + } + } + drop(to_socket_tx); + }; + let write_mux = async { + let mut queue = Queue::new(to_mux_rx); + while let Some(chunk) = shape.next(&mut queue, true).await { + if writer.send(&chunk).await.is_err() { break; } + } + writer.close().await; + }; + let write_socket = async { + let mut queue = Queue::new(to_socket_rx); + while let Some(chunk) = shape.next(&mut queue, true).await { + if wr.write_all(&chunk).await.is_err() { break; } + } + let _ = wr.shutdown().await; + }; + tokio::join!(read_socket, read_mux, write_mux, write_socket); +} + +pub async fn pump_udp_owner(target: SocketAddr, writer: MuxWriter, mut reader: MuxReader, shape: &Shape) -> Result<()> { + let bind: SocketAddr = if target.is_ipv4() { "0.0.0.0:0".parse()? } else { "[::]:0".parse()? }; + let socket = UdpSocket::bind(bind).await?; + socket.connect(target).await?; + + let (to_mux_tx, to_mux_rx) = mpsc::channel::<(Instant, Vec)>(QUEUE); + let (to_socket_tx, to_socket_rx) = mpsc::channel::<(Instant, Vec)>(QUEUE); + + let relay = async { + let mut buf = vec![0u8; 65535]; + loop { + tokio::select! { + incoming = tokio::time::timeout(UDP_IDLE, reader.recv()) => match incoming { + Ok(Incoming::Datagram(data)) => { if !shape.lose() { let _ = to_socket_tx.try_send((Instant::now(), data)); } } + Ok(Incoming::Close) | Ok(Incoming::Reset) | Err(_) => break, + Ok(_) => {} + }, + received = socket.recv(&mut buf) => match received { + Ok(n) => { if !shape.lose() { let _ = to_mux_tx.try_send((Instant::now(), buf[..n].to_vec())); } } + Err(_) => {} + }, + } + } + drop(to_socket_tx); + drop(to_mux_tx); + }; + let write_socket = async { + let mut queue = Queue::new(to_socket_rx); + while let Some(datagram) = shape.next(&mut queue, false).await { let _ = socket.send(&datagram).await; } + }; + let write_mux = async { + let mut queue = Queue::new(to_mux_rx); + while let Some(datagram) = shape.next(&mut queue, false).await { + if writer.send_datagram(&datagram).await.is_err() { break; } + } + }; + tokio::join!(relay, write_socket, write_mux); + writer.close().await; + Ok(()) +} diff --git a/cli/src/tls.rs b/cli/src/tls.rs new file mode 100644 index 0000000..b2646a7 --- /dev/null +++ b/cli/src/tls.rs @@ -0,0 +1,51 @@ +use anyhow::Result; +use rustls::client::danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier}; +use rustls::crypto::{ring, CryptoProvider}; +use rustls::{ClientConfig, DigitallySignedStruct, SignatureScheme}; +use rustls_pki_types::{CertificateDer, ServerName, UnixTime}; +use rustls_platform_verifier::Verifier; +use std::sync::Arc; +use tokio::net::TcpStream; +use tokio_rustls::client::TlsStream; +use tokio_rustls::TlsConnector; + +#[derive(Debug)] +struct Trusting; + +impl ServerCertVerifier for Trusting { + fn verify_server_cert(&self, _: &CertificateDer<'_>, _: &[CertificateDer<'_>], _: &ServerName<'_>, _: &[u8], _: UnixTime) -> Result { + Ok(ServerCertVerified::assertion()) + } + + fn verify_tls12_signature(&self, _: &[u8], _: &CertificateDer<'_>, _: &DigitallySignedStruct) -> Result { + Ok(HandshakeSignatureValid::assertion()) + } + + fn verify_tls13_signature(&self, _: &[u8], _: &CertificateDer<'_>, _: &DigitallySignedStruct) -> Result { + Ok(HandshakeSignatureValid::assertion()) + } + + fn supported_verify_schemes(&self) -> Vec { + provider().signature_verification_algorithms.supported_schemes() + } +} + +pub fn install_provider() { + let _ = ring::default_provider().install_default(); +} + +fn provider() -> Arc { + CryptoProvider::get_default().unwrap().clone() +} + +pub fn client_config(accept_invalid_certs: bool) -> Result> { + let verifier: Arc = if accept_invalid_certs { Arc::new(Trusting) } else { Arc::new(Verifier::new(provider())?) }; + let config = ClientConfig::builder_with_provider(provider()).with_safe_default_protocol_versions()? + .dangerous().with_custom_certificate_verifier(verifier).with_no_client_auth(); + Ok(Arc::new(config)) +} + +pub async fn connect_trusting(host: &str, socket: TcpStream) -> Result> { + let name = ServerName::try_from(host.to_string())?; + Ok(TlsConnector::from(client_config(true)?).connect(name, socket).await?) +} diff --git a/cli/src/tui.rs b/cli/src/tui.rs new file mode 100644 index 0000000..8bc7321 --- /dev/null +++ b/cli/src/tui.rs @@ -0,0 +1,409 @@ +use anyhow::Result; +use chrono::{DateTime, Local}; +use crossterm::event::{Event, EventStream, KeyCode, KeyEvent, KeyModifiers}; +use futures_util::StreamExt; +use ratatui::layout::{Constraint, Direction, Layout, Rect}; +use ratatui::style::{Color, Modifier, Style}; +use ratatui::text::{Line, Span}; +use ratatui::widgets::{Block, BorderType, Borders, Cell, Padding, Paragraph, Row, Sparkline, Table, TableState}; +use ratatui::Frame; +use std::collections::VecDeque; +use std::time::{Duration, Instant}; +use tokio::sync::mpsc::UnboundedReceiver; +use crate::qr; +use crate::session::{bytes, took, Connection, Online, Request, StopHandle, TunnelEvent}; + +const KEEP: usize = 500; +const TICK: Duration = Duration::from_millis(200); +const SPINNER: [&str; 10] = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]; +const TEAL: Color = Color::Rgb(20, 184, 166); +const TEAL_BRIGHT: Color = Color::Rgb(45, 212, 191); +const AMBER: Color = Color::Rgb(251, 191, 36); +const RED: Color = Color::Rgb(248, 113, 113); +const GREEN: Color = Color::Rgb(52, 211, 153); +const MUTED: Color = Color::Rgb(121, 113, 107); +const SUBTEXT: Color = Color::Rgb(168, 162, 158); +const BORDER: Color = Color::Rgb(60, 56, 52); + +pub struct Context { + pub server_url: String, + pub account: String, + pub target: String, + pub network: Option, + pub tcp: bool, +} + +enum Status { Connecting, Online, Reconnecting(u64, Option) } + +struct Seen { at: DateTime, item: T } + +struct State { + ctx: Context, + status: Status, + online: Option, + access: Option, + requests: VecDeque>, + connections: VecDeque>, + samples: VecDeque<(Instant, u64)>, + total: u64, + errors: u64, + open: i64, + bytes_in: u64, + bytes_out: u64, + table: TableState, + copied: bool, + notice: Option<(String, Instant)>, + update: Option, + frame: usize, + ended: Option, +} + +impl State { + fn apply(&mut self, event: TunnelEvent) { + match event { + TunnelEvent::Connecting => self.status = Status::Connecting, + TunnelEvent::Online(online) | TunnelEvent::Resumed(online) | TunnelEvent::Replaced(online) => { + self.status = Status::Online; + self.access = online.access.clone(); + self.online = Some(online); + if !self.copied && self.copy() { self.notice("Link copied to clipboard"); } + } + TunnelEvent::Request(request) => { + self.total += 1; + if request.status >= 400 { self.errors += 1; } + self.samples.push_back((Instant::now(), request.duration)); + while self.samples.len() > KEEP { self.samples.pop_front(); } + self.requests.push_front(Seen { at: Local::now(), item: request }); + self.requests.truncate(KEEP); + self.bump(); + } + TunnelEvent::Connection(connection) => { + if connection.opened { + self.open += 1; + self.total += 1; + self.connections.push_front(Seen { at: Local::now(), item: connection }); + self.connections.truncate(KEEP); + self.bump(); + } else { + self.open -= 1; + self.bytes_in += connection.bytes_in; + self.bytes_out += connection.bytes_out; + self.samples.push_back((Instant::now(), connection.duration)); + match self.connections.iter_mut().find(|seen| seen.item.key == connection.key) { + Some(seen) => seen.item = connection, + None => { self.connections.push_front(Seen { at: Local::now(), item: connection }); self.connections.truncate(KEEP); } + } + } + } + TunnelEvent::Access(summary) => { self.access = Some(summary); self.notice("Access rules updated"); } + TunnelEvent::Reconnecting { seconds, reason } => self.status = Status::Reconnecting(seconds, reason), + TunnelEvent::Update(version) => self.update = Some(version), + TunnelEvent::Stopped => {} + TunnelEvent::Ended(reason) => self.ended = Some(reason), + } + } + + fn bump(&mut self) { + if let Some(selected) = self.table.selected() { self.table.select(Some((selected + 1).min(self.entries() - 1))); } + } + + fn entries(&self) -> usize { + if self.ctx.tcp { self.connections.len() } else { self.requests.len() } + } + + fn link(&self) -> Option { + let online = self.online.as_ref()?; + online.url.clone().or_else(|| online.link(&self.ctx.server_url).map(|link| format!("frislit connect {link}"))) + } + + fn copy(&mut self) -> bool { + let Some(link) = self.link() else { return false }; + self.copied = qr::copy(&link); + self.copied + } + + fn notice(&mut self, text: &str) { + self.notice = Some((text.to_string(), Instant::now())); + } + + fn rate(&self, window: Duration) -> f64 { + let since = Instant::now() - window; + self.samples.iter().filter(|(at, _)| *at >= since).count() as f64 / window.as_secs_f64() + } + + fn percentile(&self, fraction: f64) -> u64 { + if self.samples.is_empty() { return 0; } + let mut values: Vec = self.samples.iter().map(|(_, value)| *value).collect(); + values.sort_unstable(); + values[((values.len() - 1) as f64 * fraction).round() as usize] + } + + fn histogram(&self, buckets: usize) -> Vec { + let now = Instant::now(); + let mut counts = vec![0u64; buckets]; + for (at, _) in &self.samples { + let age = now.duration_since(*at).as_secs() as usize; + if age < buckets { counts[buckets - 1 - age] += 1; } + } + counts + } +} + +fn status_color(status: u16) -> Color { + match status { 200..=299 => GREEN, 300..=399 => TEAL_BRIGHT, 400..=499 => AMBER, _ => RED } +} + +fn panel(title: &str) -> Block<'static> { + Block::default() + .borders(Borders::ALL) + .border_type(BorderType::Rounded) + .border_style(Style::default().fg(BORDER)) + .title(Span::styled(format!(" {title} "), Style::default().fg(SUBTEXT).add_modifier(Modifier::BOLD))) + .padding(Padding::horizontal(1)) +} + +fn field(name: &str, value: Span<'static>) -> Line<'static> { + Line::from(vec![Span::styled(format!("{:<11}", name), Style::default().fg(MUTED)), value]) +} + +fn plain(text: impl Into) -> Span<'static> { Span::raw(text.into()) } + +fn header(state: &State, area: Rect, frame: &mut Frame) { + let spinner = SPINNER[state.frame % SPINNER.len()]; + let status = match &state.status { + Status::Connecting => Span::styled(format!("{spinner} connecting"), Style::default().fg(AMBER)), + Status::Online => Span::raw(""), + Status::Reconnecting(seconds, reason) => Span::styled( + match reason { Some(reason) => format!("{spinner} reconnecting in {seconds}s · {reason}"), None => format!("{spinner} reconnecting") }, + Style::default().fg(AMBER), + ), + }; + let notice = state.notice.as_ref().filter(|(_, at)| at.elapsed() < Duration::from_secs(3)).map(|(text, _)| text.clone()); + let right = notice.map(|text| Span::styled(text, Style::default().fg(TEAL_BRIGHT))).unwrap_or(status); + let mut left = vec![ + Span::styled("fris", Style::default().fg(Color::White).add_modifier(Modifier::BOLD)), + Span::styled("lit", Style::default().fg(TEAL).add_modifier(Modifier::BOLD)), + Span::styled(format!(" v{}", env!("CARGO_PKG_VERSION")), Style::default().fg(MUTED)), + ]; + if let Some(version) = &state.update { + left.push(Span::styled(format!(" ↑ v{version} available · frislit update"), Style::default().fg(AMBER))); + } + let used: usize = left.iter().map(|span| span.width()).sum::() + right.width(); + let mut spans = left; + spans.push(Span::raw(" ".repeat((area.width as usize).saturating_sub(used)))); + spans.push(right); + frame.render_widget(Paragraph::new(Line::from(spans)), area); +} + +fn tunnel_lines(state: &State) -> Vec> { + let mut lines = Vec::new(); + match &state.online { + Some(online) => { + let name = if online.persistent { format!("{} persistent", online.id) } else { online.id.clone() }; + match &online.url { + Some(url) => { + lines.push(field("Public", Span::styled(url.clone(), Style::default().fg(TEAL_BRIGHT).add_modifier(Modifier::BOLD)))); + for custom in &online.custom_urls { lines.push(field("", Span::styled(custom.clone(), Style::default().fg(TEAL_BRIGHT)))); } + } + None => { + if let Some(link) = online.link(&state.ctx.server_url) { + lines.push(field("Share", Span::styled(format!("frislit connect {link}"), Style::default().fg(TEAL_BRIGHT).add_modifier(Modifier::BOLD)))); + } + } + } + lines.push(field("Local", plain(state.ctx.target.clone()))); + lines.push(field("Name", plain(name))); + } + None => lines.push(field("Local", plain(state.ctx.target.clone()))), + } + lines.push(field("Account", plain(format!("{} · {}", state.ctx.account, state.ctx.server_url)))); + if let Some(access) = &state.access { lines.push(field("Access", Span::styled(access.clone(), Style::default().fg(AMBER)))); } + if let Some(network) = &state.ctx.network { lines.push(field("Network", Span::styled(network.clone(), Style::default().fg(AMBER)))); } + lines +} + +fn tunnel_panel(lines: Vec>, area: Rect, frame: &mut Frame) { + frame.render_widget(Paragraph::new(lines).block(panel("Tunnel")), area); +} + +fn stat(label: &str, value: String) -> Line<'static> { + Line::from(vec![Span::styled(format!("{:<8}", label), Style::default().fg(MUTED)), Span::styled(value, Style::default().add_modifier(Modifier::BOLD))]) +} + +fn stats_panel(state: &State, area: Rect, frame: &mut Frame) { + let block = panel("Activity"); + let inner = block.inner(area); + frame.render_widget(block, area); + let rows = Layout::default().direction(Direction::Vertical).constraints([Constraint::Length(2), Constraint::Min(1), Constraint::Length(1)]).split(inner); + let columns = Layout::default().direction(Direction::Horizontal) + .constraints([Constraint::Ratio(1, 3), Constraint::Ratio(1, 3), Constraint::Ratio(1, 3)]).split(rows[0]); + let (left, middle, right) = if state.ctx.tcp { + ( + vec![stat("open", state.open.max(0).to_string()), stat("total", state.total.to_string())], + vec![stat("in", bytes(state.bytes_in)), stat("out", bytes(state.bytes_out))], + vec![stat("per min", format!("{:.1}", state.rate(Duration::from_secs(60)) * 60.0)), stat("p50", format!("{}ms", state.percentile(0.5)))], + ) + } else { + ( + vec![stat("total", state.total.to_string()), stat("errors", state.errors.to_string())], + vec![stat("per min", format!("{:.1}", state.rate(Duration::from_secs(60)) * 60.0)), stat("per 5m", format!("{:.1}", state.rate(Duration::from_secs(300)) * 300.0))], + vec![stat("p50", format!("{}ms", state.percentile(0.5))), stat("p90", format!("{}ms", state.percentile(0.9)))], + ) + }; + frame.render_widget(Paragraph::new(left), columns[0]); + frame.render_widget(Paragraph::new(middle), columns[1]); + frame.render_widget(Paragraph::new(right), columns[2]); + let width = rows[1].width as usize; + if width > 0 && rows[1].height > 0 { + let data = state.histogram(width); + frame.render_widget(Sparkline::default().data(&data).style(Style::default().fg(TEAL)), rows[1]); + let caption = format!("{} per second · last {width}s", if state.ctx.tcp { "connections" } else { "requests" }); + frame.render_widget(Paragraph::new(Span::styled(caption, Style::default().fg(MUTED))).right_aligned(), rows[2]); + } +} + +fn request_row(seen: &Seen) -> Row<'static> { + let request = &seen.item; + let method = if request.kind == "ws" { "WS".to_string() } else { request.method.clone() }; + Row::new(vec![ + Cell::from(Span::styled(seen.at.format("%H:%M:%S").to_string(), Style::default().fg(MUTED))), + Cell::from(Span::styled(method, Style::default().add_modifier(Modifier::BOLD))), + Cell::from(Span::styled(request.status.to_string(), Style::default().fg(status_color(request.status)).add_modifier(Modifier::BOLD))), + Cell::from(request.path.clone()), + Cell::from(Span::styled(format!("{}ms", request.duration), Style::default().fg(SUBTEXT))), + Cell::from(Span::styled(request.ip.clone(), Style::default().fg(SUBTEXT))), + Cell::from(Span::styled(request.intel().unwrap_or_default(), Style::default().fg(MUTED))), + ]) +} + +fn connection_row(seen: &Seen) -> Row<'static> { + let connection = &seen.item; + let state = if connection.opened { Span::styled("open", Style::default().fg(GREEN)) } else { Span::styled(connection.reason.clone().unwrap_or_default(), Style::default().fg(MUTED)) }; + Row::new(vec![ + Cell::from(Span::styled(seen.at.format("%H:%M:%S").to_string(), Style::default().fg(MUTED))), + Cell::from(Span::styled(connection.protocol.clone(), Style::default().add_modifier(Modifier::BOLD))), + Cell::from(Span::styled(connection.ip.clone(), Style::default().fg(SUBTEXT))), + Cell::from(connection.detail.clone().unwrap_or_default()), + Cell::from(Span::styled(if connection.opened { String::new() } else { format!("{} / {}", bytes(connection.bytes_in), bytes(connection.bytes_out)) }, Style::default().fg(SUBTEXT))), + Cell::from(Span::styled(if connection.opened { String::new() } else { took(connection.duration) }, Style::default().fg(SUBTEXT))), + Cell::from(state), + Cell::from(Span::styled(connection.intel().unwrap_or_default(), Style::default().fg(MUTED))), + ]) +} + +fn table(state: &mut State, area: Rect, frame: &mut Frame) { + let head = Style::default().fg(MUTED).add_modifier(Modifier::BOLD); + let (title, header, widths, rows): (&str, Vec<&str>, Vec, Vec) = if state.ctx.tcp { + ( + "Connections", + vec!["time", "proto", "client", "protocol", "in / out", "took", "state", "where"], + vec![Constraint::Length(8), Constraint::Length(5), Constraint::Length(16), Constraint::Min(16), Constraint::Length(18), Constraint::Length(7), Constraint::Length(18), Constraint::Length(24)], + state.connections.iter().map(connection_row).collect(), + ) + } else { + ( + "Requests", + vec!["time", "method", "status", "path", "took", "client", "where"], + vec![Constraint::Length(8), Constraint::Length(6), Constraint::Length(6), Constraint::Min(16), Constraint::Length(7), Constraint::Length(16), Constraint::Length(28)], + state.requests.iter().map(request_row).collect(), + ) + }; + let empty = rows.is_empty(); + let table = Table::new(rows, widths) + .header(Row::new(header.into_iter().map(|name| Cell::from(Span::styled(name, head))).collect::>()).bottom_margin(0)) + .block(panel(title)) + .column_spacing(2) + .row_highlight_style(Style::default().bg(Color::Rgb(34, 31, 27)).add_modifier(Modifier::BOLD)); + frame.render_stateful_widget(table, area, &mut state.table); + if empty { + let hint = if state.ctx.tcp { "Waiting for the first connection" } else { "Waiting for the first request" }; + let inner = Rect::new(area.x + 2, area.y + 2, area.width.saturating_sub(4), 1); + frame.render_widget(Paragraph::new(Span::styled(hint, Style::default().fg(MUTED))), inner); + } +} + +fn footer(state: &State, area: Rect, frame: &mut Frame) { + let keys: Vec<(&str, &str)> = if state.ctx.tcp { + vec![("q", "quit"), ("↑↓", "select"), ("c", "copy share command"), ("d", "dashboard")] + } else { + vec![("q", "quit"), ("↑↓", "select"), ("c", "copy url"), ("o", "open in browser"), ("d", "dashboard")] + }; + let mut spans = Vec::new(); + for (index, (key, action)) in keys.iter().enumerate() { + if index > 0 { spans.push(Span::styled(" · ", Style::default().fg(BORDER))); } + spans.push(Span::styled(*key, Style::default().fg(TEAL_BRIGHT).add_modifier(Modifier::BOLD))); + spans.push(Span::styled(format!(" {action}"), Style::default().fg(MUTED))); + } + frame.render_widget(Paragraph::new(Line::from(spans)), area); +} + +fn draw(frame: &mut Frame, state: &mut State) { + let area = frame.area(); + let lines = tunnel_lines(state); + let widest = lines.iter().map(|line| line.width()).fold(0, usize::max) as u16 + 4; + let column = area.width.saturating_sub(2) * 58 / 100; + let side_by_side = area.width >= 100 && widest <= column; + let tunnel_height = if side_by_side { (lines.len() as u16 + 2).max(8) } else { lines.len() as u16 + 2 }; + let constraints = if side_by_side { + vec![Constraint::Length(1), Constraint::Length(1), Constraint::Length(tunnel_height), Constraint::Min(5), Constraint::Length(1)] + } else { + vec![Constraint::Length(1), Constraint::Length(1), Constraint::Length(tunnel_height), Constraint::Length(8), Constraint::Min(5), Constraint::Length(1)] + }; + let outer = Layout::default().direction(Direction::Vertical).constraints(constraints).horizontal_margin(1).split(area); + header(state, outer[0], frame); + if side_by_side { + let top = Layout::default().direction(Direction::Horizontal) + .constraints([Constraint::Percentage(58), Constraint::Percentage(42)]).split(outer[2]); + tunnel_panel(lines, top[0], frame); + stats_panel(state, top[1], frame); + table(state, outer[3], frame); + footer(state, outer[4], frame); + } else { + tunnel_panel(lines, outer[2], frame); + stats_panel(state, outer[3], frame); + table(state, outer[4], frame); + footer(state, outer[5], frame); + } +} + +fn quit(key: &KeyEvent) -> bool { + key.code == KeyCode::Char('q') || (key.code == KeyCode::Char('c') && key.modifiers.contains(KeyModifiers::CONTROL)) +} + +pub async fn run(mut rx: UnboundedReceiver, stop: StopHandle, ctx: Context) -> Result> { + let mut state = State { + ctx, status: Status::Connecting, online: None, access: None, requests: VecDeque::new(), connections: VecDeque::new(), + samples: VecDeque::new(), total: 0, errors: 0, open: 0, bytes_in: 0, bytes_out: 0, table: TableState::default(), + copied: false, notice: None, update: None, frame: 0, ended: None, + }; + let mut terminal = ratatui::init(); + let mut keys = EventStream::new(); + let mut ticker = tokio::time::interval(TICK); + loop { + tokio::select! { + event = rx.recv() => match event { + Some(event) => state.apply(event), + None => break, + }, + Some(Ok(Event::Key(key))) = keys.next() => { + if quit(&key) { stop.stop(); } + let last = state.entries().saturating_sub(1); + match key.code { + KeyCode::Up => state.table.select(Some(state.table.selected().map_or(0, |at| at.saturating_sub(1)))), + KeyCode::Down => state.table.select(Some(state.table.selected().map_or(0, |at| (at + 1).min(last)))), + KeyCode::PageUp => state.table.select(Some(state.table.selected().map_or(0, |at| at.saturating_sub(10)))), + KeyCode::PageDown => state.table.select(Some(state.table.selected().map_or(0, |at| (at + 10).min(last)))), + KeyCode::Esc | KeyCode::Home => state.table.select(None), + KeyCode::Char('c') => { if state.copy() { state.notice("Link copied to clipboard"); } } + KeyCode::Char('o') => { if let Some(url) = state.online.as_ref().and_then(|online| online.url.clone()) { let _ = open::that(url); } } + KeyCode::Char('d') => { if let Some(online) = &state.online { let _ = open::that(format!("{}/@frislit/tunnels/{}", state.ctx.server_url, online.id)); } } + _ => {} + } + }, + _ = ticker.tick() => state.frame += 1, + } + terminal.draw(|frame| draw(frame, &mut state))?; + } + ratatui::restore(); + Ok(state.ended) +} diff --git a/cli/src/tunnel.rs b/cli/src/tunnel.rs new file mode 100644 index 0000000..97ed280 --- /dev/null +++ b/cli/src/tunnel.rs @@ -0,0 +1,376 @@ +use anyhow::{bail, Context, Result}; +use serde_json::json; +use std::net::SocketAddr; +use std::path::{Path, PathBuf}; +use std::sync::Arc; +use std::time::Duration; +use tokio::net::TcpStream; +use crate::api::ws_url; +use crate::config::Config; +use crate::mux::{expect, Mux, MuxEvents, OpenMeta}; +use crate::router::{self, Route, RouteTarget}; +use crate::serve; +use crate::session::{Connection, Events, Online, Request, Stop, Task, TunnelEvent}; +use crate::shape::Shape; +use crate::tcp::{pump_tcp, pump_udp_owner}; + +pub const PROTOCOL_VERSION: u64 = 1; + +const CONNECT_TIMEOUT: Duration = Duration::from_secs(10); + +#[derive(Clone)] +pub struct Target { pub host: String, pub port: u16, pub tls: bool } + +impl Target { + pub fn parse(raw: &str) -> Result { + let raw = raw.trim(); + if let Ok(port) = raw.parse::() { return Ok(Self { host: "127.0.0.1".into(), port, tls: false }); } + + let (scheme, rest) = match raw.split_once("://") { + Some((scheme, rest)) => (Some(scheme.to_ascii_lowercase()), rest.split(['/', '?', '#']).next().unwrap_or("")), + None => (None, raw), + }; + let default_port = match scheme.as_deref() { + Some("https") => Some(443), + Some("http") => Some(80), + Some(other) => bail!("Invalid target \"{raw}\": {other}:// is not supported, use http:// or https://"), + None => None, + }; + let (host, port) = match rest.rsplit_once(':') { + Some((host, port)) if !port.contains(']') => { + (host, port.parse::().with_context(|| format!("Invalid port in \"{raw}\""))?) + } + _ => (rest, default_port.with_context(|| format!("Invalid target \"{raw}\": use , : or https://[:]"))?), + }; + let host = host.trim_matches(|c| c == '[' || c == ']'); + if host.is_empty() { bail!("Invalid target \"{raw}\""); } + let tls = match scheme.as_deref() { + Some("https") => true, + Some(_) => false, + None => port == 443, + }; + Ok(Self { host: host.to_string(), port, tls }) + } + + pub fn authority(&self) -> String { + if self.host.contains(':') { format!("[{}]:{}", self.host, self.port) } else { format!("{}:{}", self.host, self.port) } + } + + pub fn label(&self) -> String { + if self.tls { format!("https://{}", self.authority()) } else { self.authority() } + } + + pub async fn resolve(&self) -> Result> { + let addrs: Vec = tokio::net::lookup_host((self.host.as_str(), self.port)).await?.collect(); + if addrs.is_empty() { bail!("Could not resolve {}", self.host); } + Ok(addrs) + } +} + +#[derive(Clone)] +pub enum TargetSpec { Addr(Target), Dir(PathBuf), Routes(Vec) } + +impl TargetSpec { + pub fn with_routes(target: &str, routes: &[String]) -> Result { + Self::routed(RouteTarget::parse(target)?, routes.iter().map(|raw| Route::parse(raw)).collect::>()?) + } + + pub fn label(&self) -> String { + match self { + Self::Addr(target) => target.label(), + Self::Dir(dir) => format!("{} (static files)", dir.display()), + Self::Routes(routes) => format!("{} +{} routes", routes[0].target.label(), routes.len() - 1), + } + } + + pub fn dir(raw: &str) -> Result { + Self::routed(RouteTarget::dir(raw)?, Vec::new()) + } + + pub fn routed(root: RouteTarget, mut routes: Vec) -> Result { + if routes.is_empty() { + return Ok(match root { RouteTarget::Addr(target) => Self::Addr(target), RouteTarget::Dir(dir) => Self::Dir(dir) }); + } + routes.insert(0, Route::new("/", root)?); + Ok(Self::Routes(routes)) + } + + pub fn parse(raw: &str) -> Result { + let path = Path::new(raw); + if path.is_dir() { return Ok(Self::Dir(path.to_path_buf())); } + Ok(Self::Addr(Target::parse(raw)?)) + } +} + +const CATEGORIES: [&str; 4] = ["tor", "vpn", "datacenter", "blocklist"]; + +#[derive(Clone, Default)] +pub struct Rules { + pub allow_ips: Vec, + pub allow_countries: Vec, + pub block_ips: Vec, + pub block_countries: Vec, + pub block: Vec, +} + +fn split(values: Vec) -> Vec { + values.iter().flat_map(|value| value.split(',')).map(str::trim).filter(|value| !value.is_empty()).map(String::from).collect() +} + +fn countries(values: Vec) -> Result> { + split(values).into_iter().map(|code| { + let code = code.to_uppercase(); + if code.len() != 2 || !code.chars().all(|c| c.is_ascii_uppercase()) { bail!("\"{code}\" is not a country code"); } + Ok(code) + }).collect() +} + +impl Rules { + pub fn ips(allow_ips: Vec) -> Self { + Self { allow_ips, ..Self::default() } + } + + pub fn new(allow_ips: Vec, allow_countries: Vec, block_ips: Vec, block_countries: Vec, block: Vec) -> Result { + let block = split(block).into_iter().map(|entry| { + let entry = entry.to_lowercase(); + if !CATEGORIES.contains(&entry.as_str()) { bail!("\"{entry}\" is not one of {}", CATEGORIES.join(", ")); } + Ok(entry) + }).collect::>()?; + Ok(Self { allow_ips: split(allow_ips), allow_countries: countries(allow_countries)?, block_ips: split(block_ips), block_countries: countries(block_countries)?, block }) + } + + fn is_empty(&self) -> bool { + self.allow_ips.is_empty() && self.allow_countries.is_empty() && self.block_ips.is_empty() && self.block_countries.is_empty() && self.block.is_empty() + } +} + +#[derive(Clone, Default)] +pub struct Access { + pub rules: Rules, + pub password: Option, + pub require_login: bool, +} + +impl Access { + pub fn new(rules: Rules, password: Option, require_login: bool) -> Result { + if password.is_some() && require_login { + bail!("Use either --password or --require-login, not both"); + } + Ok(Self { rules, password, require_login }) + } + + fn as_json(&self) -> Option { + if self.rules.is_empty() && self.password.is_none() && !self.require_login { return None; } + let auth = if self.require_login { "frislit" } else if self.password.is_some() { "password" } else { "none" }; + let rules = &self.rules; + Some(json!({ + "auth": auth, + "password": self.password, + "allow": { "ips": rules.allow_ips, "countries": rules.allow_countries }, + "block": { "ips": rules.block_ips, "countries": rules.block_countries, "categories": rules.block }, + })) + } +} + +#[derive(Clone)] +pub struct Options { pub mode: &'static str, pub http_mode: Option, pub target: TargetSpec, pub name: Option, pub keep_host: bool, pub access: Access, pub shape: Shape } + +impl Options { + pub fn http(target: TargetSpec, name: Option, keep_host: bool, access: Access) -> Self { + Self { mode: "http", http_mode: None, target, name, keep_host, access, shape: Shape::default() } + } + + pub fn tcp(target: Target, name: Option, access: Access) -> Self { + Self { mode: "tcp", http_mode: None, target: TargetSpec::Addr(target), name, keep_host: false, access, shape: Shape::default() } + } + + pub fn http_mode(mut self, http_mode: Option) -> Self { + self.http_mode = http_mode; + self + } + + pub fn shaped(self, shape: Shape) -> Self { + Self { shape, ..self } + } +} + +pub fn server_hello(role: &str, token: Option<&str>) -> serde_json::Value { + let mut hello = json!({ "type": "hello", "version": PROTOCOL_VERSION, "role": role, "client": format!("frislit-cli/{}", env!("CARGO_PKG_VERSION")) }); + if let Some(token) = token { hello["token"] = json!(token); } + hello +} + +struct Registration { online: Online, resume_token: String } + +async fn register(url: &str, token: &str, accept_invalid_certs: bool, opts: &Options, target: &Target, resume: Option<&str>, share: Option<&str>) -> Result<(Arc, MuxEvents, Registration)> { + let (mux, mut events) = Mux::connect(url, Some(token), accept_invalid_certs).await?; + mux.send_control(server_hello("owner", Some(token))).await?; + expect(&mut events, "hello").await?; + let mut message = json!({ + "type": "register", "mode": opts.mode, "target": target.authority(), + "name": opts.name, "keepHost": opts.keep_host, "resume": resume, "share": share, + }); + if let Some(http_mode) = &opts.http_mode { + message["httpMode"] = json!(http_mode); + } + if let Some(policy) = opts.access.as_json() { + message["policy"] = policy; + } + mux.send_control(message).await?; + let msg = expect(&mut events, "registered").await?; + let get = |key: &str| msg.get(key).and_then(|v| v.as_str()).map(|s| s.to_string()); + let registration = Registration { + online: Online { + id: get("id").context("registered without id")?, + url: get("url"), + share_code: get("shareCode"), + connect_url: get("connectUrl"), + custom_urls: msg.get("customUrls").and_then(|v| v.as_array()).map(|list| list.iter().filter_map(|v| v.as_str().map(String::from)).collect()).unwrap_or_default(), + persistent: msg.get("persistent").and_then(|v| v.as_bool()).unwrap_or(false), + access: get("access"), + }, + resume_token: get("resumeToken").context("registered without resume token")?, + }; + Ok((mux, events, registration)) +} + +enum Ended { + Dropped, + Error(String), + ByServer(String), +} + +async fn serve_streams(events: &mut MuxEvents, target: &Target, shape: &Shape, out: &Events) -> Ended { + loop { + tokio::select! { + stream = events.streams.recv() => { + let Some((writer, reader, meta)) = stream else { return Ended::Dropped }; + let target = target.clone(); + let shape = shape.clone(); + tokio::spawn(async move { handle_stream(writer, reader, meta, target, shape).await; }); + } + control = events.control.recv() => match control { + None => return Ended::Dropped, + Some(msg) => match msg.get("type").and_then(|t| t.as_str()) { + Some("error") => return Ended::Error(msg.get("message").and_then(|m| m.as_str()).unwrap_or("unknown error").to_string()), + Some("bye") => return Ended::ByServer(msg.get("reason").and_then(|r| r.as_str()).unwrap_or("closed by the server").to_string()), + Some("request") => { let _ = out.send(TunnelEvent::Request(Request::from_control(&msg))); } + Some("connection") => { let _ = out.send(TunnelEvent::Connection(Connection::from_control(&msg))); } + Some("access") => { let _ = out.send(TunnelEvent::Access(msg.get("access").and_then(|v| v.as_str()).unwrap_or("open to anyone").to_string())); } + _ => {} + }, + } + } + } +} + +pub async fn connect_target(addrs: &[SocketAddr]) -> Result { + let mut last = anyhow::anyhow!("no address to connect to"); + for addr in addrs { + match tokio::time::timeout(CONNECT_TIMEOUT, TcpStream::connect(addr)).await { + Ok(Ok(socket)) => { let _ = socket.set_nodelay(true); return Ok(socket); } + Ok(Err(err)) => last = err.into(), + Err(_) => last = anyhow::anyhow!("connect timed out"), + } + } + Err(last) +} + +async fn handle_stream(writer: crate::mux::MuxWriter, reader: crate::mux::MuxReader, meta: OpenMeta, target: Target, shape: Shape) { + let Ok(addrs) = target.resolve().await else { writer.reset(); return }; + if meta.is_udp() { + let _ = pump_udp_owner(addrs[0], writer, reader, &shape).await; + return; + } + let Ok(socket) = connect_target(&addrs).await else { writer.reset(); return }; + if !target.tls { return pump_tcp(socket, writer, reader, &shape).await; } + + match tokio::time::timeout(CONNECT_TIMEOUT, crate::tls::connect_trusting(&target.host, socket)).await { + Ok(Ok(stream)) => pump_tcp(stream, writer, reader, &shape).await, + _ => writer.reset(), + } +} + +pub async fn prepare(opts: Options) -> Result<(Options, Target, String, Option)> { + let label = opts.target.label(); + let (target, local) = match opts.target { + TargetSpec::Addr(target) => (target, None), + TargetSpec::Dir(dir) => { + if opts.mode == "tcp" { bail!("`frislit tcp` needs a port or host:port, not a directory"); } + local(serve::start(dir).await?) + } + TargetSpec::Routes(routes) => local(router::start(routes).await?), + }; + Ok((Options { target: TargetSpec::Addr(target.clone()), ..opts }, target, label, local)) +} + +fn local((port, task): (u16, Task)) -> (Target, Option) { + (Target { host: "127.0.0.1".into(), port, tls: false }, Some(task)) +} + +fn is_fatal(text: &str) -> bool { + text.contains("(unauthorized)") || text.contains("(invalid_name)") || text.contains("(name_taken)") || text.contains("(name_reserved)") || text.contains("(quota_exceeded)") +} + +pub async fn run(opts: Options, target: Target, out: Events, mut stop: Stop) -> Result<()> { + let cfg = Config::load()?; + let (server_url, token) = cfg.require_auth()?; + let url = ws_url(&server_url); + + let _ = out.send(TunnelEvent::Connecting); + let first = tokio::select! { + result = register(&url, &token, cfg.accept_invalid_certs, &opts, &target, None, None) => result, + _ = stop.wait() => return Ok(()), + }; + let (mut mux, mut events, mut reg) = first?; + let _ = out.send(TunnelEvent::Online(reg.online.clone())); + + let mut backoff = 1u64; + loop { + let outcome = tokio::select! { + result = serve_streams(&mut events, &target, &opts.shape, &out) => result, + _ = stop.wait() => { + let _ = mux.send_control(json!({ "type": "bye" })).await; + mux.close().await; + let _ = out.send(TunnelEvent::Stopped); + return Ok(()); + } + }; + match outcome { + Ended::Error(message) => bail!("Server error: {message}"), + Ended::ByServer(reason) => { + let _ = out.send(TunnelEvent::Ended(reason)); + return Ok(()); + } + Ended::Dropped => {} + } + + let mut reason = None; + loop { + let _ = out.send(TunnelEvent::Reconnecting { seconds: backoff, reason: reason.take() }); + tokio::select! { + _ = tokio::time::sleep(Duration::from_secs(backoff)) => {} + _ = stop.wait() => { let _ = out.send(TunnelEvent::Stopped); return Ok(()); } + } + let attempt = tokio::select! { + result = register(&url, &token, cfg.accept_invalid_certs, &opts, &target, Some(®.resume_token), reg.online.share_code.as_deref()) => result, + _ = stop.wait() => { let _ = out.send(TunnelEvent::Stopped); return Ok(()); } + }; + match attempt { + Ok((new_mux, new_events, new_reg)) => { + let same = new_reg.online.id == reg.online.id; + mux = new_mux; events = new_events; reg = new_reg; + let _ = out.send(if same { TunnelEvent::Resumed(reg.online.clone()) } else { TunnelEvent::Replaced(reg.online.clone()) }); + backoff = 1; + break; + } + Err(err) => { + let text = err.to_string(); + if is_fatal(&text) { bail!("{text}"); } + backoff = (backoff * 2).min(30); + reason = Some(text); + } + } + } + } +} diff --git a/cli/src/update.rs b/cli/src/update.rs new file mode 100644 index 0000000..99d71ad --- /dev/null +++ b/cli/src/update.rs @@ -0,0 +1,132 @@ +use anyhow::{bail, Context, Result}; +use std::path::{Path, PathBuf}; +use std::process::Command; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; +use crate::config::Config; + +const REPOSITORY: &str = "https://git.fristy.net/fristy/frislit"; +const CHECK_EVERY: u64 = 24 * 60 * 60; +pub const CURRENT: &str = env!("CARGO_PKG_VERSION"); + +#[derive(PartialEq)] +pub enum Install { Binary, Msi, Managed } + +fn exe() -> Result { + std::env::current_exe().context("Could not find the frislit binary") +} + +fn owned_by(command: &str, args: &[&str], path: &Path) -> bool { + Command::new(command).args(args).arg(path).output().is_ok_and(|out| out.status.success()) +} + +pub fn detect() -> Install { + let Ok(path) = exe() else { return Install::Binary }; + let text = path.to_string_lossy(); + if cfg!(windows) { + let program_files = std::env::var("ProgramFiles").unwrap_or_default(); + return if !program_files.is_empty() && text.starts_with(&program_files) { Install::Msi } else { Install::Binary }; + } + let managed = text.contains("/Cellar/") || text.contains("/homebrew/") + || (cfg!(target_os = "linux") && (owned_by("dpkg", &["-S"], &path) || owned_by("rpm", &["-qf"], &path))); + if managed { Install::Managed } else { Install::Binary } +} + +fn parse(version: &str) -> Option<[u64; 3]> { + let mut parts = version.trim_start_matches('v').split('.').map(|part| part.parse::().ok()); + Some([parts.next()??, parts.next()??, parts.next()??]) +} + +pub fn newer(candidate: &str) -> bool { + matches!((parse(candidate), parse(CURRENT)), (Some(a), Some(b)) if a > b) +} + +fn client() -> Result { + Ok(reqwest::Client::builder().user_agent(format!("frislit/{CURRENT}")).timeout(Duration::from_secs(60)).build()?) +} + +pub async fn latest() -> Result { + #[derive(serde::Deserialize)] + struct Release { tag_name: String } + let release: Release = client()?.get("https://git.fristy.net/api/v1/repos/fristy/frislit/releases/latest").send().await?.error_for_status()?.json().await?; + Ok(release.tag_name.trim_start_matches('v').to_string()) +} + +fn now() -> u64 { + SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) +} + +pub async fn check() -> Option { + let mut cfg = Config::load().ok()?; + if now().saturating_sub(cfg.update_checked_at) < CHECK_EVERY { + return cfg.update_latest.clone().filter(|version| newer(version)); + } + let version = latest().await.ok()?; + cfg.update_checked_at = now(); + cfg.update_latest = Some(version.clone()); + cfg.save().ok()?; + newer(&version).then_some(version) +} + +fn asset(install: &Install) -> Result<&'static str> { + let gui = cfg!(feature = "gui"); + Ok(match (install, std::env::consts::OS, std::env::consts::ARCH) { + (Install::Msi, _, "x86_64") => "frislit-x64.msi", + (Install::Msi, _, "aarch64") => "frislit-arm64.msi", + (_, "windows", "x86_64") => "frislit-windows-x64.exe", + (_, "windows", "aarch64") => "frislit-windows-arm64.exe", + (_, "linux", "x86_64") => if gui { "frislit-linux-x64" } else { "frislit-linux-x64-static" }, + (_, "linux", "aarch64") => if gui { "frislit-linux-arm64" } else { "frislit-linux-arm64-static" }, + (_, "linux", "arm") => "frislit-linux-armv7-static", + (_, "linux", "riscv64") => "frislit-linux-riscv64-static", + (_, "macos", "x86_64") => "frislit-macos-x64", + (_, "macos", "aarch64") => "frislit-macos-arm64", + (_, os, arch) => bail!("No prebuilt frislit for {os} {arch}"), + }) +} + +async fn download(version: &str, name: &str, to: &Path) -> Result<()> { + let url = format!("{REPOSITORY}/releases/download/v{version}/{name}"); + let bytes = client()?.get(&url).send().await?.error_for_status().with_context(|| format!("Could not download {url}"))?.bytes().await?; + let magic: &[u8] = if name.ends_with(".msi") { b"\xD0\xCF\x11\xE0" } else if cfg!(windows) { b"MZ" } else if cfg!(target_os = "macos") { &[0xCF, 0xFA, 0xED, 0xFE] } else { b"\x7FELF" }; + if !bytes.starts_with(magic) { bail!("The download does not look like a frislit build"); } + std::fs::write(to, &bytes)?; + Ok(()) +} + +pub async fn apply(version: &str, install: &Install, relaunch_gui: bool) -> Result<()> { + let name = asset(install)?; + #[cfg(windows)] + if *install == Install::Msi { + use std::os::windows::process::CommandExt; + let path = std::env::temp_dir().join(name); + download(version, name, &path).await?; + let mut script = format!("msiexec /i \"{}\" /passive /norestart", path.display()); + if relaunch_gui { script.push_str(&format!(" && start \"\" \"{}\" gui", exe()?.display())); } + Command::new("cmd").args(["/c", &script]).creation_flags(0x0000_0008 | 0x0800_0000).spawn()?; + return Ok(()); + } + #[cfg(not(windows))] + let _ = relaunch_gui; + let target = exe()?; + let staged = target.with_extension("update"); + download(version, name, &staged).await?; + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions(&staged, std::fs::Permissions::from_mode(0o755))?; + } + if cfg!(windows) { + let old = target.with_extension("old"); + let _ = std::fs::remove_file(&old); + std::fs::rename(&target, &old)?; + } + std::fs::rename(&staged, &target).map_err(|err| { + let _ = std::fs::remove_file(&staged); + if err.kind() == std::io::ErrorKind::PermissionDenied { anyhow::anyhow!("No permission to replace {}. Run `sudo frislit update`", target.display()) } else { err.into() } + })?; + Ok(()) +} + +pub fn cleanup() { + if let Ok(target) = exe() { let _ = std::fs::remove_file(target.with_extension("old")); } +} diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/client/eslint.config.js b/client/eslint.config.js new file mode 100644 index 0000000..13b6e66 --- /dev/null +++ b/client/eslint.config.js @@ -0,0 +1,40 @@ +import js from '@eslint/js' +import globals from 'globals' +import react from 'eslint-plugin-react' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' + +export default [ + { ignores: ['dist', 'vite.config.js'] }, + { + files: ['**/*.{js,jsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + parserOptions: { + ecmaVersion: 'latest', + ecmaFeatures: { jsx: true }, + sourceType: 'module', + }, + }, + settings: { react: { version: '19.0' } }, + plugins: { + react, + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...js.configs.recommended.rules, + ...react.configs.recommended.rules, + ...react.configs['jsx-runtime'].rules, + ...reactHooks.configs.recommended.rules, + 'react/prop-types': 'off', + 'react-hooks/set-state-in-effect': 'off', + 'react/jsx-no-target-blank': 'off', + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +] diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..57127c7 --- /dev/null +++ b/client/index.html @@ -0,0 +1,14 @@ + + + + + + + + frislit + + +
+ + + diff --git a/client/package-lock.json b/client/package-lock.json new file mode 100644 index 0000000..d7eec23 --- /dev/null +++ b/client/package-lock.json @@ -0,0 +1,6512 @@ +{ + "name": "client", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "client", + "version": "1.0.0", + "dependencies": { + "@codemirror/autocomplete": "^6.20.4", + "@codemirror/commands": "^6.11.1", + "@codemirror/lang-css": "^6.3.1", + "@codemirror/lang-html": "^6.4.12", + "@codemirror/lang-javascript": "^6.2.5", + "@codemirror/lang-json": "^6.0.2", + "@codemirror/lang-xml": "^6.1.0", + "@codemirror/language": "^6.13.1", + "@codemirror/search": "^6.7.2", + "@codemirror/state": "^6.7.6", + "@codemirror/view": "^6.43.15", + "@fontsource/plus-jakarta-sans": "^5.3.0", + "@lezer/highlight": "^1.2.5", + "@prettier/plugin-xml": "^3.4.2", + "@simplewebauthn/browser": "^14.0.0", + "codemirror": "^6.0.2", + "flag-icons": "^7.6.0", + "lucide-react": "^1.65.0", + "prettier": "^3.9.10", + "qrcode": "^1.5.4", + "react": "^19.3.0", + "react-dom": "^19.3.1", + "react-router-dom": "^7.18.4", + "recharts": "^3.10.1" + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "@vitejs/plugin-react": "^6.1.2", + "eslint": "^10.13.0", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1", + "eslint-plugin-react-refresh": "^0.5.7", + "globals": "^17.13.0", + "sass-embedded": "^1.107.0", + "vite": "^8.3.4" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", + "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@babel/types": "^7.29.8", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", + "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.8" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz", + "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.8", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.8", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.8", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bufbuild/protobuf": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.15.0.tgz", + "integrity": "sha512-DAheWUkVr/SJTWCc+lg9dhY0eN4SaWlf4+bG1KzHeXbnqt0AfB/NX0Z+VunGlM1ki1B4zVvye27MpKh/svySUA==", + "dev": true, + "license": "(Apache-2.0 AND BSD-3-Clause)" + }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@codemirror/autocomplete": { + "version": "6.20.4", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.20.4.tgz", + "integrity": "sha512-yF8RhOf2SXlg00+qtupzLhrglcas61boqaONiNcbPIebHCpJocpqTBA6dyrtUrQO47hqyTdeob/3XnYilT7TaQ==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@codemirror/commands": { + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.11.1.tgz", + "integrity": "sha512-O/4hG3SC1YwcmQ0d2UVNDs+AsaNWd1iHVxbTeEBuqH+6bExAiPK3iS/BvpY6rZGURALv4ZD3sIgcCmRvw3ehBg==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.7.0", + "@codemirror/view": "^6.27.0", + "@lezer/common": "^1.1.0" + } + }, + "node_modules/@codemirror/lang-css": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@codemirror/lang-css/-/lang-css-6.3.1.tgz", + "integrity": "sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@lezer/common": "^1.0.2", + "@lezer/css": "^1.1.7" + } + }, + "node_modules/@codemirror/lang-html": { + "version": "6.4.12", + "resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.12.tgz", + "integrity": "sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/lang-css": "^6.0.0", + "@codemirror/lang-javascript": "^6.0.0", + "@codemirror/language": "^6.4.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0", + "@lezer/css": "^1.1.0", + "@lezer/html": "^1.3.12" + } + }, + "node_modules/@codemirror/lang-javascript": { + "version": "6.2.5", + "resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.5.tgz", + "integrity": "sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.6.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0", + "@lezer/javascript": "^1.0.0" + } + }, + "node_modules/@codemirror/lang-json": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@codemirror/lang-json/-/lang-json-6.0.2.tgz", + "integrity": "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@lezer/json": "^1.0.0" + } + }, + "node_modules/@codemirror/lang-xml": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@codemirror/lang-xml/-/lang-xml-6.1.0.tgz", + "integrity": "sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.4.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/common": "^1.0.0", + "@lezer/xml": "^1.0.0" + } + }, + "node_modules/@codemirror/language": { + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.13.1.tgz", + "integrity": "sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/streamparser": "^6.0.0", + "@codemirror/view": "^6.23.0", + "@lezer/common": "^1.5.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0", + "style-mod": "^4.0.0" + } + }, + "node_modules/@codemirror/lint": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.9.7.tgz", + "integrity": "sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.42.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/search": { + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.7.2.tgz", + "integrity": "sha512-gUYkYhT2+n/+VGZ+8EzE5WFkYZUZYm1VOKDudIsNqh42uRVQJ0a6Yss9sdKT3MeOYfuL1N6AZA57oza0Oyr0LA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.37.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/state": { + "version": "6.7.6", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.7.6.tgz", + "integrity": "sha512-kAz+AncRtKuIknedxT1bq4XwXv4UowhbkHU1myPrtVb/jZtImWuV5BXzv5vK6i3kYACsdiZiQKFQQ5Mq7elW8w==", + "license": "MIT", + "dependencies": { + "@marijn/find-cluster-break": "^1.0.0" + } + }, + "node_modules/@codemirror/streamparser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@codemirror/streamparser/-/streamparser-6.0.0.tgz", + "integrity": "sha512-JTFPF6xrfjt0mnfGPgzcLiMwYmvIyNaoizp8BYzv8FE8KrT6GBGDZ190rtt+O7Wke3gG/MFHyiY9YGNeimof4w==", + "license": "MIT" + }, + "node_modules/@codemirror/view": { + "version": "6.43.15", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.43.15.tgz", + "integrity": "sha512-HHsfpqFeHyXLs983pSRe38Xajs0vFWZQ2BuX0m7Ki8w3jZ5iD8cuR3lBz2/5/X53Dhf32SBHKh6rtSTB6tKeGw==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.7.0", + "crelt": "^1.0.6", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-array/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@fontsource/plus-jakarta-sans": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/plus-jakarta-sans/-/plus-jakarta-sans-5.3.0.tgz", + "integrity": "sha512-9WRw3G74Ve4cyPApAZSXLPY5DiLOZXDn7Q7dIBjFBpA0Pj56ljDItEdy2UUajjJxRuTg2HkMLO5C3K2nAQORWg==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@lezer/common": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.5.2.tgz", + "integrity": "sha512-sxQE460fPZyU3sdc8lafxiPwJHBzZRy/udNFynGQky1SePYBdhkBl1kOagA9uT3pxR8K09bOrmTUqA9wb/PjSQ==", + "license": "MIT" + }, + "node_modules/@lezer/css": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/@lezer/css/-/css-1.3.8.tgz", + "integrity": "sha512-EJn1zcL9qoDptief6ipWKZKLiOpXkxSe0+t8CH9oiMVcZlq7NBWrjCqnc/41EIjeo/ITj1gFFiATdTkaJDL+Og==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.3.0" + } + }, + "node_modules/@lezer/highlight": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.5.tgz", + "integrity": "sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.3.0" + } + }, + "node_modules/@lezer/html": { + "version": "1.3.13", + "resolved": "https://registry.npmjs.org/@lezer/html/-/html-1.3.13.tgz", + "integrity": "sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@lezer/javascript": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.5.5.tgz", + "integrity": "sha512-sWg4yX1J6XW67AaAynVt0iwF0M5c+np36TEu+P2ifAJ8haRYvHnWDV28r1jdwnJehWCwXECutAUy56K4RBZIyg==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.1.3", + "@lezer/lr": "^1.3.0" + } + }, + "node_modules/@lezer/json": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@lezer/json/-/json-1.0.3.tgz", + "integrity": "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@lezer/lr": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.10.tgz", + "integrity": "sha512-rnCpTIBafOx4mRp43xOxDJbFipJm/c0cia/V5TiGlhmMa+wsSdoGmUN3w5Bqrks/09Q/D4tNAmWaT8p6NRi77A==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@lezer/xml": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@lezer/xml/-/xml-1.0.6.tgz", + "integrity": "sha512-CdDwirL0OEaStFue/66ZmFSeppuL6Dwjlk8qk153mSQwiSH/Dlri4GNymrNWnUmPl2Um7QfV1FO9KFUyX3Twww==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@marijn/find-cluster-break": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.4.tgz", + "integrity": "sha512-Wy0V7+SGUjnF9/TkiM1hKVDPj7jKXduPNboMVtHTA8dySMURWqfg/JZ9E2Sq8JgSJmkl7k7Qe9FLeMSrSraWmQ==", + "license": "MIT" + }, + "node_modules/@oxc-project/types": { + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@parcel/watcher": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.6.0.tgz", + "integrity": "sha512-7FNeNl8NCE7aINx7WXiKQrPYZWC/hvrTsmk6zmxbI7LTXE7hVek/n8AfVgpe2y82zl3w0HvCHN0bVKMBoJcC0w==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "detect-libc": "^2.0.3", + "is-glob": "^4.0.3", + "node-addon-api": "^7.0.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "@parcel/watcher-android-arm64": "2.6.0", + "@parcel/watcher-darwin-arm64": "2.6.0", + "@parcel/watcher-darwin-x64": "2.6.0", + "@parcel/watcher-freebsd-x64": "2.6.0", + "@parcel/watcher-linux-arm-glibc": "2.6.0", + "@parcel/watcher-linux-arm-musl": "2.6.0", + "@parcel/watcher-linux-arm64-glibc": "2.6.0", + "@parcel/watcher-linux-arm64-musl": "2.6.0", + "@parcel/watcher-linux-x64-glibc": "2.6.0", + "@parcel/watcher-linux-x64-musl": "2.6.0", + "@parcel/watcher-win32-arm64": "2.6.0", + "@parcel/watcher-win32-x64": "2.6.0" + } + }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.6.0.tgz", + "integrity": "sha512-trgpLSCKRC/huFjXX/Smh+0sWe4+YtKfktIToiMl59ghz7z+qkH6kMvNnUbLyRs9N11t8l4svSCs1+5B3rOAhA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.6.0.tgz", + "integrity": "sha512-Y3QV0gl7Q1zbfueunkWIERICbEojQFCgpyG7YqOGNFLsckXyI1xu9mAIUpKY9QBYzBtSkN8dBPwd3yiAO9ovMw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-x64": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.6.0.tgz", + "integrity": "sha512-Ohv6OpzhUfKYD7Beb8kDvG0jbIxORCYY1JRdZnaBtnjjkJxgD7ZVL0nw2sCYd0yTMKTvz3nnTnOF3cDifK+kvw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.6.0.tgz", + "integrity": "sha512-5HmXvDgs8VK+74jF9y9/2FE3/OnlcKmc56tjmSrEuZjpSZOGL+fvAu+HKJBdPs9uwoP2hE6TlSUpXZ/C5jUFmQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.6.0.tgz", + "integrity": "sha512-Ps/hui3A+vMbjdqlqAowK2ZL8+BO8dBjxeWXj6npTBs3jx4wWmbPpaLuqwrQrSqIVMCnpWo238bJ1U37GhQOYg==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-musl": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.6.0.tgz", + "integrity": "sha512-9c6AUHgHoG+IY88MRIHupztQiQnrbqHYQjkM2btA+Bf/wQnQMuiD0Wfk1EVv3TlNT3x41uU71rn6E4xh/+zvkw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.6.0.tgz", + "integrity": "sha512-yHRqS2owEXe6Hic9z6Mh1ECsCd+ODVOGvZDyciqRd21+v+o+DnXMOrw50DSpIG2sb8GPEaPPmfeCAWKPJdq46g==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.6.0.tgz", + "integrity": "sha512-WhB2e/V7rqdHHWZusBSPuy5Ei8S6lSz6FE5TKKQz5h3a0O+C+mhY7vxU9b/stqvMb8beLnPY82ZrFTLKs+SrKA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-glibc": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.6.0.tgz", + "integrity": "sha512-ulGE6x6Oz6iAwg75T8YQSoguBWasniIbX+QWpaYPcCnDOpdWX3k+4xbEYPZVLxOuoJI+svJJPD3sEj8G7lrQ3A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-musl": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.6.0.tgz", + "integrity": "sha512-tkBYKt7YQrjIJWYDnto2YgO8MRkjlMTSNoRHzsXinBqbLdeOM3L32wPZJvIZxqaLMfSlS/4sUjH/6STVP/XDLw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.6.0.tgz", + "integrity": "sha512-gIZAP23jaHjGWasY/TY6yL7NHFClf0Ga7FN+iINvk+KN94rhm94lYZhFsbYFNcA04/onvGD9kKmiJLJB2HbNwQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-x64": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.6.0.tgz", + "integrity": "sha512-cA+/pXV2YkfxlIcXOQ5fSWqAzzPyD78/x5qbK/I0vUkrlYHA8TIz+MXjAbGouguKVSI4bOmkTSJ1/poVSsgt+A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@prettier/plugin-xml": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-3.4.2.tgz", + "integrity": "sha512-/UyNlHfkuLXG6Ed85KB0WBF283xn2yavR+UtRibBRUcvEJId2DSLdGXwJ/cDa1X++SWDPzq3+GSFniHjkNy7yg==", + "license": "MIT", + "dependencies": { + "@xml-tools/parser": "^1.0.11" + }, + "peerDependencies": { + "prettier": "^3.0.0" + } + }, + "node_modules/@reduxjs/toolkit": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.12.0.tgz", + "integrity": "sha512-KiT+RzZbp6mQET+Mg+h2c97+9j1sNflUxQkIHI7Yuzf6Peu+OYpmkn6nbHWmLLWj+1ZODUJFwGZ7gx3L9R9EOw==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@standard-schema/utils": "^0.3.0", + "immer": "^11.0.0", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.18.tgz", + "integrity": "sha512-ubTG+4KlidvioxjOFdsdEa2F6JVGZb8m2ByJUqQ7fYzUeT1cEn194POcsQ10PKH4p//q0YQn4SB3YpSuzcA1Yg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.18.tgz", + "integrity": "sha512-2Xa1t/JeFGTZn5TbzgPppcCftF8sCVnTNvrIvoSdcZhoFzAuVy1L3xxQUQ4sfWDtwVzg1u6Yi1R3SlJugRNV2Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.18.tgz", + "integrity": "sha512-iUzw9HshVvrWci9gVXjxWS7/M/IcLvNo67vu2c/w9zKBz4hIvPRixdUpIW/iCfhldLaq9ER2hecsI9UY5z0/yA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.18.tgz", + "integrity": "sha512-XuDHFzbFEtZl0QGJi92+fmG67tfnp1iZ9VOeDkwasGyTq2VG3/5PnJnvAr+MTzFh/rNScJ3VhN+XpZyyGsN7Jw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.18.tgz", + "integrity": "sha512-MM8opLfsLK15oEXDz6iBc0t3ahu+ew9jsAmha+ovZ33hSwYgqo7YmpRITqFTfW7xA71BLEQ3jJdTsaCmhB1c9w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.18.tgz", + "integrity": "sha512-J6EoCWiy5RnFQzHrKyHXXevZ9lukQfGpnchX/zG/k/WC2nc9O9XyS1JgA8kI9VxMFggMbCPjpv7LcikriXfehw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.18.tgz", + "integrity": "sha512-HIkFuLF7CdDeki+1aCZLLbLq0hk/PHntb+z4/YCTo47JbksTD6jJEELIz92tYROmDmvMrNqUMqBi71BkJLDR+A==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.18.tgz", + "integrity": "sha512-4oqWItLLYt7IceOnElCct8T2ek5p7PmD7LN04TRJRXGo5f3HtKTgGH6PhYRFK4C2ICkq/LMUU0BVPvvlAKhm8g==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.18.tgz", + "integrity": "sha512-+AkRly5SrCEgnPhGRfub7pucASYEC2fTsxZg7VCcnozpA2+Wn/gCYy1t7LuJS67/xyJu/7noYBJncDUkbwgw2A==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.18.tgz", + "integrity": "sha512-Ttg1r9vVykMnQrE/GwYO9icKtXiuiMfRe/w74xJkeoVuvhRG+WtT6LEMOf58Yl63yd77lhHzO8Y55R8CC3XALA==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.18.tgz", + "integrity": "sha512-xX1Tt4o5jUMma0vJsXp5eRZA9nOuyigb2dKJMMzZRmzMxLYGE9PaKKSqHPzPvSQgM8ZOEacSTQwDQcwWfh0xmQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.18.tgz", + "integrity": "sha512-4VVlGI5K2kociZlW3lSN8VjG3TW5yQIlAcfCdBXMgGjJxZll15Fa4ocRHXHvIVVnwlibCw/NQajJrNDiqqpiiw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.18.tgz", + "integrity": "sha512-PApTsgH1jLYuyy3tSCz9De82Gq5qXwi7vImVZhEzTgX1C4150Cp5M2ZfL3pLvbCvbEHL0oJeC6pd6podtv8Y5w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.18.tgz", + "integrity": "sha512-J2XjWjx/SP+4x0H4r6dz3Vzb5WVkg7re40Do9K7HJ3sK2/xcmZrWwakXlSwaMvOkvruLJCD4CL/3wqsIR/thgg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.18.tgz", + "integrity": "sha512-XwRJxRQvkuEtS0hIIt29QrqPJ+JzMJSNYHJw4ae/mc6uEarfRG1ceyg4HmmWiBdL/YCb6g7N5BLbSvmRJRYZHw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@simplewebauthn/browser": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-14.0.0.tgz", + "integrity": "sha512-1odWVqeEBTl7lJ9zMKLEsmTlnyrDO5iRcTvfMKKk1WThUnp/i8JJdffdj2icP+tty159s4PgwE3BiMoEW9NFow==", + "license": "MIT" + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "license": "MIT" + }, + "node_modules/@standard-schema/utils": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", + "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", + "license": "MIT" + }, + "node_modules/@types/d3-array": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz", + "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==", + "license": "MIT" + }, + "node_modules/@types/d3-color": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", + "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", + "license": "MIT" + }, + "node_modules/@types/d3-ease": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", + "license": "MIT" + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", + "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", + "license": "MIT", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", + "license": "MIT" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", + "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", + "license": "MIT", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-kVd74ta9eof3eJOvbNd1vGKS/XERRyQbT26Og63hIsvDO84cjD5gEOhsXf26w3FSoNlPVz84DOFcKv/oou+fMw==", + "license": "MIT", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", + "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", + "license": "MIT" + }, + "node_modules/@types/d3-timer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", + "license": "MIT" + }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.3.0" + } + }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", + "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==", + "license": "MIT" + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.3.0.tgz", + "integrity": "sha512-H9E955aVvD2F4zNHCw4eIZbIfF6xKldlh7MNu+hSU7xwQzh65lI/N+CJWqmfhi0PEjDXIt/H7T7J/4wU63KJiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0 || ^0.3.0", + "babel-plugin-react-compiler": "^1.0.0", + "oxc-transform-react": ">=0.152.0 <0.157.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "oxc-transform-react": { + "optional": true + } + } + }, + "node_modules/@xml-tools/parser": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@xml-tools/parser/-/parser-1.0.11.tgz", + "integrity": "sha512-aKqQ077XnR+oQtHJlrAflaZaL7qZsulWc/i/ZEooar5JiWj1eLt0+Wg28cpa+XLney107wXqneC+oG1IZvxkTA==", + "license": "Apache-2.0", + "dependencies": { + "chevrotain": "7.1.1" + } + }, + "node_modules/acorn": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz", + "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.2.0.tgz", + "integrity": "sha512-VXY5eFRarnXcYxwBjJzPmEhH55+rmP79/+ueDhi0F+TuqfHCItagIHqxeUZrmgrOPa31QTh9H85DjX3FfJ0FTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-object-atoms": "^1.1.2", + "es-shim-unscopables": "^1.1.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlast": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", + "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", + "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3", + "es-errors": "^1.3.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.25", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.25.tgz", + "integrity": "sha512-gMmEShwwq7FJqMwvfRwvCl00v4kN+KOfJqXn+f4nrufak5gNHJOksd/60Dvjuz7sI8Y5WiSFBa8FEYr+zoyqCw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browserslist": { + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz", + "integrity": "sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.11.23", + "caniuse-lite": "^1.0.30001810", + "electron-to-chromium": "^1.5.427", + "node-releases": "^2.0.55", + "update-browserslist-db": "^1.3.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, + "node_modules/call-bind": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.9.tgz", + "integrity": "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "get-intrinsic": "^1.3.0", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001810", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", + "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chevrotain": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-7.1.1.tgz", + "integrity": "sha512-wy3mC1x4ye+O+QkEinVJkPf5u2vsrDIYW9G7ZuwFl6v/Yu0LwUuT2POsb+NUWApebyxfkQq6+yDfRExbnI5rcw==", + "license": "Apache-2.0", + "dependencies": { + "regexp-to-ast": "0.5.0" + } + }, + "node_modules/chokidar": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz", + "integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "readdirp": "^5.0.0" + }, + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/codemirror": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.2.tgz", + "integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/commands": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/search": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/colorjs.io": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/colorjs.io/-/colorjs.io-0.7.1.tgz", + "integrity": "sha512-LY7OHnJZxHwT5UlzNa9bbhHHDbzB6yE5+3MIPwJEQKRvSCt/T4G7epsj+9j2BExUIIfXFIJGsIXUKdfrK9Q5tA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/color" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/crelt": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.7.tgz", + "integrity": "sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA==", + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz", + "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decimal.js-light": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", + "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", + "license": "MIT" + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dijkstrajs": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", + "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", + "license": "MIT" + }, + "node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.435", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.435.tgz", + "integrity": "sha512-hwZNgb6JmRlmQX/L0yojyu6upuvtR7iGS1hB/9nc7I9vCsvekahqh3noFeXUBRirv9+Hk7E6v/LFz4CW6FvpWA==", + "dev": true, + "license": "ISC" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/es-abstract": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.2.tgz", + "integrity": "sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-abstract-get": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-abstract-get/-/es-abstract-get-1.0.0.tgz", + "integrity": "sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.2", + "is-callable": "^1.2.7", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.4.0.tgz", + "integrity": "sha512-c/A0P0oxkACDc+cKWw8evLXK83oBKgn0qPOqCYT4x9uolpCIJAcYvJC9QYKNDRPsTeGyCrQ326jrvgZWdCdK5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.1.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.3.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.5", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.4.tgz", + "integrity": "sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-abstract-get": "^1.0.0", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "is-callable": "^1.2.7", + "is-date-object": "^1.1.0", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-toolkit": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.52.0.tgz", + "integrity": "sha512-XTNEJQh1tY1ZJVcf6ayP/2n4ZPyaHlW2FWs7xvw5ddPuhUVjLD3olQVQS7kf58JbAB48iL0uL/jerTrjtV3lDA==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks", + "tests/types", + "tests/browser-compat" + ] + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.14.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.14.0.tgz", + "integrity": "sha512-T0pNsxkb9IKmtQjhpK3d7nWOpFv+YHuMbTJnSVMoQblF0onvXfErrtp4V1jHtsQPan7dKaGVD0q1WCXnzMF31A==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "11.1.5 || >11.1.6 <12", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.6", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.37.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", + "integrity": "sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.8", + "array.prototype.findlast": "^1.2.5", + "array.prototype.flatmap": "^1.3.3", + "array.prototype.tosorted": "^1.1.4", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.2.1", + "estraverse": "^5.3.0", + "hasown": "^2.0.2", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.9", + "object.fromentries": "^2.0.8", + "object.values": "^1.2.1", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.12", + "string.prototype.repeat": "^1.0.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz", + "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.5.7.tgz", + "integrity": "sha512-XhJSzLljuYD4UjNuFGJu2v7aD3sqNVK12w5/DCUfrNfHWegZo2+TsavNx8MuxMwEquuFAzNbNfXKU0WoZ+YUIg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": "^9 || ^10" + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^6.1.23" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flag-icons": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/flag-icons/-/flag-icons-7.6.0.tgz", + "integrity": "sha512-hir/PsXwr0EESyizKrXJzmkzpLIMf+1vlNKLqAfvdh+bsU94a7LYWTiubkHKqptGoCPzOUGcm6c4PfC9/BaGSQ==", + "license": "MIT" + }, + "node_modules/flat-cache": { + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" + } + }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.2.0.tgz", + "integrity": "sha512-jObKIik1P2QjPHP5nz5BaOtUlfgS0fWo8IUByNXkM+o+02sJOi94em77GwJKQSJ3gfPHdgzLNrHc1uokV4P/ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2", + "hasown": "^2.0.4", + "is-callable": "^1.2.7", + "is-document.all": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "17.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.14.0.tgz", + "integrity": "sha512-UtdkTVyAJePQv0J2M9Xe4L0ruNSDV314XiIJsADI2Zf40bcdAonE/D/OhAU8AT99oij9mhLByb+NvA3QWZYgCg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hermes-estree": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", + "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", + "dev": true, + "license": "MIT" + }, + "node_modules/hermes-parser": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", + "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hermes-estree": "0.25.1" + } + }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/immer": { + "version": "11.1.18", + "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.18.tgz", + "integrity": "sha512-EQyQtLiYW029lyoczMl/Hh4Xu7cDecSc58JRYpHyL4tIAu3eqd1yJzQX04d2BZHDkzFFvm6qJEJWOtfDSWAXbQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/immutable": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.9.tgz", + "integrity": "sha512-m8nVez3rwrgmWxtLMt1ZYXB2Lv7OKYn/disyxAlSDYAlKSlFoPPfIAmAM/M5xqL4m4C/wAPw7S2/CNaUii1Hxg==", + "dev": true, + "license": "MIT" + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz", + "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-document.all": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-document.all/-/is-document.all-1.0.0.tgz", + "integrity": "sha512-+XSoyS05OdBbhFuELhgTCpFNHkpBOJqtsZfUFFpe5QTw+9Sjbh8zitxhQkYAo6wV7e1Vb8cAPvpCk9jGam/82g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/iterator.prototype": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/keyv": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lucide-react": { + "version": "1.71.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.71.0.tgz", + "integrity": "sha512-8YtvF+bqT/EMqAXU7kWvYdRu+TV9j4kS1eIS7IbN1j1Z1DgupbrTL0nDIygdqgBDTD7AJPP607VdVgzDTar4zA==", + "license": "ISC", + "peerDependencies": { + "@types/react": "*", + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/node-exports-info": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.2.tgz", + "integrity": "sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==", + "dev": true, + "license": "MIT", + "dependencies": { + "array.prototype.flatmap": "^1.3.3", + "es-errors": "^1.3.0", + "object.entries": "^1.1.9", + "semver": "^6.3.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/node-releases": { + "version": "2.0.56", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.56.tgz", + "integrity": "sha512-x0InOIyzgdk+eyaWaRJFH5snEtiImgBgblZ2CyPrLmqqcuMQkEvcDPHbzqbD8eDsSeJbVOjn+crzyzHaM4D+/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", + "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/own-keys": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.2.tgz", + "integrity": "sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "get-intrinsic": "^1.3.0", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pngjs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", + "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.10.tgz", + "integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==", + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "dev": true, + "license": "MIT" + }, + "node_modules/qrcode": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==", + "license": "MIT", + "dependencies": { + "dijkstrajs": "^1.0.1", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" + }, + "bin": { + "qrcode": "bin/qrcode" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/react": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + } + }, + "node_modules/react-is": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.3.0.tgz", + "integrity": "sha512-UpMYezM4v5/18F28aC66AEsjXIgE02kyEMH6yLdgLXu/UTfa1Ntwck/nNLrbqJsEXW7gPb0coNO9FQse9WTovA==", + "license": "MIT", + "peer": true + }, + "node_modules/react-redux": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.3.0.tgz", + "integrity": "sha512-KQopgqFo/p/fgmAs5qz6p5RWaNAzq40WAu7fJIXnQpYxFPbJYtsJPWvGeF2rOBaY/kEuV77AVsX8TsQzKm+A/g==", + "license": "MIT", + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "use-sync-external-store": "^1.4.0" + }, + "peerDependencies": { + "@types/react": "^18.2.25 || ^19", + "react": "^18.0 || ^19", + "redux": "^5.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, + "node_modules/react-router": { + "version": "7.18.5", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.5.tgz", + "integrity": "sha512-dTgvcXDOrLPrlLHrcZAqWveiK1hMSqN+rGAJzegP8HtmNkfRxOoshGWBNX3ZJ0cZjOHkRdlUJtaIhZMLLyGyPw==", + "license": "MIT", + "dependencies": { + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + } + }, + "node_modules/react-router-dom": { + "version": "7.18.5", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.5.tgz", + "integrity": "sha512-9HcfDMU6JJ/fp6gJZYGwNE6RknVGS4kBjH1HkNw959mCJi70TVwdipQWv2FEol9uGpi+SZTFtVpJPtEQfayeOw==", + "license": "MIT", + "dependencies": { + "react-router": "7.18.5" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + } + }, + "node_modules/readdirp": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.1.1.tgz", + "integrity": "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/recharts": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.10.1.tgz", + "integrity": "sha512-QXFrvt6IVcw7eeZCoyXTwkIJAX3Dv1nyVhMicXJ47GsGDDpcN8z6o644DibE9XjpBTThtsomLKnTV6lc+cVFUA==", + "license": "MIT", + "workspaces": [ + "www" + ], + "dependencies": { + "@reduxjs/toolkit": "^1.9.0 || 2.x.x", + "clsx": "^2.1.1", + "decimal.js-light": "^2.5.1", + "es-toolkit": "^1.39.3", + "eventemitter3": "^5.0.1", + "immer": "^11.1.8", + "react-redux": "8.x.x || 9.x.x", + "reselect": "5.2.0", + "tiny-invariant": "^1.3.3", + "use-sync-external-store": "^1.2.2", + "victory-vendor": "^37.0.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT" + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "license": "MIT", + "peerDependencies": { + "redux": "^5.0.0" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexp-to-ast": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz", + "integrity": "sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw==", + "license": "MIT" + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "license": "ISC" + }, + "node_modules/reselect": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.2.0.tgz", + "integrity": "sha512-AgZ3UOZm3YndfrJ4OYjgrT7bmCm/1iqkjvEfH/oYjzh6PD2qw4QuT3jjnXIrpdt4MTpMXclMT3lXbmRY+XRakw==", + "license": "MIT" + }, + "node_modules/resolve": { + "version": "2.0.0-next.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.7.tgz", + "integrity": "sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.16.2", + "node-exports-info": "^1.6.0", + "object-keys": "^1.1.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rolldown": { + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.18.tgz", + "integrity": "sha512-C1uuT3UR60SShuCaPQFAAZyefJCWZlAKB02BV3BuPE2Rs4fevRQltEKoFO2tV5W9/eJhU5RieV6vJj3euulfNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.156.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.18", + "@rolldown/binding-android-arm64": "1.2.18", + "@rolldown/binding-darwin-arm64": "1.2.18", + "@rolldown/binding-darwin-x64": "1.2.18", + "@rolldown/binding-freebsd-x64": "1.2.18", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.18", + "@rolldown/binding-linux-arm64-gnu": "1.2.18", + "@rolldown/binding-linux-arm64-musl": "1.2.18", + "@rolldown/binding-linux-ppc64-gnu": "1.2.18", + "@rolldown/binding-linux-s390x-gnu": "1.2.18", + "@rolldown/binding-linux-x64-gnu": "1.2.18", + "@rolldown/binding-linux-x64-musl": "1.2.18", + "@rolldown/binding-openharmony-arm64": "1.2.18", + "@rolldown/binding-win32-arm64-msvc": "1.2.18", + "@rolldown/binding-win32-x64-msvc": "1.2.18" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.4.tgz", + "integrity": "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "get-intrinsic": "^1.3.0", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sass": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.108.1.tgz", + "integrity": "sha512-sIYgSvOPeD9wABwDS/ofNjHASSck+7h3jLkk7wG1NPFL3XeS6vOQjBlAFSmRV09kZr1yt/Tuayt6kKtBbLjHNQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "chokidar": "^5.0.0", + "immutable": "^5.1.5", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=20.19.0" + }, + "optionalDependencies": { + "@parcel/watcher": "^2.4.1" + } + }, + "node_modules/sass-embedded": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded/-/sass-embedded-1.108.1.tgz", + "integrity": "sha512-IstYYjzmV1xxJ3E9LSAznPii/h+sUQT4h/Bizp/vveBAiXaG5Sf48eIz4g7UQDy5sM7hJ7tJLw5/Do+tsOaotQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bufbuild/protobuf": "^2.5.0", + "colorjs.io": "^0.7.0", + "immutable": "^5.1.5", + "rxjs": "^7.4.0", + "supports-color": "^8.1.1", + "sync-child-process": "^1.0.2", + "varint": "^6.0.0" + }, + "bin": { + "sass": "dist/bin/sass.js" + }, + "engines": { + "node": ">=20.19.0" + }, + "optionalDependencies": { + "sass-embedded-all-unknown": "1.108.1", + "sass-embedded-android-arm": "1.108.1", + "sass-embedded-android-arm64": "1.108.1", + "sass-embedded-android-riscv64": "1.108.1", + "sass-embedded-android-x64": "1.108.1", + "sass-embedded-darwin-arm64": "1.108.1", + "sass-embedded-darwin-x64": "1.108.1", + "sass-embedded-linux-arm": "1.108.1", + "sass-embedded-linux-arm64": "1.108.1", + "sass-embedded-linux-musl-arm": "1.108.1", + "sass-embedded-linux-musl-arm64": "1.108.1", + "sass-embedded-linux-musl-riscv64": "1.108.1", + "sass-embedded-linux-musl-x64": "1.108.1", + "sass-embedded-linux-riscv64": "1.108.1", + "sass-embedded-linux-x64": "1.108.1", + "sass-embedded-unknown-all": "1.108.1", + "sass-embedded-win32-arm64": "1.108.1", + "sass-embedded-win32-x64": "1.108.1" + } + }, + "node_modules/sass-embedded-all-unknown": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-all-unknown/-/sass-embedded-all-unknown-1.108.1.tgz", + "integrity": "sha512-8DX5amNn2soKlvYBzkahVepUTWJyARSIs0iE6Obv8mUoUDVxisr+uBRqSht/QDSAs/cUWfuJ3SLOOAiz2Ee/BQ==", + "cpu": [ + "!arm", + "!arm64", + "!riscv64", + "!x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "sass": "1.108.1" + } + }, + "node_modules/sass-embedded-android-arm": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-android-arm/-/sass-embedded-android-arm-1.108.1.tgz", + "integrity": "sha512-FaJvpf4ykjCLY1uTwMlG4wKDF4X292AEqUWpaDubkefsRQkA2l23u1v0isZJi5naywsIp14yL/al+LGpFjoE1g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-android-arm64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-android-arm64/-/sass-embedded-android-arm64-1.108.1.tgz", + "integrity": "sha512-RSIzxdbcD9VMuOZZ2AWj3QEVACaAbjcC4PNKwZd5V0cLJD3MVpGsyDWhtl+ztYZaSbXwpmWzdEwxcinItGoj2Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-android-riscv64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-android-riscv64/-/sass-embedded-android-riscv64-1.108.1.tgz", + "integrity": "sha512-UsBOCpBjIe4NmSakGpg+XFmj8lhuAP6OA/XDFGaXCd3RhgrB8rS0kFYPZJXIKul4+Kvfiu2nOJwrkwIiL+mRAg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-android-x64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-android-x64/-/sass-embedded-android-x64-1.108.1.tgz", + "integrity": "sha512-Afqovco5LSYOlL5eQ0j9jdpVp4ACgEinDaTFrZktui/xZi0kD7YHMiyQ1KRb+Tc4GzdLSD8QcY848K8XEgp0BQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-darwin-arm64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-darwin-arm64/-/sass-embedded-darwin-arm64-1.108.1.tgz", + "integrity": "sha512-Tchxsw9kxwC+08ghJGzPjpicAYHotbOD6imYZq5L5wLHmPnd4k6r/4B0aSWFqTHBS4kJ2Fm5Q8EaHnMLqn4kgg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-darwin-x64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-darwin-x64/-/sass-embedded-darwin-x64-1.108.1.tgz", + "integrity": "sha512-IMjnowKRoDQ12MTbVYs8DG037Wn6fu5BBoojGCivqyIawrIkK+VKSu/h796nIHMOogrLkv8+djaApDvZ4OOmtg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-linux-arm": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm/-/sass-embedded-linux-arm-1.108.1.tgz", + "integrity": "sha512-8mtm+MCLMwDJEhkpZZH9PqaPYiiSCTfYm4duYU0YnVq3jabxIp1kOIbZyNJjBB/clQd5W6ZkkyAimPg9SJrEmA==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": "glibc", + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-linux-arm64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm64/-/sass-embedded-linux-arm64-1.108.1.tgz", + "integrity": "sha512-576kvZ3fo2kVILC80kMjFNwCJTSpbKneoSK0RNeJEmnydAnhIu/9T5BReCVxb3f1Zi7rclynexJ12g5Yt4VywA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": "glibc", + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-linux-musl-arm": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm/-/sass-embedded-linux-musl-arm-1.108.1.tgz", + "integrity": "sha512-CGp496gDB14lm1Mrycun/ZKC8jPavyZMib1Eyhy9FRDYre7fAkzCCDBtuoGL+syi1aB0pU8/AIn+8aqamnHwHA==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": "musl", + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-linux-musl-arm64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm64/-/sass-embedded-linux-musl-arm64-1.108.1.tgz", + "integrity": "sha512-7rvj3ADnOiSVj+Fjqyx6LhnxILcoUyf0u7G7Bzks5dHFXsMM9+zI1X4rsYEuLrn5St2i64RIben3NEvefCCXSA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": "musl", + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-linux-musl-riscv64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-riscv64/-/sass-embedded-linux-musl-riscv64-1.108.1.tgz", + "integrity": "sha512-/1zYmc3C56D2BAS/YO1ZQ6xx7yLyr3aGVmyIjTmtdv3AC2oyQS9pzR6tCe/NB88aAgZXN8SuOFjBWyJpglx3hQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": "musl", + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-linux-musl-x64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-x64/-/sass-embedded-linux-musl-x64-1.108.1.tgz", + "integrity": "sha512-fXWiJzWoQuoJAP31ig7VoPi8iJbVoEaVWPf+UAZA2nn9NhmRU5CLribVZO1mmJdIkPDakRJ4LdFla/EpmIpcow==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": "musl", + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-linux-riscv64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-riscv64/-/sass-embedded-linux-riscv64-1.108.1.tgz", + "integrity": "sha512-UjOLDh60rJIhZFIdNh1Mn59ZvKQP+R3oVbgwY5foP3tgeVD0m/P6YInZhns5yycB3cD9zCIutwKD+n8Jv+2qkQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": "glibc", + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-linux-x64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-x64/-/sass-embedded-linux-x64-1.108.1.tgz", + "integrity": "sha512-c6ynIfjlZuK2V++mJhu4ZBKx7+eFdbfnTufiqfSL7MtY18n4LOAkiPerRnhlXcWukr9/MYHnsFJy1xSsOdq+0Q==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": "glibc", + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-unknown-all": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-unknown-all/-/sass-embedded-unknown-all-1.108.1.tgz", + "integrity": "sha512-Dmtp1nzd/sgmdlOLV3Mf2IAYNg+8C+fhumLIEcnY2SYDRQr1IyXNpLL+6Od3FdLACrP9kL8tZv3cpOLsoLaj9Q==", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "!android", + "!darwin", + "!linux", + "!win32" + ], + "dependencies": { + "sass": "1.108.1" + } + }, + "node_modules/sass-embedded-win32-arm64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-win32-arm64/-/sass-embedded-win32-arm64-1.108.1.tgz", + "integrity": "sha512-yDY8zEBSIUjcxbZxaWih8QCoMQYghNo7Q4yOVLm7Tz1yBNvmyES/BgmOJ2swk93wY6UynGz/ur92/MfQA9BxAQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-embedded-win32-x64": { + "version": "1.108.1", + "resolved": "https://registry.npmjs.org/sass-embedded-win32-x64/-/sass-embedded-win32-x64-1.108.1.tgz", + "integrity": "sha512-CEAQHFP+MMhAUEWCrkHWojpzWsVJ344O0wNM1Pe4L6qmVUaKE6eMnAvb0p480Wgbx4IgBhw6hKOJvlU0G+xwRA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "license": "ISC" + }, + "node_modules/set-cookie-parser": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", + "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", + "license": "MIT" + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.matchall": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.1.0.tgz", + "integrity": "sha512-tHNHTxInrYLCga9O9YGxWA3G9/nnzQw8UGAyqGx3Ar1pSTTzIuM4woFSq4SowkXCjJIwq5sIiQvEfRI9tCH1qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.2", + "get-intrinsic": "^1.3.0", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.4", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.repeat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", + "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.11.tgz", + "integrity": "sha512-PwvK7BU+CMTJGYQCTZb5RWXIML92lftJLhQz1tBzgKiqGxJaMlBAa48POXaNAC2s4y8jr3EFqrkF9+44neS46w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-object-atoms": "^1.1.2", + "has-property-descriptors": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.10.tgz", + "integrity": "sha512-2+3aDAOmPTmuFwjDnmJG2ctEkQKVki7vOSqaxkv42Mowj1V6PnvuwFCRrR5lChUux1TBskPjfkeTOhqczDMxTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/style-mod": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.4.tgz", + "integrity": "sha512-XXWIQt633/EpAFx8aZDOTjBzrCaGmhvEQlQo6MVPfa2OzO2cWo+4hV9h+6UkHYlXGfy+ODXKUdP7Pthmcu5ATw==", + "license": "MIT" + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sync-child-process": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.0.2.tgz", + "integrity": "sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "sync-message-port": "^1.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/sync-message-port": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/sync-message-port/-/sync-message-port-1.2.0.tgz", + "integrity": "sha512-gAQ9qrUN/UCypHtGFbbe7Rc/f9bzO88IwrG8TDo/aMKAApKyD6E3W4Cm0EfhfBb6Z6SKt59tTCTfD+n1xmAvMg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.5.tgz", + "integrity": "sha512-0FHJvLPqZ7KJzp17O13jfsAjsqazgrxBu2zEK95PmUz8lv2+GjRuxUInCr2Rk9Dms3ihN21zJ929ZO43yJ95QQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.9", + "for-each": "^0.3.5", + "gopd": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.8.tgz", + "integrity": "sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "for-each": "^0.3.5", + "gopd": "^1.2.0", + "is-typed-array": "^1.1.15", + "possible-typed-array-names": "^1.1.0", + "reflect.getprototypeof": "^1.0.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz", + "integrity": "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/use-sync-external-store": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz", + "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "dev": true, + "license": "MIT" + }, + "node_modules/victory-vendor": { + "version": "37.3.6", + "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz", + "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==", + "license": "MIT AND ISC", + "dependencies": { + "@types/d3-array": "^3.0.3", + "@types/d3-ease": "^3.0.0", + "@types/d3-interpolate": "^3.0.1", + "@types/d3-scale": "^4.0.2", + "@types/d3-shape": "^3.1.0", + "@types/d3-time": "^3.0.0", + "@types/d3-timer": "^3.0.0", + "d3-array": "^3.1.6", + "d3-ease": "^3.0.1", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-shape": "^3.1.0", + "d3-time": "^3.0.0", + "d3-timer": "^3.0.1" + } + }, + "node_modules/vite": { + "version": "8.3.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.7.tgz", + "integrity": "sha512-oxh0dMxrayBr33ScJvvBJ2HBQ2jc1TBrXKR2NyL/MJ9WPuX19mN2DXWUmywKdyw5RFVQBo8hmtb2FMC0LHrnng==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.32", + "rolldown": "~1.2.18", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "license": "MIT" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "license": "ISC" + }, + "node_modules/which-typed-array": { + "version": "1.1.24", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.24.tgz", + "integrity": "sha512-wk4Mf4pR5mRP7eYuuTBCIQ9d0ud2Fv2jRLQpfgnRjbOxAFHmjKFValgTpitVKzJJS8ajnYQV2Du1SZ8j6b/EUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "license": "ISC" + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.5.tgz", + "integrity": "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-validation-error": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", + "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + } + } + } +} diff --git a/client/package.json b/client/package.json new file mode 100644 index 0000000..4252877 --- /dev/null +++ b/client/package.json @@ -0,0 +1,55 @@ +{ + "name": "client", + "version": "1.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "lint": "eslint .", + "preview": "vite preview" + }, + "dependencies": { + "@codemirror/autocomplete": "^6.20.4", + "@codemirror/commands": "^6.11.1", + "@codemirror/lang-css": "^6.3.1", + "@codemirror/lang-html": "^6.4.12", + "@codemirror/lang-javascript": "^6.2.5", + "@codemirror/lang-json": "^6.0.2", + "@codemirror/lang-xml": "^6.1.0", + "@codemirror/language": "^6.13.1", + "@codemirror/search": "^6.7.2", + "@codemirror/state": "^6.7.6", + "@codemirror/view": "^6.43.15", + "@fontsource/plus-jakarta-sans": "^5.3.0", + "@lezer/highlight": "^1.2.5", + "@prettier/plugin-xml": "^3.4.2", + "@simplewebauthn/browser": "^14.0.0", + "codemirror": "^6.0.2", + "flag-icons": "^7.6.0", + "lucide-react": "^1.65.0", + "prettier": "^3.9.10", + "qrcode": "^1.5.4", + "react": "^19.3.0", + "react-dom": "^19.3.1", + "react-router-dom": "^7.18.4", + "recharts": "^3.10.1" + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "@vitejs/plugin-react": "^6.1.2", + "eslint": "^10.13.0", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1", + "eslint-plugin-react-refresh": "^0.5.7", + "globals": "^17.13.0", + "sass-embedded": "^1.107.0", + "vite": "^8.3.4" + }, + "overrides": { + "eslint-plugin-react": { + "eslint": "$eslint" + } + } +} diff --git a/client/public/assets/img/favicon.png b/client/public/assets/img/favicon.png new file mode 100644 index 0000000..8d5bd5a Binary files /dev/null and b/client/public/assets/img/favicon.png differ diff --git a/client/public/assets/img/favicon.svg b/client/public/assets/img/favicon.svg new file mode 100644 index 0000000..d623541 --- /dev/null +++ b/client/public/assets/img/favicon.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/client/public/robots.txt b/client/public/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/client/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/client/src/App.jsx b/client/src/App.jsx new file mode 100644 index 0000000..6c7661e --- /dev/null +++ b/client/src/App.jsx @@ -0,0 +1,94 @@ +import "@fontsource/plus-jakarta-sans/300.css"; +import "@fontsource/plus-jakarta-sans/400.css"; +import "@fontsource/plus-jakarta-sans/600.css"; +import "@fontsource/plus-jakarta-sans/700.css"; +import "@fontsource/plus-jakarta-sans/800.css"; +import { createBrowserRouter, Navigate, RouterProvider } from "react-router-dom"; +import "@/common/styles/main.sass"; +import { lazy, Suspense } from "react"; +import Root from "@/common/layouts/Root.jsx"; +import PublicRoot from "@/common/layouts/PublicRoot.jsx"; +import { ErrorBoundary, RouteErrorPage } from "@/common/components/ErrorBoundary"; +import PublicShell from "@/common/layouts/PublicShell.jsx"; +import Loading from "@/common/components/Loading"; + +const Tunnels = lazy(() => import("@/pages/Tunnels")); +const TunnelDetail = lazy(() => import("@/pages/TunnelDetail")); +const Settings = lazy(() => import("@/pages/Settings")); +const SettingsServer = lazy(() => import("@/pages/Settings/pages/Server")); +const SettingsForwarding = lazy(() => import("@/pages/Settings/pages/Forwarding")); +const SettingsHttps = lazy(() => import("@/pages/Settings/pages/Https")); +const SettingsDevices = lazy(() => import("@/pages/Settings/pages/Devices")); +const SettingsAccount = lazy(() => import("@/pages/Settings/pages/Account")); +const SettingsAccounts = lazy(() => import("@/pages/Settings/pages/Accounts")); +const SettingsProviders = lazy(() => import("@/pages/Settings/pages/Providers")); +const Setup = lazy(() => import("@/pages/Setup")); +const Login = lazy(() => import("@/pages/Login")); +const Select = lazy(() => import("@/pages/Select")); +const Status = lazy(() => import("@/pages/Status")); +const Handoff = lazy(() => import("@/pages/Handoff")); +const Connect = lazy(() => import("@/pages/Connect")); +const Invite = lazy(() => import("@/pages/Invite")); + +export const BASE_PATH = "/@frislit"; +export const GITHUB_URL = "https://git.fristy.net/fristy/frislit"; +export const DOCS_URL = "https://git.fristy.net/fristy/frislit#documentation"; +export const AUTHOR_URL = "https://gnm.dev"; +export const FORK_URL = "https://fristy.dev"; + +const App = () => { + const bootState = typeof window !== "undefined" ? window.__frislit__ : null; + if (bootState) { + return ( + + + }> + + + + + ); + } + + const router = createBrowserRouter([ + { + path: "/", + element: , + errorElement: , + children: [ + { path: "/", element: }, + { path: "/tunnels", element: }, + { path: "/tunnels/:id", element: }, + { + path: "/settings", element: , children: [ + { path: "server", element: }, + { path: "forwarding", element: }, + { path: "https", element: }, + { path: "devices", element: }, + { path: "accounts", element: }, + { path: "providers", element: }, + { path: "account", element: }, + ], + }, + ], + }, + { + path: "/", + element: , + errorElement: , + children: [ + { path: "/setup", element: }, + { path: "/login", element: }, + { path: "/select", element: + {suffix && {suffix}} + + + ); +}; diff --git a/client/src/common/components/Input/index.js b/client/src/common/components/Input/index.js new file mode 100644 index 0000000..4c78da1 --- /dev/null +++ b/client/src/common/components/Input/index.js @@ -0,0 +1 @@ +export { Input as default } from "./Input.jsx"; diff --git a/client/src/common/components/Input/styles.sass b/client/src/common/components/Input/styles.sass new file mode 100644 index 0000000..633baf0 --- /dev/null +++ b/client/src/common/components/Input/styles.sass @@ -0,0 +1,65 @@ +@use "@/common/styles/colors" + +.field + display: flex + flex-direction: column + gap: 0.4rem + min-width: 0 + + label + color: colors.$subtext + font-size: 0.8125rem + font-weight: 500 + +.field-input + display: flex + align-items: center + gap: 0.5rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.75rem + padding: 0 0.875rem + transition: border-color 0.15s ease + + &:focus-within + border-color: colors.$primary + + input + flex: 1 + min-width: 0 + background: none + border: none + outline: none + color: colors.$text + font-family: inherit + font-size: 0.9375rem + font-weight: 500 + padding: 0.625rem 0 + + &::placeholder + color: colors.$muted + + &:disabled + color: colors.$muted + cursor: not-allowed + + .field-suffix + color: colors.$muted + font-size: 0.8125rem + white-space: nowrap + +@keyframes field-autofill + from + opacity: 1 + to + opacity: 1 + +.field-input input + &:-webkit-autofill, + &:-webkit-autofill:hover, + &:-webkit-autofill:focus + animation-name: field-autofill + animation-duration: 1ms + box-shadow: 0 0 0 1000px colors.$surface inset + -webkit-text-fill-color: colors.$text + caret-color: colors.$text diff --git a/client/src/common/components/Loading/Loading.jsx b/client/src/common/components/Loading/Loading.jsx new file mode 100644 index 0000000..4f2eb3d --- /dev/null +++ b/client/src/common/components/Loading/Loading.jsx @@ -0,0 +1,12 @@ +import { memo } from "react"; +import "./styles.sass"; + +export const Loading = memo(() => { + return ( +
+ +
+ ); +}); + +Loading.displayName = "Loading"; diff --git a/client/src/common/components/Loading/index.js b/client/src/common/components/Loading/index.js new file mode 100644 index 0000000..9c2242a --- /dev/null +++ b/client/src/common/components/Loading/index.js @@ -0,0 +1 @@ +export { Loading as default } from "./Loading.jsx"; diff --git a/client/src/common/components/Loading/styles.sass b/client/src/common/components/Loading/styles.sass new file mode 100644 index 0000000..e6e816c --- /dev/null +++ b/client/src/common/components/Loading/styles.sass @@ -0,0 +1,20 @@ +@use "@/common/styles/colors" + +.loading + display: flex + align-items: center + justify-content: center + padding: 4rem 0 + flex: 1 + +.loading-spinner + width: 1.5rem + height: 1.5rem + border: 2px solid colors.$border-strong + border-top-color: colors.$primary + border-radius: 50% + animation: loading-spin 0.7s linear infinite + +@keyframes loading-spin + to + transform: rotate(360deg) diff --git a/client/src/common/components/OpenInFrislit/OpenInFrislit.jsx b/client/src/common/components/OpenInFrislit/OpenInFrislit.jsx new file mode 100644 index 0000000..9459f7b --- /dev/null +++ b/client/src/common/components/OpenInFrislit/OpenInFrislit.jsx @@ -0,0 +1,54 @@ +import "./styles.sass"; +import { useEffect, useRef, useState } from "react"; +import { Download, Terminal } from "lucide-react"; +import Button from "@/common/components/Button"; +import CopyField from "@/common/components/CopyField"; +import { getRequest } from "@/common/utils/RequestUtil.js"; +import { detectPlatform, downloadsFor, installCommand } from "@/common/utils/platform.js"; + +const HANDOFF_TIMEOUT = 1500; + +export const OpenInFrislit = ({ href }) => { + const [missing, setMissing] = useState(null); + const timers = useRef([]); + + useEffect(() => () => timers.current.forEach(clearTimeout), []); + + const offerInstall = async () => { + const [platform, info] = await Promise.all([detectPlatform(), getRequest("info").catch(() => ({}))]); + setMissing({ command: installCommand(platform.os), downloads: downloadsFor(platform, info.version) }); + }; + + const open = () => { + setMissing(null); + window.location.href = href; + + timers.current.push(setTimeout(() => { + if (document.hasFocus()) offerInstall(); + }, HANDOFF_TIMEOUT)); + }; + + return ( +
+
+ ); +}; diff --git a/client/src/common/components/OpenInFrislit/index.js b/client/src/common/components/OpenInFrislit/index.js new file mode 100644 index 0000000..ac85ebd --- /dev/null +++ b/client/src/common/components/OpenInFrislit/index.js @@ -0,0 +1 @@ +export { OpenInFrislit as default } from "./OpenInFrislit.jsx"; diff --git a/client/src/common/components/OpenInFrislit/styles.sass b/client/src/common/components/OpenInFrislit/styles.sass new file mode 100644 index 0000000..1f8634d --- /dev/null +++ b/client/src/common/components/OpenInFrislit/styles.sass @@ -0,0 +1,58 @@ +@use "@/common/styles/colors" + +.open-in-frislit + display: flex + flex-direction: column + align-items: flex-start + gap: 0.75rem + +.open-in-frislit-install + display: flex + flex-direction: column + gap: 0.625rem + width: 100% + padding: 0.875rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.75rem + + > p + margin: 0 + color: colors.$subtext + font-size: 0.8125rem + +.open-in-frislit-files + display: flex + flex-wrap: wrap + gap: 0.5rem + + a + display: inline-flex + align-items: center + gap: 0.375rem + padding: 0.4375rem 0.75rem + background-color: colors.$surface-raised + border: 1px solid colors.$border-strong + border-radius: 0.5rem + color: colors.$text + font-size: 0.8125rem + font-weight: 500 + text-decoration: none + transition: background-color 0.15s ease, border-color 0.15s ease + + &:hover + background-color: colors.$surface-hover + border-color: colors.$primary + + &:first-child + border-color: colors.$primary + color: colors.$primary-bright + +.open-in-frislit-all + color: colors.$muted + font-size: 0.75rem + text-decoration: none + + &:hover + color: colors.$subtext + text-decoration: underline diff --git a/client/src/common/components/QuotaFields/QuotaFields.jsx b/client/src/common/components/QuotaFields/QuotaFields.jsx new file mode 100644 index 0000000..76e9a17 --- /dev/null +++ b/client/src/common/components/QuotaFields/QuotaFields.jsx @@ -0,0 +1,13 @@ +import "./styles.sass"; +import Input from "@/common/components/Input"; +import { FIELDS } from "./limits.js"; + +export const QuotaFields = ({ values, setValues, idPrefix, placeholders }) => ( +
+ {FIELDS.map(({ key, label, suffix }) => ( + setValues({ ...values, [key]: value })} /> + ))} +
+); diff --git a/client/src/common/components/QuotaFields/index.js b/client/src/common/components/QuotaFields/index.js new file mode 100644 index 0000000..948b384 --- /dev/null +++ b/client/src/common/components/QuotaFields/index.js @@ -0,0 +1,2 @@ +export { QuotaFields as default } from "./QuotaFields.jsx"; +export { FIELDS, toForm, fromForm } from "./limits.js"; diff --git a/client/src/common/components/QuotaFields/limits.js b/client/src/common/components/QuotaFields/limits.js new file mode 100644 index 0000000..21572b5 --- /dev/null +++ b/client/src/common/components/QuotaFields/limits.js @@ -0,0 +1,21 @@ +const GB = 1e9; + +export const FIELDS = [ + { key: "tunnels", label: "Tunnels" }, + { key: "persistent", label: "Persistent" }, + { key: "domains", label: "Domains" }, + { key: "traffic", label: "Traffic", suffix: "GB / month" }, +]; + +export const toForm = limits => Object.fromEntries(FIELDS.map(({ key }) => { + const value = limits?.[key]; + if (value === undefined || value === null) return [key, ""]; + return [key, String(key === "traffic" ? value / GB : value)]; +})); + +export const fromForm = values => Object.fromEntries(FIELDS.map(({ key }) => { + const text = String(values[key] ?? "").trim(); + if (text === "") return [key, null]; + const number = Number(text); + return [key, key === "traffic" ? Math.round(number * GB) : number]; +})); diff --git a/client/src/common/components/QuotaFields/styles.sass b/client/src/common/components/QuotaFields/styles.sass new file mode 100644 index 0000000..f3d9e27 --- /dev/null +++ b/client/src/common/components/QuotaFields/styles.sass @@ -0,0 +1,9 @@ +@use "@/common/styles/breakpoints" + +.quota-fields + display: grid + grid-template-columns: repeat(4, 1fr) + gap: 0.75rem + + @media (max-width: breakpoints.$mobile) + grid-template-columns: 1fr 1fr diff --git a/client/src/common/components/Select/Select.jsx b/client/src/common/components/Select/Select.jsx new file mode 100644 index 0000000..06e7665 --- /dev/null +++ b/client/src/common/components/Select/Select.jsx @@ -0,0 +1,62 @@ +import "./styles.sass"; +import { useEffect, useRef, useState } from "react"; +import { Check, ChevronDown } from "lucide-react"; + +export const Select = ({ options, selected, setSelected, label, id, disabled, multiple = false, emptyLabel = "Select" }) => { + const [open, setOpen] = useState(false); + const ref = useRef(null); + const values = multiple ? selected || [] : [selected]; + const current = multiple ? null : options.find(option => option.value === selected); + const summary = multiple + ? values.length === 0 + ? emptyLabel + : values.length === 1 + ? options.find(option => option.value === values[0])?.label || emptyLabel + : `${values.length} selected` + : current?.label || emptyLabel; + + useEffect(() => { + if (!open) return; + const handleClick = event => { if (!ref.current?.contains(event.target)) setOpen(false); }; + const handleKey = event => { if (event.key === "Escape") setOpen(false); }; + document.addEventListener("mousedown", handleClick); + document.addEventListener("keydown", handleKey); + return () => { + document.removeEventListener("mousedown", handleClick); + document.removeEventListener("keydown", handleKey); + }; + }, [open]); + + const choose = value => { + if (!multiple) { + setSelected(value); + setOpen(false); + return; + } + setSelected(values.includes(value) ? values.filter(entry => entry !== value) : [...values, value]); + }; + + return ( +
+ {label && } +
+ + {open && ( +
+ {options.map(option => ( + + ))} +
+ )} +
+
+ ); +}; diff --git a/client/src/common/components/Select/index.js b/client/src/common/components/Select/index.js new file mode 100644 index 0000000..30bad46 --- /dev/null +++ b/client/src/common/components/Select/index.js @@ -0,0 +1 @@ +export { Select as default } from "./Select.jsx"; diff --git a/client/src/common/components/Select/styles.sass b/client/src/common/components/Select/styles.sass new file mode 100644 index 0000000..515acb9 --- /dev/null +++ b/client/src/common/components/Select/styles.sass @@ -0,0 +1,82 @@ +@use "@/common/styles/colors" + +.select + position: relative + +.select-trigger + display: flex + align-items: center + justify-content: space-between + gap: 0.5rem + width: 100% + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.75rem + padding: 0.625rem 0.875rem + color: colors.$text + font-family: inherit + font-size: 0.9375rem + font-weight: 500 + text-align: left + cursor: pointer + transition: border-color 0.15s ease + + svg + width: 1.125rem + height: 1.125rem + color: colors.$muted + flex-shrink: 0 + transition: transform 0.15s ease + + &:disabled + color: colors.$muted + cursor: not-allowed + +.select.open .select-trigger + border-color: colors.$primary + + svg + transform: rotate(180deg) + +.select-menu + position: absolute + top: calc(100% + 0.375rem) + left: 0 + right: 0 + z-index: 50 + max-height: 15rem + overflow-y: auto + background-color: colors.$surface-raised + border: 1px solid colors.$border-strong + border-radius: 0.75rem + padding: 0.25rem + box-shadow: colors.$shadow-lg + +.select-option + display: flex + align-items: center + justify-content: space-between + gap: 0.5rem + width: 100% + background: none + border: none + border-radius: 0.5rem + padding: 0.5rem 0.625rem + color: colors.$subtext + font-family: inherit + font-size: 0.875rem + font-weight: 500 + text-align: left + cursor: pointer + + svg + width: 1rem + height: 1rem + color: colors.$primary + + &:hover + background-color: colors.$surface-hover + color: colors.$text + + &.selected + color: colors.$text diff --git a/client/src/common/components/ServerSettingsForm/ServerSettingsForm.jsx b/client/src/common/components/ServerSettingsForm/ServerSettingsForm.jsx new file mode 100644 index 0000000..dade97e --- /dev/null +++ b/client/src/common/components/ServerSettingsForm/ServerSettingsForm.jsx @@ -0,0 +1,25 @@ +import "./styles.sass"; +import Input from "@/common/components/Input"; +import Select from "@/common/components/Select"; + +export const ServerSettingsForm = ({ values, setValues, idPrefix = "settings", showHttpMode = true }) => { + const update = (key, value) => setValues({ ...values, [key]: value }); + + return ( +
+ update("baseDomain", value)} autoComplete="off" /> + update("publicUrl", value)} autoComplete="off" /> + {showHttpMode && ( + update("gracePeriod", value)} /> +
+ + ); +}; diff --git a/client/src/common/components/ServerSettingsForm/index.js b/client/src/common/components/ServerSettingsForm/index.js new file mode 100644 index 0000000..3b8aeb6 --- /dev/null +++ b/client/src/common/components/ServerSettingsForm/index.js @@ -0,0 +1,2 @@ +export { ServerSettingsForm as default, ServerSettingsForm } from "./ServerSettingsForm.jsx"; +export { normalizeSettings } from "./normalizeSettings.js"; diff --git a/client/src/common/components/ServerSettingsForm/normalizeSettings.js b/client/src/common/components/ServerSettingsForm/normalizeSettings.js new file mode 100644 index 0000000..5f1c017 --- /dev/null +++ b/client/src/common/components/ServerSettingsForm/normalizeSettings.js @@ -0,0 +1,8 @@ +export const normalizeSettings = values => ({ + baseDomain: values.baseDomain.trim(), + publicUrl: values.publicUrl.trim(), + httpMode: values.httpMode, + tlsMode: values.tlsMode || "proxy", + gracePeriod: Number(values.gracePeriod), + trustProxy: values.tlsMode === "acme" ? false : !!values.trustProxy, +}); diff --git a/client/src/common/components/ServerSettingsForm/styles.sass b/client/src/common/components/ServerSettingsForm/styles.sass new file mode 100644 index 0000000..8dc4daa --- /dev/null +++ b/client/src/common/components/ServerSettingsForm/styles.sass @@ -0,0 +1,17 @@ +@use "@/common/styles/breakpoints" + +.settings-form + display: flex + flex-direction: column + gap: 0.875rem + +.settings-form-row + display: flex + gap: 0.75rem + + @media (max-width: breakpoints.$mobile) + flex-direction: column + + > * + flex: 1 + min-width: 0 diff --git a/client/src/common/components/TlsChoice/TlsChoice.jsx b/client/src/common/components/TlsChoice/TlsChoice.jsx new file mode 100644 index 0000000..b749dc2 --- /dev/null +++ b/client/src/common/components/TlsChoice/TlsChoice.jsx @@ -0,0 +1,28 @@ +import { TlsDiagram } from "./TlsDiagram.jsx"; +import { TLS_MODES } from "./modes.js"; + +export const TlsChoice = ({ value, onChange, onPreview, disabled }) => ( +
onPreview?.(null)}> + {Object.entries(TLS_MODES).map(([mode, details]) => ( + + ))} +
+); + +export const TlsExplainer = ({ mode }) => ( +
+ +

{TLS_MODES[mode].title}

+
    {TLS_MODES[mode].facts.map(fact =>
  • {fact}
  • )}
+
+); diff --git a/client/src/common/components/TlsChoice/TlsDiagram.jsx b/client/src/common/components/TlsChoice/TlsDiagram.jsx new file mode 100644 index 0000000..cc5c556 --- /dev/null +++ b/client/src/common/components/TlsChoice/TlsDiagram.jsx @@ -0,0 +1,52 @@ +const BOX = { width: 92, height: 42, radius: 10 }; +const GAP = 40; +const PAD = 4; +const WIDTH = BOX.width * 3 + GAP * 2 + PAD * 2; +const HEIGHT = BOX.height + PAD * 2; +const MONO = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"; + +const CHAINS = { + acme: [ + { label: "Visitor", port: "https" }, + { label: "frislit", port: ":443", accent: true }, + ], + proxy: [ + { label: "Visitor", port: "https" }, + { label: "nginx", port: ":443" }, + { label: "frislit", port: ":8080", accent: true }, + ], +}; + +export const TlsDiagram = ({ mode }) => { + const chain = CHAINS[mode] || CHAINS.proxy; + const span = chain.length * BOX.width + (chain.length - 1) * GAP; + const left = (WIDTH - span) / 2; + + return ( + + {chain.map((node, index) => { + const x = left + index * (BOX.width + GAP); + return ( + + + {node.label} + {node.port} + + {index < chain.length - 1 && ( + + )} + + ); + })} + + ); +}; diff --git a/client/src/common/components/TlsChoice/index.js b/client/src/common/components/TlsChoice/index.js new file mode 100644 index 0000000..f7deb55 --- /dev/null +++ b/client/src/common/components/TlsChoice/index.js @@ -0,0 +1,2 @@ +export { TlsChoice as default, TlsChoice, TlsExplainer } from "./TlsChoice.jsx"; +export { TLS_MODES } from "./modes.js"; diff --git a/client/src/common/components/TlsChoice/modes.js b/client/src/common/components/TlsChoice/modes.js new file mode 100644 index 0000000..0d6c144 --- /dev/null +++ b/client/src/common/components/TlsChoice/modes.js @@ -0,0 +1,20 @@ +export const TLS_MODES = { + proxy: { + title: "Behind a proxy", + summary: "nginx or Caddy terminates TLS and forwards to frislit.", + facts: [ + "frislit serves plain HTTP on one port and never sees a certificate.", + "Your proxy already holds the wildcard certificate and renews it.", + "Trust the X-Forwarded-* headers so tunnels see the real visitor.", + ], + }, + acme: { + title: "frislit manages it", + summary: "frislit gets certificates from Let's Encrypt and serves HTTPS.", + facts: [ + "Listens on 443 for traffic and on 80 to send visitors to HTTPS.", + "Renews on its own, thirty days before a certificate runs out.", + "Nothing else needs to run in front of it.", + ], + }, +}; diff --git a/client/src/common/components/Toggle/Toggle.jsx b/client/src/common/components/Toggle/Toggle.jsx new file mode 100644 index 0000000..13a8d76 --- /dev/null +++ b/client/src/common/components/Toggle/Toggle.jsx @@ -0,0 +1,13 @@ +import "./styles.sass"; + +export const Toggle = ({ checked, onChange, id, disabled, label }) => { + return ( +
+ {label && } + +
+ ); +}; diff --git a/client/src/common/components/Toggle/index.js b/client/src/common/components/Toggle/index.js new file mode 100644 index 0000000..3631b29 --- /dev/null +++ b/client/src/common/components/Toggle/index.js @@ -0,0 +1 @@ +export { Toggle as default } from "./Toggle.jsx"; diff --git a/client/src/common/components/Toggle/styles.sass b/client/src/common/components/Toggle/styles.sass new file mode 100644 index 0000000..b25071e --- /dev/null +++ b/client/src/common/components/Toggle/styles.sass @@ -0,0 +1,45 @@ +@use "@/common/styles/colors" + +.toggle-row + display: flex + align-items: center + justify-content: space-between + gap: 1rem + + label + color: colors.$subtext + font-size: 0.8125rem + font-weight: 500 + +.toggle + position: relative + width: 2.5rem + height: 1.4rem + flex-shrink: 0 + border: none + border-radius: 999px + background-color: colors.$border-strong + cursor: pointer + padding: 0 + transition: background-color 0.15s ease + + .toggle-knob + position: absolute + top: 0.2rem + left: 0.2rem + width: 1rem + height: 1rem + border-radius: 50% + background-color: colors.$subtext + transition: transform 0.15s ease, background-color 0.15s ease + + &.on + background-color: colors.$primary + + .toggle-knob + transform: translateX(1.1rem) + background-color: colors.$on-primary + + &:disabled + opacity: 0.45 + cursor: not-allowed diff --git a/client/src/common/components/TopNav/TopNav.jsx b/client/src/common/components/TopNav/TopNav.jsx new file mode 100644 index 0000000..522288f --- /dev/null +++ b/client/src/common/components/TopNav/TopNav.jsx @@ -0,0 +1,66 @@ +import "./styles.sass"; +import { useEffect, useRef, useState } from "react"; +import { NavLink, useNavigate } from "react-router-dom"; +import { BookOpen, ChevronDown, LogOut } from "lucide-react"; +import GithubMark from "@/common/components/GithubMark"; +import FrislitLogo from "@/common/components/FrislitLogo"; +import ActionConfirmDialog from "@/common/components/ActionConfirmDialog"; +import { useUser } from "@/common/contexts/user.js"; +import { getNavigation } from "@/common/utils/navigationConfig.js"; +import { DOCS_URL, GITHUB_URL } from "@/App.jsx"; + +export const TopNav = () => { + const { user, logout } = useUser(); + const navigate = useNavigate(); + const [menuOpen, setMenuOpen] = useState(false); + const [logoutOpen, setLogoutOpen] = useState(false); + const menuRef = useRef(null); + + useEffect(() => { + if (!menuOpen) return; + const handleClick = event => { if (!menuRef.current?.contains(event.target)) setMenuOpen(false); }; + document.addEventListener("mousedown", handleClick); + return () => document.removeEventListener("mousedown", handleClick); + }, [menuOpen]); + + return ( +
+ +
+
navigate("/tunnels")}> + + frislit +
+ +
+ + {menuOpen && ( +
+ setMenuOpen(false)}> + Documentation + + setMenuOpen(false)}> + GitHub + +
+ +
+ )} +
+
+
+ ); +}; diff --git a/client/src/common/components/TopNav/index.js b/client/src/common/components/TopNav/index.js new file mode 100644 index 0000000..66da98f --- /dev/null +++ b/client/src/common/components/TopNav/index.js @@ -0,0 +1 @@ +export { TopNav as default } from "./TopNav.jsx"; diff --git a/client/src/common/components/TopNav/styles.sass b/client/src/common/components/TopNav/styles.sass new file mode 100644 index 0000000..61de03f --- /dev/null +++ b/client/src/common/components/TopNav/styles.sass @@ -0,0 +1,161 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.topnav + flex-shrink: 0 + border-bottom: 1px solid colors.$border + background-color: colors.$background + position: sticky + top: 0 + z-index: 40 + +.topnav-inner + max-width: 68rem + margin: 0 auto + height: 3.5rem + padding: 0 2rem + display: flex + align-items: center + gap: 2rem + + @media (max-width: breakpoints.$mobile) + padding: 0 1rem + gap: 1rem + +.topnav-brand + display: flex + align-items: center + gap: 0.5rem + cursor: pointer + user-select: none + flex-shrink: 0 + + span + font-size: 1rem + font-weight: 700 + letter-spacing: -0.02em + + @media (max-width: breakpoints.$mobile) + span + display: none + +.topnav-links + display: flex + align-items: center + gap: 0.25rem + flex: 1 + min-width: 0 + overflow-x: auto + scrollbar-width: none + + &::-webkit-scrollbar + display: none + +.topnav-link + display: flex + align-items: center + gap: 0.45rem + padding: 0.375rem 0.75rem + border-radius: 0.625rem + color: colors.$muted + font-size: 0.875rem + font-weight: 500 + white-space: nowrap + transition: color 0.15s ease, background-color 0.15s ease + + &:hover + color: colors.$text + + &.active + color: colors.$text + background-color: colors.$surface-hover + +.topnav-account + position: relative + flex-shrink: 0 + +.topnav-user + display: flex + align-items: center + gap: 0.5rem + background: none + border: none + border-radius: 0.625rem + padding: 0.3rem 0.5rem 0.3rem 0.3rem + color: colors.$subtext + font-family: inherit + font-size: 0.875rem + font-weight: 500 + cursor: pointer + transition: background-color 0.15s ease, color 0.15s ease + + svg + width: 1rem + height: 1rem + color: colors.$muted + + &:hover, &.open + background-color: colors.$surface-hover + color: colors.$text + + @media (max-width: breakpoints.$mobile) + .topnav-username + display: none + +.topnav-avatar + display: flex + align-items: center + justify-content: center + width: 1.625rem + height: 1.625rem + flex-shrink: 0 + border-radius: 0.5rem + background-color: colors.$primary-tint + color: colors.$primary + font-size: 0.75rem + font-weight: 700 + +.topnav-menu + position: absolute + top: calc(100% + 0.5rem) + right: 0 + min-width: 11rem + background-color: colors.$surface-raised + border: 1px solid colors.$border-strong + border-radius: 0.75rem + padding: 0.25rem + box-shadow: colors.$shadow-lg + z-index: 50 + +.topnav-menu-item + display: flex + align-items: center + gap: 0.625rem + width: 100% + background: none + border: none + border-radius: 0.5rem + padding: 0.5rem 0.625rem + color: colors.$subtext + font-family: inherit + font-size: 0.875rem + font-weight: 500 + text-align: left + cursor: pointer + + svg + width: 1rem + height: 1rem + + &:hover + background-color: colors.$surface-hover + color: colors.$text + + &.danger:hover + background-color: colors.$error-tint + color: colors.$error + +.topnav-menu-divider + height: 1px + background-color: colors.$border + margin: 0.25rem 0 diff --git a/client/src/common/components/UsageSummary/UsageSummary.jsx b/client/src/common/components/UsageSummary/UsageSummary.jsx new file mode 100644 index 0000000..24eae27 --- /dev/null +++ b/client/src/common/components/UsageSummary/UsageSummary.jsx @@ -0,0 +1,19 @@ +import "./styles.sass"; +import { FIELDS } from "@/common/components/QuotaFields"; +import { formatBytes } from "@/common/utils/formatUtils.js"; + +const show = (key, value) => (key === "traffic" ? formatBytes(value) : value); + +export const UsageSummary = ({ usage, limits }) => ( +
    + {FIELDS.map(({ key, label }) => ( +
  • + {label} + + {show(key, usage[key])} + {limits[key] ? ` / ${show(key, limits[key])}` : ""} + +
  • + ))} +
+); diff --git a/client/src/common/components/UsageSummary/index.js b/client/src/common/components/UsageSummary/index.js new file mode 100644 index 0000000..c45079e --- /dev/null +++ b/client/src/common/components/UsageSummary/index.js @@ -0,0 +1 @@ +export { UsageSummary as default } from "./UsageSummary.jsx"; diff --git a/client/src/common/components/UsageSummary/styles.sass b/client/src/common/components/UsageSummary/styles.sass new file mode 100644 index 0000000..d114240 --- /dev/null +++ b/client/src/common/components/UsageSummary/styles.sass @@ -0,0 +1,32 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.usage-summary + display: grid + grid-template-columns: repeat(4, 1fr) + gap: 0.75rem + + li + display: flex + flex-direction: column + gap: 0.125rem + padding: 0.75rem 0.875rem + background-color: colors.$surface-raised + border: 1px solid colors.$border + border-radius: 0.75rem + + @media (max-width: breakpoints.$mobile) + grid-template-columns: 1fr 1fr + +.usage-label + color: colors.$muted + font-size: 0.75rem + +.usage-value + font-size: 1rem + font-weight: 600 + font-variant-numeric: tabular-nums + +.usage-limit + color: colors.$muted + font-weight: 500 diff --git a/client/src/common/contexts/ToastContext.jsx b/client/src/common/contexts/ToastContext.jsx new file mode 100644 index 0000000..bd7c767 --- /dev/null +++ b/client/src/common/contexts/ToastContext.jsx @@ -0,0 +1,43 @@ +import { useCallback, useState } from "react"; +import { ToastContext } from "./toast.js"; +import "@/common/styles/toast.sass"; +import { CircleAlert, CircleCheck, Info, X } from "lucide-react"; + +const ICONS = { + Success: CircleCheck, + Error: CircleAlert, + Info: Info, +}; + +export const ToastProvider = ({ children }) => { + const [toasts, setToasts] = useState([]); + + const removeToast = useCallback(id => setToasts(prev => prev.filter(toast => toast.id !== id)), []); + + const sendToast = useCallback((type, message, duration = 4000) => { + const id = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`; + setToasts(prev => [...prev, { id, type, message }]); + setTimeout(() => removeToast(id), duration); + return id; + }, [removeToast]); + + return ( + + {children} +
+ {toasts.map(toast => { + const Glyph = ICONS[toast.type] || ICONS.Info; + return ( +
+ + {toast.message} + +
+ ); + })} +
+
+ ); +}; diff --git a/client/src/common/contexts/UserContext.jsx b/client/src/common/contexts/UserContext.jsx new file mode 100644 index 0000000..f905bd6 --- /dev/null +++ b/client/src/common/contexts/UserContext.jsx @@ -0,0 +1,45 @@ +import { useCallback, useEffect, useState } from "react"; +import { UserContext } from "./user.js"; +import { getRequest, postRequest } from "@/common/utils/RequestUtil.js"; + +export const UserProvider = ({ children }) => { + const [user, setUser] = useState(null); + const [setupRequired, setSetupRequired] = useState(false); + const [serverInfo, setServerInfo] = useState(null); + const [loaded, setLoaded] = useState(false); + + const checkSetup = useCallback(async () => { + const status = await getRequest("setup/status"); + setSetupRequired(status.setupRequired); + return status; + }, []); + + const login = useCallback(async () => { + try { + setUser(await getRequest("auth/me")); + return true; + } catch { + setUser(null); + return false; + } + }, []); + + const logout = async () => { + try { + await postRequest("auth/logout"); + } catch { /* the session may already be gone */ } + setUser(null); + }; + + useEffect(() => { + Promise.all([checkSetup(), login(), getRequest("info").then(setServerInfo).catch(() => null)]) + .catch(console.error) + .finally(() => setLoaded(true)); + }, [checkSetup, login]); + + return ( + + {children} + + ); +}; diff --git a/client/src/common/contexts/toast.js b/client/src/common/contexts/toast.js new file mode 100644 index 0000000..9679ab8 --- /dev/null +++ b/client/src/common/contexts/toast.js @@ -0,0 +1,5 @@ +import { createContext, useContext } from "react"; + +export const ToastContext = createContext({}); + +export const useToast = () => useContext(ToastContext); diff --git a/client/src/common/contexts/user.js b/client/src/common/contexts/user.js new file mode 100644 index 0000000..1ff8868 --- /dev/null +++ b/client/src/common/contexts/user.js @@ -0,0 +1,5 @@ +import { createContext, useContext } from "react"; + +export const UserContext = createContext({}); + +export const useUser = () => useContext(UserContext); diff --git a/client/src/common/layouts/PublicRoot.jsx b/client/src/common/layouts/PublicRoot.jsx new file mode 100644 index 0000000..37f85df --- /dev/null +++ b/client/src/common/layouts/PublicRoot.jsx @@ -0,0 +1,36 @@ +import { Navigate, Outlet, useLocation } from "react-router-dom"; +import { Suspense } from "react"; +import { UserProvider } from "@/common/contexts/UserContext.jsx"; +import { useUser } from "@/common/contexts/user.js"; +import { ToastProvider } from "@/common/contexts/ToastContext.jsx"; +import Loading from "@/common/components/Loading"; +import { ErrorBoundary } from "@/common/components/ErrorBoundary"; +import PublicShell from "./PublicShell.jsx"; + +const PublicContent = () => { + const { loaded, setupRequired } = useUser(); + const { pathname } = useLocation(); + + if (!loaded) return ; + if (setupRequired && pathname !== "/setup") return ; + + return ( + + }> + + + + ); +}; + +const PublicRoot = () => ( + + + + + + + +); + +export default PublicRoot; diff --git a/client/src/common/layouts/PublicShell.jsx b/client/src/common/layouts/PublicShell.jsx new file mode 100644 index 0000000..30a9b59 --- /dev/null +++ b/client/src/common/layouts/PublicShell.jsx @@ -0,0 +1,26 @@ +import { useState } from "react"; +import { AsideContext } from "./aside.js"; +import FrislitLogo from "@/common/components/FrislitLogo"; +import "./public.sass"; + +export const PublicShell = ({ children }) => { + const [aside, setAside] = useState(null); + + return ( + +
+
+
{children}
+
+ +
+
+ ); +}; + +export default PublicShell; diff --git a/client/src/common/layouts/Root.jsx b/client/src/common/layouts/Root.jsx new file mode 100644 index 0000000..7a4cdc5 --- /dev/null +++ b/client/src/common/layouts/Root.jsx @@ -0,0 +1,42 @@ +import { Navigate, Outlet, useLocation } from "react-router-dom"; +import { Suspense } from "react"; +import { UserProvider } from "@/common/contexts/UserContext.jsx"; +import { useUser } from "@/common/contexts/user.js"; +import { ToastProvider } from "@/common/contexts/ToastContext.jsx"; +import Loading from "@/common/components/Loading"; +import { ErrorBoundary } from "@/common/components/ErrorBoundary"; +import TopNav from "@/common/components/TopNav"; +import Footer from "@/common/components/Footer"; + +const AppContent = () => { + const { loaded, user, setupRequired } = useUser(); + const location = useLocation(); + + if (!loaded) return ; + if (setupRequired) return ; + if (!user) return ; + + return ( +
+ +
+ }> + + +
+
+
+ ); +}; + +const Root = () => ( + + + + + + + +); + +export default Root; diff --git a/client/src/common/layouts/aside.js b/client/src/common/layouts/aside.js new file mode 100644 index 0000000..49de66f --- /dev/null +++ b/client/src/common/layouts/aside.js @@ -0,0 +1,5 @@ +import { createContext, useContext } from "react"; + +export const AsideContext = createContext(null); + +export const usePublicAside = () => useContext(AsideContext) || (() => {}); diff --git a/client/src/common/layouts/public.sass b/client/src/common/layouts/public.sass new file mode 100644 index 0000000..14cf13f --- /dev/null +++ b/client/src/common/layouts/public.sass @@ -0,0 +1,90 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.split + display: grid + grid-template-columns: 1fr 1fr + height: 100vh + + @media (max-width: breakpoints.$tablet) + grid-template-columns: 1fr + +.split-form + display: flex + align-items: center + justify-content: flex-end + overflow-y: auto + padding: 3rem 2rem + + @media (max-width: breakpoints.$tablet) + justify-content: center + + @media (max-width: breakpoints.$mobile) + padding: 2rem 1.25rem + +.split-form-inner + width: 100% + max-width: 23rem + +.split-hero + position: relative + overflow: hidden + display: flex + flex-direction: column + justify-content: flex-end + padding: 3.5rem + + &.filled + justify-content: center + background: radial-gradient(90% 70% at 85% 15%, rgba(20, 184, 166, 0.16), transparent 70%), linear-gradient(200deg, #16211F 0%, #0C0F0F 55%, #000000 100%) + border-left: 1px solid colors.$border + + &::after + content: "" + position: absolute + inset: 0 + background: radial-gradient(60% 50% at 50% 120%, rgba(13, 148, 136, 0.18), transparent 70%) + pointer-events: none + + h2 + position: relative + font-size: 2.75rem + line-height: 1.1 + letter-spacing: -0.04em + color: colors.$text + + @media (max-width: breakpoints.$tablet) + display: none + +.split-hero-logo + position: absolute + top: 3.5rem + left: 3.5rem + opacity: 0.9 + +.form-head + margin-bottom: 1.75rem + + h1 + font-size: 1.875rem + margin-bottom: 0.5rem + + p + margin: 0 + color: colors.$subtext + font-size: 0.875rem + line-height: 1.55 + +.form-body + display: flex + flex-direction: column + gap: 0.875rem + +.form-actions + display: flex + align-items: center + gap: 0.5rem + margin-top: 1.5rem + + .spacer + flex: 1 diff --git a/client/src/common/styles/_breakpoints.sass b/client/src/common/styles/_breakpoints.sass new file mode 100644 index 0000000..252b724 --- /dev/null +++ b/client/src/common/styles/_breakpoints.sass @@ -0,0 +1,2 @@ +$mobile: 768px +$tablet: 1024px diff --git a/client/src/common/styles/_choices.sass b/client/src/common/styles/_choices.sass new file mode 100644 index 0000000..504d6d8 --- /dev/null +++ b/client/src/common/styles/_choices.sass @@ -0,0 +1,128 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.mode-choices + display: grid + grid-template-columns: 1fr 1fr + gap: 0.75rem + + @media (max-width: 30rem) + grid-template-columns: 1fr + +.mode-choice + display: flex + flex-direction: column + align-items: stretch + gap: 0.3rem + padding: 0.875rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + color: colors.$text + font-family: inherit + text-align: left + cursor: pointer + transition: border-color 0.15s ease, background-color 0.15s ease + + &:hover + border-color: colors.$border-strong + + &:disabled + opacity: 0.45 + cursor: not-allowed + + &:hover + border-color: colors.$border + + &.selected + border-color: colors.$primary + background-color: colors.$primary-tint + + .mode-choice-mark + border-color: colors.$primary + background-color: colors.$primary + + &::after + opacity: 1 + + &:focus-visible + outline: 2px solid colors.$primary + outline-offset: 2px + +.mode-choice-title + display: flex + align-items: center + gap: 0.4rem + font-size: 0.9375rem + font-weight: 600 + +.mode-choice-mark + position: relative + width: 0.9375rem + height: 0.9375rem + margin-left: auto + flex-shrink: 0 + border: 1px solid colors.$border-strong + border-radius: 999px + + &::after + content: "" + position: absolute + inset: 0.1875rem + border-radius: 999px + background-color: colors.$on-primary + opacity: 0 + +.mode-choice-summary + color: colors.$subtext + font-size: 0.8125rem + line-height: 1.45 + +.mode-explainer + position: relative + width: 100% + max-width: 26rem + + h3 + margin-top: 1.5rem + font-size: 1.25rem + font-weight: 600 + letter-spacing: -0.025em + + ul + margin-top: 0.625rem + display: flex + flex-direction: column + gap: 0.4rem + + li + position: relative + padding-left: 0.875rem + color: colors.$subtext + font-size: 0.8125rem + line-height: 1.5 + + &::before + content: "" + position: absolute + left: 0 + top: 0.5rem + width: 0.25rem + height: 0.25rem + border-radius: 999px + background-color: colors.$primary + +.mode-diagram + width: 100% + height: auto + +.mode-explainer-inline + display: none + margin-top: 1.25rem + padding: 1rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + + @media (max-width: breakpoints.$tablet) + display: block diff --git a/client/src/common/styles/_colors.sass b/client/src/common/styles/_colors.sass new file mode 100644 index 0000000..c80f277 --- /dev/null +++ b/client/src/common/styles/_colors.sass @@ -0,0 +1,55 @@ +:root + --background: #11100E + --surface: #171613 + --surface-raised: #1C1A17 + --surface-hover: #221F1B + --border: rgba(255, 255, 255, 0.07) + --border-strong: rgba(255, 255, 255, 0.13) + + --primary: #14B8A6 + --primary-deep: #0D9488 + --primary-bright: #2DD4BF + --primary-hover: #5EEAD4 + --primary-tint: rgba(20, 184, 166, 0.14) + --on-primary: #05201C + + --text: #FAFAF9 + --subtext: #A8A29E + --muted: #79716B + + --error: #F87171 + --error-tint: rgba(248, 113, 113, 0.13) + --success: #34D399 + --success-tint: rgba(52, 211, 153, 0.13) + --warning: #FBBF24 + --warning-tint: rgba(251, 191, 36, 0.13) + + --chart-in: #0D9488 + --chart-out: #D97706 + + --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4) + --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5) + +$background: var(--background) +$surface: var(--surface) +$surface-raised: var(--surface-raised) +$surface-hover: var(--surface-hover) +$border: var(--border) +$border-strong: var(--border-strong) +$primary: var(--primary) +$primary-deep: var(--primary-deep) +$primary-bright: var(--primary-bright) +$primary-hover: var(--primary-hover) +$primary-tint: var(--primary-tint) +$on-primary: var(--on-primary) +$text: var(--text) +$subtext: var(--subtext) +$muted: var(--muted) +$error: var(--error) +$error-tint: var(--error-tint) +$success: var(--success) +$success-tint: var(--success-tint) +$warning: var(--warning) +$warning-tint: var(--warning-tint) +$shadow-md: var(--shadow-md) +$shadow-lg: var(--shadow-lg) diff --git a/client/src/common/styles/main.sass b/client/src/common/styles/main.sass new file mode 100644 index 0000000..f5aa045 --- /dev/null +++ b/client/src/common/styles/main.sass @@ -0,0 +1,93 @@ +@use "colors" +@use "breakpoints" +@use "choices" + +* + box-sizing: border-box + +ul, ol + margin: 0 + padding: 0 + list-style: none + +body, html + margin: 0 + height: 100% + background-color: colors.$background + color: colors.$text + font-family: "Plus Jakarta Sans", sans-serif + font-weight: 500 + -webkit-font-smoothing: antialiased + +h1, h2, h3 + letter-spacing: -0.025em + font-weight: 600 + margin: 0 + +a + color: inherit + text-decoration: none + +code, pre + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + +.app-wrapper + display: flex + flex-direction: column + height: 100vh + overflow: hidden + +.main-content + flex: 1 + overflow-y: auto + min-height: 0 + transition: padding-right 0.18s ease + + @media (min-width: 90rem) + body.panel-open & + padding-right: 40rem + +.page + max-width: 68rem + margin: 0 auto + padding: 2.5rem 2rem 4rem + + @media (max-width: breakpoints.$mobile) + padding: 1.5rem 1rem 3rem + +.page-title + display: flex + align-items: flex-end + justify-content: space-between + gap: 1rem + margin-bottom: 1.75rem + + h1 + font-size: 1.875rem + + .page-title-meta + color: colors.$muted + font-size: 0.8125rem + font-weight: 500 + + .page-title-side + display: flex + align-items: center + gap: 0.875rem + +::-webkit-scrollbar + width: 10px + +::-webkit-scrollbar-track + background: transparent + +::-webkit-scrollbar-thumb + background: colors.$border-strong + border-radius: 10px + + &:hover + background: colors.$subtext + +.wordmark em + font-style: normal + color: colors.$primary diff --git a/client/src/common/styles/toast.sass b/client/src/common/styles/toast.sass new file mode 100644 index 0000000..cf11569 --- /dev/null +++ b/client/src/common/styles/toast.sass @@ -0,0 +1,59 @@ +@use "colors" + +.toast-container + position: fixed + bottom: 1.5rem + left: 50% + transform: translateX(-50%) + display: flex + flex-direction: column-reverse + gap: 0.5rem + z-index: 200 + pointer-events: none + width: min(24rem, calc(100% - 2rem)) + +.toast + display: flex + align-items: center + gap: 0.625rem + background-color: colors.$surface-raised + border: 1px solid colors.$border-strong + border-radius: 0.75rem + padding: 0.625rem 0.875rem + box-shadow: colors.$shadow-lg + pointer-events: all + animation: toast-in 0.18s ease + + svg + width: 1.0625rem + height: 1.0625rem + flex-shrink: 0 + color: colors.$primary + + span + flex: 1 + min-width: 0 + font-size: 0.875rem + font-weight: 500 + + button + display: flex + background: none + border: none + padding: 0 + color: colors.$muted + cursor: pointer + + &:hover + color: colors.$text + + &[data-type="Error"] svg + color: colors.$error + + &[data-type="Success"] svg + color: colors.$success + +@keyframes toast-in + from + opacity: 0 + transform: translateY(0.5rem) diff --git a/client/src/common/utils/RequestUtil.js b/client/src/common/utils/RequestUtil.js new file mode 100644 index 0000000..6a39cc9 --- /dev/null +++ b/client/src/common/utils/RequestUtil.js @@ -0,0 +1,24 @@ +const API_BASE = "/@frislit/api/"; + +export const request = async (url, method, body, headers) => { + url = url.startsWith("/") ? url.substring(1) : url; + + const response = await fetch(`${API_BASE}${url}`, { + method: method, + headers: { ...headers, "Content-Type": "application/json" }, + body: body ? JSON.stringify(body) : undefined, + credentials: "same-origin", + }); + + const rawData = await response.text(); + const data = rawData ? JSON.parse(rawData) : {}; + + if (!response.ok) throw Object.assign(new Error(data.message || data.error || `Request failed (${response.status})`), { code: response.status, ...data }); + + return data; +}; + +export const getRequest = url => request(url, "GET"); +export const postRequest = (url, body) => request(url, "POST", body); +export const putRequest = (url, body) => request(url, "PUT", body); +export const deleteRequest = url => request(url, "DELETE"); diff --git a/client/src/common/utils/autofill.js b/client/src/common/utils/autofill.js new file mode 100644 index 0000000..4623a79 --- /dev/null +++ b/client/src/common/utils/autofill.js @@ -0,0 +1,34 @@ +import { useEffect, useRef } from "react"; + +const AUTOFILL_ANIMATION = "field-autofill"; + +export const formValues = form => Object.fromEntries(new FormData(form).entries()); + +export const useAutofill = (formRef, apply) => { + const latest = useRef(apply); + useEffect(() => { latest.current = apply; }); + + useEffect(() => { + const form = formRef.current; + if (!form) return; + + const sync = () => { + const filled = {}; + for (const element of form.elements) if (element.name && element.value) filled[element.name] = element.value; + if (Object.keys(filled).length) latest.current(filled); + }; + + const onAnimation = event => { + if (event.animationName === AUTOFILL_ANIMATION) sync(); + }; + + sync(); + const timer = setTimeout(sync, 250); + form.addEventListener("animationstart", onAnimation, true); + + return () => { + clearTimeout(timer); + form.removeEventListener("animationstart", onAnimation, true); + }; + }, [formRef]); +}; diff --git a/client/src/common/utils/clipboard.js b/client/src/common/utils/clipboard.js new file mode 100644 index 0000000..fd8e651 --- /dev/null +++ b/client/src/common/utils/clipboard.js @@ -0,0 +1,16 @@ +export const copyToClipboard = async text => { + try { + await navigator.clipboard.writeText(text); + return true; + } catch { + const area = document.createElement("textarea"); + area.value = text; + area.style.position = "fixed"; + area.style.opacity = "0"; + document.body.appendChild(area); + area.select(); + const ok = document.execCommand("copy"); + document.body.removeChild(area); + return ok; + } +}; diff --git a/client/src/common/utils/country.js b/client/src/common/utils/country.js new file mode 100644 index 0000000..c2de8c5 --- /dev/null +++ b/client/src/common/utils/country.js @@ -0,0 +1,15 @@ +const names = new Intl.DisplayNames(["en"], { type: "region" }); +const flags = import.meta.glob("/node_modules/flag-icons/flags/4x3/*.svg", { eager: true, import: "default", query: "?url" }); + +export const countryName = code => { + try { + return names.of(code); + } catch { + return code; + } +}; + +export const countryCodes = Object.keys(flags) + .map(path => path.slice(path.lastIndexOf("/") + 1, -4).toUpperCase()) + .filter(code => /^[A-Z]{2}$/.test(code) && countryName(code) !== code) + .sort((a, b) => countryName(a).localeCompare(countryName(b))); diff --git a/client/src/common/utils/formatUtils.js b/client/src/common/utils/formatUtils.js new file mode 100644 index 0000000..ac94a28 --- /dev/null +++ b/client/src/common/utils/formatUtils.js @@ -0,0 +1,34 @@ +const toMillis = value => (typeof value === "string" ? Date.parse(value) : value); + +export const formatRelative = timestamp => { + const seconds = Math.round((Date.now() - toMillis(timestamp)) / 1000); + if (!Number.isFinite(seconds)) return "unknown"; + if (seconds < 5) return "just now"; + if (seconds < 60) return `${seconds}s ago`; + const minutes = Math.round(seconds / 60); + if (minutes < 60) return `${minutes}m ago`; + const hours = Math.round(minutes / 60); + if (hours < 24) return `${hours}h ago`; + return `${Math.round(hours / 24)}d ago`; +}; + +export const formatCountdown = (until, now = Date.now()) => { + const seconds = Math.max(0, Math.ceil((until - now) / 1000)); + if (seconds < 60) return `${seconds}s`; + return `${Math.floor(seconds / 60)}m ${seconds % 60}s`; +}; + +const UNITS = ["B", "kB", "MB", "GB", "TB"]; + +export const formatBytes = bytes => { + let value = Number(bytes) || 0; + let unit = 0; + while (value >= 1000 && unit < UNITS.length - 1) { + value /= 1000; + unit += 1; + } + const rounded = unit === 0 ? Math.round(value) : value.toFixed(value < 10 ? 1 : 0); + return `${rounded} ${UNITS[unit]}`; +}; + +export const formatRate = bytesPerSecond => `${formatBytes(bytesPerSecond)}/s`; diff --git a/client/src/common/utils/navigationConfig.js b/client/src/common/utils/navigationConfig.js new file mode 100644 index 0000000..df2a471 --- /dev/null +++ b/client/src/common/utils/navigationConfig.js @@ -0,0 +1,6 @@ +import { Settings, Waypoints } from "lucide-react"; + +export const getNavigation = () => [ + { title: "Tunnels", key: "tunnels", path: "/tunnels", icon: Waypoints }, + { title: "Settings", key: "settings", path: "/settings", icon: Settings }, +]; diff --git a/client/src/common/utils/platform.js b/client/src/common/utils/platform.js new file mode 100644 index 0000000..cc2c016 --- /dev/null +++ b/client/src/common/utils/platform.js @@ -0,0 +1,77 @@ +const REPOSITORY = "https://git.fristy.net/fristy/frislit"; + +const PLATFORMS = { Windows: "windows", macOS: "macos", Linux: "linux" }; + +const appleSilicon = () => { + try { + const gl = document.createElement("canvas").getContext("webgl"); + const debug = gl?.getExtension("WEBGL_debug_renderer_info"); + const renderer = debug ? String(gl.getParameter(debug.UNMASKED_RENDERER_WEBGL)) : ""; + return /apple\s*m\d|apple gpu/i.test(renderer); + } catch { + return false; + } +}; + +const fromUserAgent = () => { + const agent = navigator.userAgent; + const os = /Windows/i.test(agent) ? "windows" + : /Mac OS X|Macintosh/i.test(agent) ? "macos" + : /Linux|X11/i.test(agent) ? "linux" : null; + + if (os === "macos") return { os, arch: appleSilicon() ? "arm64" : null }; + if (/arm64|aarch64/i.test(agent)) return { os, arch: "arm64" }; + if (/x86_64|x86-64|Win64|WOW64|x64/i.test(agent)) return { os, arch: "x64" }; + return { os, arch: null }; +}; + +export const detectPlatform = async () => { + const hints = navigator.userAgentData; + if (hints?.getHighEntropyValues) { + try { + const high = await hints.getHighEntropyValues(["architecture", "bitness", "platform"]); + const os = PLATFORMS[high.platform] || null; + const arch = high.architecture === "arm" && high.bitness === "64" ? "arm64" + : high.architecture === "x86" && high.bitness === "64" ? "x64" : null; + if (os) return { os, arch: arch || fromUserAgent().arch }; + } catch { + return fromUserAgent(); + } + } + return fromUserAgent(); +}; + +export const installCommand = os => (os === "windows" ? "irm https://git.fristy.net/fristy/frislit/raw/branch/main/packaging/install/install.ps1 | iex" : "curl -fsSL https://git.fristy.net/fristy/frislit/raw/branch/main/packaging/install/install | sh"); + +export const releasesUrl = version => (version ? `${REPOSITORY}/releases/tag/v${version}` : `${REPOSITORY}/releases/latest`); + +export const downloadsFor = ({ os, arch }, version) => { + const all = releasesUrl(version); + if (!os) return { version, all, files: [] }; + + const base = version ? `${REPOSITORY}/releases/download/v${version}` : `${REPOSITORY}/releases/latest/download`; + const file = (name, label) => ({ url: `${base}/${name}`, label }); + + if (os === "windows") { + const suffix = arch === "arm64" ? "arm64" : "x64"; + return { version, all, files: [ + file(`frislit-${suffix}.msi`, "Windows installer"), + file(`frislit-windows-${suffix}.exe`, "Plain frislit.exe"), + ] }; + } + + if (os === "macos") { + const silicon = file("frislit-macos-arm64", "macOS, Apple Silicon"); + const intel = file("frislit-macos-x64", "macOS, Intel"); + return { version, all, files: arch === "x64" ? [intel, silicon] : [silicon, intel] }; + } + + const onArm = arch === "arm64"; + const plain = onArm ? "frislit-linux-arm64" : "frislit-linux-x64"; + return { version, all, files: [ + file(`frislit-cli-${onArm ? "arm64" : "amd64"}.deb`, "Debian, Ubuntu"), + file(`frislit-cli-${onArm ? "aarch64" : "x86_64"}.rpm`, "Fedora, RHEL"), + file(plain, "Plain binary"), + file(`${plain}-static`, "Static binary, any distro"), + ] }; +}; diff --git a/client/src/common/utils/tunnelTab.js b/client/src/common/utils/tunnelTab.js new file mode 100644 index 0000000..4c74a79 --- /dev/null +++ b/client/src/common/utils/tunnelTab.js @@ -0,0 +1,43 @@ +const STORAGE_KEY = "frislit-tunnel"; +const SW_PATH = "/@frislit/sw.js"; + +export const readTab = () => { + try { + return sessionStorage.getItem(STORAGE_KEY); + } catch { + return null; + } +}; + +export const rememberTab = tunnel => { + try { + sessionStorage.setItem(STORAGE_KEY, tunnel); + } catch { /* private mode: the worker binding below still carries this tab */ } +}; + +export const bindTab = tunnel => new Promise((resolve, reject) => { + if (!navigator.serviceWorker || !window.isSecureContext) return reject(new Error("service workers unavailable")); + + const onMessage = event => { + if (event.data?.type !== "frislit-bound") return; + navigator.serviceWorker.removeEventListener("message", onMessage); + resolve(); + }; + navigator.serviceWorker.addEventListener("message", onMessage); + + navigator.serviceWorker.register(SW_PATH, { scope: "/" }) + .then(() => navigator.serviceWorker.ready) + .then(registration => { + const worker = navigator.serviceWorker.controller || registration.active; + if (!worker) return resolve(); + worker.postMessage({ type: "frislit-bind", tunnel }); + }) + .catch(reject); +}); + +export const resetWorkers = async () => { + try { + const registrations = await navigator.serviceWorker?.getRegistrations() || []; + await Promise.all(registrations.map(registration => registration.unregister())); + } catch { /* nothing registered, or the API is unavailable */ } +}; diff --git a/client/src/common/utils/webauthn.js b/client/src/common/utils/webauthn.js new file mode 100644 index 0000000..cadb73e --- /dev/null +++ b/client/src/common/utils/webauthn.js @@ -0,0 +1,20 @@ +import { startAuthentication, startRegistration } from "@simplewebauthn/browser"; +import { deleteRequest, getRequest, postRequest } from "@/common/utils/RequestUtil.js"; + +export const passkeysSupported = () => typeof window !== "undefined" && !!window.PublicKeyCredential; + +export const listPasskeys = async () => (await getRequest("auth/passkeys")).passkeys; + +export const addPasskey = async name => { + const options = await postRequest("auth/passkeys/options"); + const response = await startRegistration({ optionsJSON: options }); + return postRequest("auth/passkeys", { response, name }); +}; + +export const removePasskey = id => deleteRequest(`auth/passkeys/${id}`); + +export const signInWithPasskey = async username => { + const options = await postRequest("auth/passkey/options", { username }); + const response = await startAuthentication({ optionsJSON: options }); + return postRequest("auth/passkey/verify", { response }); +}; diff --git a/client/src/main.jsx b/client/src/main.jsx new file mode 100644 index 0000000..b72cb87 --- /dev/null +++ b/client/src/main.jsx @@ -0,0 +1,9 @@ +import { StrictMode } from "react"; +import { createRoot } from "react-dom/client"; +import App from "@/App.jsx"; + +createRoot(document.getElementById("root")).render( + + + , +); diff --git a/client/src/pages/Connect/Connect.jsx b/client/src/pages/Connect/Connect.jsx new file mode 100644 index 0000000..9f35bdd --- /dev/null +++ b/client/src/pages/Connect/Connect.jsx @@ -0,0 +1,30 @@ +import "./styles.sass"; +import { useParams } from "react-router-dom"; +import CopyField from "@/common/components/CopyField"; +import OpenInFrislit from "@/common/components/OpenInFrislit"; + +export const Connect = () => { + const { code } = useParams(); + const command = `frislit connect ${window.location.origin}/@frislit/connect/${code}`; + + return ( +
+
+

Connect to this port.

+

The port appears on your own machine, as if it were running there.

+
+ + + +
+ or run + +
+ +

+ No frislit yet? Install it in one line. + You do not need an account to connect. +

+
+ ); +}; diff --git a/client/src/pages/Connect/index.js b/client/src/pages/Connect/index.js new file mode 100644 index 0000000..2362ddc --- /dev/null +++ b/client/src/pages/Connect/index.js @@ -0,0 +1 @@ +export { Connect as default } from "./Connect.jsx"; diff --git a/client/src/pages/Connect/styles.sass b/client/src/pages/Connect/styles.sass new file mode 100644 index 0000000..1e91124 --- /dev/null +++ b/client/src/pages/Connect/styles.sass @@ -0,0 +1,37 @@ +@use "@/common/styles/colors" + +.connect-page + width: 100% + + .copy-field + align-items: flex-start + + code + overflow: visible + text-overflow: clip + white-space: pre-wrap + word-break: break-all + line-height: 1.5 + +.connect-hint + margin-top: 1rem + color: colors.$muted + font-size: 0.8125rem + line-height: 1.55 + + a + color: colors.$primary-bright + text-decoration: none + + &:hover + text-decoration: underline + +.connect-command + display: flex + flex-direction: column + gap: 0.375rem + margin-top: 1.25rem + + > span + color: colors.$muted + font-size: 0.75rem diff --git a/client/src/pages/Gate/Gate.jsx b/client/src/pages/Gate/Gate.jsx new file mode 100644 index 0000000..a454af2 --- /dev/null +++ b/client/src/pages/Gate/Gate.jsx @@ -0,0 +1,59 @@ +import "./styles.sass"; +import { useEffect, useRef, useState } from "react"; +import Input from "@/common/components/Input"; +import Button from "@/common/components/Button"; +import Loading from "@/common/components/Loading"; +import { postRequest } from "@/common/utils/RequestUtil.js"; +import { formValues, useAutofill } from "@/common/utils/autofill.js"; + +const PasswordGate = ({ id }) => { + const [password, setPassword] = useState(""); + const [error, setError] = useState(null); + const [busy, setBusy] = useState(false); + const formRef = useRef(null); + + useAutofill(formRef, filled => { + if (filled["gate-password"]) setPassword(current => current || filled["gate-password"]); + }); + + const submit = async event => { + event.preventDefault(); + const secret = formValues(event.currentTarget)["gate-password"] || password; + setPassword(secret); + setBusy(true); + setError(null); + try { + await postRequest(`gate/${encodeURIComponent(id)}`, { password: secret }); + window.location.reload(); + } catch (failure) { + setError(failure.message || "That did not work"); + setBusy(false); + } + }; + + return ( +
+
+

Protected tunnel.

+

Enter the password for {id}.

+
+
+ + {error &&

{error}

} +
+
+
+
+ + ); +}; + +export const Gate = ({ id, auth, authorize }) => { + useEffect(() => { + if (auth === "frislit") window.location.replace(`${authorize}?return=${encodeURIComponent(window.location.href)}`); + }, [auth, authorize]); + + return auth === "frislit" ? : ; +}; diff --git a/client/src/pages/Gate/index.js b/client/src/pages/Gate/index.js new file mode 100644 index 0000000..b9ea9d0 --- /dev/null +++ b/client/src/pages/Gate/index.js @@ -0,0 +1 @@ +export { Gate as default } from "./Gate.jsx"; diff --git a/client/src/pages/Gate/styles.sass b/client/src/pages/Gate/styles.sass new file mode 100644 index 0000000..8498d86 --- /dev/null +++ b/client/src/pages/Gate/styles.sass @@ -0,0 +1,14 @@ +@use "@/common/styles/colors" + +.gate + width: 100% + + code + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.85em + color: colors.$primary-bright + +.gate-error + color: colors.$error + font-size: 0.8125rem + margin-top: 0.5rem diff --git a/client/src/pages/Handoff/Handoff.jsx b/client/src/pages/Handoff/Handoff.jsx new file mode 100644 index 0000000..0039397 --- /dev/null +++ b/client/src/pages/Handoff/Handoff.jsx @@ -0,0 +1,122 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import { useNavigate, useSearchParams } from "react-router-dom"; +import Input from "@/common/components/Input"; +import Button from "@/common/components/Button"; +import Loading from "@/common/components/Loading"; +import { getRequest, postRequest } from "@/common/utils/RequestUtil.js"; +import { useUser } from "@/common/contexts/user.js"; + +export const Handoff = () => { + const [params] = useSearchParams(); + const navigate = useNavigate(); + const { user, loaded } = useUser(); + const code = (params.get("code") || "").toUpperCase(); + + const [request, setRequest] = useState(null); + const [name, setName] = useState(""); + const [error, setError] = useState(null); + const [done, setDone] = useState(null); + const [busy, setBusy] = useState(false); + + const load = useCallback(async () => { + if (!code) return setError("This link has no code in it."); + try { + const data = await getRequest(`devices/pending/${encodeURIComponent(code)}`); + setRequest(data.request); + setName(previous => previous || data.request.client || ""); + } catch (failure) { + if (failure.code !== 401) setError(failure.message); + } + }, [code]); + + useEffect(() => { + if (loaded && user) load(); + }, [loaded, user, load]); + + if (!loaded) return ; + + if (!user) { + return ( +
+
+

Sign in first.

+

Approving a device needs your frislit account.

+
+
+
+
+
+ ); + } + + if (done) { + return ( +
+
+

{done === "approved" ? "Device linked." : "Request denied."}

+

{done === "approved" + ? "The CLI has its token and is ready to create tunnels." + : "Nothing was handed out. You can close this page."}

+
+
+
+
+
+ ); + } + + if (error) { + return ( +
+
+

That code is gone.

+

{error} Run frislit login again to get a new one.

+
+
+ ); + } + + if (!request) return ; + + const act = async action => { + setBusy(true); + try { + await postRequest(`devices/pending/${encodeURIComponent(code)}/${action}`, action === "approve" ? { name } : {}); + setDone(action === "approve" ? "approved" : "denied"); + } catch (failure) { + setError(failure.message); + } finally { + setBusy(false); + } + }; + + return ( +
+
+

Link this device?

+

A frislit CLI is asking to create tunnels on this server.

+
+ +
+
Code
{request.code}
+
From
{request.ip || "unknown"}
+
Client
{request.userAgent || request.client}
+
+ +
+ +
+ +
+
+
+ ); +}; diff --git a/client/src/pages/Handoff/index.js b/client/src/pages/Handoff/index.js new file mode 100644 index 0000000..a185590 --- /dev/null +++ b/client/src/pages/Handoff/index.js @@ -0,0 +1 @@ +export { Handoff as default } from "./Handoff.jsx"; diff --git a/client/src/pages/Handoff/styles.sass b/client/src/pages/Handoff/styles.sass new file mode 100644 index 0000000..12d994b --- /dev/null +++ b/client/src/pages/Handoff/styles.sass @@ -0,0 +1,42 @@ +@use "@/common/styles/colors" + +.handoff + width: 100% + + code + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.85em + color: colors.$primary-bright + +.handoff-facts + display: flex + flex-direction: column + gap: 0.4rem + margin: 1rem 0 + padding: 0.875rem 1rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + + > div + display: flex + align-items: baseline + gap: 0.75rem + + dt + flex-shrink: 0 + width: 3.5rem + color: colors.$muted + font-size: 0.75rem + + dd + margin: 0 + color: colors.$subtext + font-size: 0.8125rem + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + + .mono + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + color: colors.$text diff --git a/client/src/pages/Invite/Invite.jsx b/client/src/pages/Invite/Invite.jsx new file mode 100644 index 0000000..56bf8bf --- /dev/null +++ b/client/src/pages/Invite/Invite.jsx @@ -0,0 +1,31 @@ +import "@/pages/Connect/styles.sass"; +import { useParams } from "react-router-dom"; +import CopyField from "@/common/components/CopyField"; +import OpenInFrislit from "@/common/components/OpenInFrislit"; + +export const Invite = () => { + const { token } = useParams(); + const origin = window.location.origin; + const link = `${origin}/@frislit/invite/${token}`; + + return ( +
+
+

Tunnel through this server.

+

This link lets you open tunnels here without an account. Keep it to yourself.

+
+ + + +
+ or run + +
+ +

+ No frislit yet? Install it in one line. + Afterwards frislit http 3000 works as usual. +

+
+ ); +}; diff --git a/client/src/pages/Invite/index.js b/client/src/pages/Invite/index.js new file mode 100644 index 0000000..6549dad --- /dev/null +++ b/client/src/pages/Invite/index.js @@ -0,0 +1 @@ +export { Invite as default } from "./Invite.jsx"; diff --git a/client/src/pages/Login/Login.jsx b/client/src/pages/Login/Login.jsx new file mode 100644 index 0000000..490ba89 --- /dev/null +++ b/client/src/pages/Login/Login.jsx @@ -0,0 +1,147 @@ +import "./styles.sass"; +import { useEffect, useRef, useState } from "react"; +import { Navigate, useLocation, useNavigate, useSearchParams } from "react-router-dom"; +import { Fingerprint } from "lucide-react"; +import Input from "@/common/components/Input"; +import Button from "@/common/components/Button"; +import { getRequest, postRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { useUser } from "@/common/contexts/user.js"; +import { passkeysSupported, signInWithPasskey } from "@/common/utils/webauthn.js"; +import { formValues, useAutofill } from "@/common/utils/autofill.js"; + +export const Login = () => { + const { sendToast } = useToast(); + const { user, setupRequired, login } = useUser(); + const navigate = useNavigate(); + const location = useLocation(); + const [params] = useSearchParams(); + const [username, setUsername] = useState(""); + const [password, setPassword] = useState(""); + const [code, setCode] = useState(""); + const [needsCode, setNeedsCode] = useState(false); + const [providers, setProviders] = useState([]); + const [loading, setLoading] = useState(false); + const formRef = useRef(null); + const requested = params.get("next"); + const next = /^\/@frislit\/[^/\\]/.test(requested) ? requested : null; + + useAutofill(formRef, filled => { + if (filled.username) setUsername(current => current || filled.username); + if (filled.password) setPassword(current => current || filled.password); + }); + + useEffect(() => { + getRequest("auth/providers").then(data => setProviders(data.providers)).catch(() => setProviders([])); + }, []); + + useEffect(() => { + const error = params.get("error"); + if (error) sendToast("Error", error); + }, [params, sendToast]); + + useEffect(() => { + if (user && next) window.location.replace(next); + }, [user, next]); + + if (setupRequired) return ; + if (user && !next) return ; + + const done = async () => { + if (next) return window.location.replace(next); + await login(); + navigate(location.state?.from || "/tunnels", { replace: true }); + }; + + const submit = async event => { + event.preventDefault(); + const filled = formValues(event.currentTarget); + const identity = filled.username || username; + const secret = filled.password || password; + setUsername(identity); + setPassword(secret); + setLoading(true); + try { + const result = await postRequest("auth/login", { + username: identity, password: secret, + code: needsCode ? (filled.code || code) : undefined, + }); + if (result.totpRequired) { + setNeedsCode(true); + setCode(""); + return; + } + await done(); + } catch (error) { + sendToast("Error", error.message); + } finally { + setLoading(false); + } + }; + + const withPasskey = async () => { + setLoading(true); + try { + await signInWithPasskey(username || undefined); + await done(); + } catch (error) { + if (error.name !== "NotAllowedError") sendToast("Error", error.message); + } finally { + setLoading(false); + } + }; + + const withProvider = async provider => { + try { + const { url } = await postRequest(`auth/oidc/${provider.id}/start`, { next }); + window.location.assign(url); + } catch (error) { + sendToast("Error", error.message); + } + }; + + return ( +
+
+

{needsCode ? "One more step." : "Welcome back."}

+ {needsCode &&

Enter the code from your authenticator app.

} +
+ +
+ {needsCode ? ( + + ) : ( + <> + + + + )} +
+ +
+ {needsCode + ?
+ + {!needsCode && (passkeysSupported() || providers.length > 0) && ( +
+ or + {passkeysSupported() && ( +
+ )} +
+ ); +}; diff --git a/client/src/pages/Login/index.js b/client/src/pages/Login/index.js new file mode 100644 index 0000000..f9b6f51 --- /dev/null +++ b/client/src/pages/Login/index.js @@ -0,0 +1 @@ +export { Login as default } from "./Login.jsx"; diff --git a/client/src/pages/Login/styles.sass b/client/src/pages/Login/styles.sass new file mode 100644 index 0000000..49d0cb6 --- /dev/null +++ b/client/src/pages/Login/styles.sass @@ -0,0 +1,27 @@ +@use "@/common/styles/colors" + +.login + width: 100% + +.login-alternatives + display: flex + flex-direction: column + gap: 0.5rem + margin-top: 1.5rem + + .btn + width: 100% + +.login-divider + display: flex + align-items: center + gap: 0.75rem + margin-bottom: 0.25rem + color: colors.$muted + font-size: 0.75rem + + &::before, &::after + content: "" + flex: 1 + height: 1px + background-color: colors.$border diff --git a/client/src/pages/Select/Select.jsx b/client/src/pages/Select/Select.jsx new file mode 100644 index 0000000..708979a --- /dev/null +++ b/client/src/pages/Select/Select.jsx @@ -0,0 +1,39 @@ +import "./styles.sass"; +import { useState } from "react"; +import { useNavigate } from "react-router-dom"; +import Input from "@/common/components/Input"; +import Button from "@/common/components/Button"; +import { useUser } from "@/common/contexts/user.js"; +import { resetWorkers } from "@/common/utils/tunnelTab.js"; + +export const Select = () => { + const { user } = useUser(); + const navigate = useNavigate(); + const [id, setId] = useState(""); + + const open = async event => { + event.preventDefault(); + const name = id.trim().toLowerCase().replace(/^@/, ""); + if (!name) return; + await resetWorkers(); + window.location.href = `/@${encodeURIComponent(name)}`; + }; + + return ( +
+
+

No tunnel selected.

+

Enter a tunnel id to open it in this browser.

+
+
+ +
+
+
+
+ ); +}; diff --git a/client/src/pages/Select/index.js b/client/src/pages/Select/index.js new file mode 100644 index 0000000..30bad46 --- /dev/null +++ b/client/src/pages/Select/index.js @@ -0,0 +1 @@ +export { Select as default } from "./Select.jsx"; diff --git a/client/src/pages/Select/styles.sass b/client/src/pages/Select/styles.sass new file mode 100644 index 0000000..df8e1cc --- /dev/null +++ b/client/src/pages/Select/styles.sass @@ -0,0 +1,2 @@ +.select-page + width: 100% diff --git a/client/src/pages/Settings/Settings.jsx b/client/src/pages/Settings/Settings.jsx new file mode 100644 index 0000000..5f05943 --- /dev/null +++ b/client/src/pages/Settings/Settings.jsx @@ -0,0 +1,48 @@ +import "./styles.sass"; +import { Suspense } from "react"; +import { Navigate, NavLink, Outlet, useLocation } from "react-router-dom"; +import { KeyRound, Laptop, Lock, Server, UserRound, Users, Waypoints } from "lucide-react"; +import Loading from "@/common/components/Loading"; +import { useUser } from "@/common/contexts/user.js"; + +const TABS = [ + { to: "server", label: "Server", icon: Server, adminOnly: true }, + { to: "forwarding", label: "Forwarding", icon: Waypoints, adminOnly: true }, + { to: "https", label: "HTTPS", icon: Lock, adminOnly: true }, + { to: "accounts", label: "Accounts", icon: Users, adminOnly: true }, + { to: "providers", label: "Providers", icon: KeyRound, adminOnly: true }, + { to: "devices", label: "Devices", icon: Laptop }, + { to: "account", label: "Account", icon: UserRound }, +]; + +export const Settings = () => { + const { user } = useUser(); + const { pathname } = useLocation(); + const tabs = TABS.filter(tab => !tab.adminOnly || user?.role === "admin"); + + if (pathname.replace(/\/$/, "").endsWith("/settings")) return ; + + return ( +
+
+

Settings

+
+ +
+ +
+ }> + + +
+
+
+ ); +}; diff --git a/client/src/pages/Settings/index.js b/client/src/pages/Settings/index.js new file mode 100644 index 0000000..3a2593e --- /dev/null +++ b/client/src/pages/Settings/index.js @@ -0,0 +1 @@ +export { Settings as default } from "./Settings.jsx"; diff --git a/client/src/pages/Settings/pages/Account/Account.jsx b/client/src/pages/Settings/pages/Account/Account.jsx new file mode 100644 index 0000000..07bd482 --- /dev/null +++ b/client/src/pages/Settings/pages/Account/Account.jsx @@ -0,0 +1,98 @@ +import { useEffect, useRef, useState } from "react"; +import Button from "@/common/components/Button"; +import Input from "@/common/components/Input"; +import UsageSummary from "@/common/components/UsageSummary"; +import { getRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { useUser } from "@/common/contexts/user.js"; +import { formValues, useAutofill } from "@/common/utils/autofill.js"; +import TwoFactor from "./components/TwoFactor"; +import Passkeys from "./components/Passkeys"; + +export const Account = () => { + const { sendToast } = useToast(); + const { setUser } = useUser(); + const [currentPassword, setCurrentPassword] = useState(""); + const [newPassword, setNewPassword] = useState(""); + const [confirm, setConfirm] = useState(""); + const [saving, setSaving] = useState(false); + const [quotas, setQuotas] = useState(null); + const formRef = useRef(null); + + useEffect(() => { + getRequest("quotas").then(setQuotas).catch(() => null); + }, []); + + useAutofill(formRef, filled => { + if (filled["current-password"]) setCurrentPassword(current => current || filled["current-password"]); + }); + + const submit = async event => { + event.preventDefault(); + const filled = formValues(event.currentTarget); + const current = filled["current-password"] || currentPassword; + const next = filled["new-password"] || newPassword; + setCurrentPassword(current); + setNewPassword(next); + if (next.length < 8) return sendToast("Error", "Password must be at least 8 characters"); + if (next !== (filled["confirm-password"] || confirm)) return sendToast("Error", "Passwords do not match"); + setSaving(true); + try { + await putRequest("settings/password", { currentPassword: current, newPassword: next }); + sendToast("Success", "Password changed"); + setUser(null); + } catch (error) { + sendToast("Error", error.message); + } finally { + setSaving(false); + } + }; + + return ( + <> + {quotas && ( +
+
+

Usage

+
+ +
+ )} +
+
+

Change password

+
+
+ +
+ + +
+
+
+
+
+ + +
+
+

Two-factor

+

A code from an authenticator app, on top of your password.

+
+ +
+ +
+
+

Passkeys

+

Sign in with your fingerprint, face or security key instead of a password.

+
+ +
+ + ); +}; diff --git a/client/src/pages/Settings/pages/Account/components/Passkeys/Passkeys.jsx b/client/src/pages/Settings/pages/Account/components/Passkeys/Passkeys.jsx new file mode 100644 index 0000000..b3df8f3 --- /dev/null +++ b/client/src/pages/Settings/pages/Account/components/Passkeys/Passkeys.jsx @@ -0,0 +1,90 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import { Fingerprint, Plus, Trash2 } from "lucide-react"; +import ActionConfirmDialog from "@/common/components/ActionConfirmDialog"; +import Button from "@/common/components/Button"; +import Input from "@/common/components/Input"; +import { useToast } from "@/common/contexts/toast.js"; +import { formatRelative } from "@/common/utils/formatUtils.js"; +import { addPasskey, listPasskeys, passkeysSupported, removePasskey } from "@/common/utils/webauthn.js"; + +export const Passkeys = () => { + const { sendToast } = useToast(); + const [passkeys, setPasskeys] = useState(null); + const [name, setName] = useState(""); + const [adding, setAdding] = useState(false); + const [removing, setRemoving] = useState(null); + + const load = useCallback(async () => { + try { + setPasskeys(await listPasskeys()); + } catch (error) { + if (error.code !== 401) sendToast("Error", error.message); + } + }, [sendToast]); + + useEffect(() => { load(); }, [load]); + + const add = async event => { + event.preventDefault(); + setAdding(true); + try { + const result = await addPasskey(name); + sendToast("Success", result.message); + setName(""); + await load(); + } catch (error) { + if (error.name !== "NotAllowedError") sendToast("Error", error.message); + } finally { + setAdding(false); + } + }; + + const drop = async () => { + try { + sendToast("Success", (await removePasskey(removing.id)).message); + await load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + if (!passkeysSupported()) { + return

This browser cannot use passkeys.

; + } + + return ( +
+ !open && setRemoving(null)} onConfirm={drop} + title={`Remove ${removing?.name}?`} + text="That passkey can no longer sign in to this account." + confirmText="Remove" /> + + {passkeys?.length > 0 && ( +
    + {passkeys.map(passkey => ( +
  • + +
    + {passkey.name} + + added {formatRelative(passkey.createdAt)} + {passkey.lastUsedAt ? ` · last used ${formatRelative(passkey.lastUsedAt)}` : " · never used"} + +
    + +
  • + ))} +
+ )} + +
+ +
+ ); +}; diff --git a/client/src/pages/Settings/pages/Account/components/Passkeys/index.js b/client/src/pages/Settings/pages/Account/components/Passkeys/index.js new file mode 100644 index 0000000..4fddb6b --- /dev/null +++ b/client/src/pages/Settings/pages/Account/components/Passkeys/index.js @@ -0,0 +1 @@ +export { Passkeys as default } from "./Passkeys.jsx"; diff --git a/client/src/pages/Settings/pages/Account/components/Passkeys/styles.sass b/client/src/pages/Settings/pages/Account/components/Passkeys/styles.sass new file mode 100644 index 0000000..e8bdd78 --- /dev/null +++ b/client/src/pages/Settings/pages/Account/components/Passkeys/styles.sass @@ -0,0 +1,72 @@ +@use "@/common/styles/colors" + +.passkeys + display: flex + flex-direction: column + gap: 0.875rem + +.passkeys-unsupported + margin: 0 + color: colors.$muted + font-size: 0.8125rem + +.passkey-list + display: flex + flex-direction: column + gap: 0.5rem + + li + display: flex + align-items: center + gap: 0.75rem + padding: 0.625rem 0.875rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.75rem + + > svg + flex-shrink: 0 + color: colors.$primary + + > div + display: flex + flex-direction: column + flex: 1 + min-width: 0 + + > button + display: flex + align-items: center + justify-content: center + width: 2rem + height: 2rem + flex-shrink: 0 + background: none + border: none + border-radius: 0.5rem + color: colors.$muted + cursor: pointer + + svg + width: 1rem + height: 1rem + + &:hover + background-color: colors.$error-tint + color: colors.$error + +.passkey-name + font-size: 0.875rem + font-weight: 600 + +.passkey-meta + color: colors.$muted + font-size: 0.75rem + +.passkey-add + display: flex + align-items: flex-end + gap: 0.5rem + + .field + flex: 1 diff --git a/client/src/pages/Settings/pages/Account/components/TwoFactor/QrCode.jsx b/client/src/pages/Settings/pages/Account/components/TwoFactor/QrCode.jsx new file mode 100644 index 0000000..ea5adf6 --- /dev/null +++ b/client/src/pages/Settings/pages/Account/components/TwoFactor/QrCode.jsx @@ -0,0 +1,15 @@ +import { useEffect, useState } from "react"; +import { toDataURL } from "qrcode"; + +export const QrCode = ({ value, size = 148 }) => { + const [src, setSrc] = useState(null); + + useEffect(() => { + toDataURL(value, { width: size * 2, margin: 1, color: { dark: "#FAFAF9", light: "#00000000" } }) + .then(setSrc) + .catch(() => setSrc(null)); + }, [value, size]); + + if (!src) return
; + return ; +}; diff --git a/client/src/pages/Settings/pages/Account/components/TwoFactor/TwoFactor.jsx b/client/src/pages/Settings/pages/Account/components/TwoFactor/TwoFactor.jsx new file mode 100644 index 0000000..00ee5e5 --- /dev/null +++ b/client/src/pages/Settings/pages/Account/components/TwoFactor/TwoFactor.jsx @@ -0,0 +1,98 @@ +import "./styles.sass"; +import { useState } from "react"; +import { ShieldCheck, ShieldOff } from "lucide-react"; +import Button from "@/common/components/Button"; +import CopyField from "@/common/components/CopyField"; +import Input from "@/common/components/Input"; +import { getRequest, postRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { useUser } from "@/common/contexts/user.js"; +import { QrCode } from "./QrCode.jsx"; + +export const TwoFactor = () => { + const { sendToast } = useToast(); + const { user, setUser, login } = useUser(); + const [setup, setSetup] = useState(null); + const [code, setCode] = useState(""); + const [busy, setBusy] = useState(false); + + const start = async () => { + try { + setSetup(await getRequest("auth/totp/setup")); + setCode(""); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const enable = async event => { + event.preventDefault(); + setBusy(true); + try { + await postRequest("auth/totp/enable", { code }); + sendToast("Success", "Two-factor is on. Sign in again to continue."); + setUser(null); + } catch (error) { + sendToast("Error", error.message); + } finally { + setBusy(false); + } + }; + + const disable = async event => { + event.preventDefault(); + setBusy(true); + try { + await postRequest("auth/totp/disable", { code }); + sendToast("Success", "Two-factor is off"); + setCode(""); + await login(); + } catch (error) { + sendToast("Error", error.message); + } finally { + setBusy(false); + } + }; + + if (user?.totpEnabled) { + return ( +
+
+ + Your account asks for a code when you sign in. +
+
+ +
+
+ ); + } + + return ( +
+
+ + A password is all your account needs right now. +
+ + {!setup &&
+
+ + )} +
+ ); +}; diff --git a/client/src/pages/Settings/pages/Account/components/TwoFactor/index.js b/client/src/pages/Settings/pages/Account/components/TwoFactor/index.js new file mode 100644 index 0000000..fceda37 --- /dev/null +++ b/client/src/pages/Settings/pages/Account/components/TwoFactor/index.js @@ -0,0 +1 @@ +export { TwoFactor as default } from "./TwoFactor.jsx"; diff --git a/client/src/pages/Settings/pages/Account/components/TwoFactor/styles.sass b/client/src/pages/Settings/pages/Account/components/TwoFactor/styles.sass new file mode 100644 index 0000000..8c21537 --- /dev/null +++ b/client/src/pages/Settings/pages/Account/components/TwoFactor/styles.sass @@ -0,0 +1,54 @@ +@use "@/common/styles/colors" + +.two-factor + display: flex + flex-direction: column + align-items: flex-start + gap: 0.875rem + +.two-factor-state + display: flex + align-items: center + gap: 0.5rem + color: colors.$subtext + font-size: 0.8125rem + + svg + color: colors.$muted + + &.on svg + color: colors.$success + +.two-factor-setup + display: flex + align-items: flex-start + gap: 1.25rem + width: 100% + padding: 1rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + + p + margin: 0 0 0.75rem + color: colors.$subtext + font-size: 0.8125rem + line-height: 1.5 + +.two-factor-setup-body + flex: 1 + min-width: 0 + +.qr-code + flex-shrink: 0 + border-radius: 0.5rem + background-color: colors.$surface-raised + +.two-factor-row + display: flex + align-items: flex-end + gap: 0.5rem + margin-top: 0.75rem + + .field + flex: 1 diff --git a/client/src/pages/Settings/pages/Account/index.js b/client/src/pages/Settings/pages/Account/index.js new file mode 100644 index 0000000..119bba7 --- /dev/null +++ b/client/src/pages/Settings/pages/Account/index.js @@ -0,0 +1 @@ +export { Account as default } from "./Account.jsx"; diff --git a/client/src/pages/Settings/pages/Accounts/Accounts.jsx b/client/src/pages/Settings/pages/Accounts/Accounts.jsx new file mode 100644 index 0000000..55d1e7b --- /dev/null +++ b/client/src/pages/Settings/pages/Accounts/Accounts.jsx @@ -0,0 +1,151 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import { Plus, SlidersHorizontal, Trash2, UserRound } from "lucide-react"; +import ActionConfirmDialog from "@/common/components/ActionConfirmDialog"; +import Button from "@/common/components/Button"; +import Loading from "@/common/components/Loading"; +import Select from "@/common/components/Select"; +import QuotaFields, { fromForm, toForm } from "@/common/components/QuotaFields"; +import { deleteRequest, getRequest, postRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { useUser } from "@/common/contexts/user.js"; +import { formatBytes, formatRelative } from "@/common/utils/formatUtils.js"; +import NewAccountDialog from "./components/NewAccountDialog"; +import LimitsDialog from "./components/LimitsDialog"; + +const ROLES = [{ value: "admin", label: "Admin" }, { value: "user", label: "User" }]; + +export const Accounts = () => { + const { sendToast } = useToast(); + const { user } = useUser(); + const [accounts, setAccounts] = useState(null); + const [defaults, setDefaults] = useState(null); + const [limits, setLimits] = useState(null); + const [creating, setCreating] = useState(false); + const [deleting, setDeleting] = useState(null); + const [editing, setEditing] = useState(null); + + const load = useCallback(async () => { + try { + const data = await getRequest("accounts"); + setAccounts(data.accounts); + setDefaults(data.defaults); + setLimits(current => current || toForm(data.defaults)); + } catch (error) { + if (error.code !== 401) sendToast("Error", "Could not load accounts"); + } + }, [sendToast]); + + const saveDefaults = async event => { + event.preventDefault(); + try { + const result = await putRequest("quotas", fromForm(limits)); + sendToast("Success", result.message); + setDefaults(result.defaults); + setLimits(toForm(result.defaults)); + load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const saveLimits = async quotas => { + const result = await putRequest(`accounts/${editing.id}`, { quotas }); + sendToast("Success", result.message); + load(); + }; + + useEffect(() => { load(); }, [load]); + + const create = async values => { + const result = await postRequest("accounts", values); + sendToast("Success", result.message); + load(); + }; + + const changeRole = async (account, role) => { + try { + const result = await putRequest(`accounts/${account.id}`, { role }); + sendToast("Success", result.message); + load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const remove = async () => { + try { + const result = await deleteRequest(`accounts/${deleting.id}`); + sendToast("Success", result.message); + load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + return ( + <> + {limits && ( +
+
+

Limits

+

Per user, 0 for none. Admins are not limited.

+
+ +
+
+
+ + )} +
+ + {editing && setEditing(null)} onSave={saveLimits} />} + !open && setDeleting(null)} onConfirm={remove} + title={`Delete ${deleting?.username}?`} + text="Their devices and sessions go with them. Tunnels they have open close when the CLI reconnects." + confirmText="Delete" /> + +
+

Accounts

+

Everyone signs in with their own account and sees their own tunnels.

+
+ + {!accounts && } + {accounts && ( +
    + {accounts.map(account => ( +
  • +
    +
    + + {account.username} + {account.id === user?.id && you} + + + {account.role === "admin" ? `added ${formatRelative(account.createdAt)}` + : `${formatBytes(account.usage.traffic)} this month · ${account.usage.tunnels} ${account.usage.tunnels === 1 ? "tunnel" : "tunnels"}${account.quotas ? " · own limits" : ""}`} + +
    + + + + +
  • + ))} +
+ )} +
+ ); +}; diff --git a/client/src/pages/Settings/pages/Devices/index.js b/client/src/pages/Settings/pages/Devices/index.js new file mode 100644 index 0000000..162bd81 --- /dev/null +++ b/client/src/pages/Settings/pages/Devices/index.js @@ -0,0 +1 @@ +export { Devices as default } from "./Devices.jsx"; diff --git a/client/src/pages/Settings/pages/Devices/styles.sass b/client/src/pages/Settings/pages/Devices/styles.sass new file mode 100644 index 0000000..8c1b338 --- /dev/null +++ b/client/src/pages/Settings/pages/Devices/styles.sass @@ -0,0 +1,115 @@ +@use "@/common/styles/colors" + +.settings-head code + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + color: colors.$primary-bright + +.devices-empty + display: flex + flex-direction: column + align-items: center + gap: 0.5rem + + svg + color: colors.$muted + opacity: 0.7 + + padding: 1.5rem 1rem + text-align: center + background-color: colors.$surface-raised + border: 1px solid colors.$border + border-radius: 0.75rem + + p + color: colors.$muted + font-size: 0.875rem + +.device-list + display: flex + flex-direction: column + gap: 0.375rem + + li + display: flex + align-items: center + gap: 0.75rem + padding: 0.625rem 0.5rem 0.625rem 0.875rem + background-color: colors.$surface-raised + border: 1px solid colors.$border + border-radius: 0.75rem + + button + display: inline-flex + align-items: center + justify-content: center + flex-shrink: 0 + width: 1.75rem + height: 1.75rem + padding: 0 + background: none + border: none + border-radius: 0.5rem + color: colors.$muted + cursor: pointer + transition: background-color 0.15s ease, color 0.15s ease + + &:hover + background-color: colors.$error-tint + color: colors.$error + + svg + width: 1rem + height: 1rem + +.device-main + display: flex + flex-direction: column + gap: 0.15rem + min-width: 0 + flex: 1 + +.device-name + font-size: 0.875rem + font-weight: 600 + +.device-meta + color: colors.$muted + font-size: 0.75rem + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + +.invites-head + margin-top: 2rem + + p + margin-top: 0.25rem + color: colors.$muted + font-size: 0.8125rem + +.invite-form + display: flex + gap: 0.5rem + align-items: flex-end + margin-bottom: 0.75rem + + .field + flex: 1 + +.invite-created + display: flex + flex-direction: column + gap: 0.375rem + margin-bottom: 0.75rem + padding: 0.75rem 0.875rem + background-color: colors.$primary-tint + border: 1px solid colors.$border + border-radius: 0.75rem + + > span + color: colors.$subtext + font-size: 0.8125rem + +.invite-icon + flex-shrink: 0 + color: colors.$muted diff --git a/client/src/pages/Settings/pages/Forwarding/Forwarding.jsx b/client/src/pages/Settings/pages/Forwarding/Forwarding.jsx new file mode 100644 index 0000000..22742a9 --- /dev/null +++ b/client/src/pages/Settings/pages/Forwarding/Forwarding.jsx @@ -0,0 +1,68 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import Button from "@/common/components/Button"; +import Loading from "@/common/components/Loading"; +import { ForwardingChoice, ForwardingExplainer } from "@/common/components/ForwardingChoice"; +import { getRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; + +export const Forwarding = () => { + const { sendToast } = useToast(); + const [settings, setSettings] = useState(null); + const [mode, setMode] = useState(null); + const [preview, setPreview] = useState(null); + const [saving, setSaving] = useState(false); + + const load = useCallback(async () => { + try { + const data = await getRequest("settings"); + setSettings(data.settings); + setMode(data.settings.httpMode); + } catch (error) { + if (error.code !== 401) sendToast("Error", "Could not load settings"); + } + }, [sendToast]); + + useEffect(() => { load(); }, [load]); + + if (!settings) return ; + + const shown = preview || mode; + const dirty = mode !== settings.httpMode; + + const save = async () => { + setSaving(true); + try { + const response = await putRequest("settings", { ...settings, httpMode: mode }); + setSettings(response.settings); + setMode(response.settings.httpMode); + sendToast("Success", "Forwarding mode saved"); + } catch (error) { + sendToast("Error", error.message); + } finally { + setSaving(false); + } + }; + + return ( +
+
+

Forwarding

+

How a web tunnel is reached.

+
+ + + +
+ +
+ +
+
+
+
+ ); +}; diff --git a/client/src/pages/Settings/pages/Forwarding/index.js b/client/src/pages/Settings/pages/Forwarding/index.js new file mode 100644 index 0000000..a9dd30c --- /dev/null +++ b/client/src/pages/Settings/pages/Forwarding/index.js @@ -0,0 +1 @@ +export { Forwarding as default } from "./Forwarding.jsx"; diff --git a/client/src/pages/Settings/pages/Forwarding/styles.sass b/client/src/pages/Settings/pages/Forwarding/styles.sass new file mode 100644 index 0000000..4b431d3 --- /dev/null +++ b/client/src/pages/Settings/pages/Forwarding/styles.sass @@ -0,0 +1,42 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.forwarding-preview + margin-top: 1rem + padding: 1rem + background-color: colors.$surface-raised + border: 1px solid colors.$border + border-radius: 0.875rem + + .mode-explainer + max-width: none + display: grid + grid-template-columns: minmax(0, 21rem) 1fr + column-gap: 1.25rem + align-items: center + + .mode-diagram + grid-column: 1 + grid-row: 1 / span 2 + align-self: center + + h3 + grid-column: 2 + grid-row: 1 + align-self: end + margin-top: 0 + font-size: 1rem + + ul + grid-column: 2 + grid-row: 2 + align-self: start + margin-top: 0.4rem + + @media (max-width: breakpoints.$mobile) + .mode-explainer + grid-template-columns: 1fr + + .mode-diagram, h3, ul + grid-column: 1 + grid-row: auto diff --git a/client/src/pages/Settings/pages/Https/Https.jsx b/client/src/pages/Settings/pages/Https/Https.jsx new file mode 100644 index 0000000..687395b --- /dev/null +++ b/client/src/pages/Settings/pages/Https/Https.jsx @@ -0,0 +1,143 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import { ShieldCheck } from "lucide-react"; +import Button from "@/common/components/Button"; +import Input from "@/common/components/Input"; +import Loading from "@/common/components/Loading"; +import Select from "@/common/components/Select"; +import Toggle from "@/common/components/Toggle"; +import { TlsChoice, TlsExplainer } from "@/common/components/TlsChoice"; +import { getRequest, postRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import CertificatePanel from "./components/CertificatePanel"; + +const POLL_INTERVAL = 3000; + +export const Https = () => { + const { sendToast } = useToast(); + const [data, setData] = useState(null); + const [mode, setMode] = useState(null); + const [preview, setPreview] = useState(null); + const [acme, setAcme] = useState({ email: "", provider: "manual", credential: "" }); + const [trustProxy, setTrustProxy] = useState(false); + const [pinned, setPinned] = useState(false); + const [saving, setSaving] = useState(false); + + const load = useCallback(async (quiet = false) => { + try { + const [tls, settings] = await Promise.all([getRequest("tls"), getRequest("settings")]); + setData(tls); + setTrustProxy(!!settings.settings.trustProxy); + setPinned(settings.sources.tlsMode === "env"); + if (!quiet) { + setMode(tls.mode); + setAcme({ ...tls.acme, email: tls.acme.email || "", credential: "" }); + } + } catch (error) { + if (error.code !== 401) sendToast("Error", error.message); + } + }, [sendToast]); + + useEffect(() => { load(); }, [load]); + + useEffect(() => { + if (!data?.status?.busy) return; + const timer = setInterval(() => load(true), POLL_INTERVAL); + return () => clearInterval(timer); + }, [data?.status?.busy, load]); + + if (!data || mode === null) return ; + + const managed = mode === "acme"; + const provider = data.providers.find(entry => entry.id === acme.provider); + const needsWildcard = data.wildcard; + + const save = async () => { + setSaving(true); + try { + await putRequest("settings", { tlsMode: mode, trustProxy: managed ? false : trustProxy }); + if (managed) { + const values = { email: acme.email, provider: acme.provider }; + if (acme.credential) values.credential = acme.credential; + await putRequest("tls", values); + } + sendToast("Success", managed ? "Saved. Restart frislit to listen on 443." : "Saved"); + await load(); + } catch (error) { + sendToast("Error", error.message); + } finally { + setSaving(false); + } + }; + + const verify = async () => { + try { + sendToast("Info", (await postRequest("tls/verify")).message); + } catch (error) { + sendToast("Error", error.message); + } + }; + + return ( +
+
+

HTTPS

+

Who holds the certificate for {data.status.domains.join(" and ")}.{pinned && <> Set by FRISLIT_TLS_MODE.}

+
+ +
+ + +
+ + {!managed && ( +
+ +

+ Turn this on only when nothing but your proxy can reach the port. The IP allowlist and the login + rate limit both believe whatever address X-Forwarded-For carries. +

+
+ )} + + {managed && ( +
+ setAcme({ ...acme, email: value })} autoComplete="off" /> + setAcme({ ...acme, credential: value })} + autoComplete="off" /> + {data.acme.hasCredential && ( +
+
+ )} + + )} + {needsWildcard && ( +

+ + Subdomain forwarding needs the wildcard *.{data.status.domains[0]}, which only a + DNS challenge can prove. +

+ )} +
+ )} + +
+
+
+ + {managed && } +
+ ); +}; diff --git a/client/src/pages/Settings/pages/Https/components/CertificatePanel/CertificatePanel.jsx b/client/src/pages/Settings/pages/Https/components/CertificatePanel/CertificatePanel.jsx new file mode 100644 index 0000000..d664e50 --- /dev/null +++ b/client/src/pages/Settings/pages/Https/components/CertificatePanel/CertificatePanel.jsx @@ -0,0 +1,77 @@ +import "./styles.sass"; +import { useState } from "react"; +import { CircleAlert, CircleCheck, RefreshCw } from "lucide-react"; +import Button from "@/common/components/Button"; +import CopyField from "@/common/components/CopyField"; +import { postRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { formatRelative } from "@/common/utils/formatUtils.js"; + +const STATES = { + none: { tone: "idle", text: "No certificate yet." }, + requesting: { tone: "busy", text: "Talking to Let's Encrypt…" }, + stale: { tone: "warn", text: "The certificate does not cover every hostname any more." }, + expired: { tone: "warn", text: "The certificate has expired." }, + error: { tone: "warn", text: "The last request did not work." }, + ready: { tone: "ok", text: "Certificate in place." }, +}; + +export const CertificatePanel = ({ status, onChanged }) => { + const { sendToast } = useToast(); + const [busy, setBusy] = useState(false); + const state = STATES[status.state] || STATES.none; + const several = status.pendingRecords.length > 1; + + const act = async (path, success) => { + setBusy(true); + try { + const result = await postRequest(path); + sendToast("Success", success || result.message); + await onChanged(); + } catch (error) { + sendToast("Error", error.message); + } finally { + setBusy(false); + } + }; + + return ( +
+
+ {state.tone === "ok" ? : state.tone === "busy" + ? : } +
+ {state.text} + {status.certificate && ( + {status.certificate.altNames.join(", ")} · renews {formatRelative(status.certificate.expiresAt)} + )} + {status.error && {status.error}} +
+
+ + {status.pendingRecords.length > 0 && ( +
+

{several + ? "Add each of these as its own TXT record at your DNS provider, then continue. Keep both, even on the same name." + : "Add this TXT record at your DNS provider, then continue."} + {" "}Let's Encrypt checks from the outside, so give it a moment to spread.

+ {status.pendingRecords.map(record => ( +
+ {record.record} + +
+ ))} +
+ )} + + {!status.busy && ( +
+
+ )} +
+ ); +}; diff --git a/client/src/pages/Settings/pages/Https/components/CertificatePanel/index.js b/client/src/pages/Settings/pages/Https/components/CertificatePanel/index.js new file mode 100644 index 0000000..8bf512a --- /dev/null +++ b/client/src/pages/Settings/pages/Https/components/CertificatePanel/index.js @@ -0,0 +1 @@ +export { CertificatePanel as default } from "./CertificatePanel.jsx"; diff --git a/client/src/pages/Settings/pages/Https/components/CertificatePanel/styles.sass b/client/src/pages/Settings/pages/Https/components/CertificatePanel/styles.sass new file mode 100644 index 0000000..706d74e --- /dev/null +++ b/client/src/pages/Settings/pages/Https/components/CertificatePanel/styles.sass @@ -0,0 +1,78 @@ +@use "@/common/styles/colors" + +.certificate + margin-top: 1.5rem + padding-top: 1.25rem + border-top: 1px solid colors.$border + display: flex + flex-direction: column + gap: 1rem + +.certificate-state + display: flex + align-items: flex-start + gap: 0.625rem + + div + display: flex + flex-direction: column + gap: 0.125rem + + strong + font-size: 0.875rem + font-weight: 600 + + span + color: colors.$muted + font-size: 0.8125rem + + &.ok svg + color: colors.$success + + &.warn svg + color: colors.$warning + + &.busy svg, &.idle svg + color: colors.$muted + + .spin + animation: certificate-spin 1.4s linear infinite + +.certificate-error + color: colors.$error + +.certificate-records + display: flex + flex-direction: column + gap: 0.625rem + padding: 1rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + + p + margin: 0 + color: colors.$subtext + font-size: 0.8125rem + line-height: 1.5 + + button + align-self: flex-start + +.certificate-record + display: flex + flex-direction: column + gap: 0.25rem + + > span + color: colors.$muted + font-size: 0.75rem + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + +.certificate-actions + display: flex + justify-content: flex-start + +@keyframes certificate-spin + to + transform: rotate(360deg) diff --git a/client/src/pages/Settings/pages/Https/index.js b/client/src/pages/Settings/pages/Https/index.js new file mode 100644 index 0000000..2f59162 --- /dev/null +++ b/client/src/pages/Settings/pages/Https/index.js @@ -0,0 +1 @@ +export { Https as default } from "./Https.jsx"; diff --git a/client/src/pages/Settings/pages/Https/styles.sass b/client/src/pages/Settings/pages/Https/styles.sass new file mode 100644 index 0000000..837fb21 --- /dev/null +++ b/client/src/pages/Settings/pages/Https/styles.sass @@ -0,0 +1,35 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.tls-layout + display: grid + grid-template-columns: 1fr 1fr + gap: 1.5rem + align-items: start + + @media (max-width: breakpoints.$tablet) + grid-template-columns: 1fr + + .mode-choices + grid-template-columns: 1fr + align-content: start + +.tls-section + margin-top: 1.5rem + +.tls-note + margin: 0 + color: colors.$muted + font-size: 0.8125rem + line-height: 1.55 + + svg + vertical-align: -0.15em + margin-right: 0.3rem + + code + color: colors.$primary + +.tls-inline-action + display: flex + justify-content: flex-start diff --git a/client/src/pages/Settings/pages/Providers/Providers.jsx b/client/src/pages/Settings/pages/Providers/Providers.jsx new file mode 100644 index 0000000..3e6e0f3 --- /dev/null +++ b/client/src/pages/Settings/pages/Providers/Providers.jsx @@ -0,0 +1,96 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import { KeyRound, Plus, Trash2 } from "lucide-react"; +import ActionConfirmDialog from "@/common/components/ActionConfirmDialog"; +import Button from "@/common/components/Button"; +import CopyField from "@/common/components/CopyField"; +import Loading from "@/common/components/Loading"; +import Toggle from "@/common/components/Toggle"; +import { deleteRequest, getRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import ProviderDialog from "./components/ProviderDialog"; + +export const Providers = () => { + const { sendToast } = useToast(); + const [data, setData] = useState(null); + const [adding, setAdding] = useState(false); + const [removing, setRemoving] = useState(null); + + const load = useCallback(async () => { + try { + setData(await getRequest("oidc")); + } catch (error) { + if (error.code !== 401) sendToast("Error", error.message); + } + }, [sendToast]); + + useEffect(() => { load(); }, [load]); + + const toggle = async (provider, enabled) => { + try { + await putRequest(`oidc/${provider.id}`, { enabled }); + await load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const drop = async () => { + try { + sendToast("Success", (await deleteRequest(`oidc/${removing.id}`)).message); + await load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + if (!data) return ; + + return ( +
+ + !open && setRemoving(null)} onConfirm={drop} + title={`Remove ${removing?.name}?`} + text="Accounts it created stay, but nobody can sign in through it any more." + confirmText="Remove" /> + +
+

Login providers

+

Let people sign in with an OpenID Connect provider instead of a frislit password.

+
+ + {data.providers.length === 0 && ( +

No providers yet.

+ )} + + {data.providers.length > 0 && ( +
    + {data.providers.map(provider => ( +
  • +
    + {provider.name} + + {provider.issuer} · {provider.createAccounts ? "creates accounts" : "existing accounts only"} + +
    + toggle(provider, value)} /> + +
  • + ))} +
+ )} + +
+ Redirect URI to paste into the provider + +
+ +
+
+
+ ); +}; diff --git a/client/src/pages/Settings/pages/Providers/components/ProviderDialog/ProviderDialog.jsx b/client/src/pages/Settings/pages/Providers/components/ProviderDialog/ProviderDialog.jsx new file mode 100644 index 0000000..abc71f2 --- /dev/null +++ b/client/src/pages/Settings/pages/Providers/components/ProviderDialog/ProviderDialog.jsx @@ -0,0 +1,69 @@ +import "./styles.sass"; +import { useState } from "react"; +import { DialogProvider } from "@/common/components/Dialog"; +import Button from "@/common/components/Button"; +import Input from "@/common/components/Input"; +import Toggle from "@/common/components/Toggle"; +import { postRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; + +const EMPTY = { + name: "", issuer: "", clientId: "", clientSecret: "", + scope: "openid profile email", usernameClaim: "preferred_username", createAccounts: true, +}; + +export const ProviderDialog = ({ open, setOpen, onSaved }) => { + const { sendToast } = useToast(); + const [values, setValues] = useState(EMPTY); + const [busy, setBusy] = useState(false); + + const update = (key, value) => setValues({ ...values, [key]: value }); + + const close = () => { + setOpen(false); + setValues(EMPTY); + }; + + const submit = async event => { + event.preventDefault(); + setBusy(true); + try { + sendToast("Success", (await postRequest("oidc", values)).message); + close(); + await onSaved(); + } catch (error) { + sendToast("Error", error.message); + } finally { + setBusy(false); + } + }; + + return ( + +
+
+

Add a provider

+

Anything that speaks OpenID Connect: Authentik, Keycloak, Entra, Google.

+
+ + update("name", value)} autoFocus required /> + update("issuer", value)} required /> + update("clientId", value)} autoComplete="off" required /> + update("clientSecret", value)} autoComplete="new-password" /> + update("usernameClaim", value)} /> + update("createAccounts", value)} /> + +
+
+ +
+ ); +}; diff --git a/client/src/pages/Settings/pages/Providers/components/ProviderDialog/index.js b/client/src/pages/Settings/pages/Providers/components/ProviderDialog/index.js new file mode 100644 index 0000000..7454c79 --- /dev/null +++ b/client/src/pages/Settings/pages/Providers/components/ProviderDialog/index.js @@ -0,0 +1 @@ +export { ProviderDialog as default } from "./ProviderDialog.jsx"; diff --git a/client/src/pages/Settings/pages/Providers/components/ProviderDialog/styles.sass b/client/src/pages/Settings/pages/Providers/components/ProviderDialog/styles.sass new file mode 100644 index 0000000..bc78fb1 --- /dev/null +++ b/client/src/pages/Settings/pages/Providers/components/ProviderDialog/styles.sass @@ -0,0 +1,26 @@ +@use "@/common/styles/colors" + +.provider-dialog + display: flex + flex-direction: column + gap: 0.875rem + + h2 + font-size: 1.125rem + + p + margin: 0 + color: colors.$subtext + font-size: 0.875rem + line-height: 1.5 + +.provider-dialog-head + display: flex + flex-direction: column + gap: 0.375rem + +.provider-dialog-actions + display: flex + justify-content: flex-end + gap: 0.5rem + margin-top: 0.5rem diff --git a/client/src/pages/Settings/pages/Providers/index.js b/client/src/pages/Settings/pages/Providers/index.js new file mode 100644 index 0000000..575c38a --- /dev/null +++ b/client/src/pages/Settings/pages/Providers/index.js @@ -0,0 +1 @@ +export { Providers as default } from "./Providers.jsx"; diff --git a/client/src/pages/Settings/pages/Providers/styles.sass b/client/src/pages/Settings/pages/Providers/styles.sass new file mode 100644 index 0000000..8ae73a1 --- /dev/null +++ b/client/src/pages/Settings/pages/Providers/styles.sass @@ -0,0 +1,81 @@ +@use "@/common/styles/colors" + +.providers-empty + display: flex + flex-direction: column + align-items: center + gap: 0.5rem + padding: 2rem 1rem + border: 1px dashed colors.$border-strong + border-radius: 0.875rem + + svg + color: colors.$muted + opacity: 0.7 + + p + margin: 0 + color: colors.$subtext + font-size: 0.875rem + +.provider-list + display: flex + flex-direction: column + gap: 0.5rem + + li + display: flex + align-items: center + gap: 0.875rem + padding: 0.75rem 0.875rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.75rem + + > button + display: flex + align-items: center + justify-content: center + width: 2rem + height: 2rem + flex-shrink: 0 + background: none + border: none + border-radius: 0.5rem + color: colors.$muted + cursor: pointer + + svg + width: 1rem + height: 1rem + + &:hover + background-color: colors.$error-tint + color: colors.$error + +.provider-main + display: flex + flex-direction: column + flex: 1 + min-width: 0 + +.provider-name + font-size: 0.875rem + font-weight: 600 + +.provider-meta + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + color: colors.$muted + font-size: 0.75rem + +.provider-redirect + display: flex + flex-direction: column + gap: 0.375rem + margin-top: 1.25rem + + > span + color: colors.$muted + font-size: 0.75rem diff --git a/client/src/pages/Settings/pages/Server/Server.jsx b/client/src/pages/Settings/pages/Server/Server.jsx new file mode 100644 index 0000000..bc2c928 --- /dev/null +++ b/client/src/pages/Settings/pages/Server/Server.jsx @@ -0,0 +1,59 @@ +import { useCallback, useEffect, useState } from "react"; +import Button from "@/common/components/Button"; +import Loading from "@/common/components/Loading"; +import ServerSettingsForm, { normalizeSettings } from "@/common/components/ServerSettingsForm"; +import { getRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; + +export const Server = () => { + const { sendToast } = useToast(); + const [saved, setSaved] = useState(null); + const [values, setValues] = useState(null); + const [saving, setSaving] = useState(false); + + const load = useCallback(async () => { + try { + const data = await getRequest("settings"); + setSaved(data.settings); + setValues(data.settings); + } catch (error) { + if (error.code !== 401) sendToast("Error", "Could not load settings"); + } + }, [sendToast]); + + useEffect(() => { load(); }, [load]); + + if (!values) return ; + + const dirty = JSON.stringify(normalizeSettings(values)) !== JSON.stringify(normalizeSettings(saved)); + + const save = async event => { + event.preventDefault(); + setSaving(true); + try { + const response = await putRequest("settings", normalizeSettings(values)); + setSaved(response.settings); + setValues(response.settings); + sendToast("Success", "Settings saved"); + } catch (error) { + sendToast("Error", error.message); + } finally { + setSaving(false); + } + }; + + return ( +
+
+

Server

+
+ +
+
+
+ + ); +}; diff --git a/client/src/pages/Settings/pages/Server/index.js b/client/src/pages/Settings/pages/Server/index.js new file mode 100644 index 0000000..3645b1f --- /dev/null +++ b/client/src/pages/Settings/pages/Server/index.js @@ -0,0 +1 @@ +export { Server as default } from "./Server.jsx"; diff --git a/client/src/pages/Settings/styles.sass b/client/src/pages/Settings/styles.sass new file mode 100644 index 0000000..7202e97 --- /dev/null +++ b/client/src/pages/Settings/styles.sass @@ -0,0 +1,82 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.settings-layout + display: grid + grid-template-columns: 11rem 1fr + gap: 1.5rem + align-items: start + + @media (max-width: breakpoints.$tablet) + grid-template-columns: 1fr + gap: 1rem + +.settings-nav + display: flex + flex-direction: column + gap: 0.125rem + position: sticky + top: 1.5rem + + @media (max-width: breakpoints.$tablet) + position: static + flex-direction: row + overflow-x: auto + padding-bottom: 0.25rem + +.settings-nav-item + display: flex + align-items: center + gap: 0.5rem + padding: 0.45rem 0.75rem + border-radius: 0.625rem + color: colors.$muted + font-size: 0.875rem + font-weight: 500 + text-decoration: none + white-space: nowrap + transition: background-color 0.15s ease, color 0.15s ease + + &:hover + color: colors.$text + background-color: colors.$surface + + &.active + color: colors.$text + background-color: colors.$surface-hover + +.settings-content + min-width: 0 + max-width: 42rem + +.settings-panel + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + padding: 1.25rem + +.settings-head + margin-bottom: 1.25rem + + h2 + font-size: 1.0625rem + font-weight: 600 + letter-spacing: -0.02em + + p + margin-top: 0.2rem + color: colors.$muted + font-size: 0.8125rem + line-height: 1.55 + +.settings-actions + display: flex + align-items: center + gap: 0.5rem + margin-top: 1.25rem + + .spacer + flex: 1 + +.settings-content > .settings-panel + .settings-panel + margin-top: 1.25rem diff --git a/client/src/pages/Setup/Setup.jsx b/client/src/pages/Setup/Setup.jsx new file mode 100644 index 0000000..f99a111 --- /dev/null +++ b/client/src/pages/Setup/Setup.jsx @@ -0,0 +1,79 @@ +import "./styles.sass"; +import { useEffect, useState } from "react"; +import { Navigate, useNavigate } from "react-router-dom"; +import Loading from "@/common/components/Loading"; +import { getRequest, postRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { useUser } from "@/common/contexts/user.js"; +import { normalizeSettings } from "@/common/components/ServerSettingsForm"; +import WelcomeStep from "./components/WelcomeStep"; +import AccountStep from "./components/AccountStep"; +import ForwardingStep from "./components/ForwardingStep"; +import HttpsStep from "./components/HttpsStep"; +import ServerStep from "./components/ServerStep"; +import DoneStep from "./components/DoneStep"; + +const STEPS = ["Welcome", "Account", "Forwarding", "HTTPS", "Server", "Done"]; +const LAST_EDITABLE = 4; + +export const Setup = () => { + const { sendToast } = useToast(); + const { setupRequired, setSetupRequired, login } = useUser(); + const navigate = useNavigate(); + const [settings, setSettings] = useState(null); + const [sources, setSources] = useState({}); + const [step, setStep] = useState(0); + const [account, setAccount] = useState({ username: "", password: "", confirm: "" }); + const [submitting, setSubmitting] = useState(false); + + useEffect(() => { + getRequest("setup/status") + .then(data => { setSettings(data.settings); setSources(data.sources); }) + .catch(error => sendToast("Error", error.message)); + }, [sendToast]); + + if (!setupRequired) return ; + if (!settings) return ; + + const complete = async () => { + setSubmitting(true); + try { + await postRequest("setup/complete", { + username: account.username, + password: account.password, + settings: normalizeSettings(settings), + }); + await login(); + setStep(5); + } catch (error) { + sendToast("Error", error.message); + } finally { + setSubmitting(false); + } + }; + + const finish = () => { + setSetupRequired(false); + navigate("/tunnels", { replace: true }); + }; + + return ( +
+
+ {STEPS.map((title, index) => ( +
+ + {step === 0 && setStep(1)} />} + {step === 1 && setStep(0)} onNext={() => setStep(2)} />} + {step === 2 && setStep(1)} onNext={() => setStep(3)} />} + {step === 3 && setStep(2)} onNext={() => setStep(4)} />} + {step === 4 && setStep(3)} onNext={complete} submitting={submitting} />} + {step === 5 && } +
+ ); +}; diff --git a/client/src/pages/Setup/components/AccountStep/AccountStep.jsx b/client/src/pages/Setup/components/AccountStep/AccountStep.jsx new file mode 100644 index 0000000..ee8c0a9 --- /dev/null +++ b/client/src/pages/Setup/components/AccountStep/AccountStep.jsx @@ -0,0 +1,52 @@ +import { useRef } from "react"; +import Button from "@/common/components/Button"; +import Input from "@/common/components/Input"; +import { useToast } from "@/common/contexts/toast.js"; +import { formValues, useAutofill } from "@/common/utils/autofill.js"; + +export const AccountStep = ({ account, setAccount, onBack, onNext }) => { + const { sendToast } = useToast(); + const formRef = useRef(null); + const update = (key, value) => setAccount({ ...account, [key]: value }); + + useAutofill(formRef, filled => setAccount(current => ({ + username: current.username || filled["setup-username"] || "", + password: current.password || filled["setup-password"] || "", + confirm: current.confirm || filled["setup-confirm"] || "", + }))); + + const submit = event => { + event.preventDefault(); + const filled = formValues(event.currentTarget); + const username = filled["setup-username"] || account.username; + const password = filled["setup-password"] || account.password; + const confirm = filled["setup-confirm"] || account.confirm; + setAccount({ username, password, confirm }); + if (!/^[a-zA-Z0-9._-]{3,32}$/.test(username)) return sendToast("Error", "Username must be 3-32 characters"); + if (password.length < 8) return sendToast("Error", "Password must be at least 8 characters"); + if (password !== confirm) return sendToast("Error", "Passwords do not match"); + onNext(); + }; + + return ( +
+
+

Admin account.

+

Signs you in to this dashboard.

+
+
+ update("username", value)} + autoComplete="username" autoFocus required /> + update("password", value)} autoComplete="new-password" required /> + update("confirm", value)} autoComplete="new-password" required /> +
+
+
+
+ ); +}; diff --git a/client/src/pages/Setup/components/AccountStep/index.js b/client/src/pages/Setup/components/AccountStep/index.js new file mode 100644 index 0000000..7ce2240 --- /dev/null +++ b/client/src/pages/Setup/components/AccountStep/index.js @@ -0,0 +1 @@ +export { AccountStep as default } from "./AccountStep.jsx"; diff --git a/client/src/pages/Setup/components/DoneStep/DoneStep.jsx b/client/src/pages/Setup/components/DoneStep/DoneStep.jsx new file mode 100644 index 0000000..9877438 --- /dev/null +++ b/client/src/pages/Setup/components/DoneStep/DoneStep.jsx @@ -0,0 +1,20 @@ +import Button from "@/common/components/Button"; +import { Check } from "lucide-react"; + +export const DoneStep = ({ username, onFinish }) => { + return ( + <> +
+
+
+

All set, {username}.

+

Your tunnels show up on the dashboard. Run frislit login on a machine to link it.

+
+
+
+
+
+ + ); +}; diff --git a/client/src/pages/Setup/components/DoneStep/index.js b/client/src/pages/Setup/components/DoneStep/index.js new file mode 100644 index 0000000..35cf148 --- /dev/null +++ b/client/src/pages/Setup/components/DoneStep/index.js @@ -0,0 +1 @@ +export { DoneStep as default } from "./DoneStep.jsx"; diff --git a/client/src/pages/Setup/components/ForwardingStep/ForwardingStep.jsx b/client/src/pages/Setup/components/ForwardingStep/ForwardingStep.jsx new file mode 100644 index 0000000..ec3bf29 --- /dev/null +++ b/client/src/pages/Setup/components/ForwardingStep/ForwardingStep.jsx @@ -0,0 +1,36 @@ +import { useEffect, useState } from "react"; +import Button from "@/common/components/Button"; +import { ForwardingChoice, ForwardingExplainer } from "@/common/components/ForwardingChoice"; +import { usePublicAside } from "@/common/layouts/aside.js"; + +export const ForwardingStep = ({ settings, setSettings, onBack, onNext }) => { + const selected = settings.httpMode || "subdomain"; + const domain = settings.baseDomain?.trim() || "frislit.example.com"; + const [preview, setPreview] = useState(null); + const shown = preview || selected; + + const setAside = usePublicAside(); + useEffect(() => { + setAside(); + return () => setAside(null); + }, [setAside, shown, domain]); + + return ( +
+
+

Forwarding.

+

How a web tunnel is reached. This can be changed later.

+
+ + setSettings({ ...settings, httpMode: mode })} /> +
+ +
+
+
+ ); +}; diff --git a/client/src/pages/Setup/components/ForwardingStep/index.js b/client/src/pages/Setup/components/ForwardingStep/index.js new file mode 100644 index 0000000..4367098 --- /dev/null +++ b/client/src/pages/Setup/components/ForwardingStep/index.js @@ -0,0 +1 @@ +export { ForwardingStep as default } from "./ForwardingStep.jsx"; diff --git a/client/src/pages/Setup/components/HttpsStep/HttpsStep.jsx b/client/src/pages/Setup/components/HttpsStep/HttpsStep.jsx new file mode 100644 index 0000000..a6a39bf --- /dev/null +++ b/client/src/pages/Setup/components/HttpsStep/HttpsStep.jsx @@ -0,0 +1,60 @@ +import { useEffect, useState } from "react"; +import Button from "@/common/components/Button"; +import Toggle from "@/common/components/Toggle"; +import { TlsChoice, TlsExplainer } from "@/common/components/TlsChoice"; +import { usePublicAside } from "@/common/layouts/aside.js"; + +export const HttpsStep = ({ settings, setSettings, pinned, onBack, onNext }) => { + const selected = settings.tlsMode || "proxy"; + const [preview, setPreview] = useState(null); + const shown = preview || selected; + const wildcard = (settings.httpMode || "subdomain") === "subdomain"; + const domain = settings.baseDomain?.trim() || "frislit.example.com"; + + const setAside = usePublicAside(); + useEffect(() => { + setAside(); + return () => setAside(null); + }, [setAside, shown]); + + return ( +
+
+

HTTPS.

+

{pinned ? <>Set by FRISLIT_TLS_MODE when the server was started. : "Who holds the certificate. Switching later needs a restart."}

+
+ + setSettings({ ...settings, tlsMode: mode })} /> +
+ + {selected === "proxy" ? ( +
+ setSettings({ ...settings, trustProxy: value })} /> +

+ Turn this on once only your proxy can reach the port. The reverse proxy guide in the + documentation has an nginx config you can paste. +

+
+ ) : ( +
+

+ frislit will ask Let's Encrypt for a certificate + {wildcard ? <> covering {domain} and *.{domain} : <> for {domain}}. + {wildcard + ? " A wildcard needs a DNS challenge, so have an API token for your DNS provider ready." + : " Point the domain at this machine and it can use an HTTP challenge, no DNS token needed."} +

+

Finish the setup first, then request the certificate on the HTTPS settings page.

+
+ )} + +
+
+
+ ); +}; diff --git a/client/src/pages/Setup/components/HttpsStep/index.js b/client/src/pages/Setup/components/HttpsStep/index.js new file mode 100644 index 0000000..f757e8b --- /dev/null +++ b/client/src/pages/Setup/components/HttpsStep/index.js @@ -0,0 +1 @@ +export { HttpsStep as default } from "./HttpsStep.jsx"; diff --git a/client/src/pages/Setup/components/ServerStep/ServerStep.jsx b/client/src/pages/Setup/components/ServerStep/ServerStep.jsx new file mode 100644 index 0000000..72b9c3a --- /dev/null +++ b/client/src/pages/Setup/components/ServerStep/ServerStep.jsx @@ -0,0 +1,28 @@ +import Button from "@/common/components/Button"; +import ServerSettingsForm from "@/common/components/ServerSettingsForm"; +import { useToast } from "@/common/contexts/toast.js"; + +export const ServerStep = ({ settings, setSettings, onBack, onNext, submitting }) => { + const { sendToast } = useToast(); + + const submit = event => { + event.preventDefault(); + if (!settings.baseDomain.trim()) return sendToast("Error", "Base domain is required"); + onNext(); + }; + + return ( +
+
+

Server.

+

You can change all of this later.

+
+ +
+
+ + ); +}; diff --git a/client/src/pages/Setup/components/ServerStep/index.js b/client/src/pages/Setup/components/ServerStep/index.js new file mode 100644 index 0000000..7a4f0de --- /dev/null +++ b/client/src/pages/Setup/components/ServerStep/index.js @@ -0,0 +1 @@ +export { ServerStep as default } from "./ServerStep.jsx"; diff --git a/client/src/pages/Setup/components/WelcomeStep/WelcomeStep.jsx b/client/src/pages/Setup/components/WelcomeStep/WelcomeStep.jsx new file mode 100644 index 0000000..8d63602 --- /dev/null +++ b/client/src/pages/Setup/components/WelcomeStep/WelcomeStep.jsx @@ -0,0 +1,22 @@ +import Button from "@/common/components/Button"; +import { Server, ShieldCheck, Waypoints } from "lucide-react"; + +export const WelcomeStep = ({ onNext }) => { + return ( + <> +
+

Welcome.

+

Three things and your tunnel server is ready.

+
+
    +
  • Admin account
  • +
  • Forwarding mode
  • +
  • Server settings
  • +
+
+
+
+ + ); +}; diff --git a/client/src/pages/Setup/components/WelcomeStep/index.js b/client/src/pages/Setup/components/WelcomeStep/index.js new file mode 100644 index 0000000..f6f4691 --- /dev/null +++ b/client/src/pages/Setup/components/WelcomeStep/index.js @@ -0,0 +1 @@ +export { WelcomeStep as default } from "./WelcomeStep.jsx"; diff --git a/client/src/pages/Setup/index.js b/client/src/pages/Setup/index.js new file mode 100644 index 0000000..634e6c8 --- /dev/null +++ b/client/src/pages/Setup/index.js @@ -0,0 +1 @@ +export { Setup as default } from "./Setup.jsx"; diff --git a/client/src/pages/Setup/styles.sass b/client/src/pages/Setup/styles.sass new file mode 100644 index 0000000..427048c --- /dev/null +++ b/client/src/pages/Setup/styles.sass @@ -0,0 +1,94 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.setup + width: 100% + +.setup-rail + display: flex + align-items: center + gap: 0.375rem + margin-bottom: 2rem + +.setup-rail-dot + width: 0.375rem + height: 0.375rem + padding: 0 + flex-shrink: 0 + background-color: colors.$border-strong + border: none + border-radius: 999px + cursor: default + transition: width 0.2s ease, background-color 0.2s ease + + &.done + background-color: colors.$primary-deep + cursor: pointer + + &:hover + background-color: colors.$primary + + &.active + width: 1.125rem + background-color: colors.$primary + + &:focus-visible + outline: 2px solid colors.$primary + outline-offset: 3px + +.setup-list + display: flex + flex-direction: column + gap: 0.625rem + + li + display: flex + align-items: center + gap: 0.625rem + color: colors.$subtext + font-size: 0.875rem + + svg + width: 1rem + height: 1rem + flex-shrink: 0 + color: colors.$primary + +.setup-done + display: flex + flex-direction: column + gap: 0.75rem + + .setup-done-icon + display: flex + align-items: center + justify-content: center + width: 2.5rem + height: 2.5rem + border-radius: 0.875rem + background-color: colors.$success-tint + color: colors.$success + margin-bottom: 0.5rem + + svg + width: 1.375rem + height: 1.375rem + +.setup-note + display: flex + flex-direction: column + gap: 0.625rem + margin-top: 1.25rem + padding: 1rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + + p + margin: 0 + color: colors.$subtext + font-size: 0.8125rem + line-height: 1.5 + + code + color: colors.$primary diff --git a/client/src/pages/Status/Status.jsx b/client/src/pages/Status/Status.jsx new file mode 100644 index 0000000..2619c04 --- /dev/null +++ b/client/src/pages/Status/Status.jsx @@ -0,0 +1,112 @@ +import "./styles.sass"; +import { useEffect, useRef, useState } from "react"; +import Button from "@/common/components/Button"; +import Gate from "@/pages/Gate"; +import { getRequest } from "@/common/utils/RequestUtil.js"; +import { bindTab, readTab, rememberTab } from "@/common/utils/tunnelTab.js"; + +const POLL_INTERVAL = 2000; +const BIND_TIMEOUT = 2000; +const BLOCKED = { + address: "This tunnel does not accept requests from your address.", + country: "This tunnel does not accept requests from your country.", + tor: "This tunnel does not accept requests from Tor exit nodes.", + vpn: "This tunnel does not accept requests from VPN services.", + datacenter: "This tunnel does not accept requests from datacenters.", + blocklist: "This tunnel does not accept requests from blocklisted addresses.", +}; + +export const Status = ({ kind, id, to, auth, authorize, ip, reason }) => { + const target = to || new URLSearchParams(window.location.search).get("to") || "/"; + const [failed, setFailed] = useState(false); + const started = useRef(false); + + useEffect(() => { + if (started.current) return; + started.current = true; + + if (kind === "attach" || kind === "reattach") { + const tunnel = kind === "attach" ? id : readTab(); + if (!tunnel) { + window.location.replace("/@frislit/select"); + return; + } + rememberTab(tunnel); + let done = false; + const go = () => { + if (done) return; + done = true; + window.location.replace(target); + }; + bindTab(tunnel).then(go).catch(() => setFailed(true)); + const timer = setTimeout(go, BIND_TIMEOUT); + return () => clearTimeout(timer); + } + + if (kind === "offline") { + const timer = setInterval(async () => { + try { + const status = await getRequest(`status/${encodeURIComponent(id)}`); + if (status.online) window.location.reload(); + if (!status.exists) setFailed(true); + } catch { /* keep waiting, the server may be restarting too */ } + }, POLL_INTERVAL); + return () => clearInterval(timer); + } + }, [kind, id, target]); + + if (kind === "gate") return ; + + if (kind === "blocked") { + return ( +
+
+

Not allowed.

+

{BLOCKED[reason]}{ip ? <> Your address is {ip}. : null}

+
+
+ ); + } + + if (kind === "attach" || kind === "reattach") { + return ( +
+
+

{failed ? "Could not open this tunnel." : "Opening…"}

+

{failed + ? "This browser could not start the tunnel router. Path mode needs HTTPS or localhost." + : <>Attaching this tab to {id || readTab()}.}

+
+ {failed &&
+
} +
+ ); + } + + if (kind === "offline") { + return ( +
+
+

{failed ? "Tunnel closed." : "Reconnecting…"}

+

{failed + ? <>The tunnel {id} is gone. + : <>The client for {id} is disconnected. This page continues by itself once it is back.}

+
+
{!failed && }
+
+ ); + } + + return ( +
+
+

Tunnel not found.

+

There is no tunnel called {id}. It may have been closed, or the id was mistyped.

+
+
+
+
+ ); +}; diff --git a/client/src/pages/Status/index.js b/client/src/pages/Status/index.js new file mode 100644 index 0000000..6922635 --- /dev/null +++ b/client/src/pages/Status/index.js @@ -0,0 +1 @@ +export { Status as default } from "./Status.jsx"; diff --git a/client/src/pages/Status/styles.sass b/client/src/pages/Status/styles.sass new file mode 100644 index 0000000..b7270ea --- /dev/null +++ b/client/src/pages/Status/styles.sass @@ -0,0 +1,30 @@ +@use "@/common/styles/colors" + +.status-page + width: 100% + + code + font-family: ui-monospace, SFMono-Regular, Menlo, monospace + font-size: 0.85em + color: var(--primary-bright) + background: var(--surface-raised) + border: 1px solid var(--border) + border-radius: 0.375rem + padding: 0.1rem 0.35rem + + .status-wait + display: flex + align-items: center + min-height: 2rem + + .status-spinner + width: 1.1rem + height: 1.1rem + border: 2px solid var(--border-strong) + border-top-color: var(--primary-bright) + border-radius: 50% + animation: status-spin 0.9s linear infinite + +@keyframes status-spin + to + transform: rotate(360deg) diff --git a/client/src/pages/TunnelDetail/TunnelDetail.jsx b/client/src/pages/TunnelDetail/TunnelDetail.jsx new file mode 100644 index 0000000..be5e3d0 --- /dev/null +++ b/client/src/pages/TunnelDetail/TunnelDetail.jsx @@ -0,0 +1,249 @@ +import "./styles.sass"; +import { useCallback, useEffect, useRef, useState } from "react"; +import { useNavigate, useParams } from "react-router-dom"; +import Button from "@/common/components/Button"; +import CopyField from "@/common/components/CopyField"; +import OpenInFrislit from "@/common/components/OpenInFrislit"; +import Loading from "@/common/components/Loading"; +import ActionConfirmDialog from "@/common/components/ActionConfirmDialog"; +import { deleteRequest, getRequest, postRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { formatCountdown, formatRelative } from "@/common/utils/formatUtils.js"; +import TrafficTable from "./components/TrafficTable"; +import VisitorsTable from "./components/VisitorsTable"; +import ConnectionsTable from "./components/ConnectionsTable"; +import AccessSection from "./components/AccessSection"; +import DomainsSection from "./components/DomainsSection"; +import StatsPanel from "./components/StatsPanel"; +import { ArrowLeft, Bookmark, BookmarkX, ExternalLink, X } from "lucide-react"; + +const POLL_INTERVAL = 2000; + +const stateOf = (live, now) => { + if (!live) return ["dormant", "Offline"]; + if (live.online) return ["online", "Online"]; + return ["offline", `Reconnecting · closes in ${formatCountdown(live.graceUntil, now)}`]; +}; + +export const TunnelDetail = () => { + const { id } = useParams(); + const navigate = useNavigate(); + const { sendToast } = useToast(); + const [data, setData] = useState(null); + const [definition, setDefinition] = useState(null); + const [checked, setChecked] = useState(false); + const [now, setNow] = useState(() => Date.now()); + const [closing, setClosing] = useState(false); + const [busyMode, setBusyMode] = useState(false); + const [releasing, setReleasing] = useState(false); + const [disconnecting, setDisconnecting] = useState(null); + const [view, setView] = useState("traffic"); + const [focus, setFocus] = useState(""); + const tunnelRef = useRef(null); + + const load = useCallback(async () => { + try { + const response = await getRequest(`tunnels/${id}`); + tunnelRef.current = response.tunnel; + setData(response); + setNow(Date.now()); + } catch (error) { + if (error.code === 401) return; + if (error.code !== 404) return sendToast("Error", "Could not load the tunnel"); + tunnelRef.current = null; + setData(null); + } + }, [id, sendToast]); + + const loadDefinition = useCallback(async () => { + if (tunnelRef.current && !tunnelRef.current.persistent) return setDefinition(null); + try { + setDefinition((await getRequest(`persistent/${id}`)).tunnel); + } catch (error) { + if (error.code === 404) setDefinition(null); + } + }, [id]); + + useEffect(() => { + const refresh = async () => { + await load(); + await loadDefinition(); + setChecked(true); + }; + refresh(); + const poll = setInterval(refresh, POLL_INTERVAL); + const tick = setInterval(() => setNow(Date.now()), 1000); + return () => { clearInterval(poll); clearInterval(tick); }; + }, [load, loadDefinition]); + + const live = data?.tunnel || null; + const persistent = live ? live.persistent : !!definition; + + const close = async () => { + try { + await deleteRequest(`tunnels/${id}`); + sendToast("Success", `Closed ${id}`); + if (!persistent) navigate("/tunnels"); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const keep = async () => { + try { + const result = await postRequest("persistent", { name: id }); + sendToast("Success", result.message); + await load(); + await loadDefinition(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const release = async () => { + try { + const result = await deleteRequest(`persistent/${id}`); + sendToast("Success", result.message); + setDefinition(null); + if (!live) navigate("/tunnels"); + else load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const changeMode = async mode => { + if (busyMode || mode === tunnel.mode) return; + setBusyMode(true); + try { + const result = await putRequest(`tunnels/${id}/mode`, { mode }); + sendToast("Success", `${result.message} · ${result.url}`); + await load(); + } catch (error) { + sendToast("Error", error.message); + } finally { + setBusyMode(false); + } + }; + + const disconnect = async () => { + const path = disconnecting === "all" ? `tunnels/${id}/clients` : `tunnels/${id}/clients/${disconnecting.id}`; + try { + const result = await deleteRequest(path); + sendToast("Success", result.message); + load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + if (checked && !live && !definition) { + return ( +
+
+

Tunnel closed.

+

There is no tunnel called {id} any more.

+
+
+ ); + } + + if (!live && !definition) return
; + + const tunnel = live || { + id: definition.name, + mode: "http", + url: definition.url, + online: false, + access: definition.access, + persistent: true, + }; + const isHttp = tunnel.mode !== "tcp"; + const heading = ( +
+ + +
+ ); + const domains = definition?.domains || []; + const [state, stateLabel] = stateOf(live, now); + + return ( +
+ + + !open && setDisconnecting(null)} + onConfirm={disconnect} + title={disconnecting === "all" ? "Disconnect every client?" : `Disconnect ${disconnecting?.ip}?`} + text="Their open connections drop immediately. They can connect again with the same share code." + confirmText="Disconnect" /> + + + +
+
+

{tunnel.id}{persistent && } + {isHttp && {tunnel.mode === "subdomain" ? "subdomain" : "path"}} +

+

+ + {stateLabel} + {live && · {tunnel.target}} + {live && ` · started ${formatRelative(tunnel.createdAt)}`} +

+
+
+ {live && isHttp && ( +
+ {["path", "subdomain"].map(option => ( + + ))} +
+ )} + {live && tunnel.url &&
+
+ + {live + ? + : } + + {live?.shareCode &&
} + + { load(); loadDefinition(); }} + endpoint={live ? `tunnels/${tunnel.id}/access` : `persistent/${tunnel.id}/access`} /> + + {persistent && isHttp && } + + {live && } + + {live && (view === "visitors" + ? { setFocus(ip); setView("traffic"); } : null} /> + : isHttp + ? + : setDisconnecting(client)} + onDisconnectAll={() => setDisconnecting("all")} />)} +
+ ); +}; diff --git a/client/src/pages/TunnelDetail/components/AccessSection/AccessSection.jsx b/client/src/pages/TunnelDetail/components/AccessSection/AccessSection.jsx new file mode 100644 index 0000000..9272ab9 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/AccessSection/AccessSection.jsx @@ -0,0 +1,204 @@ +import "./styles.sass"; +import { useEffect, useState } from "react"; +import Input from "@/common/components/Input"; +import Select from "@/common/components/Select"; +import Button from "@/common/components/Button"; +import Toggle from "@/common/components/Toggle"; +import Flag from "@/common/components/Flag"; +import { countryCodes, countryName } from "@/common/utils/country.js"; +import { getRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { Plus, X } from "lucide-react"; + +const AUTH_OPTIONS = [ + { label: "Open to everyone", value: "none" }, + { label: "Password", value: "password" }, + { label: "frislit account", value: "frislit" }, +]; + +const CATEGORIES = [["tor", "Tor exit nodes"], ["vpn", "VPN services"], ["datacenter", "Datacenters"], ["blocklist", "Blocklisted addresses"]]; + +const SUGGESTIONS = 6; + +const matches = (text, taken) => { + const value = text.trim().toLowerCase(); + if (!value) return []; + return countryCodes + .filter(code => !taken.includes(code) && (code.toLowerCase().startsWith(value) || countryName(code).toLowerCase().includes(value))) + .slice(0, SUGGESTIONS); +}; + +const RuleList = ({ id, items, onChange, busy, country, placeholder }) => { + const [draft, setDraft] = useState(""); + const suggestions = country ? matches(draft, items) : []; + + const add = value => { + const entry = country ? suggestions[0] : value.trim(); + if (!entry) return; + setDraft(""); + if (!items.includes(entry)) onChange([...items, entry]); + }; + + const pick = code => { + setDraft(""); + onChange([...items, code]); + }; + + return ( +
+ {items.length > 0 && ( +
    + {items.map(item => ( +
  • + {country ? <>{countryName(item)} : {item}} + +
  • + ))} +
+ )} +
+
+ { if (event.key === "Enter") { event.preventDefault(); add(draft); } }} /> + {suggestions.length > 0 && ( +
    + {suggestions.map(code => ( +
  • + +
  • + ))} +
+ )} +
+
+
+ ); +}; + +export const AccessSection = ({ tunnel, onSaved, endpoint = `tunnels/${tunnel.id}/access` }) => { + const { sendToast } = useToast(); + const { allow, block } = tunnel.access; + const [auth, setAuth] = useState(tunnel.access?.auth || "none"); + const [password, setPassword] = useState(""); + const [people, setPeople] = useState([]); + const [selected, setSelected] = useState(tunnel.access?.accounts || []); + const [busy, setBusy] = useState(false); + + useEffect(() => setAuth(tunnel.access?.auth || "none"), [tunnel.id, tunnel.access?.auth]); + useEffect(() => setSelected(tunnel.access?.accounts || []), [tunnel.id, tunnel.access?.accounts]); + + useEffect(() => { + if (auth !== "frislit") return; + let cancelled = false; + getRequest(`tunnels/${tunnel.id}/access/accounts`) + .then(result => { if (!cancelled) setPeople(result.accounts || []); }) + .catch(() => { if (!cancelled) setPeople([]); }); + return () => { cancelled = true; }; + }, [auth, tunnel.id]); + + const isTcp = tunnel.mode === "tcp"; + const accountsChanged = JSON.stringify(selected) !== JSON.stringify(tunnel.access?.accounts || []); + const authChanged = auth !== (tunnel.access?.auth || "none") || !!password || (auth === "frislit" && accountsChanged); + const needsPassword = auth === "password" && !tunnel.access?.hasPassword && !password; + + + + const save = async (body, message) => { + setBusy(true); + try { + await putRequest(endpoint, body); + sendToast("Success", message); + onSaved?.(); + return true; + } catch (error) { + sendToast("Error", error.message); + return false; + } finally { + setBusy(false); + } + }; + + const saveAuth = () => save( + { auth, ...(password ? { password } : {}), ...(auth === "frislit" ? { accounts: selected } : {}) }, + auth === "none" ? "Sign-in turned off" : "Sign-in updated", + ).then(ok => ok && setPassword("")); + + const toggleCategory = (key, on) => save( + { block: { categories: on ? [...block.categories, key] : block.categories.filter(entry => entry !== key) } }, + "Rules updated", + ); + + return ( +
+
+

Access

+ {isTcp ? "Who may use the share code" : "Who may reach this tunnel"} +
+ +
+ {!isTcp && ( +
+
+

Sign-in

+
+
+ + )} + {auth === "frislit" && ( + { if (event.key === "Enter") { event.preventDefault(); add(); } }} /> +
+ +

CNAME it to {serverInfo?.baseDomain}.

+
+
+ ); +}; diff --git a/client/src/pages/TunnelDetail/components/DomainsSection/index.js b/client/src/pages/TunnelDetail/components/DomainsSection/index.js new file mode 100644 index 0000000..6da00a2 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/DomainsSection/index.js @@ -0,0 +1 @@ +export { DomainsSection as default } from "./DomainsSection.jsx"; diff --git a/client/src/pages/TunnelDetail/components/DomainsSection/styles.sass b/client/src/pages/TunnelDetail/components/DomainsSection/styles.sass new file mode 100644 index 0000000..a4e5932 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/DomainsSection/styles.sass @@ -0,0 +1,123 @@ +@use "@/common/styles/colors" + +.domains + margin-top: 1.75rem + +.domains-card + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + +.domain-list + margin: 0.875rem 1rem 0 + display: flex + flex-direction: column + gap: 0.3rem + + li + display: flex + align-items: center + gap: 0.5rem + padding: 0.5rem 0.4rem 0.5rem 0.75rem + background-color: colors.$surface-raised + border: 1px solid colors.$border + border-radius: 0.5rem + + button + display: inline-flex + align-items: center + justify-content: center + flex-shrink: 0 + width: 1.5rem + height: 1.5rem + padding: 0 + background: none + border: none + border-radius: 0.375rem + color: colors.$muted + cursor: pointer + transition: background-color 0.15s ease, color 0.15s ease + + svg + width: 0.875rem + height: 0.875rem + + &:hover:not(:disabled) + background-color: colors.$surface-hover + color: colors.$text + + &:last-child:hover:not(:disabled) + background-color: colors.$error-tint + color: colors.$error + + &:disabled + opacity: 0.5 + cursor: default + + &.spinning svg + animation: domain-spin 0.8s linear infinite + +@keyframes domain-spin + to + transform: rotate(360deg) + +.domain-main + flex: 1 + min-width: 0 + display: flex + align-items: center + flex-wrap: wrap + gap: 0.25rem 0.5rem + + a + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.8125rem + color: colors.$text + + &[href]:hover + color: colors.$primary-bright + +.domain-state + padding: 0.0625rem 0.45rem + border-radius: 0.375rem + background-color: colors.$surface-hover + color: colors.$subtext + font-size: 0.6875rem + font-weight: 600 + + &.active + background-color: colors.$success-tint + color: colors.$success + + &.pending, &.issuing + background-color: colors.$warning-tint + color: colors.$warning + + &.error + background-color: colors.$error-tint + color: colors.$error + +.domain-error, .domain-cert + width: 100% + color: colors.$muted + font-size: 0.75rem + +.domain-add + display: flex + align-items: flex-start + gap: 0.5rem + padding: 0.875rem 1rem + + .field + flex: 1 + +.domains-hint + margin: 0 + padding: 0 1rem 0.875rem + color: colors.$muted + font-size: 0.75rem + line-height: 1.5 + + code + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + color: colors.$subtext diff --git a/client/src/pages/TunnelDetail/components/StatsPanel/ChartTooltip.jsx b/client/src/pages/TunnelDetail/components/StatsPanel/ChartTooltip.jsx new file mode 100644 index 0000000..596d45a --- /dev/null +++ b/client/src/pages/TunnelDetail/components/StatsPanel/ChartTooltip.jsx @@ -0,0 +1,22 @@ +import { formatRate } from "@/common/utils/formatUtils.js"; + +export const ChartTooltip = ({ active, payload, label, series }) => { + if (!active || !payload?.length) return null; + const point = payload[0].payload; + + return ( +
+ {new Date(label).toLocaleTimeString()} + {series.map(entry => ( + + + {entry.label} + {formatRate(point[entry.key])} + + ))} + + {point.requests} {point.requests === 1 ? "request" : "requests"} + +
+ ); +}; diff --git a/client/src/pages/TunnelDetail/components/StatsPanel/StatTile.jsx b/client/src/pages/TunnelDetail/components/StatsPanel/StatTile.jsx new file mode 100644 index 0000000..76399d9 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/StatsPanel/StatTile.jsx @@ -0,0 +1,6 @@ +export const StatTile = ({ label, value, accent }) => ( +
+ {label} + {value} +
+); diff --git a/client/src/pages/TunnelDetail/components/StatsPanel/StatsPanel.jsx b/client/src/pages/TunnelDetail/components/StatsPanel/StatsPanel.jsx new file mode 100644 index 0000000..3bf14b2 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/StatsPanel/StatsPanel.jsx @@ -0,0 +1,101 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; +import { getRequest } from "@/common/utils/RequestUtil.js"; +import { formatBytes, formatRate } from "@/common/utils/formatUtils.js"; +import { StatTile } from "./StatTile.jsx"; +import { ChartTooltip } from "./ChartTooltip.jsx"; + +const POLL_INTERVAL = 2000; +const SERIES = [ + { key: "out", label: "Out", color: "var(--chart-out)" }, + { key: "in", label: "In", color: "var(--chart-in)" }, +]; + +const clock = value => new Date(value).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit" }); + +export const StatsPanel = ({ id }) => { + const [stats, setStats] = useState(null); + + const load = useCallback(async () => { + try { + setStats((await getRequest(`tunnels/${id}/stats`)).stats); + } catch { /* the tunnel may have closed while we were asking */ } + }, [id]); + + useEffect(() => { + load(); + const timer = setInterval(load, POLL_INTERVAL); + return () => clearInterval(timer); + }, [load]); + + if (!stats) return null; + + const points = stats.buckets.map(bucket => ({ + t: bucket.t, + out: Math.round(bucket.out / stats.interval), + in: Math.round(bucket.in / stats.interval), + requests: bucket.requests, + })); + const peak = points.reduce((most, point) => Math.max(most, point.in + point.out), 0); + const quiet = peak === 0; + + return ( +
+
+

Live

+ {quiet ? "idle" : `peak ${formatRate(peak)}`} +
+ +
+
+ + + + + +
+ +
+
+ Throughput +
+ {SERIES.map(series => ( + + {series.label} + + ))} +
+
+ +
+ + + + {SERIES.map(series => ( + + + + + ))} + + + + + } cursor={{ stroke: "var(--border-strong)" }} /> + {SERIES.map(series => ( + + ))} + + + {quiet &&

Nothing has come through in the last few minutes.

} +
+
+
+
+ ); +}; diff --git a/client/src/pages/TunnelDetail/components/StatsPanel/index.js b/client/src/pages/TunnelDetail/components/StatsPanel/index.js new file mode 100644 index 0000000..c27be31 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/StatsPanel/index.js @@ -0,0 +1 @@ +export { StatsPanel as default } from "./StatsPanel.jsx"; diff --git a/client/src/pages/TunnelDetail/components/StatsPanel/styles.sass b/client/src/pages/TunnelDetail/components/StatsPanel/styles.sass new file mode 100644 index 0000000..dd960ec --- /dev/null +++ b/client/src/pages/TunnelDetail/components/StatsPanel/styles.sass @@ -0,0 +1,124 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.stats + margin-top: 1.75rem + +.stats-panel + padding: 1.25rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + +.stats-tiles + display: grid + grid-template-columns: repeat(5, 1fr) + gap: 0.75rem + + @media (max-width: breakpoints.$tablet) + grid-template-columns: repeat(2, 1fr) + +.stat-tile + display: flex + flex-direction: column + gap: 0.1875rem + padding: 0.75rem 0.875rem + background-color: colors.$surface-raised + border: 1px solid colors.$border + border-radius: 0.75rem + + &.accent-out + border-color: var(--chart-out) + + &.accent-in + border-color: var(--chart-in) + +.stat-tile-label + color: colors.$muted + font-size: 0.6875rem + text-transform: uppercase + letter-spacing: 0.06em + +.stat-tile-value + font-size: 1.0625rem + font-weight: 600 + font-variant-numeric: tabular-nums + letter-spacing: -0.01em + +.stats-chart + margin: 1.25rem 0 0 + + figcaption + display: flex + align-items: center + justify-content: space-between + margin-bottom: 0.625rem + color: colors.$subtext + font-size: 0.8125rem + font-weight: 600 + +.stats-legend + display: flex + gap: 0.875rem + font-weight: 500 + + span + display: flex + align-items: center + gap: 0.375rem + color: colors.$muted + font-size: 0.75rem + + i + width: 0.5rem + height: 0.5rem + border-radius: 2px + +.stats-chart-area + position: relative + +.stats-quiet + position: absolute + inset: 0 + display: flex + align-items: center + justify-content: center + margin: 0 + color: colors.$muted + font-size: 0.8125rem + pointer-events: none + +.chart-tooltip + display: flex + flex-direction: column + gap: 0.25rem + padding: 0.625rem 0.75rem + background-color: colors.$surface-raised + border: 1px solid colors.$border-strong + border-radius: 0.625rem + box-shadow: colors.$shadow-md + font-size: 0.75rem + +.chart-tooltip-time + color: colors.$muted + font-size: 0.6875rem + +.chart-tooltip-row + display: flex + align-items: center + gap: 0.375rem + color: colors.$subtext + + i + width: 0.5rem + height: 0.5rem + border-radius: 2px + + b + margin-left: auto + padding-left: 0.75rem + color: colors.$text + font-variant-numeric: tabular-nums + + &.muted + color: colors.$muted diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/TrafficTable.jsx b/client/src/pages/TunnelDetail/components/TrafficTable/TrafficTable.jsx new file mode 100644 index 0000000..4aae514 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/TrafficTable.jsx @@ -0,0 +1,264 @@ +import "./styles.sass"; +import { useCallback, useEffect, useRef, useState } from "react"; +import Button from "@/common/components/Button"; +import Flag from "@/common/components/Flag"; +import ActionConfirmDialog from "@/common/components/ActionConfirmDialog"; +import { deleteRequest, getRequest, postRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { Activity, ArrowDown, ArrowUp, ChevronLeft, ChevronRight, CirclePause, Download, Pause, Play, Search, Trash2, X } from "lucide-react"; +import RequestPanel from "./components/RequestPanel"; +import BreakpointsBar, { PhaseIcon } from "./components/BreakpointsBar"; +import { formatTime, statusClass } from "./format.js"; +import { countryName } from "@/common/utils/country.js"; + +const POLL_INTERVAL = 1500; +const PAGE_SIZE = 50; +const METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "WS"]; +const STATUSES = [2, 3, 4, 5]; +const COLUMNS = [["time", "Time"], ["client", "Client"], ["method", "Method"], ["path", "Path"], ["status", "Status"], ["duration", "Duration"]]; +const EMPTY = { search: "", methods: [], statuses: [], countries: [] }; + +const rowClass = (...names) => names.filter(Boolean).join(" "); +const toggle = (list, value) => (list.includes(value) ? list.filter(entry => entry !== value) : [...list, value]); +const typing = () => { + const active = document.activeElement; + return active && (active.tagName === "INPUT" || active.tagName === "TEXTAREA" || active.tagName === "SELECT" || active.isContentEditable); +}; + +export const TrafficTable = ({ id, heading, focus }) => { + const { sendToast } = useToast(); + const [clearing, setClearing] = useState(false); + const [requests, setRequests] = useState([]); + const [loaded, setLoaded] = useState(false); + const [total, setTotal] = useState(0); + const [countries, setCountries] = useState([]); + const [page, setPage] = useState(0); + const [paused, setPaused] = useState(false); + const [selected, setSelected] = useState(null); + const [filter, setFilter] = useState(EMPTY); + const [search, setSearch] = useState(""); + const [sort, setSort] = useState({ by: "time", order: "desc" }); + const [breakpoints, setBreakpoints] = useState({ rules: [], held: [], now: 0 }); + const [showBreakpoints, setShowBreakpoints] = useState(false); + const [cursor, setCursor] = useState(null); + const keyState = useRef({}); + + useEffect(() => { + const timer = setTimeout(() => setFilter(current => ({ ...current, search: search.trim() })), 250); + return () => clearTimeout(timer); + }, [search]); + + useEffect(() => setPage(0), [filter, sort]); + useEffect(() => { if (focus) setSearch(focus); }, [focus]); + + const load = useCallback(async () => { + const query = new URLSearchParams({ offset: page * PAGE_SIZE, limit: PAGE_SIZE, sort: sort.by, order: sort.order }); + if (filter.search) query.set("search", filter.search); + if (filter.methods.length) query.set("methods", filter.methods.join(",")); + if (filter.statuses.length) query.set("statuses", filter.statuses.join(",")); + if (filter.countries.length) query.set("countries", filter.countries.join(",")); + try { + const data = await getRequest(`tunnels/${id}/requests?${query}`); + setTotal(data.total); + setCountries(data.countries); + setRequests(data.requests); + setLoaded(true); + } catch { + return; + } + }, [id, page, filter, sort]); + + useEffect(() => { + load(); + if (paused || page > 0) return; + const poll = setInterval(load, POLL_INTERVAL); + return () => clearInterval(poll); + }, [load, paused, page]); + + const loadBreakpoints = useCallback(async () => { + try { + setBreakpoints(await getRequest(`tunnels/${id}/breakpoints`)); + } catch { + return; + } + }, [id]); + + useEffect(() => { + loadBreakpoints(); + const poll = setInterval(loadBreakpoints, POLL_INTERVAL); + return () => clearInterval(poll); + }, [loadBreakpoints]); + + useEffect(() => { + if (selected?.held && !breakpoints.held.some(entry => entry.id === selected.id)) setSelected(null); + }, [breakpoints.held, selected]); + + const pick = entry => setSelected({ ...entry, held: true }); + + useEffect(() => { + keyState.current = { rows: [...breakpoints.held.map(entry => ({ ...entry, held: true })), ...requests], cursor, selected }; + }, [breakpoints.held, requests, cursor, selected]); + + useEffect(() => { + const onKey = event => { + if (event.altKey || event.ctrlKey || event.metaKey || typing()) return; + const { rows, cursor, selected } = keyState.current; + if (event.key === "j" || event.key === "k") { + if (rows.length === 0) return; + const at = rows.findIndex(entry => entry.id === (cursor ?? selected?.id)); + const next = event.key === "j" ? Math.min(rows.length - 1, at + 1) : Math.max(0, at - 1); + setCursor(rows[next].id); + if (selected) setSelected(rows[next]); + document.querySelector(`.traffic-table tr[data-id="${rows[next].id}"]`)?.scrollIntoView({ block: "nearest" }); + } else if (event.key === "Enter" && cursor !== null) { + const entry = rows.find(entry => entry.id === cursor); + if (entry) setSelected(entry); + } else if (event.key === "Escape") { + setCursor(null); + } else if (event.key === "r" && selected && !selected.held) { + postRequest(`tunnels/${id}/requests/${selected.id}/replay`, {}) + .then(result => sendToast("Success", result.message)) + .catch(error => sendToast("Error", error.message)); + } + }; + document.addEventListener("keydown", onKey); + return () => document.removeEventListener("keydown", onKey); + }, [id, sendToast]); + + const settle = async (held, input) => { + try { + const result = await postRequest(`tunnels/${id}/breakpoints/${held.id}`, input); + sendToast("Success", result.message); + setSelected(null); + loadBreakpoints(); + load(); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const clear = async () => { + try { + const result = await deleteRequest(`tunnels/${id}/requests`); + sendToast("Success", result.message); + setSelected(null); + if (page === 0) load(); else setPage(0); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const sortBy = key => setSort(current => ({ by: key, order: current.by === key && current.order === "desc" ? "asc" : "desc" })); + const filtering = filter.search || filter.methods.length > 0 || filter.statuses.length > 0 || filter.countries.length > 0; + const pages = Math.max(1, Math.ceil(total / PAGE_SIZE)); + const first = page * PAGE_SIZE + 1; + const last = Math.min(total, (page + 1) * PAGE_SIZE); + + return ( +
+ {selected && setSelected(null)} + onSettle={selected.held ? input => settle(selected, input) : null} />} + +
+ {heading} + {total} {total === 1 ? "request" : "requests"} +
+ {total > 0 && <> + + Export HAR + +
+ + {showBreakpoints && } + + {loaded && (total > 0 || filtering) && ( +
+ +
+ {METHODS.map(method => ( + + ))} +
+
+ {STATUSES.map(hundreds => ( + + ))} +
+ {countries.length > 0 && ( +
+ {countries.map(({ code, count }) => ( + + ))} +
+ )} + {filtering &&
+ )} + + {loaded && requests.length === 0 && breakpoints.held.length === 0 + ?
+ +

{filtering ? "Nothing matches." : "No requests yet."}

+
+ :
+ + + + {COLUMNS.map(([key, label]) => ( + + ))} + + + + {breakpoints.held.map(entry => ( + pick(entry)}> + + + + + + + + ))} + {requests.map(entry => ( + setSelected(entry)}> + + + + + + + + ))} + +
key !== "client" && sortBy(key)}> + {label} + {sort.by === key && (sort.order === "desc" ? : )} +
{formatTime(entry.time)}{entry.ip}{entry.method}{entry.path}{entry.phase === "response" ? entry.status : "paused"}{Math.round((breakpoints.now - entry.time) / 1000)}s
{formatTime(entry.time)}{entry.ip}{entry.kind === "ws" ? "WS" : entry.method}{entry.path}{entry.status}{entry.duration}ms
+ {total > PAGE_SIZE && ( +
+ {first}–{last} of {total} + + +
+ )} +
} +
+ ); +}; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/BreakpointsBar.jsx b/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/BreakpointsBar.jsx new file mode 100644 index 0000000..00a8eb2 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/BreakpointsBar.jsx @@ -0,0 +1,66 @@ +import "./styles.sass"; +import { useState } from "react"; +import Button from "@/common/components/Button"; +import Input from "@/common/components/Input"; +import Select from "@/common/components/Select"; +import { putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { ArrowLeft, ArrowLeftRight, ArrowRight, Plus, X } from "lucide-react"; + +const METHODS = [["", "Any"], ["GET", "GET"], ["POST", "POST"], ["PUT", "PUT"], ["PATCH", "PATCH"], ["DELETE", "DELETE"]].map(([value, label]) => ({ value, label })); +const PHASES = [{ value: "request", label: "Request" }, { value: "response", label: "Response" }, { value: "both", label: "Both" }]; +const PHASE_ICONS = { request: ArrowRight, response: ArrowLeft, both: ArrowLeftRight }; + +export const PhaseIcon = ({ phase }) => { + const Glyph = PHASE_ICONS[phase]; + return ; +}; + +export const BreakpointsBar = ({ tunnelId, rules, onChanged }) => { + const { sendToast } = useToast(); + const [method, setMethod] = useState(""); + const [phase, setPhase] = useState("request"); + const [path, setPath] = useState("/"); + const [busy, setBusy] = useState(false); + + const save = async next => { + setBusy(true); + try { + await putRequest(`tunnels/${tunnelId}/breakpoints`, { rules: next }); + onChanged(); + return true; + } catch (error) { + sendToast("Error", error.message); + return false; + } finally { + setBusy(false); + } + }; + + const add = async () => { + if (await save([...rules, { method, path: path.trim(), phase }])) setPath("/"); + }; + + return ( +
+
    + {rules.map((rule, index) => ( +
  • + + {rule.method || "ANY"} + {rule.path} + +
  • + ))} + {rules.length === 0 &&
  • No breakpoints. Matching requests wait until you continue or drop them.
  • } +
+
+ + { if (event.key === "Enter") { event.preventDefault(); add(); } }} /> +
+
+ ); +}; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/index.js b/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/index.js new file mode 100644 index 0000000..b16e0d0 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/index.js @@ -0,0 +1 @@ +export { BreakpointsBar as default, PhaseIcon } from "./BreakpointsBar.jsx"; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/styles.sass b/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/styles.sass new file mode 100644 index 0000000..6164dd5 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/BreakpointsBar/styles.sass @@ -0,0 +1,74 @@ +@use "@/common/styles/colors" + +.breakpoints + margin-bottom: 0.75rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + +.breakpoint-list + display: flex + flex-wrap: wrap + gap: 0.375rem + margin: 0 + padding: 0.75rem 1rem 0 + + li + display: inline-flex + align-items: center + gap: 0.5rem + padding: 0.25rem 0.375rem 0.25rem 0.625rem + background-color: colors.$surface-raised + border: 1px solid colors.$border + border-radius: 0.5rem + font-size: 0.8125rem + + code + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + + button + display: inline-flex + align-items: center + justify-content: center + width: 1.25rem + height: 1.25rem + padding: 0 + background: none + border: none + border-radius: 0.375rem + color: colors.$muted + cursor: pointer + + svg + width: 0.8125rem + height: 0.8125rem + + &:hover:not(:disabled) + background-color: colors.$error-tint + color: colors.$error + +.breakpoint-method + color: colors.$warning + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.6875rem + font-weight: 700 + +.phase-icon + width: 0.875rem + height: 0.875rem + flex-shrink: 0 + color: colors.$warning + +.breakpoint-empty + background: none + border: none + padding: 0 + color: colors.$muted + font-size: 0.8125rem + +.breakpoint-add + display: grid + grid-template-columns: 8rem 8rem 1fr auto + gap: 0.5rem + align-items: start + padding: 0.75rem 1rem diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/BodyView.jsx b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/BodyView.jsx new file mode 100644 index 0000000..cac8607 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/BodyView.jsx @@ -0,0 +1,31 @@ +import { useMemo } from "react"; +import CodeEditor from "@/common/components/CodeEditor"; +import { languageFor } from "@/common/components/CodeEditor/detect.js"; +import { decode } from "./body.js"; + +const pretty = (text, language) => { + if (language !== "json") return text; + try { + return JSON.stringify(JSON.parse(text), null, 2); + } catch { + return text; + } +}; + +export const BodyView = ({ part, headers }) => { + const type = headers.find(([name]) => name.toLowerCase() === "content-type")?.[1] || ""; + const language = languageFor(type); + const text = useMemo(() => (part.body ? decode(part.body) : null), [part.body]); + const source = useMemo(() => (text === null ? null : pretty(text, language)), [text, language]); + + if (!part.bytes) return

No body

; + if (!part.body) return

Body was not stored

; + if (text === null) return

Binary, {part.bytes} bytes

; + + return ( + <> + + {part.truncated &&

Showing the first 64 kB of {part.bytes} bytes.

} + + ); +}; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/FramesView.jsx b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/FramesView.jsx new file mode 100644 index 0000000..d1ac43d --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/FramesView.jsx @@ -0,0 +1,112 @@ +import { useEffect, useRef, useState } from "react"; +import { ArrowDown, ArrowUp, Send, Trash2 } from "lucide-react"; +import { getRequest, postRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { formatBytes } from "@/common/utils/formatUtils.js"; +import { formatTime } from "../../format.js"; +import { decode } from "./body.js"; + +const POLL_INTERVAL = 1500; +const KEEP = 500; +const OPCODES = { 1: "text", 2: "binary", 8: "close", 9: "ping", 10: "pong" }; +const FILTERS = [["all", "All"], ["in", "Received"], ["out", "Sent"]]; + +const describe = frame => { + const text = frame.payload ? decode(frame.payload) : ""; + return { ...frame, kind: OPCODES[frame.opcode] || String(frame.opcode), text: text === null ? `binary, ${formatBytes(frame.bytes)}` : text }; +}; + +export const FramesView = ({ tunnelId, entry }) => { + const { sendToast } = useToast(); + const [frames, setFrames] = useState([]); + const [draft, setDraft] = useState(""); + const [direction, setDirection] = useState("in"); + const [filter, setFilter] = useState("all"); + const [open, setOpen] = useState(true); + const [expanded, setExpanded] = useState(null); + const latest = useRef(0); + const list = useRef(null); + const pinned = useRef(true); + + useEffect(() => { + let active = true; + const load = async () => { + try { + const data = await getRequest(`tunnels/${tunnelId}/requests/${entry.id}/frames?after=${latest.current}`); + if (!active) return; + setOpen(data.open); + if (!data.frames.length) return; + latest.current = data.frames[data.frames.length - 1].id; + setFrames(previous => [...previous, ...data.frames.map(describe)].slice(-KEEP)); + } catch { + setOpen(false); + } + }; + load(); + if (!open) return () => { active = false; }; + const poll = setInterval(load, POLL_INTERVAL); + return () => { active = false; clearInterval(poll); }; + }, [tunnelId, entry.id, open]); + + useEffect(() => { + if (pinned.current && list.current) list.current.scrollTop = list.current.scrollHeight; + }, [frames]); + + const onScroll = () => { + const element = list.current; + pinned.current = element.scrollHeight - element.scrollTop - element.clientHeight < 8; + }; + + const send = async event => { + event.preventDefault(); + if (!draft) return; + try { + await postRequest(`tunnels/${tunnelId}/requests/${entry.id}/frames`, { direction, text: draft }); + setDraft(""); + pinned.current = true; + } catch (error) { + sendToast("Error", error.message); + } + }; + + const shown = filter === "all" ? frames : frames.filter(frame => frame.direction === filter); + + return ( + <> +
+

Messages

+
+ {FILTERS.map(([key, label]) => ( + + ))} + +
+ {shown.length}{open ? " · live" : ""} +
+ {shown.length === 0 + ?

{open ? "No messages yet" : "No messages"}

+ :
    + {shown.map(frame => ( +
  • setExpanded(expanded === frame.id ? null : frame.id)}> + {frame.direction === "in" ? : } + {frame.kind} + {frame.text} + {formatBytes(frame.bytes)} · {formatTime(frame.time)} +
  • + ))} +
} + {open && ( +
+
+ + +
+ setDraft(event.target.value)} spellCheck={false} + placeholder={direction === "in" ? "Message to your app" : "Message to the visitor"} /> + +
+ )} + + ); +}; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/RequestEdit.jsx b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/RequestEdit.jsx new file mode 100644 index 0000000..67d34b1 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/RequestEdit.jsx @@ -0,0 +1,52 @@ +import { useState } from "react"; +import Button from "@/common/components/Button"; +import Input from "@/common/components/Input"; +import CodeEditor from "@/common/components/CodeEditor"; +import { languageFor } from "@/common/components/CodeEditor/detect.js"; +import { Play, Send } from "lucide-react"; +import { decode } from "./body.js"; + +const parseHeaders = text => text.split("\n").map(line => line.trim()).filter(Boolean).map(line => { + const index = line.indexOf(":"); + return index === -1 ? [line, ""] : [line.slice(0, index).trim(), line.slice(index + 1).trim()]; +}); + +const contentType = headers => parseHeaders(headers).find(([name]) => name.toLowerCase() === "content-type")?.[1] || ""; + +export const RequestEdit = ({ entry, detail, onSend, onCancel, busy, held, part }) => { + const source = detail[part]; + const stored = source.body ? decode(source.body) : ""; + const [method, setMethod] = useState(entry.method); + const [path, setPath] = useState(entry.path); + const [status, setStatus] = useState(String(detail.status)); + const [headers, setHeaders] = useState(source.headers.map(pair => pair.join(": ")).join("\n")); + const [body, setBody] = useState(stored ?? ""); + const binary = stored === null; + + const submit = event => { + event.preventDefault(); + const line = part === "response" ? { status: Number(status) } : { method, path }; + onSend({ ...line, headers: parseHeaders(headers), ...(binary ? {} : { body }) }); + }; + + return ( +
+ {part === "response" + ?
+ +
+ :
+ setMethod(value.toUpperCase())} required /> + +
} + + {binary + ?

Binary body, sent as is.

+ : } +
+
+ + ); +}; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/RequestPanel.jsx b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/RequestPanel.jsx new file mode 100644 index 0000000..cedafc8 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/RequestPanel.jsx @@ -0,0 +1,243 @@ +import "./styles.sass"; +import { useEffect, useState } from "react"; +import { createPortal } from "react-dom"; +import { Ban, ExternalLink, Pencil, Play, RotateCcw, X } from "lucide-react"; +import Button from "@/common/components/Button"; +import CopyButton from "@/common/components/CopyButton"; +import Flag from "@/common/components/Flag"; +import { countryName } from "@/common/utils/country.js"; +import Loading from "@/common/components/Loading"; +import { getRequest, postRequest } from "@/common/utils/RequestUtil.js"; +import { formatBytes } from "@/common/utils/formatUtils.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { useUser } from "@/common/contexts/user.js"; +import { copyToClipboard } from "@/common/utils/clipboard.js"; +import { statusClass } from "../../format.js"; +import { BodyView } from "./BodyView.jsx"; +import { RequestEdit } from "./RequestEdit.jsx"; +import { FramesView } from "./FramesView.jsx"; +import { decode } from "./body.js"; + +const header = (list, name) => list.find(([key]) => key.toLowerCase() === name)?.[1]; + +const curlFor = (url, detail) => { + const parts = [`curl -X ${detail.method} '${url}'`]; + for (const [name, value] of detail.request.headers) { + if (!["host", "content-length"].includes(name.toLowerCase())) parts.push(`-H '${name}: ${value}'`); + } + const body = detail.request.body && decode(detail.request.body); + if (body) parts.push(`--data-raw '${body.replace(/'/g, "'\\''")}'`); + return parts.join(" \\\n "); +}; + +const rawFor = (detail, part) => { + const line = part === "request" ? `${detail.method} ${detail.path} HTTP/1.1` : `HTTP/1.1 ${detail.status}`; + return [line, ...detail[part].headers.map(([name, value]) => `${name}: ${value}`)].join("\n"); +}; + +const Card = ({ title, aside, children }) => ( +
+

{title}

{aside && {aside}}
+ {children} +
+); + +const Rows = ({ items }) => ( +
+ {items.filter(([, value]) => value !== undefined && value !== null && value !== "").map(([label, value, copy], index) => ( +
+
{label}
+
{value}{copy && }
+
+ ))} +
+); + +const Headers = ({ headers }) => ( + + {headers.length > 0 && [name, {value}])} />} + +); + +const Intelligence = ({ intel, ip }) => { + if (!intel || intel.private) { + return ( + + {intel?.ip || ip}, intel?.ip || ip], + ["Location", intel ? "Not routed on the internet" : "Unknown"], + ]} /> + + ); + } + const tags = [["tor", "Tor exit"], ["vpn", "VPN"], ["datacenter", "Datacenter"], ["blocklisted", "Blocklisted"]].filter(([key]) => intel[key]); + return ( + <> +
+
+ +
+ {intel.country ? countryName(intel.country) : "Unknown location"} + {[intel.country, intel.continent, intel.eu && "EU"].filter(Boolean).join(" · ")} +
+
{tags.map(([key, label]) => {label})}
+
+ {intel.ip}, intel.ip], + ["ASN", intel.asn && AS{intel.asn}], + ["Organization", intel.org], + ]} /> +
+

IP Geolocation by DB-IP

+ + ); +}; + +export const RequestPanel = ({ tunnelId, entry, onClose, onSettle }) => { + const { sendToast } = useToast(); + const { serverInfo } = useUser(); + const [detail, setDetail] = useState(null); + const [error, setError] = useState(null); + const [tab, setTab] = useState("request"); + const [editing, setEditing] = useState(false); + const [replaying, setReplaying] = useState(false); + const ws = entry.kind === "ws"; + const held = !!onSettle; + const heldResponse = held && entry.phase === "response"; + + useEffect(() => { + setDetail(null); + setError(null); + setEditing(false); + setTab("request"); + if (held) return setDetail(entry); + getRequest(`tunnels/${tunnelId}/requests/${entry.id}`) + .then(data => setDetail(data.request)) + .catch(failure => setError(failure.message)); + }, [tunnelId, entry, held]); + + useEffect(() => { + document.body.classList.add("panel-open"); + return () => document.body.classList.remove("panel-open"); + }, []); + + useEffect(() => { + const onKey = event => { if (event.key === "Escape") onClose(); }; + document.addEventListener("keydown", onKey); + return () => document.removeEventListener("keydown", onKey); + }, [onClose]); + + const replay = async (changes = {}) => { + setReplaying(true); + try { + const result = await postRequest(`tunnels/${tunnelId}/requests/${entry.id}/replay`, changes); + sendToast("Success", result.message); + setEditing(false); + } catch (failure) { + sendToast("Error", failure.message); + } finally { + setReplaying(false); + } + }; + + const scheme = serverInfo?.publicUrl?.startsWith("http://") ? "http" : "https"; + const url = `${scheme}://${entry.host}${entry.path}`; + const intel = entry.intel; + const tabs = held + ? [["request", "Request"], ...(heldResponse ? [["response", "Response"]] : [])] + : [["request", "Request"], ws ? ["frames", "Messages"] : ["response", "Response"], ["intel", "IP Intelligence"]]; + + return createPortal( + , + document.body, + ); +}; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/body.js b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/body.js new file mode 100644 index 0000000..16bad95 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/body.js @@ -0,0 +1,7 @@ +export const decode = value => { + try { + return new TextDecoder("utf-8", { fatal: true }).decode(Uint8Array.from(atob(value), c => c.charCodeAt(0))); + } catch { + return null; + } +}; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/index.js b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/index.js new file mode 100644 index 0000000..810265c --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/index.js @@ -0,0 +1 @@ +export { RequestPanel as default } from "./RequestPanel.jsx"; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/styles.sass b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/styles.sass new file mode 100644 index 0000000..646eb49 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/components/RequestPanel/styles.sass @@ -0,0 +1,389 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.request-panel + position: fixed + top: 3.5rem + right: 0 + bottom: 0 + z-index: 30 + display: flex + flex-direction: column + width: min(40rem, 100vw) + background-color: colors.$background + border-left: 1px solid colors.$border-strong + box-shadow: colors.$shadow-lg + animation: panel-in 0.18s ease + + @media (max-width: breakpoints.$mobile) + top: 0 + z-index: 60 + +@keyframes panel-in + from + transform: translateX(1rem) + opacity: 0 + to + transform: none + opacity: 1 + +.panel-head + display: flex + align-items: center + gap: 0.625rem + min-width: 0 + padding: 0.75rem 1rem + border-bottom: 1px solid colors.$border + +.panel-method + flex-shrink: 0 + color: colors.$primary + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.8125rem + font-weight: 700 + +.panel-path + flex: 1 + min-width: 0 + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.9375rem + +.panel-actions + display: flex + gap: 0.125rem + flex-shrink: 0 + +.panel-scroll + flex: 1 + min-height: 0 + overflow-y: auto + padding: 1rem + + > * + * + margin-top: 0.75rem + +.panel-error + margin: 0 + color: colors.$error + font-size: 0.875rem + +.panel-card + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + overflow: hidden + +.panel-card-head + display: flex + align-items: center + justify-content: space-between + gap: 0.5rem + padding: 0.75rem 1rem + + h3 + font-size: 0.875rem + font-weight: 600 + + > span + color: colors.$muted + font-size: 0.75rem + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + +.panel-rows + margin: 0 + + > div + display: grid + grid-template-columns: 8rem 1fr + gap: 0.75rem + align-items: center + padding: 0.4375rem 1rem + font-size: 0.8125rem + border-top: 1px solid colors.$border + + dt + color: colors.$muted + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + + dd + display: flex + align-items: center + gap: 0.375rem + min-width: 0 + margin: 0 + color: colors.$text + overflow-wrap: anywhere + + > .mono, > a + min-width: 0 + overflow: hidden + text-overflow: ellipsis + + a + color: colors.$text + + svg + width: 0.75rem + height: 0.75rem + vertical-align: -0.0625rem + color: colors.$muted + + &:hover + color: colors.$primary-bright + + .mono + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.75rem + + .copy-button + margin-left: auto + +.panel-card > .panel-rows > div:first-child + border-top: none + +.panel-client + display: inline-flex + align-items: center + gap: 0.5rem + +.panel-tabs + display: flex + gap: 0.25rem + border-bottom: 1px solid colors.$border + + button + padding: 0.5rem 0.75rem + margin-bottom: -1px + background: none + border: none + border-bottom: 2px solid transparent + color: colors.$muted + font-family: inherit + font-size: 0.8125rem + font-weight: 500 + cursor: pointer + + &:hover + color: colors.$text + + &.active + color: colors.$text + border-bottom-color: colors.$primary + +.panel-raw + margin: 0 + padding: 0.75rem 1rem + border-top: 1px solid colors.$border + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.75rem + line-height: 1.6 + color: colors.$subtext + white-space: pre-wrap + word-break: break-all + +.panel-card .request-body-empty, .panel-card .request-body-note + margin: 0 + padding: 0.75rem 1rem + border-top: 1px solid colors.$border + +.request-body-empty, .request-body-note + color: colors.$muted + font-size: 0.8125rem + +.panel-country + display: flex + align-items: center + gap: 0.875rem + padding: 1rem + + > div:not(.panel-tags) + display: flex + flex-direction: column + gap: 0.125rem + min-width: 0 + + strong + font-size: 1rem + font-weight: 600 + + span + color: colors.$muted + font-size: 0.75rem + +.panel-tags + display: flex + flex-wrap: wrap + gap: 0.375rem + margin-left: auto + +.panel-tag + padding: 0.125rem 0.5rem + border-radius: 0.375rem + background-color: colors.$warning-tint + color: colors.$warning + font-size: 0.6875rem + font-weight: 600 + + &.blocklisted + background-color: colors.$error-tint + color: colors.$error + + &.datacenter + background-color: colors.$surface-hover + color: colors.$subtext + +.panel-attribution + margin: 0 + color: colors.$muted + font-size: 0.6875rem + text-align: right + + a + color: colors.$muted + + &:hover + color: colors.$text + +.request-edit + display: flex + flex-direction: column + gap: 0.5rem + +.request-edit-line + display: grid + grid-template-columns: 7rem 1fr + gap: 0.5rem + + input + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + +.request-edit-actions + display: flex + justify-content: flex-end + gap: 0.5rem + margin-top: 0.5rem + +.frames + max-height: 28rem + overflow-y: auto + overscroll-behavior: contain + +.frame + display: grid + grid-template-columns: 1rem 3.25rem 1fr auto + align-items: baseline + gap: 0.625rem + padding: 0.375rem 1rem + border-top: 1px solid colors.$border + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.75rem + cursor: pointer + + svg + width: 0.75rem + height: 0.75rem + align-self: center + color: var(--chart-in) + + &.out svg + color: var(--chart-out) + + &.expanded .frame-payload + white-space: pre-wrap + word-break: break-all + +.frame-kind + color: colors.$muted + +.frame-payload + min-width: 0 + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + color: colors.$text + +.frame-meta + color: colors.$muted + white-space: nowrap + +.frame-send + display: flex + align-items: center + gap: 0.5rem + padding: 0.5rem 0.75rem + border-top: 1px solid colors.$border + + input + flex: 1 + min-width: 0 + padding: 0.4rem 0.625rem + background-color: colors.$background + border: 1px solid colors.$border + border-radius: 0.5rem + color: colors.$text + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.75rem + + &:focus + outline: none + border-color: colors.$primary + +.frame-tools + display: flex + align-items: center + gap: 0.125rem + margin-left: auto + margin-right: 0.75rem + +.frame-tools button, .frame-target button, .frame-submit + display: inline-flex + align-items: center + gap: 0.3rem + height: 1.75rem + padding: 0 0.5rem + background: none + border: none + border-radius: 0.5rem + color: colors.$muted + font-family: inherit + font-size: 0.75rem + cursor: pointer + + svg + width: 0.8125rem + height: 0.8125rem + + &:hover:not(:disabled), &.active + background-color: colors.$surface-hover + color: colors.$text + + &:disabled + opacity: 0.4 + cursor: default + +.frame-target + display: flex + gap: 0.125rem + padding: 0.125rem + background-color: colors.$background + border: 1px solid colors.$border + border-radius: 0.625rem + + button + height: 1.5rem + border-radius: 0.45rem + + &.in.active svg + color: var(--chart-in) + + &.out.active svg + color: var(--chart-out) + +.frame-submit + border: 1px solid colors.$border + color: colors.$subtext diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/format.js b/client/src/pages/TunnelDetail/components/TrafficTable/format.js new file mode 100644 index 0000000..ad20162 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/format.js @@ -0,0 +1,10 @@ +export const statusClass = status => { + if (status >= 500) return "error"; + if (status >= 400) return "warn"; + if (status >= 300) return "info"; + if (status >= 200) return "ok"; + return ""; +}; + +export const formatTime = time => new Date(time).toLocaleTimeString([], { hour12: false }) + + "." + String(new Date(time).getMilliseconds()).padStart(3, "0"); diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/index.js b/client/src/pages/TunnelDetail/components/TrafficTable/index.js new file mode 100644 index 0000000..f5c49a5 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/index.js @@ -0,0 +1 @@ +export { TrafficTable as default } from "./TrafficTable.jsx"; diff --git a/client/src/pages/TunnelDetail/components/TrafficTable/styles.sass b/client/src/pages/TunnelDetail/components/TrafficTable/styles.sass new file mode 100644 index 0000000..4d490bd --- /dev/null +++ b/client/src/pages/TunnelDetail/components/TrafficTable/styles.sass @@ -0,0 +1,295 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.traffic + margin-top: 1.75rem + +.traffic-head + display: flex + align-items: center + gap: 0.625rem + margin-bottom: 0.75rem + + h2 + font-size: 1rem + font-weight: 600 + letter-spacing: -0.015em + +.traffic-count + color: colors.$muted + font-size: 0.8125rem + +.traffic-spacer + flex: 1 + +.traffic-filters + display: flex + align-items: center + flex-wrap: wrap + gap: 0.5rem + margin-bottom: 0.75rem + +.traffic-search + display: flex + align-items: center + gap: 0.375rem + flex: 1 + min-width: 12rem + max-width: 20rem + padding: 0 0.5rem 0 0.625rem + height: 2rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.625rem + + &:focus-within + border-color: colors.$primary + + svg + width: 0.875rem + height: 0.875rem + flex-shrink: 0 + color: colors.$muted + + input + flex: 1 + min-width: 0 + background: none + border: none + color: colors.$text + font-family: inherit + font-size: 0.8125rem + + &:focus + outline: none + + button + display: inline-flex + padding: 0 + background: none + border: none + color: colors.$muted + cursor: pointer + + &:hover + color: colors.$text + +.traffic-chips + display: flex + gap: 0.125rem + padding: 0.125rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.625rem + + button + height: 1.625rem + padding: 0 0.5rem + background: none + border: none + border-radius: 0.45rem + color: colors.$muted + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.6875rem + font-weight: 600 + cursor: pointer + + &:hover + color: colors.$text + + &.active + background-color: colors.$surface-hover + color: colors.$text + + &.ok.active + color: colors.$success + + &.info.active + color: colors.$primary-bright + + &.warn.active + color: colors.$warning + + &.error.active + color: colors.$error + +.traffic-countries + flex-wrap: wrap + + button + display: inline-flex + align-items: center + gap: 0.3rem + + small + font-size: 0.625rem + font-weight: 500 + opacity: 0.7 + +.traffic-empty + display: flex + flex-direction: column + align-items: center + gap: 0.5rem + padding: 2.5rem 1rem + text-align: center + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + + svg + color: colors.$muted + opacity: 0.7 + + p + color: colors.$muted + font-size: 0.875rem + +.traffic-table + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + overflow: hidden + + table + width: 100% + border-collapse: collapse + font-size: 0.8125rem + + th + text-align: left + padding: 0.625rem 0.875rem + color: colors.$muted + font-size: 0.6875rem + font-weight: 600 + text-transform: uppercase + letter-spacing: 0.06em + border-bottom: 1px solid colors.$border + white-space: nowrap + user-select: none + + svg + width: 0.75rem + height: 0.75rem + margin-left: 0.25rem + vertical-align: -0.125rem + + &.sortable + cursor: pointer + + &:hover + color: colors.$text + + td + padding: 0.5rem 0.875rem + border-bottom: 1px solid colors.$border + white-space: nowrap + vertical-align: middle + + tbody tr + cursor: pointer + + &:hover + background-color: colors.$surface-hover + + &.selected + background-color: colors.$primary-tint + + &.cursor + box-shadow: inset 2px 0 0 colors.$primary + + &.held + background-color: colors.$warning-tint + + .held .phase-icon + margin-right: 0.375rem + vertical-align: -0.125rem + + &:focus-visible + outline: 2px solid colors.$primary + outline-offset: -2px + + .mono + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + + .dim + color: colors.$muted + font-variant-numeric: tabular-nums + + .client .flag + margin-right: 0.5rem + + .path + width: 100% + max-width: 0 + overflow: hidden + text-overflow: ellipsis + color: colors.$subtext + + @media (max-width: breakpoints.$mobile) + th:nth-child(2), td:nth-child(2), th:nth-child(6), td:nth-child(6) + display: none + +.traffic-pages + display: flex + align-items: center + justify-content: flex-end + gap: 0.25rem + padding: 0.375rem 0.625rem + border-top: 1px solid colors.$border + color: colors.$muted + font-size: 0.75rem + font-variant-numeric: tabular-nums + + span + margin-right: 0.5rem + + button + display: inline-flex + align-items: center + justify-content: center + width: 1.75rem + height: 1.75rem + background: none + border: 1px solid colors.$border + border-radius: 0.5rem + color: colors.$subtext + cursor: pointer + + svg + width: 0.875rem + height: 0.875rem + + &:hover:not(:disabled) + background-color: colors.$surface-hover + color: colors.$text + + &:disabled + opacity: 0.35 + cursor: default + +.status + display: inline-block + padding: 0.0625rem 0.4rem + border-radius: 0.375rem + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.75rem + font-weight: 600 + background-color: colors.$surface-hover + color: colors.$subtext + + &.ok + background-color: colors.$success-tint + color: colors.$success + + &.info + background-color: colors.$primary-tint + color: colors.$primary-bright + + &.warn + background-color: colors.$warning-tint + color: colors.$warning + + &.error + background-color: colors.$error-tint + color: colors.$error diff --git a/client/src/pages/TunnelDetail/components/VisitorsTable/VisitorsTable.jsx b/client/src/pages/TunnelDetail/components/VisitorsTable/VisitorsTable.jsx new file mode 100644 index 0000000..2817946 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/VisitorsTable/VisitorsTable.jsx @@ -0,0 +1,156 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import Button from "@/common/components/Button"; +import Flag from "@/common/components/Flag"; +import ActionConfirmDialog from "@/common/components/ActionConfirmDialog"; +import { deleteRequest, getRequest, putRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import { countryName } from "@/common/utils/country.js"; +import { formatRelative } from "@/common/utils/formatUtils.js"; +import { ArrowDown, ArrowUp, Ban, ChevronLeft, ChevronRight, Search, ShieldCheck, Trash2, Users } from "lucide-react"; + +const POLL_INTERVAL = 1500; +const PAGE_SIZE = 50; +const COLUMNS = [["ip", "Visitor"], [null, "Location"], [null, "Network"], ["requests", "Requests"], ["blocked", "Blocked"], ["first", "First seen"], ["last", "Last seen"]]; +const TAGS = ["tor", "vpn", "datacenter", "blocklisted"]; +const REASONS = { address: "address", country: "country", tor: "Tor", vpn: "VPN", datacenter: "datacenter", blocklist: "blocklist" }; + +export const VisitorsTable = ({ tunnel, heading, onSaved, onInspect }) => { + const { sendToast } = useToast(); + const [visitors, setVisitors] = useState([]); + const [loaded, setLoaded] = useState(false); + const [total, setTotal] = useState(0); + const [page, setPage] = useState(0); + const [clearing, setClearing] = useState(false); + const [busy, setBusy] = useState(false); + const [sort, setSort] = useState({ by: "last", order: "desc" }); + const blockedIps = tunnel.access.block.ips; + + useEffect(() => setPage(0), [sort]); + + const load = useCallback(async () => { + const query = new URLSearchParams({ offset: page * PAGE_SIZE, limit: PAGE_SIZE, sort: sort.by, order: sort.order }); + try { + const data = await getRequest(`tunnels/${tunnel.id}/visitors?${query}`); + setTotal(data.total); + setVisitors(data.visitors); + setLoaded(true); + } catch { + return; + } + }, [tunnel.id, page, sort]); + + useEffect(() => { + load(); + if (page > 0) return; + const poll = setInterval(load, POLL_INTERVAL); + return () => clearInterval(poll); + }, [load, page]); + + const clear = async () => { + try { + const result = await deleteRequest(`tunnels/${tunnel.id}/visitors`); + sendToast("Success", result.message); + if (page === 0) load(); else setPage(0); + } catch (error) { + sendToast("Error", error.message); + } + }; + + const toggleBlock = async ip => { + const ips = blockedIps.includes(ip) ? blockedIps.filter(entry => entry !== ip) : [...blockedIps, ip]; + setBusy(true); + try { + await putRequest(`tunnels/${tunnel.id}/access`, { block: { ips } }); + sendToast("Success", blockedIps.includes(ip) ? `${ip} unblocked` : `${ip} blocked`); + onSaved(); + } catch (error) { + sendToast("Error", error.message); + } finally { + setBusy(false); + } + }; + + const sortBy = key => setSort(current => ({ by: key, order: current.by === key && current.order === "desc" ? "asc" : "desc" })); + const pages = Math.max(1, Math.ceil(total / PAGE_SIZE)); + const first = page * PAGE_SIZE + 1; + const last = Math.min(total, (page + 1) * PAGE_SIZE); + + return ( +
+ +
+ {heading} + {total} {total === 1 ? "visitor" : "visitors"} +
+ {total > 0 &&
+ + {loaded && visitors.length === 0 + ?
+ +

No visitors yet.

+
+ :
+ + + + {COLUMNS.map(([key, label]) => ( + + ))} + + + + {visitors.map(visitor => { + const intel = visitor.intel; + const blocked = blockedIps.includes(visitor.ip); + return ( + + + + + + + + + + + ); + })} + +
key && sortBy(key)}> + {label} + {key && sort.by === key && (sort.order === "desc" ? : )} + +
{visitor.ip}{intel.private ? "Private network" : intel.country ? countryName(intel.country) : "—"} +
+ {intel.org || "—"} + {TAGS.filter(tag => intel[tag]).map(tag => {tag})} +
+
{visitor.requests} + {visitor.blocked > 0 + ? {visitor.blocked} + : 0} + {formatRelative(visitor.firstSeen)}{formatRelative(visitor.lastSeen)} + {onInspect && visitor.requests > 0 && ( + + )} + {!intel.private && ( + + )} +
+ {total > PAGE_SIZE && ( +
+ {first}–{last} of {total} + + +
+ )} +
} +
+ ); +}; diff --git a/client/src/pages/TunnelDetail/components/VisitorsTable/index.js b/client/src/pages/TunnelDetail/components/VisitorsTable/index.js new file mode 100644 index 0000000..e78a1fe --- /dev/null +++ b/client/src/pages/TunnelDetail/components/VisitorsTable/index.js @@ -0,0 +1 @@ +export { VisitorsTable as default } from "./VisitorsTable.jsx"; diff --git a/client/src/pages/TunnelDetail/components/VisitorsTable/styles.sass b/client/src/pages/TunnelDetail/components/VisitorsTable/styles.sass new file mode 100644 index 0000000..5fd8bc3 --- /dev/null +++ b/client/src/pages/TunnelDetail/components/VisitorsTable/styles.sass @@ -0,0 +1,193 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.visitors + margin-top: 1.75rem + +.visitors-head + display: flex + align-items: center + gap: 0.625rem + margin-bottom: 0.75rem + +.visitors-count + color: colors.$muted + font-size: 0.8125rem + +.visitors-spacer + flex: 1 + +.visitors-empty + display: flex + flex-direction: column + align-items: center + gap: 0.5rem + padding: 2.5rem 1rem + text-align: center + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + + svg + color: colors.$muted + opacity: 0.7 + + p + color: colors.$muted + font-size: 0.875rem + +.visitors-table + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + overflow: hidden + + table + width: 100% + border-collapse: collapse + font-size: 0.8125rem + + th + text-align: left + padding: 0.625rem 0.875rem + color: colors.$muted + font-size: 0.6875rem + font-weight: 600 + text-transform: uppercase + letter-spacing: 0.06em + border-bottom: 1px solid colors.$border + white-space: nowrap + user-select: none + + svg + width: 0.75rem + height: 0.75rem + margin-left: 0.25rem + vertical-align: -0.125rem + + &.sortable + cursor: pointer + + &:hover + color: colors.$text + + td + padding: 0.5rem 0.875rem + border-bottom: 1px solid colors.$border + white-space: nowrap + vertical-align: middle + + tbody tr:hover + background-color: colors.$surface-hover + + tbody tr.blocked .visitor + color: colors.$error + + .mono + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-variant-numeric: tabular-nums + + .dim + color: colors.$muted + + .visitor .flag + margin-right: 0.5rem + + .network + display: flex + align-items: center + gap: 0.375rem + max-width: 22rem + + > span:first-child + min-width: 0 + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + color: colors.$subtext + + .visitor-blocked + color: colors.$error + font-weight: 600 + + .actions + text-align: right + width: 1% + + button + display: inline-flex + align-items: center + justify-content: center + width: 1.75rem + height: 1.75rem + padding: 0 + background: none + border: none + border-radius: 0.5rem + color: colors.$muted + cursor: pointer + + svg + width: 0.875rem + height: 0.875rem + + &:hover:not(:disabled) + background-color: colors.$surface-hover + color: colors.$text + + &.block:hover:not(:disabled) + background-color: colors.$error-tint + color: colors.$error + + &.unblock + color: colors.$error + + &.unblock:hover:not(:disabled) + background-color: colors.$success-tint + color: colors.$success + + &:disabled + opacity: 0.4 + cursor: default + + @media (max-width: breakpoints.$mobile) + th:nth-child(3), td:nth-child(3), th:nth-child(6), td:nth-child(6) + display: none + +.visitors-pages + display: flex + align-items: center + justify-content: flex-end + gap: 0.25rem + padding: 0.375rem 0.625rem + border-top: 1px solid colors.$border + color: colors.$muted + font-size: 0.75rem + font-variant-numeric: tabular-nums + + span + margin-right: 0.5rem + + button + display: inline-flex + align-items: center + justify-content: center + width: 1.75rem + height: 1.75rem + background: none + border: 1px solid colors.$border + border-radius: 0.5rem + color: colors.$subtext + cursor: pointer + + svg + width: 0.875rem + height: 0.875rem + + &:hover:not(:disabled) + background-color: colors.$surface-hover + color: colors.$text + + &:disabled + opacity: 0.35 + cursor: default diff --git a/client/src/pages/TunnelDetail/index.js b/client/src/pages/TunnelDetail/index.js new file mode 100644 index 0000000..4c0199f --- /dev/null +++ b/client/src/pages/TunnelDetail/index.js @@ -0,0 +1 @@ +export { TunnelDetail as default } from "./TunnelDetail.jsx"; diff --git a/client/src/pages/TunnelDetail/styles.sass b/client/src/pages/TunnelDetail/styles.sass new file mode 100644 index 0000000..78d9aad --- /dev/null +++ b/client/src/pages/TunnelDetail/styles.sass @@ -0,0 +1,186 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.detail-back + display: inline-flex + align-items: center + gap: 0.35rem + margin-bottom: 0.875rem + padding: 0 + background: none + border: none + color: colors.$muted + font-family: inherit + font-size: 0.8125rem + cursor: pointer + transition: color 0.15s ease + + &:hover + color: colors.$text + + svg + width: 1rem + height: 1rem + +.detail-head + display: flex + align-items: center + gap: 1rem + min-width: 0 + margin-bottom: 1rem + + h1 + font-size: 1.375rem + font-weight: 600 + letter-spacing: -0.025em + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + +.detail-actions + display: flex + gap: 0.375rem + margin-left: auto + flex-shrink: 0 + +.detail-heading + min-width: 0 + + h1 + display: flex + align-items: center + gap: 0.5rem + +.detail-pin + width: 1rem + height: 1rem + flex-shrink: 0 + color: colors.$primary + +.detail-mode + padding: 0.1rem 0.45rem + border: 1px solid colors.$border + border-radius: 0.4rem + color: colors.$muted + font-size: 0.6875rem + font-weight: 600 + letter-spacing: 0.04em + text-transform: uppercase + + &.subdomain + color: colors.$primary + border-color: colors.$primary-tint + +.mode-switch + display: inline-flex + padding: 0.15rem + background-color: colors.$surface-raised + border: 1px solid colors.$border + border-radius: 0.55rem + + button + padding: 0.25rem 0.6rem + background: none + border: none + border-radius: 0.4rem + color: colors.$muted + font-family: inherit + font-size: 0.75rem + cursor: pointer + + &.active + background-color: colors.$surface + color: colors.$text + + &:disabled + opacity: 0.6 + cursor: default + +.detail-sub + display: flex + align-items: center + gap: 0.375rem + margin: 0.375rem 0 0 + color: colors.$muted + font-size: 0.8125rem + white-space: nowrap + overflow: hidden + text-overflow: ellipsis + + .mono + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + +.detail-dot + width: 0.5rem + height: 0.5rem + flex-shrink: 0 + border-radius: 50% + background-color: colors.$success + + &.offline + background-color: colors.$warning + + &.dormant + background-color: colors.$border-strong + +.detail-gone + text-align: center + padding: 4rem 1rem + + h1 + font-size: 1.25rem + font-weight: 600 + margin-bottom: 0.5rem + + p + color: colors.$muted + margin-bottom: 1.25rem + + code + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + color: colors.$primary-bright + +.section-head + display: flex + align-items: baseline + gap: 0.625rem + margin-bottom: 0.75rem + + h2 + font-size: 1rem + font-weight: 600 + letter-spacing: -0.015em + +.section-hint + color: colors.$muted + font-size: 0.8125rem + +.detail-open + margin-top: 0.75rem + +.detail-views + display: flex + gap: 0.125rem + padding: 0.125rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.625rem + + button + height: 1.75rem + padding: 0 0.75rem + background: none + border: none + border-radius: 0.45rem + color: colors.$muted + font-family: inherit + font-size: 0.8125rem + font-weight: 600 + cursor: pointer + + &:hover + color: colors.$text + + &.active + background-color: colors.$surface-hover + color: colors.$text diff --git a/client/src/pages/Tunnels/Tunnels.jsx b/client/src/pages/Tunnels/Tunnels.jsx new file mode 100644 index 0000000..df450f9 --- /dev/null +++ b/client/src/pages/Tunnels/Tunnels.jsx @@ -0,0 +1,65 @@ +import "./styles.sass"; +import { useCallback, useEffect, useState } from "react"; +import Loading from "@/common/components/Loading"; +import { getRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; +import Button from "@/common/components/Button"; +import TunnelItem from "./components/TunnelItem"; +import EmptyState from "./components/EmptyState"; +import ReserveDialog from "./components/ReserveDialog"; +import { Bookmark } from "lucide-react"; + +const POLL_INTERVAL = 3000; + +export const Tunnels = () => { + const { sendToast } = useToast(); + const [data, setData] = useState(null); + const [persistent, setPersistent] = useState([]); + const [reserving, setReserving] = useState(false); + const [now, setNow] = useState(() => Date.now()); + + const load = useCallback(async () => { + try { + const [live, saved] = await Promise.all([getRequest("tunnels"), getRequest("persistent")]); + setData(live); + setPersistent(saved.tunnels); + setNow(Date.now()); + } catch (error) { + if (error.code !== 401) sendToast("Error", "Could not load tunnels"); + } + }, [sendToast]); + + useEffect(() => { + load(); + const poll = setInterval(load, POLL_INTERVAL); + const tick = setInterval(() => setNow(Date.now()), 1000); + return () => { clearInterval(poll); clearInterval(tick); }; + }, [load]); + + const tunnels = data?.tunnels || []; + const online = tunnels.filter(tunnel => tunnel.online).length; + const dormant = persistent.filter(entry => !entry.live).map(entry => ({ + id: entry.name, mode: "http", url: entry.url, online: false, persistent: true, dormant: true, + owner: entry.owner, access: entry.access, domains: entry.domains, + })); + + return ( +
+ +
+

Tunnels

+
+ {data && {online} of {tunnels.length} online} +
+
+ {!data && } + {data && (tunnels.length + dormant.length === 0 + ? + :
+ {tunnels.map(tunnel => )} + {dormant.map(tunnel => )} +
)} +
+ ); +}; diff --git a/client/src/pages/Tunnels/components/EmptyState/EmptyState.jsx b/client/src/pages/Tunnels/components/EmptyState/EmptyState.jsx new file mode 100644 index 0000000..29f9722 --- /dev/null +++ b/client/src/pages/Tunnels/components/EmptyState/EmptyState.jsx @@ -0,0 +1,55 @@ +import "./styles.sass"; +import { useEffect, useState } from "react"; +import { ChevronDown, Download, Waypoints } from "lucide-react"; +import CopyField from "@/common/components/CopyField"; +import { detectPlatform, downloadsFor, installCommand } from "@/common/utils/platform.js"; + +export const EmptyState = () => { + const [platform, setPlatform] = useState({ os: null, arch: null }); + const [open, setOpen] = useState(false); + const downloads = downloadsFor(platform); + const [primary, ...rest] = downloads.files; + + useEffect(() => { + detectPlatform().then(setPlatform); + }, []); + + return ( +
+
+ +

No tunnels yet

+

Tunnels show up here the moment the CLI shares something.

+ +
+ + {open &&
    +
  1. +

    Get the CLI

    +

    One line, picks the right build for this machine.

    + + {primary && + + {primary.label} + } +
    + {rest.map(entry => {entry.label})} + All releases +
    +
  2. +
  3. +

    Link this device

    +

    Sends you back here to confirm, then the device stays signed in.

    + +
  4. +
  5. +

    Share a port

    +

    Swap 3000 for the port your app runs on, or share a folder with frislit serve .

    + +
  6. +
} +
+ ); +}; diff --git a/client/src/pages/Tunnels/components/EmptyState/index.js b/client/src/pages/Tunnels/components/EmptyState/index.js new file mode 100644 index 0000000..f199036 --- /dev/null +++ b/client/src/pages/Tunnels/components/EmptyState/index.js @@ -0,0 +1 @@ +export { EmptyState as default } from "./EmptyState.jsx"; diff --git a/client/src/pages/Tunnels/components/EmptyState/styles.sass b/client/src/pages/Tunnels/components/EmptyState/styles.sass new file mode 100644 index 0000000..5cfe23a --- /dev/null +++ b/client/src/pages/Tunnels/components/EmptyState/styles.sass @@ -0,0 +1,151 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.empty + border: 1px dashed colors.$border-strong + border-radius: 0.875rem + padding: 2.5rem 2rem + +.empty-head + display: flex + flex-direction: column + align-items: center + text-align: center + gap: 0.5rem + + svg + color: colors.$muted + opacity: 0.7 + + h2 + margin: 0 + font-size: 1.0625rem + font-weight: 600 + letter-spacing: -0.01em + + p + margin: 0 + max-width: 26rem + color: colors.$subtext + font-size: 0.875rem + +.empty-toggle + display: inline-flex + align-items: center + gap: 0.25rem + margin-top: 0.5rem + padding: 0.375rem 0.75rem + background: none + border: 1px solid colors.$border + border-radius: 0.625rem + color: colors.$subtext + font-family: inherit + font-size: 0.8125rem + font-weight: 500 + cursor: pointer + transition: background-color 0.15s ease, color 0.15s ease + + svg + width: 0.875rem + height: 0.875rem + transition: transform 0.15s ease + + &.open svg + transform: rotate(180deg) + + &:hover + background-color: colors.$surface + color: colors.$text + +.empty-steps + display: grid + grid-template-columns: repeat(3, 1fr) + gap: 1.5rem + counter-reset: step + margin: 2.5rem 0 0 + padding: 0 + list-style: none + + @media (max-width: breakpoints.$mobile) + grid-template-columns: 1fr + gap: 2rem + + li + display: grid + grid-template-rows: subgrid + grid-row: span 6 + justify-items: start + align-content: start + gap: 0.375rem + counter-increment: step + + @media (max-width: breakpoints.$mobile) + display: flex + flex-direction: column + align-items: flex-start + + &::before + content: counter(step) + display: flex + align-items: center + justify-content: center + width: 1.5rem + height: 1.5rem + margin-bottom: 0.375rem + border-radius: 0.5rem + background-color: colors.$primary-tint + color: colors.$primary + font-size: 0.75rem + font-weight: 700 + + h3 + margin: 0 + font-size: 0.9375rem + font-weight: 600 + + p + margin: 0 0 0.5rem + color: colors.$subtext + font-size: 0.8125rem + line-height: 1.5 + + code + color: colors.$primary + font-size: 0.8125rem + + .copy-field + width: 100% + +.empty-download + display: inline-flex + align-items: center + gap: 0.5rem + margin-top: 0.75rem + border-radius: 0.75rem + padding: 0.5rem 1rem + background-color: colors.$primary-bright + color: colors.$on-primary + font-size: 0.875rem + font-weight: 600 + transition: background-color 0.15s ease + + svg + width: 1.0625rem + height: 1.0625rem + + &:hover + background-color: colors.$primary-hover + +.empty-platforms + display: flex + flex-wrap: wrap + gap: 0.25rem 0.875rem + margin-top: 0.75rem + + a + color: colors.$muted + font-size: 0.8125rem + transition: color 0.15s ease + + &:hover + color: colors.$text diff --git a/client/src/pages/Tunnels/components/ReserveDialog/ReserveDialog.jsx b/client/src/pages/Tunnels/components/ReserveDialog/ReserveDialog.jsx new file mode 100644 index 0000000..58f2310 --- /dev/null +++ b/client/src/pages/Tunnels/components/ReserveDialog/ReserveDialog.jsx @@ -0,0 +1,52 @@ +import "./styles.sass"; +import { useState } from "react"; +import { DialogProvider } from "@/common/components/Dialog"; +import Button from "@/common/components/Button"; +import Input from "@/common/components/Input"; +import { postRequest } from "@/common/utils/RequestUtil.js"; +import { useToast } from "@/common/contexts/toast.js"; + +export const ReserveDialog = ({ open, setOpen, onReserved }) => { + const { sendToast } = useToast(); + const [name, setName] = useState(""); + const [busy, setBusy] = useState(false); + + const close = () => { + setOpen(false); + setName(""); + }; + + const submit = async event => { + event.preventDefault(); + setBusy(true); + try { + const result = await postRequest("persistent", { name: name.trim().toLowerCase() }); + sendToast("Success", result.message); + close(); + onReserved?.(result.tunnel); + } catch (error) { + sendToast("Error", error.message); + } finally { + setBusy(false); + } + }; + + return ( + +
+
+

Reserve a name.

+

Reserved for your account, with its own access rules and domains.

+
+ + + +
+
+
+
+ ); +}; diff --git a/client/src/pages/Tunnels/components/ReserveDialog/index.js b/client/src/pages/Tunnels/components/ReserveDialog/index.js new file mode 100644 index 0000000..4362bc1 --- /dev/null +++ b/client/src/pages/Tunnels/components/ReserveDialog/index.js @@ -0,0 +1 @@ +export { ReserveDialog as default } from "./ReserveDialog.jsx"; diff --git a/client/src/pages/Tunnels/components/ReserveDialog/styles.sass b/client/src/pages/Tunnels/components/ReserveDialog/styles.sass new file mode 100644 index 0000000..716391e --- /dev/null +++ b/client/src/pages/Tunnels/components/ReserveDialog/styles.sass @@ -0,0 +1,22 @@ +@use "@/common/styles/colors" + +.reserve + display: flex + flex-direction: column + gap: 1rem + +.reserve-head + h2 + font-size: 1.25rem + + p + margin: 0.5rem 0 0 + color: colors.$subtext + font-size: 0.8125rem + line-height: 1.55 + +.reserve-actions + display: flex + justify-content: flex-end + gap: 0.5rem + margin-top: 0.25rem diff --git a/client/src/pages/Tunnels/components/TunnelItem/TunnelItem.jsx b/client/src/pages/Tunnels/components/TunnelItem/TunnelItem.jsx new file mode 100644 index 0000000..c6e973d --- /dev/null +++ b/client/src/pages/Tunnels/components/TunnelItem/TunnelItem.jsx @@ -0,0 +1,51 @@ +import "./styles.sass"; +import { useNavigate } from "react-router-dom"; +import { formatCountdown, formatRelative } from "@/common/utils/formatUtils.js"; +import { ArrowRight, Bookmark, ChevronRight } from "lucide-react"; +import { useUser } from "@/common/contexts/user.js"; + +const status = (tunnel, now) => { + if (tunnel.online) return formatRelative(tunnel.createdAt); + if (tunnel.graceUntil) return `closes in ${formatCountdown(tunnel.graceUntil, now)}`; + return "offline"; +}; + +const detail = tunnel => { + if (tunnel.mode === "tcp") return [tunnel.target, `tcp+udp · ${tunnel.joiners} connected`]; + if (tunnel.dormant) return [tunnel.url]; + return [tunnel.url, tunnel.target]; +}; + +export const TunnelItem = ({ tunnel, now }) => { + const navigate = useNavigate(); + const { user } = useUser(); + const state = tunnel.online ? "online" : tunnel.dormant ? "dormant" : "offline"; + const foreign = tunnel.owner && tunnel.owner !== user?.username; + + return ( + + ); +}; diff --git a/client/src/pages/Tunnels/components/TunnelItem/index.js b/client/src/pages/Tunnels/components/TunnelItem/index.js new file mode 100644 index 0000000..668b93f --- /dev/null +++ b/client/src/pages/Tunnels/components/TunnelItem/index.js @@ -0,0 +1 @@ +export { TunnelItem as default } from "./TunnelItem.jsx"; diff --git a/client/src/pages/Tunnels/components/TunnelItem/styles.sass b/client/src/pages/Tunnels/components/TunnelItem/styles.sass new file mode 100644 index 0000000..a45a8bc --- /dev/null +++ b/client/src/pages/Tunnels/components/TunnelItem/styles.sass @@ -0,0 +1,148 @@ +@use "@/common/styles/colors" +@use "@/common/styles/breakpoints" + +.tunnel-row + width: 100% + display: flex + align-items: center + gap: 1rem + min-width: 0 + padding: 1rem 1.125rem + background-color: colors.$surface + border: 1px solid colors.$border + border-radius: 0.875rem + color: colors.$text + font-family: inherit + text-align: left + cursor: pointer + transition: border-color 0.15s ease, background-color 0.15s ease + + &:hover + border-color: colors.$border-strong + background-color: colors.$surface-raised + + &:focus-visible + outline: 2px solid colors.$primary + outline-offset: 2px + + &.offline + opacity: 0.75 + + &.dormant + border-style: dashed + + .tunnel-id, .tunnel-detail + color: colors.$muted + + @media (max-width: breakpoints.$mobile) + gap: 0.75rem + padding: 0.875rem 1rem + +.tunnel-dot + width: 0.5rem + height: 0.5rem + flex-shrink: 0 + border-radius: 50% + background-color: colors.$success + + .offline & + background-color: colors.$warning + + .dormant & + background-color: colors.$border-strong + +.tunnel-main + flex: 1 + min-width: 0 + display: flex + flex-direction: column + gap: 0.25rem + +.tunnel-title + display: flex + align-items: center + gap: 0.5rem + min-width: 0 + +.tunnel-id + font-size: 1rem + font-weight: 600 + letter-spacing: -0.01em + white-space: nowrap + overflow: hidden + text-overflow: ellipsis + +.tunnel-pin + width: 0.875rem + height: 0.875rem + flex-shrink: 0 + color: colors.$primary + +.tunnel-mode + flex-shrink: 0 + padding: 0.1rem 0.4rem + border: 1px solid colors.$border + border-radius: 0.4rem + color: colors.$muted + font-size: 0.6875rem + font-weight: 600 + letter-spacing: 0.04em + text-transform: uppercase + + &.subdomain + color: colors.$primary + border-color: colors.$primary-tint + +.tunnel-owner + color: colors.$muted + font-size: 0.8125rem + white-space: nowrap + + &::before + content: "· " + +.tunnel-detail + display: flex + align-items: center + gap: 0.75rem + min-width: 0 + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace + font-size: 0.8125rem + color: colors.$subtext + + svg + width: 0.875rem + height: 0.875rem + flex-shrink: 0 + color: colors.$muted + +.tunnel-detail-part + display: inline-flex + align-items: center + gap: 0.75rem + min-width: 0 + + span + white-space: nowrap + overflow: hidden + text-overflow: ellipsis + + & + & + color: colors.$muted + flex-shrink: 0 + +.tunnel-status + flex-shrink: 0 + color: colors.$muted + font-size: 0.8125rem + white-space: nowrap + font-variant-numeric: tabular-nums + + @media (max-width: breakpoints.$mobile) + display: none + +.tunnel-chevron + width: 1rem + height: 1rem + flex-shrink: 0 + color: colors.$muted diff --git a/client/src/pages/Tunnels/index.js b/client/src/pages/Tunnels/index.js new file mode 100644 index 0000000..758dbbc --- /dev/null +++ b/client/src/pages/Tunnels/index.js @@ -0,0 +1 @@ +export { Tunnels as default } from "./Tunnels.jsx"; diff --git a/client/src/pages/Tunnels/styles.sass b/client/src/pages/Tunnels/styles.sass new file mode 100644 index 0000000..941ba57 --- /dev/null +++ b/client/src/pages/Tunnels/styles.sass @@ -0,0 +1,4 @@ +.tunnel-list + display: flex + flex-direction: column + gap: 0.625rem diff --git a/client/vite.config.js b/client/vite.config.js new file mode 100644 index 0000000..3a95286 --- /dev/null +++ b/client/vite.config.js @@ -0,0 +1,28 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; +import * as path from "path"; + +export default defineConfig({ + base: "/@frislit/", + plugins: [react()], + css: { + preprocessorOptions: { + sass: { + api: "modern" + } + } + }, + resolve: { + alias: { + "@": path.resolve(import.meta.dirname, "src"), + } + }, + server: { + proxy: { + "/@frislit/api": { + target: "http://localhost:8080", + ws: true + } + } + } +}); diff --git a/config.example.yml b/config.example.yml new file mode 100644 index 0000000..029f2ff --- /dev/null +++ b/config.example.yml @@ -0,0 +1,7 @@ +listen: 0.0.0.0 # FRISLIT_LISTEN +port: 8080 # FRISLIT_PORT +baseDomain: frislit.example.com # FRISLIT_BASE_DOMAIN (subdomain tunnels become .) +publicUrl: https://frislit.example.com # FRISLIT_PUBLIC_URL (used when printing URLs) +trustProxy: false # FRISLIT_TRUST_PROXY (turn on only when nothing but your proxy can reach the port) +httpMode: subdomain # FRISLIT_HTTP_MODE (how `frislit http` is exposed: "subdomain" = ., "path" = /@) +gracePeriod: 30 # FRISLIT_GRACE_PERIOD (seconds a tunnel id stays reserved after the CLI drops) diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs new file mode 100644 index 0000000..eda78d6 --- /dev/null +++ b/docs/.vitepress/config.mjs @@ -0,0 +1,61 @@ +import { defineConfig } from "vitepress"; + +export default defineConfig({ + title: "frislit", + description: "Self-hosted tunnels: subdomain, path and direct TCP/UDP behind one public port", + lastUpdated: true, + cleanUrls: true, + metaChunk: true, + + head: [ + ["link", { rel: "icon", type: "image/svg+xml", href: "/logo.svg" }], + ["meta", { name: "theme-color", content: "#0D9488" }], + ["meta", { property: "og:type", content: "website" }], + ["meta", { property: "og:locale", content: "en" }], + ["meta", { property: "og:title", content: "frislit | Self-hosted tunnels behind one public port" }], + ["meta", { property: "og:site_name", content: "frislit" }], + ["meta", { property: "og:image", content: "/logo.png" }], + ["meta", { property: "og:image:type", content: "image/png" }], + ["meta", { property: "twitter:card", content: "summary" }], + ["meta", { property: "og:url", content: "https://docs.git.fristy.net/fristy/frislit" }], + ], + themeConfig: { + logo: "/logo.svg", + + nav: [ + { text: "Home", link: "/" }, + { text: "Install", link: "/installation" }, + { text: "CLI", link: "/cli" }, + ], + + footer: { + message: "Distributed under the MIT License", + copyright: "© 2026 Mathias Wagner", + }, + search: { + provider: "local", + }, + + sidebar: [ + { + text: "Documentation", + items: [ + { text: "Home", link: "/" }, + { text: "Introduction", link: "/introduction" }, + { text: "Install", link: "/installation" }, + { text: "Configuration", link: "/configuration" }, + { text: "HTTPS", link: "/https" }, + { text: "Reverse Proxy", link: "/reverse-proxy" }, + { text: "CLI", link: "/cli" }, + { text: "Persistent tunnels", link: "/persistent" }, + { text: "Running as a service", link: "/service" }, + ], + }, + ], + + socialLinks: [ + { icon: "github", link: "https://git.fristy.net/fristy/frislit" }, + { icon: "discord", link: "https://dc.gnmyt.dev" }, + ], + }, +}); diff --git a/docs/cli.md b/docs/cli.md new file mode 100644 index 0000000..bf46d55 --- /dev/null +++ b/docs/cli.md @@ -0,0 +1,276 @@ +# ⌨️ CLI + +The frislit CLI (`frislit`) is a single static binary. It opens one WebSocket to your server and pipes bytes between +your local port and the visitors - nothing else runs on your machine. + +## Installation + +`apt`, `dnf`, a Windows installer or a single binary, all in [Installation](/installation). + +## Getting started + +```sh +frislit login +``` + +You are asked for the server URL, and the CLI then prints a short code and opens the approval page in your +browser. Sign in there with your frislit account and approve the device. The CLI is handed a token **of its own**, +saved to `~/.config/frislit/config.json` (`%APPDATA%\frislit\config.json` on Windows, +`~/Library/Application Support/frislit/config.json` on macOS). + +There is no shared secret: every machine holds its own token, and each one can be revoked separately under +**Settings**, **Devices** in the web UI. + +### Invite links + +Someone without an account can tunnel through your server with an invite link, created under **Settings**, **Devices** +in the web UI. Opening the link offers "Open in frislit" and the command to run: + +```sh +frislit login https://frislit.example.com/@frislit/invite/ +``` + +After that everything works as usual. Tunnels opened this way show up under your account with the invite's label, +and revoking the link closes them. + +### API keys + +For a machine without a browser, CI, or scripts, create an API key under **Settings**, **Devices** in the web UI and link +with it directly: + +```sh +frislit login --server https://frislit.example.com --token +``` + +A key is a device like any other: it shows up in the list, can be revoked there, and revoking it closes its tunnels. +`FRISLIT_SERVER` and `FRISLIT_TOKEN` override the saved server URL and token for one-off runs. + +## Commands + +Every mode accepts the local target as a plain port (`3000` means `127.0.0.1:3000`) or `host:port` +(`192.168.1.5:8080`). `frislit http` also takes a URL: `https://localhost:8443` makes the CLI speak TLS to the target, +and a bare `host:443` is treated the same way. The certificate is not checked, since it is usually self-signed on a +dev machine, so the tunnel works with whatever the app presents. Visitors still get the server's own certificate. + +`frislit http` also accepts a **directory**. frislit then serves it with a built-in static file server, so you can skip +`python3 -m http.server`: + +```sh +frislit http . # share the current folder +frislit http ./dist # share a build output +``` + +`index.html` is served for directories that have one, everything else gets a directory listing. The server only ever +runs on `127.0.0.1` on a random port and stops together with the tunnel. + +### HTTP tunnel + +```sh +frislit http 3000 +frislit http 192.168.1.5:8080 --name myapp +frislit http https://localhost:8443 +frislit http ./public --name site +``` + +The server decides how the tunnel is exposed (`httpMode` in its configuration): on its own subdomain +`https://myapp.frislit.example.com`, or under `https://frislit.example.com/@myapp` in path mode. The CLI prints whatever +it got. See [Introduction](/introduction) for what each mode does to the URL. + +``` +✓ Tunnel myapp is online + https://myapp.frislit.example.com forwards to 192.168.1.5:8080 + + [QR code] +✓ Copied to clipboard +Press Ctrl+C to stop. +``` + +### Routing by path + +One tunnel can send different paths to different places: + +```sh +frislit http 3000 --route /api=4000 --route /docs=./site +``` + +The positional target takes everything that matches no route; the longest matching prefix wins. Ports and +`host:port` targets receive the full path, directories are mounted at their prefix (`/docs/guide.html` serves +`./site/guide.html`). In `tunnels.yml`: + +```yaml +tunnels: + shop: + http: 3000 + routes: + /api: 4000 + /docs: ./site +``` + +### Simulating a bad connection + +```sh +frislit http 3000 --latency 200ms --jitter 50ms --bandwidth 512kbps --loss 2% +frislit tcp 27015 --latency 80ms --loss 5% +``` + +| Flag | Description | +|------------------------|------------------------------------------------------------------------------| +| `--latency ` | Added in each direction, `200ms` or `1s`. | +| `--jitter ` | Random extra delay, 0 to this value. | +| `--bandwidth ` | Cap per direction, `512kbps`, `2mbps` or `100kB/s`. | +| `--loss ` | UDP datagrams are dropped; TCP data stalls instead, like a retransmit would. | + +Applies between the CLI and your app, so every mode is covered. In `tunnels.yml` for [`frislit start`](/service): + +```yaml +tunnels: + shop: + http: 3000 + shape: + latency: 200ms + jitter: 50ms + bandwidth: 512kbps + loss: 2 +``` + +### Protecting a tunnel + +```sh +frislit http 3000 --password hunter2 # ask visitors for a password +frislit http 3000 --require-login # ask visitors for a frislit account +frislit serve --allow 10.0.0.0/8 # only this range may connect +frislit http 3000 --allow-country de,at,ch # only these countries +frislit http 3000 --block tor --block vpn # no Tor exit nodes or VPNs +frislit tcp 25565 --block-country ru # rules work for tcp too +``` + +| Flag | Description | +|---------------------------|--------------------------------------------------------------------| +| `--allow ` | Only these addresses or ranges. | +| `--allow-country ` | Only these countries, two-letter codes. | +| `--block-ip ` | Never these addresses or ranges. | +| `--block-country ` | Never these countries. | +| `--block ` | Never `tor`, `vpn`, `datacenter` or `blocklist` addresses. | +| `--password ` | HTTP only. Visitors get a password prompt, `curl -u any:` works. | +| `--require-login` | HTTP only. Visitors sign in on your frislit login page, passkeys and SSO included. `curl -u` works for accounts without two-factor. | + +All flags repeat or take comma-separated values. Block rules win over allow rules. `--password` and `--require-login` +are mutually exclusive. Rules can be changed later in the web UI, the CLI prints the new rules and they survive a reconnect. + +While the tunnel is open the CLI shows a terminal UI: the public address, live request rate, p50 and p90, and a table +of requests with status, duration, client address and location. Arrow keys select a row, `c` copies the URL, `o` +opens it in the browser, `d` opens the tunnel in the web UI, `q` quits. + +Pass `--plain` to get one line per request instead, which is also what you get when the output is not a terminal: + +``` +GET 200 / 3ms DE · Hetzner Online · datacenter +GET 404 /favicon.ico 1ms US · Comcast +WS 101 /socket 4210ms NL · Tor · tor +``` + +The same requests are kept server-side and shown in the web UI, with their headers and bodies; WebSocket connections +show their messages. From there requests can be replayed, or everything exported as a HAR file for browser devtools. + +Options: + +| Flag | Description | +|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `--name ` | Request a custom id (`a-z`, `0-9`, `-`, 3-32 characters). Fails if it is taken or [reserved](/persistent) by someone else. | +| `--keep-host` | Send the public hostname as `Host` to your app instead of `192.168.1.5:8080`. By default the local authority is sent so dev servers like Vite or Django don't reject the request; the public host is always available in `X-Forwarded-Host`. | + +### Direct TCP + UDP + +```sh +frislit tcp 25565 +``` + +``` +✓ Tunnel k3x9ab is online + Forwarding 127.0.0.1:25565 (tcp+udp) + Share code: k3x9abQ7wRkZb2m9pLdXe8vC4nHtY1sK + Others run: frislit connect k3x9abQ7wRkZb2m9pLdXe8vC4nHtY1sK --server https://frislit.example.com + + [QR code] +✓ Copied to clipboard +Press Ctrl+C to stop. +``` + +TCP and UDP on the target port are forwarded automatically, there is no flag to pick one. Several people can use the +same share code at once. + +### Connecting to a shared port + +```sh +frislit connect https://frislit.example.com/@frislit/connect/k3x9abQ7wRkZb2m9pLdXe8vC4nHtY1sK +``` + +That link is what `frislit tcp` prints and copies to the clipboard: it carries the server and the code together, +so the other side pastes one thing and needs nothing else. Opening it in a browser shows the same command with a +copy button. + +``` +✓ Forwarding 127.0.0.1:25565 (tcp+udp) to k3x9ab +Press Ctrl+C to stop. +``` + +`connect` needs **no account and no device token**: the link is enough. A bare share code works too, as long as +the server is known from `--server`, `FRISLIT_SERVER` or an earlier `frislit login`. It binds a TCP listener and a +UDP socket on the same local port. By default that is the owner's +port number; if it is taken you are asked for another one. + +| Flag | Description | +|------------------|---------------------------------------------------------------------------------------------------------------| +| `--port ` | Local port to bind instead of the owner's port. | +| `--bind ` | Local address to bind (default `127.0.0.1`). Use `0.0.0.0` to let other machines in your LAN use the forward. | +| `--server ` | frislit server URL. Only needed when a bare code was pasted instead of the link. | + +### Listing tunnels + +```sh +frislit ls +``` + +Your tunnels on the server, online or not, with their addresses. Persistent ones are marked with `*`. +`frislit status` does the same. + +### Configuration + +```sh +frislit config show +frislit config get server-url +frislit config set server-url https://frislit.example.com +frislit config set device-token +frislit config set accept-invalid-certs true +``` + +Keys: `server-url`, `device-token` (shown as `(set)`), `accept-invalid-certs` (for self-signed certificates on the +server). + +### Update + +```sh +frislit update +``` + +Downloads the latest release and replaces the binary, or runs the new installer on Windows. Installations from a +package manager are left to it. + +### Logout + +```sh +frislit logout +``` + +Removes this device's token; the server URL is kept. Revoke it on the server too, under **Settings**, **Devices**. + +## Reconnects + +An **administrator closing the tunnel**, or disconnecting a client from the web UI, ends the session for good: the +CLI prints the reason and exits. Reconnecting only applies to connections that dropped on their own. + +If the connection to the server drops, the CLI shows a spinner and reconnects with exponential backoff. As long as it +gets back within the server's grace period (30 s by default) the tunnel keeps its id, URL and share code and joiners +stay connected. Visitors see a "tunnel offline, reconnecting" page in the meantime. + +Ctrl+C tells the server to release the tunnel immediately, without waiting for the grace period. diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..616132a --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,56 @@ +# ⚙️ Configuration + +The server reads a YAML file (`/app/data/config.yml` in the image, override the path with `FRISLIT_CONFIG`). Every +key can also be set through an environment variable, which beats the file, and anything you save in the web UI +beats both. + +Nothing is required up front. Without a `baseDomain` the server starts in **setup mode** and serves only +`/@frislit/**` until you finish the setup wizard in the browser. + +```yaml +listen: 0.0.0.0 +port: 8080 +baseDomain: frislit.example.com +publicUrl: https://frislit.example.com +trustProxy: true +httpMode: subdomain +gracePeriod: 30 +``` + +| Key | Environment variable | Default | Description | +|---|---|---|---| +| `listen` | `FRISLIT_LISTEN` | `0.0.0.0` | Address the HTTP server binds to. | +| `port` | `FRISLIT_PORT` | `8080` | The one and only port. HTTP, WebSockets and the CLI control channel all use it. | +| `baseDomain` | `FRISLIT_BASE_DOMAIN` | - (setup) | Your tunnel domain. Subdomain tunnels become `.`, path-mode tunnels live on `` itself. | +| `publicUrl` | `FRISLIT_PUBLIC_URL` | `https://` | What the server prints as the public URL. Use `http://…` for local testing without TLS. | +| `tlsMode` | `FRISLIT_TLS_MODE` | `proxy` | `proxy` if something terminates TLS in front of frislit, `acme` if frislit should get its own certificates. Set through the environment, it cannot be changed in the web UI. See [HTTPS](/https). | +| `trustProxy` | `FRISLIT_TRUST_PROXY` | `false` | Use `X-Forwarded-Host`, `X-Forwarded-Proto` and `X-Forwarded-For` from nginx. Turn this on only when nothing but your proxy can reach the port: the IP allowlist and the login rate limit both believe whatever address these headers carry. | +| `httpMode` | `FRISLIT_HTTP_MODE` | `subdomain` | How `frislit http` tunnels are exposed. `subdomain`: `https://.` (needs the wildcard DNS record and certificate). `path`: `https:///@`, bound per browser tab (no wildcard needed). | +| `gracePeriod` | `FRISLIT_GRACE_PERIOD` | `30` | Seconds a tunnel id stays reserved after the owner's CLI drops. The CLI reconnects automatically and keeps the same URL/share code. Ctrl+C releases immediately. | + +`listen` and `port` are only read at startup. Everything else can be changed in the web UI and takes effect +immediately. + +Other environment variables: + +| Variable | Description | +|---|---| +| `FRISLIT_CONFIG` | Path to the YAML file. | +| `FRISLIT_DATA_DIR` | Where the database is kept. `/app/data` in the image. | +| `LOG_LEVEL` | `error`, `warn`, `info` (default) or `debug`. | + +## 💾 Data directory + +The data directory (`/app/data`, or `FRISLIT_DATA_DIR`) holds one file, `frislit.db`: accounts, sessions, devices, +tunnel access rules, certificates, the requests a tunnel has served and the settings you changed in the web UI. + +It is SQLite. Passwords are scrypt hashes and device tokens are stored hashed, so a copy of the file does not hand +anyone a working login. The schema is created and upgraded automatically on startup. + +Only settings you actually change in the UI are stored; anything you leave alone keeps coming from `config.yml` or +the environment, which is why server configuration stays reviewable in a file you can put in git. + +![Forwarding settings](/screenshots/settings.png) + +Back it up (or mount `/app/data` in Docker) to keep accounts, devices and access rules across restarts. Delete it +to start over with the setup wizard. diff --git a/docs/https.md b/docs/https.md new file mode 100644 index 0000000..084d6cd --- /dev/null +++ b/docs/https.md @@ -0,0 +1,81 @@ +# 🔒 HTTPS + +frislit never speaks plain HTTP to the internet. Two ways to get there, and you pick one during the guided setup or +later under **Settings**, **HTTPS**. The options for the other one stay out of your way. + +## 🧭 Which one + +| | Behind a proxy | frislit manages it | +|---|---|---| +| Certificate | your proxy holds it | frislit orders it from Let's Encrypt | +| frislit listens on | one plain HTTP port | `443`, plus `80` for redirects | +| Renewal | your proxy's job | automatic, 30 days before expiry | +| Needs | nginx, Caddy, Traefik… | a DNS API token, or port 80 reachable | + +Pick **behind a proxy** if something already terminates TLS on that machine, or if you want one certificate for +several services. Pick **frislit manages it** if frislit is the only thing on the box. + +## 🛡️ Behind a proxy + +The default. frislit serves plain HTTP on `port` (8080) and never sees a certificate. Set up nginx as described in +[Reverse proxy](/reverse-proxy), then turn on **Trust proxy headers** so tunnels see the real visitor address. + +> [!WARNING] +> Only turn that on when nothing but your proxy can reach the port. The per-tunnel IP allowlist and the login rate +> limit both believe whatever `X-Forwarded-For` carries. + +## 🔑 frislit manages it + +frislit binds `443` for traffic and `80` for the redirect and HTTP challenges. In Docker that is just a port +mapping, because a container may bind low ports already: + +```sh +docker run -d --name frislit --restart always -p 443:443 -p 80:80 \ + -v frislit-data:/app/data \ + -e FRISLIT_BASE_DOMAIN=frislit.example.com \ + -e FRISLIT_PUBLIC_URL=https://frislit.example.com \ + -e FRISLIT_TLS_MODE=acme \ + fristy/frislit:latest +``` + +### Which challenge + +| Forwarding mode | Certificate | Challenge | +|---|---|---| +| Path | `frislit.example.com` | HTTP, or DNS if you prefer | +| Subdomain | `frislit.example.com` **and** `*.frislit.example.com` | DNS only | + +A wildcard can only be proven with a DNS challenge, which is a Let's Encrypt rule rather than a frislit one. Subdomain +forwarding therefore needs a DNS provider; path forwarding can get by with the HTTP challenge and no token at all. + +### DNS providers + +**Cloudflare**: create a token with `Zone:DNS:Edit` on the zone, paste it, and press *Test token*. frislit adds and +removes the `_acme-challenge` record on its own, including at renewal. + +**Add the record yourself**: frislit shows the exact TXT record and waits. Fine for a first certificate, but +renewal needs you to be there again, so it is not a good long-term answer. + +### The first certificate + +Until there is one, a server in this mode serves the web UI over plain HTTP on port 80, because the page you would +request the certificate from is otherwise behind a handshake that cannot succeed. Finish the setup, open +**Settings**, **HTTPS**, press *Request certificate*, and the redirect takes over once it lands. + +## ⚙️ Keys + +| Key | Environment variable | Default | Description | +|---|---|---|---| +| `tlsMode` | `FRISLIT_TLS_MODE` | `proxy` | `proxy` or `acme`. When set through the environment it is fixed in the web UI, because the container's ports were mapped for it. Otherwise switching needs a restart. | +| `httpsPort` | `FRISLIT_HTTPS_PORT` | `443` | Where traffic is served in `acme` mode. | +| `redirectPort` | `FRISLIT_REDIRECT_PORT` | `80` | Redirects to HTTPS and answers HTTP challenges. | +| `acmeDirectoryUrl` | `FRISLIT_ACME_DIRECTORY` | - | Another ACME server: a private CA, Buypass, or Let's Encrypt staging while you are debugging. | + +The contact email, the challenge and the DNS token are set in the web UI and stored in the database, not in +`config.yml`, because a token is a credential rather than configuration. + +> [!TIP] +> Let's Encrypt rate-limits failed validations to five per hostname per hour. If you are working through a DNS +> problem and hit that, point `FRISLIT_ACME_DIRECTORY` at +> `https://acme-staging-v02.api.letsencrypt.org/directory` until it works. Staging certificates come from an +> untrusted CA, so browsers will warn about them. Switch back once the challenge succeeds. diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..9612220 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,55 @@ +--- +layout: home + +hero: + name: frislit + text: Self-hosted tunnels + tagline: Expose local ports through your own server - subdomain, path or direct TCP/UDP, all behind one public port + actions: + - theme: brand + text: Install + link: /installation + - theme: alt + text: Introduction + link: /introduction + - theme: alt + text: GitHub + link: https://git.fristy.net/fristy/frislit + image: + src: /logo.png + alt: frislit + +features: + - icon: 🌐 + title: Subdomain tunnels + details: frislit http 3000 gives your local app its own https://.your-domain, with WebSockets and rewritten redirects. frislit http . shares a folder. + link: /introduction + linkText: Learn more + - icon: 🍪 + title: Path mode + details: No wildcard certificate? Set httpMode to path and tunnels live under https://your-domain/@, one per browser tab. + link: /introduction + linkText: Learn more + - icon: 🔌 + title: Direct TCP + UDP + details: frislit tcp 25565 prints a share code. Others run frislit connect and get the port on their own machine, TCP and UDP. + link: /introduction + linkText: Learn more + - icon: 🔁 + title: Reconnects + details: Lost your connection? The CLI reconnects with the same URL or share code inside the grace period. + - icon: 📱 + title: QR & clipboard + details: Every URL and share code is printed as a terminal QR code and copied to your clipboard. + - icon: 🪶 + title: Tiny footprint + details: A small Node.js server, a single static Rust binary, one YAML file and one SQLite file. +--- + + diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000..afa9673 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,101 @@ +# 🚀 Installation + +frislit consists of the **server** (Node.js) and the **CLI** (a single Rust binary called `frislit`). + +## 🐳 Docker + +```sh +docker run -d \ + --name frislit \ + --restart always \ + -p 127.0.0.1:8080:8080 \ + -v frislit-data:/app/data \ + -e FRISLIT_BASE_DOMAIN=frislit.example.com \ + -e FRISLIT_PUBLIC_URL=https://frislit.example.com \ + -e FRISLIT_TRUST_PROXY=true \ + fristy/frislit:latest +``` + +Then open `https://frislit.example.com/@frislit` and follow the setup wizard. + +> [!IMPORTANT] +> Mount `/app/data`. That volume holds your admin account, the settings you change in the web UI and the generated +> CLI token - without it they are gone when the container is recreated. + +## 📦 Docker Compose + +```yaml +services: + frislit: + image: fristy/frislit:latest + restart: always + ports: + - "127.0.0.1:8080:8080" + volumes: + - frislit-data:/app/data + environment: + FRISLIT_BASE_DOMAIN: frislit.example.com + FRISLIT_PUBLIC_URL: https://frislit.example.com + FRISLIT_TRUST_PROXY: "true" + +volumes: + frislit-data: +``` + +Prefer a file? Mount a `config.yml` to `/app/data/config.yml` instead of setting environment variables (see +[Configuration](/configuration)). Environment variables always win over the file. + +> [!NOTE] +> Both examples above put a proxy in front, so they bind to `127.0.0.1` and set `FRISLIT_TRUST_PROXY`, which makes +> frislit believe the `X-Forwarded-*` headers it receives. frislit can hold its own certificate instead and bind 443 +> itself; see [HTTPS](/https). + +Then open `https://frislit.example.com/@frislit` and run the setup wizard, or skip it by mounting a `config.yml` +with `baseDomain` and `publicUrl` already filled in. Accounts and everything you change in the web UI live in the +mounted volume (see [Configuration](/configuration)). + +## ⌨️ CLI + +One line on Linux: + +```sh +curl -fsSL https://git.fristy.net/fristy/frislit/raw/branch/main/packaging/install/install | sh +``` + +And on Windows: + +```powershell +irm https://git.fristy.net/fristy/frislit/raw/branch/main/packaging/install/install.ps1 | iex +``` + +The script downloads the latest release from this repository: it runs the MSI installer on Windows, and puts the plain +binary in `/usr/local/bin` (or `~/.local/bin`) on Linux. macOS is not built by this fork; build from source with +`cargo build --release --manifest-path cli/Cargo.toml`. + +### Manual download + +Every release on carries the CLI binaries +(`frislit-linux-x64`, `frislit-linux-arm64`, `frislit-windows-x64.exe`, `frislit-windows-arm64.exe`), the MSI +installers (`frislit-x64.msi`, `frislit-arm64.msi`) and the `frislit-cli-*.deb` / `frislit-cli-*.rpm` packages. +There is no apt or rpm repository. + +### Updating + +```sh +frislit update +``` + +Replaces a plain binary in place, or downloads and runs the new installer on Windows. When frislit came from a package +manager it says so and leaves updating to it. The CLI checks for a new release once a day and mentions +it in the terminal UI, the desktop app shows an **Update and restart** button under Settings. + +Then log in: + +```sh +frislit login +``` + +Or open the desktop app with `frislit gui` and link the device there. `frislit links register` makes `frislit://` +links open in it. + +Continue with the [CLI guide](/cli). diff --git a/docs/introduction.md b/docs/introduction.md new file mode 100644 index 0000000..554685e --- /dev/null +++ b/docs/introduction.md @@ -0,0 +1,41 @@ +# 🚇 Introduction + +frislit is a self-hosted tunnel server with a matching CLI. You run the server on a machine with a public address, +and the CLI on any machine that has something worth sharing. All traffic goes through **one public port**, so there +is nothing else to open in your firewall. frislit can hold its own certificate or sit behind a proxy you already +run, whichever you prefer. + +![The tunnel list](/screenshots/tunnels.png) + +## The three modes + +HTTP tunnels are always created with `frislit http `. Whether they end up on a subdomain or under a path is a +server setting, so everyone using a server gets the same kind of URL. + +### 🌐 Subdomain - `httpMode: subdomain` + +The classic ngrok experience. Your local HTTP server gets its own hostname like `https://k3x9ab.frislit.example.com`. +HTTP and WebSockets work, redirects that point at your local machine are rewritten to the public host. + +### 🍪 Path / cookie - `httpMode: path` + +For setups without a wildcard certificate, or when you want everything under one hostname. Visiting +`https://frislit.example.com/@k3x9ab` binds **that browser tab** to the tunnel, so two tabs can hold different +tunnels at the same URL. Refreshes, link clicks and form posts all stay on the tab's own +tunnel. For anything that is not a browser, name the tunnel in the query string: +`curl https://frislit.example.com/api?frislit-tunnel=`. + +Two things to know before choosing it: every path-mode tunnel lives on the same origin, so cookies and storage are +shared between the apps you open this way, and it only works over HTTPS or on `localhost`. Apps that need to be +isolated from each other belong on subdomains. + +### 🔌 Direct TCP + UDP - `frislit tcp ` + +No website at all. The owner gets a share code, the other side runs `frislit connect ` and gets the port on +their own machine - both TCP **and** UDP on the same port number, automatically. Perfect for game servers, SSH or +databases. + +![The page behind a share link](/screenshots/connect.png) + +Read on: [Installation](/installation) · [Configuration](/configuration) · [Reverse proxy](/reverse-proxy) · +[CLI](/cli) · [HTTPS](/https) · [Persistent tunnels](/persistent) diff --git a/docs/persistent.md b/docs/persistent.md new file mode 100644 index 0000000..7ec52fe --- /dev/null +++ b/docs/persistent.md @@ -0,0 +1,26 @@ +# 📌 Persistent tunnels + +A persistent tunnel is a name reserved for your account. Nobody else can use it, its access rules are kept, and it +can have custom domains. The target still comes from the CLI each time: + +```sh +frislit http 3000 --name myapp +``` + +Reserve a name with **Reserve a name** on the Tunnels page, or press **Keep** on a running tunnel. **Release** makes it an +ordinary tunnel again. To keep it up without a terminal, see [Running as a service](/service). + +## Custom domains + +1. Create a `CNAME` for the hostname pointing at your base domain. +2. Add the hostname on the tunnel's page. + +frislit checks DNS every few minutes and activates the domain once it resolves to the server. Traffic on it is +proxied like a subdomain tunnel, in both forwarding modes. + +| `tlsMode` | Certificate | +|-----------|---------------------------------------------------------------------------------| +| `acme` | Issued by frislit over the HTTP challenge, served by SNI, renewed automatically. | +| `proxy` | Your reverse proxy handles it, see [Reverse proxy](/reverse-proxy). | + +Hostnames under the base domain are not allowed; those are subdomain tunnels. diff --git a/docs/public/logo.png b/docs/public/logo.png new file mode 100644 index 0000000..8d5bd5a Binary files /dev/null and b/docs/public/logo.png differ diff --git a/docs/public/logo.svg b/docs/public/logo.svg new file mode 100644 index 0000000..d623541 --- /dev/null +++ b/docs/public/logo.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/docs/public/mark.svg b/docs/public/mark.svg new file mode 100644 index 0000000..cd097df --- /dev/null +++ b/docs/public/mark.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/docs/public/screenshots/connect.png b/docs/public/screenshots/connect.png new file mode 100644 index 0000000..7d8b958 Binary files /dev/null and b/docs/public/screenshots/connect.png differ diff --git a/docs/public/screenshots/request-detail.png b/docs/public/screenshots/request-detail.png new file mode 100644 index 0000000..4716a52 Binary files /dev/null and b/docs/public/screenshots/request-detail.png differ diff --git a/docs/public/screenshots/settings.png b/docs/public/screenshots/settings.png new file mode 100644 index 0000000..404c749 Binary files /dev/null and b/docs/public/screenshots/settings.png differ diff --git a/docs/public/screenshots/tunnel-detail.png b/docs/public/screenshots/tunnel-detail.png new file mode 100644 index 0000000..c4e6250 Binary files /dev/null and b/docs/public/screenshots/tunnel-detail.png differ diff --git a/docs/public/screenshots/tunnels.png b/docs/public/screenshots/tunnels.png new file mode 100644 index 0000000..d9e237d Binary files /dev/null and b/docs/public/screenshots/tunnels.png differ diff --git a/docs/public/wordmark-dark.png b/docs/public/wordmark-dark.png new file mode 100644 index 0000000..8274f4a Binary files /dev/null and b/docs/public/wordmark-dark.png differ diff --git a/docs/public/wordmark-light.png b/docs/public/wordmark-light.png new file mode 100644 index 0000000..a337d8a Binary files /dev/null and b/docs/public/wordmark-light.png differ diff --git a/docs/reverse-proxy.md b/docs/reverse-proxy.md new file mode 100644 index 0000000..4c1f44a --- /dev/null +++ b/docs/reverse-proxy.md @@ -0,0 +1,81 @@ +# 🔀 Reverse Proxy + +> [!NOTE] +> This is one of two ways to serve HTTPS. frislit can also get its own certificates from Let's Encrypt and +> serve them itself, with nothing in front. See [HTTPS](/https). + +In this mode frislit runs behind **nginx**, which terminates TLS for the base domain **and** every subdomain. You need: + +1. A **wildcard DNS record**: `frislit.example.com` and `*.frislit.example.com` pointing at your server. +2. A **wildcard certificate** covering both `frislit.example.com` and `*.frislit.example.com`. With certbot this needs + the DNS challenge, for example: + + ```sh + certbot certonly --dns-cloudflare --dns-cloudflare-credentials ~/.secrets/cloudflare.ini \ + -d frislit.example.com -d '*.frislit.example.com' + ``` + +3. The nginx site below. WebSockets, unbuffered streaming and unlimited upload sizes are essential - tunnels carry + arbitrary apps and long-lived connections. + +```nginx +server { + listen 80; + listen [::]:80; + server_name frislit.example.com *.frislit.example.com; + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + http2 on; + server_name frislit.example.com *.frislit.example.com; + + ssl_certificate /etc/letsencrypt/live/frislit.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/frislit.example.com/privkey.pem; + + # Tunnels carry anything, including huge uploads and streams + client_max_body_size 0; + proxy_buffering off; + proxy_request_buffering off; + + location / { + proxy_pass http://127.0.0.1:8080; + proxy_http_version 1.1; + + # WebSocket support (tunnelled apps and the CLI control channel) + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + + # Long-lived connections + proxy_read_timeout 86400; + proxy_send_timeout 86400; + } +} +``` + +Add this once in the `http` block (usually `/etc/nginx/nginx.conf` or a file in `conf.d/`) so `Connection` is only +set to `upgrade` for real upgrade requests: + +```nginx +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} +``` + +Set `trustProxy: true` in the frislit config so the `X-Forwarded-*` headers above are used for the public host, the +`Secure` flag on session cookies and the client IP passed to your apps. It is off by default, because anyone who can +reach the port directly can otherwise put any address in `X-Forwarded-For` and walk through a tunnel's IP allowlist. +Only turn it on together with the tip below. + +> [!TIP] +> Only nginx needs to reach frislit. Bind the container to `127.0.0.1:8080:8080` so port 8080 is not exposed to +> the internet without TLS. diff --git a/docs/service.md b/docs/service.md new file mode 100644 index 0000000..bd76aca --- /dev/null +++ b/docs/service.md @@ -0,0 +1,62 @@ +# 🔁 Running as a service + +`frislit start` runs every tunnel from one file and reconnects on its own. `frislit service install` makes it start +with your session. + +## The file + +`~/.config/frislit/tunnels.yml` on Linux, `~/Library/Application Support/frislit/tunnels.yml` on macOS, +`%APPDATA%\frislit\tunnels.yml` on Windows. Each key is the tunnel name: + +```yaml +tunnels: + myapp: + http: 3000 + site: + serve: /var/www/site + password: hunter2 + shop: + http: 3000 + routes: + /api: 4000 + /docs: /var/www/docs + db: + tcp: 5432 + allow: [ 10.0.0.0/8 ] + block: [ tor, vpn ] +``` + +| Key | Description | +|---------------------------------|----------------------------------------------------------------------------------------------------------------| +| `http` | A port, `host:port` or `https://host[:port]`. | +| `serve` | A directory to serve. | +| `tcp` | A port or `host:port`, shared with a code. | +| `routes` | Prefix to port, `host:port` or directory, see [Routing by path](/cli#routing-by-path). | +| `shape` | `latency`, `jitter`, `bandwidth`, `loss`, see [Simulating a bad connection](/cli#simulating-a-bad-connection). | +| `keep_host` | Send the public hostname as `Host` (HTTP only). | +| `allow` / `allow_countries` | Only these addresses or countries. | +| `block_ips` / `block_countries` | Never these addresses or countries. | +| `block` | `tor`, `vpn`, `datacenter`, `blocklist`. | +| `password` / `require_login` | Sign-in for visitors (HTTP only). | + +Names should be [persistent](/persistent), otherwise they are free for anyone while the service is down. + +```sh +frislit start # foreground, Ctrl+C stops everything +frislit start --config other.yml +``` + +## Installing + +```sh +frislit service install +frislit service uninstall +``` + +| System | What it installs | +|---------|--------------------------------------------------------------------------------------------------------------------------| +| Linux | systemd user unit, `journalctl --user -u frislit -f` for logs. Linger is enabled so it also runs without a login session. | +| macOS | Launch agent, logs in `~/Library/Logs/frislit.log`. | +| Windows | Scheduled task that runs at logon. | + +The device has to be linked (`frislit login`) first; the file is created with an example if it is missing. diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..d8f6e6e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,4596 @@ +{ + "name": "frislit", + "version": "0.3.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "frislit", + "version": "0.3.0", + "license": "MIT", + "dependencies": { + "@simplewebauthn/server": "^14.0.3", + "acme-client": "^5.4.0", + "js-yaml": "^5.4.3", + "mmdb-lib": "^3.0.3", + "openid-client": "^6.8.8", + "sequelize": "^6.37.8", + "speakeasy": "^2.0.0", + "sqlite3": "^6.0.1", + "ws": "^8.22.0" + }, + "devDependencies": { + "concurrently": "^10.0.6", + "vitepress": "^1.6.4" + }, + "engines": { + "node": ">=22" + }, + "optionalDependencies": { + "bufferutil": "^4.1.0" + } + }, + "node_modules/@algolia/abtesting": { + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@algolia/abtesting/-/abtesting-1.25.0.tgz", + "integrity": "sha512-rSTin9Uta23uaewYVQEp8XI9T3iA/zrg0/1G2vhf8oFFDxFL5vybnZ5IQwsVAg4JpKxPX4/WYNKdcfWrZymk7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/autocomplete-core": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.17.7.tgz", + "integrity": "sha512-BjiPOW6ks90UKl7TwMv7oNQMnzU+t/wk9mgIDi6b1tXpUek7MW0lbNOUHpvam9pe3lVCf4xPFT+lK7s+e+fs7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/autocomplete-plugin-algolia-insights": "1.17.7", + "@algolia/autocomplete-shared": "1.17.7" + } + }, + "node_modules/@algolia/autocomplete-plugin-algolia-insights": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.17.7.tgz", + "integrity": "sha512-Jca5Ude6yUOuyzjnz57og7Et3aXjbwCSDf/8onLHSQgw1qW3ALl9mrMWaXb5FmPVkV3EtkD2F/+NkT6VHyPu9A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/autocomplete-shared": "1.17.7" + }, + "peerDependencies": { + "search-insights": ">= 1 < 3" + } + }, + "node_modules/@algolia/autocomplete-preset-algolia": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.17.7.tgz", + "integrity": "sha512-ggOQ950+nwbWROq2MOCIL71RE0DdQZsceqrg32UqnhDz8FlO9rL8ONHNsI2R1MH0tkgVIDKI/D0sMiUchsFdWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/autocomplete-shared": "1.17.7" + }, + "peerDependencies": { + "@algolia/client-search": ">= 4.9.1 < 6", + "algoliasearch": ">= 4.9.1 < 6" + } + }, + "node_modules/@algolia/autocomplete-shared": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.17.7.tgz", + "integrity": "sha512-o/1Vurr42U/qskRSuhBH+VKxMvkkUVTLU6WZQr+L5lGZZLYWyhdzWjW0iGXY7EkwRTjBqvN2EsR81yCTGV/kmg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@algolia/client-search": ">= 4.9.1 < 6", + "algoliasearch": ">= 4.9.1 < 6" + } + }, + "node_modules/@algolia/client-abtesting": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/client-abtesting/-/client-abtesting-5.59.0.tgz", + "integrity": "sha512-bm2XN0hCSMYwStSsCBT0/PUB2BDxoyR1Lnub3c392HMEy9bi8PUSW8vR6zltVEKWG2t4PQFWMD5C07bmJxGgPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-analytics": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-5.59.0.tgz", + "integrity": "sha512-XOFPOTa69WuqHR6c5tMgnUUwwqQgNSzMpxmhrgA9KmxRf8WIqEa0cokHJvohk5CYb7CZx0xeSL6Bk2IUJ7Lv7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-common": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.59.0.tgz", + "integrity": "sha512-PC8ipLOYFKRTfIUY1J3FJxS6ryzWziaXmIX9/sNMoUR8L+XhF7hX2QAeUI87YVl5zujvlYTSOb+HAIqKXDjyHQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-insights": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/client-insights/-/client-insights-5.59.0.tgz", + "integrity": "sha512-yFNcCMM5fHiyoR0HuxMrzy+VjDcmhFUZTm2IJ2DHwGsVH3B5SEob4zTmeEZ3j/AZqNnmrJOCKl/tJnBg7+84bA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-personalization": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-5.59.0.tgz", + "integrity": "sha512-GYja6HkDt2VrQhWmB2cLx3Z5fDwI9no7q+xwCWcFrTPm5CLH9QZvK0XLO9co1FcNIDxxkMaP3AXM39/XcecEOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-query-suggestions": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/client-query-suggestions/-/client-query-suggestions-5.59.0.tgz", + "integrity": "sha512-Wofg7bMpWh8N5qDDZs0wy6whc+KMmdNsxgrIGp9Ug2s1Bka0uq7AjyckdxReKPHLA0Q1qH8X/SNh0wn2t2X2Lw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/client-search": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.59.0.tgz", + "integrity": "sha512-fHnALZfbEnODczGk14Y/1YBRApp6UEpZUTexGcMUPzY7RDc7q4HN2Y6jh0KUG8Jo9B+q+wOoQEc3ziR0ErbuFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/ingestion": { + "version": "1.59.0", + "resolved": "https://registry.npmjs.org/@algolia/ingestion/-/ingestion-1.59.0.tgz", + "integrity": "sha512-Fa38s1mHgoaLCT117sfJ6P78rtxUt93CYxBYpq1VOIcslaF+cH+1h5uikAPsKfxLnsuEDZHiBiaI6eNPTsQMRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/monitoring": { + "version": "1.59.0", + "resolved": "https://registry.npmjs.org/@algolia/monitoring/-/monitoring-1.59.0.tgz", + "integrity": "sha512-NyNsRSqM2tF1MX7ZGw/j4rduoEJiQ5wfvbSo/CFVdEzYCjyxbGFRPOZyS/GETJG9rk1TdHOq8NZqKqk/u1fm4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/recommend": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-5.59.0.tgz", + "integrity": "sha512-nXBK2uygWtvbCOffMWqqfjjcEtp9enDKY5/2Pw/Hhw8VVaOyK2ThbGK04bNX/Le+qoK1VHYkodWGVTKfw0Otkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/requester-browser-xhr": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.59.0.tgz", + "integrity": "sha512-yb+4afX/zja8QwX0KmV4/ae2kyYkRknsE79CRusYS2U5D8qwn2wq0cn1x12f3tm3F3+5FgmDdbuGdQTuCLSKMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/requester-fetch": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-fetch/-/requester-fetch-5.59.0.tgz", + "integrity": "sha512-Lp52TmpA1QtNmdHzs505Xwf4tgII7RAapkDSF9AAtWIBETcGaTIaXci4Rd9nS6SdaWK1BWTSqAPp5wzh6UN3Ag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@algolia/requester-node-http": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.59.0.tgz", + "integrity": "sha512-YYHLEs5rC6oRTFwT7bJaKBR9NSFzikeVHGAT1ffATmUQzR8XqyhHXjoieAUoR7fBU6I5cfy1FVeh5GoRgriuzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/client-common": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", + "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.8" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@docsearch/css": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.8.2.tgz", + "integrity": "sha512-y05ayQFyUmCXze79+56v/4HpycYF3uFqB78pLPrSV5ZKAlDuIAAJNhaRi8tTdRNXh05yxX/TyNnzD6LwSM89vQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@docsearch/js": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.8.2.tgz", + "integrity": "sha512-Q5wY66qHn0SwA7Taa0aDbHiJvaFJLOJyHmooQ7y8hlwwQLQ/5WwCcoX0g7ii04Qi2DJlHsd0XXzJ8Ypw9+9YmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@docsearch/react": "3.8.2", + "preact": "^10.0.0" + } + }, + "node_modules/@docsearch/react": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.8.2.tgz", + "integrity": "sha512-xCRrJQlTt8N9GU0DG4ptwHRkfnSnD/YpdeaXe02iKfqs97TkZJv60yE+1eq/tjPcVnTW8dP5qLP7itifFVV5eg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/autocomplete-core": "1.17.7", + "@algolia/autocomplete-preset-algolia": "1.17.7", + "@docsearch/css": "3.8.2", + "algoliasearch": "^5.14.2" + }, + "peerDependencies": { + "@types/react": ">= 16.8.0 < 19.0.0", + "react": ">= 16.8.0 < 19.0.0", + "react-dom": ">= 16.8.0 < 19.0.0", + "search-insights": ">= 1 < 3" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "search-insights": { + "optional": true + } + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@hexagon/base64": { + "version": "1.1.28", + "resolved": "https://registry.npmjs.org/@hexagon/base64/-/base64-1.1.28.tgz", + "integrity": "sha512-lhqDEAvWixy3bZ+UOYbPwUbBkwBq5C1LAJ/xPC8Oi+lL54oyakv/npbA0aU2hgCsx/1NUd4IBvV03+aUBWxerw==", + "license": "MIT" + }, + "node_modules/@iconify-json/simple-icons": { + "version": "1.2.97", + "resolved": "https://registry.npmjs.org/@iconify-json/simple-icons/-/simple-icons-1.2.97.tgz", + "integrity": "sha512-Z6PmM6jvWVU7rmLzqbxCLJA7SeqCnK6lMHXtjyzHPLZebwuoojBEcHHycppahDzEeN9xujRkrV5J8QpOhMyNrg==", + "dev": true, + "license": "CC0-1.0", + "dependencies": { + "@iconify/types": "*" + } + }, + "node_modules/@iconify/types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", + "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@levischuck/tiny-cbor": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/@levischuck/tiny-cbor/-/tiny-cbor-0.2.11.tgz", + "integrity": "sha512-llBRm4dT4Z89aRsm6u2oEZ8tfwL/2l6BwpZ7JcyieouniDECM5AqNgr/y08zalEIvW3RSK4upYyybDcmjXqAow==", + "license": "MIT" + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@peculiar/asn1-android": { + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-android/-/asn1-android-2.9.5.tgz", + "integrity": "sha512-KnNE4l033gbJ3ZzfYk7fJpSZwhd5xT+dPAnrB8bcwqylHiLN2zjZ0OyFao0LDIOI/ZdXRabV0n3Ww/KvpgZq6w==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.9.5", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-asym-key": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-asym-key/-/asn1-asym-key-2.11.1.tgz", + "integrity": "sha512-YtXR0FbDtjHuNGvWXD4HFE7th5xYwG67O+ApDH/FZsjj5MOrWHzDvqwZ1vm6uFUJtMAkUDcF6VMPGOJ5gnLyUA==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-pkcs8": "^2.11.1", + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-cms": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.11.1.tgz", + "integrity": "sha512-Bk+oatE62dW0Tzzpfk6vdQxfGGEfvuGdWgmijnKjcv7HqZCJISs85z4zw2uDArrk+R1Oel1wts/BBl7HHrtAcA==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "@peculiar/asn1-x509-attr": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-csr": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.11.1.tgz", + "integrity": "sha512-KVfbXaKng8886/tOPG55t5K1XkTkGbR4amjIJzytXWobFU5nZgw/sKnSpa1hxP17nUSsrOF/7Mt9WUYeyLsi6Q==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-ecc": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.11.1.tgz", + "integrity": "sha512-7MSNji77fQa/oN3WAfwagMy8EoJFg50sW4hZ1dtr0zU1BSugit0I2DGpIdPhvkNplopQhz5bogxpn1077eaamA==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-pfx": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.11.1.tgz", + "integrity": "sha512-2SN2z8qkc2hk/GgTYA8RN54wtsCDZShg9gI2Mq1vLhdj1adcv5fhTbiEmExZUaAMqlizxiEpULQDfHM5iYtn1g==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-cms": "^2.11.1", + "@peculiar/asn1-pkcs8": "^2.11.1", + "@peculiar/asn1-rsa": "^2.11.1", + "@peculiar/asn1-schema": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-pkcs8": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.11.1.tgz", + "integrity": "sha512-HqsSrnpQghRp9SM9QSmR6fa4z/BNktnKq7928+oq4qF0VAnuHZ4cyePKvcxh9fP4taBCP/WHNItlVNsYaQm2qw==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-pkcs9": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.11.1.tgz", + "integrity": "sha512-OHFkTg8D2zYafILqFE4KPbqX8srpvd3diGDc2h2cduumawc765mOHGcuFMGvLWlL2bbCMWMmMSCtlXptsOuiPA==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-cms": "^2.11.1", + "@peculiar/asn1-pfx": "^2.11.1", + "@peculiar/asn1-pkcs8": "^2.11.1", + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "@peculiar/asn1-x509-attr": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-rsa": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.11.1.tgz", + "integrity": "sha512-6KwKGjulF489CpidZqkogNgLj6oGzgC4BL2FClM8PuJQ4t5NqT4q4a6A4vrSxBIBhMnL8hGYkLOpbVw0Vq38Tw==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-schema": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.11.1.tgz", + "integrity": "sha512-jaU9OaCcbZUdyXx9hMETZB9xoNmxTGjOGFqd3cOwKFkpKnyKd9WxF3uqj4PvX4cyOMP9bSdHg5YyML2qtx/d/g==", + "license": "MIT", + "dependencies": { + "@peculiar/utils": "^2.0.2", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-x509": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.11.1.tgz", + "integrity": "sha512-SXU4/X6B3FquqQAN6ARI0bFDUV7+L1WlvPEPMKzEMkstd2D7UyM0r93fv241+OjdhqAKYGx5MvV3gzZMAp0APA==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/utils": "^2.0.2", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-x509-attr": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.11.1.tgz", + "integrity": "sha512-n7RKFrbTzt8pGBlZ90kmKEn1qsLTTyw7lrvHMK0xsA42kQugPk/GXYpNbEcl7DkkdVsU/one5UX7KQPfxLj8vQ==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/asn1-x509-post-quantum": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-post-quantum/-/asn1-x509-post-quantum-2.11.1.tgz", + "integrity": "sha512-yD/pxCQ97nzwF7MGAW4kRd1WVLiMPhD39HxOnAr38DfGFwbpVhPnMbq+r6WX0XUrxn4w8ulsTdUafwVl46igLA==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-asym-key": "^2.11.1", + "@peculiar/asn1-schema": "^2.11.1", + "@peculiar/asn1-x509": "^2.11.1", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@peculiar/utils/-/utils-2.0.3.tgz", + "integrity": "sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ==", + "license": "MIT", + "dependencies": { + "tslib": "^2.8.1" + } + }, + "node_modules/@peculiar/x509": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz", + "integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-cms": "^2.6.0", + "@peculiar/asn1-csr": "^2.6.0", + "@peculiar/asn1-ecc": "^2.6.0", + "@peculiar/asn1-pkcs9": "^2.6.0", + "@peculiar/asn1-rsa": "^2.6.0", + "@peculiar/asn1-schema": "^2.6.0", + "@peculiar/asn1-x509": "^2.6.0", + "pvtsutils": "^1.3.6", + "reflect-metadata": "^0.2.2", + "tslib": "^2.8.1", + "tsyringe": "^4.10.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.4.tgz", + "integrity": "sha512-I+BSHzTAhKN2n7ZwGZsegGcZjDpLqFOMAtJz/u6uFGe0pUFbq56dEHjqJV/ZUdRJtNXNxA+hREUatZBvMR3Oiw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.4.tgz", + "integrity": "sha512-pu3BdjS2LtEzRu2elmGzS3fIeWSZy4BMDIaLNwjorO76+k2d0LMluijhsDx3KQyQBQ/lLUZCQA9/s6csvUfuhw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.4.tgz", + "integrity": "sha512-xfSrj9MHnWK9GaSqT9U0ImHtH/N8WZlHLx4cZHiuLcqs640hvZ3hLPd5UR2AZS57FaE8HrRUSpltbZdWRxHiDA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.4.tgz", + "integrity": "sha512-bqU99PLJb/dqb3S0GIMdeuyAEETSUgZBoqXYd3Sd+WCsV+MmPhnN6JrotWyir31+QgH7EvvE5/mwGJlEoci8Fw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.4.tgz", + "integrity": "sha512-JinsFZ5G40oXQb+sUuiA5x689vhr6dDYK0H0NL+rwKdL6CqnmYN8PE4ZwfRSoIjrCxqTQG/SLfTtSvHeGxoVlw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.4.tgz", + "integrity": "sha512-GAdA4UxpiNm27cLHr2GqXBpAD0x9FqwYBY7/YSP0Ss0/PNi4k8gbviqpIpYbVSRBaS2ZcegXEzgTQMbRNCwxCw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.4.tgz", + "integrity": "sha512-qDd6NoA1znaLjp4jR5U/KWCdLAKDJNB8W9ChbbDaKbo0xA+Atln5HK6LFCZ4oJQpemtRZA288DCirFRjrspptw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.4.tgz", + "integrity": "sha512-WtB5Tz5KTNINb8ZA+8sQ7bmjuS1JrRT7YverYIhUGdWWDlpzVWmIwuZE+jidkEXUn1l0zrEkaIMa8dHF3NGcsA==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.4.tgz", + "integrity": "sha512-VcQ3L1tjnkKzWjryAVaFhHEWcqOfICX9uxVVoDzm2t0DpgKRHd2zOpVrJc0xsWeBZcBFyYROCIBdyR/fS174pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.4.tgz", + "integrity": "sha512-6+ZQX6P5s0cMDN2Ypb8Lbm2+/sZYmZjdaYny992ujUU9UKi/4CWoJWsl1pNvjWJHNHGK51m+jKGLlh1ylb2ifQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.4.tgz", + "integrity": "sha512-D72ZnvkFkBXOfzMMQLcwfPLyGkKb7HZ9/mf97B7v6/P5Lbv4oFOtSY/uHbS8lH6uKUOxoKiuokdb50XZSzzbJw==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.4.tgz", + "integrity": "sha512-piU6BxeqA3O9KSu3kRCIQQtNqFFaTu21SEV4FwaRZowpnj3bLaWPZHw+xFqCs0XlJ+aOH3PTRWGoglH+mKA/OA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.4.tgz", + "integrity": "sha512-/5PGpHwqt2EEEOUs1XwzubE/ucr0dWDQ+to3zqi4Ds7EWpwtQ79wXc4JBoxqj/OwpawTsKWzJxHfSuBOq3DrWA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.4.tgz", + "integrity": "sha512-cX3beZDLWt7G2oJF+nhChiT+qtaihs+S2xi7ziGmVB+2pwPng6D0Ed0HmElQOgv2UsUmSJJLGwpBao/3TDx3VA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.4.tgz", + "integrity": "sha512-1uz2mGWHyptR7DgHHrlbdRAjXK7v7elGZ9lMja910/RP+ZYbX6xAmCiU9UZSX4hqmgtHMv6lr5l3kq1HIOpcag==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.4.tgz", + "integrity": "sha512-nLS8topojxyz7SRpKR2IODRpQ0XPZ+xaOXvT3+hqK/Uy8Lo5HFgkkIBiIrCu5tL5YqzTvgovGw55PwpahTAGig==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.4.tgz", + "integrity": "sha512-gs7DRKotr3l3q+jGPQBjH0ng1FjlEDm5ueQrkw5JtQvtLyEIcLASqAEaor56BhkKRzk+IcQzrcanBdb/bBQn8g==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.4.tgz", + "integrity": "sha512-791ET7W17NnScOZM7h4dX5hYspxE28htPFsb1awY/NRR8+PRNkS53e475rDdxXXDrP+kwnCcNWg9CX5ztn/Aqw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.4.tgz", + "integrity": "sha512-iwZQRcmj7g88g3tzefIrQY7qvmuA/cfYwhrDtTBhsmukO4U2huVO5W+86XacUMRvdSFVAc6kZUZy21JaRwiB9w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.4.tgz", + "integrity": "sha512-dVHFp9gRWrdTpnqQuGfCwd7hOQDatK1VCP2iWhLY/cGrOQs/ucFzJ6A5SRqbXX12ZDI8EUuejSM5kwg+ja7Png==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.4.tgz", + "integrity": "sha512-t3NlauOW6gxZVVFcBEnO62Cb4wbyDFL416gTg1uFI/2tgqYQlf69FbSE115Ajre9I+c26Lk4mcmdFUsS/DGifQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.4.tgz", + "integrity": "sha512-xWuIaSye5FWZF8+UYtVEcHtRJDN5kN9Kfgxx3Kq8XIov9KSKbc1fiqQCm90SKrgQbUXZelbnUhnlUJmfSE7P9A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.4.tgz", + "integrity": "sha512-9ALJJUOg/ZflMJepVo2PlgsGxSaxN7SQ4Z8GoZfVlarWr6r3rkHUNsd/zAio7p4YMtChSMXPionxej4Hkf6CXQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.4.tgz", + "integrity": "sha512-blj9z5qx/Pv4WU0W1NMFDB97e0JH5ed+aZGywW8WCvp/NhWX/4PFAq5uu6Q0AebNn+Vo6KzUYDT++JzTT5ojlQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.4.tgz", + "integrity": "sha512-Erx822VRBwLa124shbj+wNXe//BOgMEctDV0m1aqTQdNO1S69DgNUCFKC1RCeZfixs1J31l6igk1ziyXErbigQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@shikijs/core": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-2.5.0.tgz", + "integrity": "sha512-uu/8RExTKtavlpH7XqnVYBrfBkUc20ngXiX9NSrBhOVZYv/7XQRKUyhtkeflY5QsxC0GbJThCerruZfsUaSldg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/engine-javascript": "2.5.0", + "@shikijs/engine-oniguruma": "2.5.0", + "@shikijs/types": "2.5.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.4" + } + }, + "node_modules/@shikijs/engine-javascript": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-2.5.0.tgz", + "integrity": "sha512-VjnOpnQf8WuCEZtNUdjjwGUbtAVKuZkVQ/5cHy/tojVVRIRtlWMYVjyWhxOmIq05AlSOv72z7hRNRGVBgQOl0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "2.5.0", + "@shikijs/vscode-textmate": "^10.0.2", + "oniguruma-to-es": "^3.1.0" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-2.5.0.tgz", + "integrity": "sha512-pGd1wRATzbo/uatrCIILlAdFVKdxImWJGQ5rFiB5VZi2ve5xj3Ax9jny8QvkaV93btQEwR/rSz5ERFpC5mKNIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "2.5.0", + "@shikijs/vscode-textmate": "^10.0.2" + } + }, + "node_modules/@shikijs/langs": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-2.5.0.tgz", + "integrity": "sha512-Qfrrt5OsNH5R+5tJ/3uYBBZv3SuGmnRPejV9IlIbFH3HTGLDlkqgHymAlzklVmKBjAaVmkPkyikAV/sQ1wSL+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "2.5.0" + } + }, + "node_modules/@shikijs/themes": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-2.5.0.tgz", + "integrity": "sha512-wGrk+R8tJnO0VMzmUExHR+QdSaPUl/NKs+a4cQQRWyoc3YFbUzuLEi/KWK1hj+8BfHRKm2jNhhJck1dfstJpiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "2.5.0" + } + }, + "node_modules/@shikijs/transformers": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/transformers/-/transformers-2.5.0.tgz", + "integrity": "sha512-SI494W5X60CaUwgi8u4q4m4s3YAFSxln3tzNjOSYqq54wlVgz0/NbbXEb3mdLbqMBztcmS7bVTaEd2w0qMmfeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/core": "2.5.0", + "@shikijs/types": "2.5.0" + } + }, + "node_modules/@shikijs/types": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-2.5.0.tgz", + "integrity": "sha512-ygl5yhxki9ZLNuNpPitBWvcy9fsSKKaRuO4BAlMyagszQidxcpLAr0qiW/q43DtSIDxO6hEbtYLiFZNXO/hdGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@simplewebauthn/server": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-14.1.0.tgz", + "integrity": "sha512-HPRRBR4Vzr45+RVvbmf6JuCfGdYYcSs4Pnnnp9YSY2IABa4JKnG+wxybczoB7rmdLCOMS/mbBa2ZL/Bcz58UlA==", + "license": "MIT", + "dependencies": { + "@hexagon/base64": "^1.1.27", + "@levischuck/tiny-cbor": "^0.2.2", + "@peculiar/asn1-android": "^2.6.0", + "@peculiar/asn1-ecc": "^2.6.1", + "@peculiar/asn1-rsa": "^2.6.1", + "@peculiar/asn1-schema": "^2.6.0", + "@peculiar/asn1-x509": "^2.6.1", + "@peculiar/asn1-x509-post-quantum": "^2.9.4", + "@peculiar/x509": "^2.1.0", + "reflect-metadata": "^0.2.2" + }, + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/@simplewebauthn/server/node_modules/@peculiar/x509": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-2.2.0.tgz", + "integrity": "sha512-adpW58ySPQMOUPv8pTKT3RIyCFqfUFt8X05ukPdtkQToXDVr8dMtxuenik1yx8tNFTbpApWsM/Hi5SzlIx48+Q==", + "license": "MIT", + "dependencies": { + "@peculiar/asn1-cms": "^2.11.0", + "@peculiar/asn1-csr": "^2.11.0", + "@peculiar/asn1-ecc": "^2.11.0", + "@peculiar/asn1-pkcs9": "^2.11.0", + "@peculiar/asn1-rsa": "^2.11.0", + "@peculiar/asn1-schema": "^2.11.0", + "@peculiar/asn1-x509": "^2.11.0", + "@peculiar/asn1-x509-post-quantum": "^2.11.0", + "pvtsutils": "^1.3.6", + "tslib": "^2.8.1", + "tsyringe": "^4.10.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@types/debug": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/hast": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.5.tgz", + "integrity": "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/markdown-it": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.2.0.tgz", + "integrity": "sha512-NoQ2yGlLWj4wpxMs+TYmRKk3thDrQ97agr7sFqfLsAlvoS8SNQuTrlObhFqG9iugdTtgOE9jpJ6FNM4ZGsa5xQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.2.tgz", + "integrity": "sha512-X1P21scMv4zGKLYqjdGjaKa7COa0RKVYYZZN/NfvLQ1JegxFhdhpZG/Lyn8AXx6CDUavKAd11v6BvfpkDByK8g==", + "license": "MIT", + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/validator": { + "version": "13.15.10", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.15.10.tgz", + "integrity": "sha512-T8L6i7wCuyoK8A/ZeLYt1+q0ty3Zb9+qbSSvrIVitzT3YjZqkTZ40IbRsPanlB4h1QB3JVL1SYCdR6ngtFYcuA==", + "license": "MIT" + }, + "node_modules/@types/web-bluetooth": { + "version": "0.0.21", + "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.21.tgz", + "integrity": "sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.4.0.tgz", + "integrity": "sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/@vitejs/plugin-vue": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.4.tgz", + "integrity": "sha512-7Yx/SXSOcQq5HiiV3orevHUFn+pmMB4cgbEkDYgnkUWb0WfeQ/wa2yFv6D5ICiCQOVpjA7vYDXrC7AGO8yjDHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "vite": "^5.0.0 || ^6.0.0", + "vue": "^3.2.25" + } + }, + "node_modules/@vue/compiler-core": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.43.tgz", + "integrity": "sha512-zdiLhnbe1QQqgDT8xZMpNmyqZ3qlI+/Q/FHQco57Kwl/b05HhCzN6eVGN9QU9rbga4CrS0H5SYY8VGHZCt/1Hg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@vue/shared": "3.5.43", + "entities": "^7.0.1", + "estree-walker": "^2.0.2", + "source-map-js": "^1.2.1" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.43.tgz", + "integrity": "sha512-PEZoAk3NQmsn/ejMzSOCyTYqwGqczrWm70PuhBKjjv1+TCoQAaO/zOqNwjV+honlNstT5ILxtc+8r8UUfj+iEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-core": "3.5.43", + "@vue/shared": "3.5.43" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.43.tgz", + "integrity": "sha512-FCbrG3XNCRl+js3huuKx4IVHBLTvMkJhVepjbxSPu1gn4yWLaYtGNQdjJGZaMytXB6qb76qQDDmDSLy/vkmleQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@vue/compiler-core": "3.5.43", + "@vue/compiler-dom": "3.5.43", + "@vue/compiler-ssr": "3.5.43", + "@vue/shared": "3.5.43", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.21", + "postcss": "^8.5.28", + "source-map-js": "^1.2.1" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.43.tgz", + "integrity": "sha512-GF62orf7KiJX9RqrHNGrYBudsQGD0OhJ5nDs90O8UiDuS40+YMYomiXu6w6EuvtXuRDc3MSNis3EaaSKAVSWpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.5.43", + "@vue/shared": "3.5.43" + } + }, + "node_modules/@vue/devtools-api": { + "version": "7.7.10", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.10.tgz", + "integrity": "sha512-KxtEpUOOpFz/qOGRrAwA36QF7DqIA+FXgCYit9mk9wjbaZt0sXOFz81ElOZtKA4HbWHUdwNjZHBFsFFyp5BZiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/devtools-kit": "^7.7.10" + } + }, + "node_modules/@vue/devtools-kit": { + "version": "7.7.10", + "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.10.tgz", + "integrity": "sha512-3WNi2Kq4tbpVbmhml7RiphmAt0279oh3fKNeWMQIrltfX8Q91b4i5PL8DtyNKdwmcsGrV4fg+erwWOmD05CLIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/devtools-shared": "^7.7.10", + "birpc": "^2.3.0", + "hookable": "^5.5.3", + "mitt": "^3.0.1", + "perfect-debounce": "^1.0.0", + "speakingurl": "^14.0.1", + "superjson": "^2.2.2" + } + }, + "node_modules/@vue/devtools-shared": { + "version": "7.7.10", + "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.10.tgz", + "integrity": "sha512-wOPslzB8vTvpxwdaOcR2qAbwmuSP0L+rhpoC6Cf56V3Jip+HWb7PQQXOUPgBNQARpXsbQX/+mvi8kKucmBGRwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "rfdc": "^1.4.1" + } + }, + "node_modules/@vue/reactivity": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.43.tgz", + "integrity": "sha512-G/c9GyOZNI2jVaaS6OX1EF1SSFSv7H0ERqNTl4+DTFMlZmB5eVAB53aLQNam/7NL2NPtaDD7RdVrzf8uJzMuOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/shared": "3.5.43" + } + }, + "node_modules/@vue/runtime-core": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.43.tgz", + "integrity": "sha512-hU6U6VnVhBGQDpvlnnDlIB8ZGJBiOcgk2lh/0InltHiz3D8oSkluvuvY+do1G2H3+udeKFsmaBlgVYP7gXQzEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.5.43", + "@vue/shared": "3.5.43" + } + }, + "node_modules/@vue/runtime-dom": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.43.tgz", + "integrity": "sha512-Bb2Jc0YjjJdMt1SJmb9b2L/IWd3I8lIT9x9eS/xvvP9CiVgna0ffua74xKRmt4/uSJ+0r4iN8ex1jrqkhQGWQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.5.43", + "@vue/runtime-core": "3.5.43", + "@vue/shared": "3.5.43", + "csstype": "^3.2.3" + } + }, + "node_modules/@vue/server-renderer": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.43.tgz", + "integrity": "sha512-l2Ygjv9NehV94PSBxNWsAHC0j/eIIKbn92mBuWXAPGLnn6HfJ6MH5ubsd+Nk0YoZ5FRuxWI1P2VSoh+dbPQhCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-ssr": "3.5.43", + "@vue/runtime-dom": "3.5.43", + "@vue/shared": "3.5.43" + } + }, + "node_modules/@vue/shared": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.43.tgz", + "integrity": "sha512-uksS7YGMR5NZyr4JNq0Rp+QyLns0ueaz20KwzIPW9R0LH1Vnt4E+XUM29PNseEbf1www2gOuhuDi5AKOIXag9Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@vueuse/core": { + "version": "12.8.2", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-12.8.2.tgz", + "integrity": "sha512-HbvCmZdzAu3VGi/pWYm5Ut+Kd9mn1ZHnn4L5G8kOQTPs/IwIAmJoBrmYk2ckLArgMXZj0AW3n5CAejLUO+PhdQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/web-bluetooth": "^0.0.21", + "@vueuse/metadata": "12.8.2", + "@vueuse/shared": "12.8.2", + "vue": "^3.5.13" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/integrations": { + "version": "12.8.2", + "resolved": "https://registry.npmjs.org/@vueuse/integrations/-/integrations-12.8.2.tgz", + "integrity": "sha512-fbGYivgK5uBTRt7p5F3zy6VrETlV9RtZjBqd1/HxGdjdckBgBM4ugP8LHpjolqTj14TXTxSK1ZfgPbHYyGuH7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vueuse/core": "12.8.2", + "@vueuse/shared": "12.8.2", + "vue": "^3.5.13" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "async-validator": "^4", + "axios": "^1", + "change-case": "^5", + "drauu": "^0.4", + "focus-trap": "^7", + "fuse.js": "^7", + "idb-keyval": "^6", + "jwt-decode": "^4", + "nprogress": "^0.2", + "qrcode": "^1.5", + "sortablejs": "^1", + "universal-cookie": "^7" + }, + "peerDependenciesMeta": { + "async-validator": { + "optional": true + }, + "axios": { + "optional": true + }, + "change-case": { + "optional": true + }, + "drauu": { + "optional": true + }, + "focus-trap": { + "optional": true + }, + "fuse.js": { + "optional": true + }, + "idb-keyval": { + "optional": true + }, + "jwt-decode": { + "optional": true + }, + "nprogress": { + "optional": true + }, + "qrcode": { + "optional": true + }, + "sortablejs": { + "optional": true + }, + "universal-cookie": { + "optional": true + } + } + }, + "node_modules/@vueuse/metadata": { + "version": "12.8.2", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-12.8.2.tgz", + "integrity": "sha512-rAyLGEuoBJ/Il5AmFHiziCPdQzRt88VxR+Y/A/QhJ1EWtWqPBBAxTAFaSkviwEuOEZNtW8pvkPgoCZQ+HxqW1A==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/shared": { + "version": "12.8.2", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-12.8.2.tgz", + "integrity": "sha512-dznP38YzxZoNloI0qpEfpkms8knDtaoQ6Y/sfS0L7Yki4zh40LFHEhur0odJC6xTHG5dxWVPiUWBXn+wCG2s5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "vue": "^3.5.13" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/abbrev": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-4.0.0.tgz", + "integrity": "sha512-a1wflyaL0tHtJSmLSOVybYhy22vRih4eduhhrkcjgrWGnRfrZtovJ2FRjxuTtkkj47O/baf0R86QU5OuYpz8fA==", + "license": "ISC", + "optional": true, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/acme-client": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/acme-client/-/acme-client-5.4.0.tgz", + "integrity": "sha512-mORqg60S8iML6XSmVjqjGHJkINrCGLMj2QvDmFzI9vIlv1RGlyjmw3nrzaINJjkNsYXC41XhhD5pfy7CtuGcbA==", + "license": "MIT", + "dependencies": { + "@peculiar/x509": "^1.11.0", + "asn1js": "^3.0.5", + "axios": "^1.7.2", + "debug": "^4.3.5", + "node-forge": "^1.3.1" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/algoliasearch": { + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.59.0.tgz", + "integrity": "sha512-wUXzaeI7B526W4y1gFg3lcxgDZ67XSgRJIiellYWOas/pLpO7rOtxm9Gr2E/C8aiSDXIgx1q5TdSsvK67Uakqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@algolia/abtesting": "1.25.0", + "@algolia/client-abtesting": "5.59.0", + "@algolia/client-analytics": "5.59.0", + "@algolia/client-common": "5.59.0", + "@algolia/client-insights": "5.59.0", + "@algolia/client-personalization": "5.59.0", + "@algolia/client-query-suggestions": "5.59.0", + "@algolia/client-search": "5.59.0", + "@algolia/ingestion": "1.59.0", + "@algolia/monitoring": "1.59.0", + "@algolia/recommend": "5.59.0", + "@algolia/requester-browser-xhr": "5.59.0", + "@algolia/requester-fetch": "5.59.0", + "@algolia/requester-node-http": "5.59.0" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/ansi-regex": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-3.0.4.tgz", + "integrity": "sha512-fwWK3Zq22l4XJJjx5mcBHGikIk+hJqO+32dPm0Jur7+rtG5x1scOjSfdT9ZKeWHPpsya/l0HHK4tDImBkTrtvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "PSF-2.0" + }, + "node_modules/asn1js": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.10.tgz", + "integrity": "sha512-S2s3aOytiKdFRdulw2qPE51MzjzVOisppcVv7jVFR+Kw0kxwvFrDcYA0h7Ndqbmj0HkMIXYWaoj7fli8kgx1eg==", + "license": "BSD-3-Clause", + "dependencies": { + "pvtsutils": "^1.3.6", + "pvutils": "^1.1.5", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/axios": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.20.0.tgz", + "integrity": "sha512-r8aOh8j9cGKpgQAqpzrUHnSIc6a59Y3Xf/cv8sy1DrHCkZHzQGEuoq1tARk6qSyDdtQGSDgpb9kFlruzPvrgwg==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.16.0", + "form-data": "^4.0.6", + "https-proxy-agent": "^5.0.1", + "proxy-from-env": "^2.1.0" + } + }, + "node_modules/base32.js": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/base32.js/-/base32.js-0.0.1.tgz", + "integrity": "sha512-EGHIRiegFa62/SsA1J+Xs2tIzludPdzM064N9wjbiEgHnGnJ1V0WEpA4pEwCYT5nDvZk3ubf0shqaCS7k6xeUQ==", + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/birpc": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/birpc/-/birpc-2.9.0.tgz", + "integrity": "sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/bufferutil": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.2.0.tgz", + "integrity": "sha512-gyy58jET9kst2IGyBKb96a4Y2bPGTHXGyCd0/1eqIV3hr1Sz3VxtA8n7bXh8fLIuE2K6Z0Upax5a5Msx+HU1IQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chownr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/cliui": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^7.2.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/concurrently": { + "version": "10.0.7", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-10.0.7.tgz", + "integrity": "sha512-zMCeLhawVIj3SLbpg0/BWCdJl1wcBSpcHKbNrhaM01P3xAlEWcH30Lea2q+F4uGZ7YM0scDK0dgpWyn1uCJj6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "5.6.2", + "rxjs": "7.8.2", + "shell-quote": "1.12.0", + "supports-color": "10.2.2", + "tree-kill": "1.2.2", + "yargs": "18.0.0" + }, + "bin": { + "conc": "dist/bin/index.js", + "concurrently": "dist/bin/index.js" + }, + "engines": { + "node": ">=22" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/copy-anything": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-4.1.1.tgz", + "integrity": "sha512-AoT6Imdr98feSpFfmFwTFN73ccdr7uFPf27cBCgYvyyRyn1BzLRxMvrHNmwXO5LJMddRy4Rdhw2b1h7vSMKsEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dottie": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.7.tgz", + "integrity": "sha512-7lAK2A0b3zZr3UC5aE69CPdCFR4RHW1o2Dr74TqFykxkUCBXSRJum/yPc7g8zRHJqWKomPLHwFLLoUnn8PXXRg==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "license": "MIT" + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex-xs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex-xs/-/emoji-regex-xs-1.0.0.tgz", + "integrity": "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==", + "dev": true, + "license": "MIT" + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/entities": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", + "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, + "node_modules/exponential-backoff": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz", + "integrity": "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA==", + "license": "Apache-2.0", + "optional": true + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT" + }, + "node_modules/focus-trap": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.8.0.tgz", + "integrity": "sha512-/yNdlIkpWbM0ptxno3ONTuf+2g318kh2ez3KSeZN5dZ8YC6AAmgeWz+GasYYiBJPFaYcSAPeu4GfhUaChzIJXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tabbable": "^6.4.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.2.tgz", + "integrity": "sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.7.0.tgz", + "integrity": "sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT" + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC", + "optional": true + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hast-util-to-html": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz", + "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hookable": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz", + "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/html-void-elements": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inflection": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.13.4.tgz", + "integrity": "sha512-6I/HUDeYFfuNCVS3td055BaXBwKYuzw7K3ExVMStBowKo9oOAMJIXIHvdyR3iboTCp1b+1i5DSkIZTcwIktuDw==", + "engines": [ + "node >= 0.4.0" + ], + "license": "MIT" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" + }, + "node_modules/isexe": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-4.0.0.tgz", + "integrity": "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw==", + "license": "BlueOak-1.0.0", + "optional": true, + "engines": { + "node": ">=20" + } + }, + "node_modules/jose": { + "version": "6.2.15", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.15.tgz", + "integrity": "sha512-qdF6ewcZARtef63fJ9AKKZPgxw+t7USH6HLXYcD4CrdmSvDp79rpJSPFEKc90QBeGS63u1KQtN2MZQHC0yDIzA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/js-yaml": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.5.0.tgz", + "integrity": "sha512-paNr4LFIFPjeeSmwNYdrb8FafLLG/Cr2Af3GjbsHJ5CxIjH4r0c2emlmRdAtpPAieP1gRVzk6buBbVP5gBMGAg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^3.0.3" + }, + "bin": { + "js-yaml": "bin/js-yaml.mjs" + } + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/mark.js": { + "version": "8.11.1", + "resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz", + "integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minisearch": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-7.2.0.tgz", + "integrity": "sha512-dqT2XBYUOZOiC5t2HRnwADjhNS2cecp9u+TJRiJ1Qp/f5qjkeT5APcGPjHw+bz89Ms8Jp+cG4AlE+QZ/QnDglg==", + "dev": true, + "license": "MIT" + }, + "node_modules/minizlib": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "dev": true, + "license": "MIT" + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT" + }, + "node_modules/mmdb-lib": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/mmdb-lib/-/mmdb-lib-3.0.5.tgz", + "integrity": "sha512-fBhq5SQHKXwL4dPwF4/Xesw6Ai5nsPlft7RWQwBOm5fhfrQs0r1dR7FbLCaaKH9pkub2s4BKrHAeZUjq+KrX7g==", + "license": "MIT", + "engines": { + "node": ">=10", + "npm": ">=6" + } + }, + "node_modules/moment": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.31.0.tgz", + "integrity": "sha512-0acOTfMiWOheYS4eoWb80yYMb/JLvVv9SHbs2PehaDzfUG0Bw855SKyk0IKTnPGa5+U2bmi3W68l1+sGLX/pvw==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/moment-timezone": { + "version": "0.5.48", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.48.tgz", + "integrity": "sha512-f22b8LV1gbTO2ms2j2z13MuPogNoh5UzxL3nzNAYKGraILnbGc9NEE6dyiiiLv46DGRb8A4kg8UKWLjPthxBHw==", + "license": "MIT", + "dependencies": { + "moment": "^2.29.4" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.19", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", + "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT" + }, + "node_modules/node-abi": { + "version": "3.96.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.96.0.tgz", + "integrity": "sha512-rebQ/lz7i0EkoLzUVSrKRzA69zMkwLp95kKMWoMDkkM00Suxz0D7zEQPwRml5fQum24mj7bPvmlgLAmu2JCiYg==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "8.9.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.9.2.tgz", + "integrity": "sha512-VijLXbi3UACN69I0JVXJsX4tjACjNoQDgv2gTF6sx2wWEi8tkSg2eX8p5gSIFi8z2+DL3oHmY6OyKce38SDolg==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-forge": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.3.tgz", + "integrity": "sha512-P6wzfh6t70avmV8FrVEAd/36sOPJQ+hkaJVX1Laap9J/77m7M0eyozDvc8SwnDf4P7MP94gwbAAo0rg3YVXT+g==", + "license": "(BSD-3-Clause OR GPL-2.0)", + "engines": { + "node": ">= 6.13.0" + } + }, + "node_modules/node-gyp": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-12.4.0.tgz", + "integrity": "sha512-OMcPNvqTCFUnNaBlmdgq+lfNqY7gTiSmNRDjY3uAXRyudeKZEZxu3CLtjMQrx4zZxCX2b/mpNqTtwuCJgXhHkw==", + "license": "MIT", + "optional": true, + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "graceful-fs": "^4.2.6", + "nopt": "^9.0.0", + "proc-log": "^6.0.0", + "semver": "^7.3.5", + "tar": "^7.5.4", + "tinyglobby": "^0.2.12", + "undici": "^6.25.0", + "which": "^6.0.0" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "optional": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/nopt": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-9.0.0.tgz", + "integrity": "sha512-Zhq3a+yFKrYwSBluL4H9XP3m3y5uvQkB/09CwDruCiRmR/UJYnn9W4R48ry0uGC70aeTPKLynBtscP9efFFcPw==", + "license": "ISC", + "optional": true, + "dependencies": { + "abbrev": "^4.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/oauth4webapi": { + "version": "3.8.8", + "resolved": "https://registry.npmjs.org/oauth4webapi/-/oauth4webapi-3.8.8.tgz", + "integrity": "sha512-8N28E+a/oxfXWBgOMt+ZP/JUf/XR+IFbvkAEPP3gznXOMv9BpAAwiIj0TFNz3tGTPc0ZQ8zmWBNgN1nAys0gng==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/oniguruma-to-es": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-3.1.1.tgz", + "integrity": "sha512-bUH8SDvPkH3ho3dvwJwfonjlQ4R80vjyvrU8YpxuROddv55vAEJrTuCuCVUhhsHbtlD9tGGbaNApGQckXhS8iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex-xs": "^1.0.0", + "regex": "^6.0.1", + "regex-recursion": "^6.0.2" + } + }, + "node_modules/openid-client": { + "version": "6.8.9", + "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-6.8.9.tgz", + "integrity": "sha512-6mXMRNJxDOf6BflEWLXul1UwzLFz++9Ofz1PYwPwwsJsyXBsbfkO+Jo255SW1qnFNLYz4EJWHz42X4OJJrya/g==", + "license": "MIT", + "dependencies": { + "jose": "^6.2.15", + "oauth4webapi": "^3.8.8" + }, + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/perfect-debounce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz", + "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==", + "dev": true, + "license": "MIT" + }, + "node_modules/pg-connection-string": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.0.tgz", + "integrity": "sha512-XwWDGcLRGCXAR8F/AM5bG7Q+A3Wm2s6QeEjlOKZLlH3UYcguiqCWKyWXVag5TLTIjR7oOJUY8kcADaZgWPyLeg==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/preact": { + "version": "10.29.8", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.29.8.tgz", + "integrity": "sha512-ej2aVZ+vZ8WO7tvlQWRM9N63A0KzF9q4mWJfDUHgYaIofWY9hu74QdnQrjoPMmZi2/nZ5gN0bJCQF49xQqx09Q==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + }, + "peerDependencies": { + "preact-render-to-string": ">=5" + }, + "peerDependenciesMeta": { + "preact-render-to-string": { + "optional": true + } + } + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.", + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "license": "ISC", + "optional": true, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/property-information": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/proxy-from-env": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", + "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pvtsutils": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.6.tgz", + "integrity": "sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==", + "license": "MIT", + "dependencies": { + "tslib": "^2.8.1" + } + }, + "node_modules/pvutils": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.2.0.tgz", + "integrity": "sha512-BbubeCEyTuQjVMakvJQ/Sxbc93F2pwmbsxONT/ZRrwU7Ua38d8unYTwXpTVLAKJ4BDuH9IGztCjQcd/N/39Dvg==", + "license": "MIT", + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", + "license": "Apache-2.0" + }, + "node_modules/regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/regex/-/regex-6.1.0.tgz", + "integrity": "sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-recursion": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz", + "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-utilities": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", + "dev": true, + "license": "MIT" + }, + "node_modules/retry-as-promised": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-7.1.1.tgz", + "integrity": "sha512-hMD7odLOt3LkTjcif8aRZqi/hybjpLNgSk5oF5FCowfCjok6LukpN2bDX7R5wDmbgBQFn7YoBxSagmtXHaJYJw==", + "license": "MIT" + }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "dev": true, + "license": "MIT" + }, + "node_modules/rollup": { + "version": "4.63.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.4.tgz", + "integrity": "sha512-4U0liVayNIoLp3GFl1FcI8561WepLnZ1rqfraGh7S9B3Ur5F9S283y8Futii7RUU2C/97tOBmBy7nYvhoiOpbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.63.4", + "@rollup/rollup-android-arm64": "4.63.4", + "@rollup/rollup-darwin-arm64": "4.63.4", + "@rollup/rollup-darwin-x64": "4.63.4", + "@rollup/rollup-freebsd-arm64": "4.63.4", + "@rollup/rollup-freebsd-x64": "4.63.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.4", + "@rollup/rollup-linux-arm-musleabihf": "4.63.4", + "@rollup/rollup-linux-arm64-gnu": "4.63.4", + "@rollup/rollup-linux-arm64-musl": "4.63.4", + "@rollup/rollup-linux-loong64-gnu": "4.63.4", + "@rollup/rollup-linux-loong64-musl": "4.63.4", + "@rollup/rollup-linux-ppc64-gnu": "4.63.4", + "@rollup/rollup-linux-ppc64-musl": "4.63.4", + "@rollup/rollup-linux-riscv64-gnu": "4.63.4", + "@rollup/rollup-linux-riscv64-musl": "4.63.4", + "@rollup/rollup-linux-s390x-gnu": "4.63.4", + "@rollup/rollup-linux-x64-gnu": "4.63.4", + "@rollup/rollup-linux-x64-musl": "4.63.4", + "@rollup/rollup-openbsd-x64": "4.63.4", + "@rollup/rollup-openharmony-arm64": "4.63.4", + "@rollup/rollup-win32-arm64-msvc": "4.63.4", + "@rollup/rollup-win32-ia32-msvc": "4.63.4", + "@rollup/rollup-win32-x64-gnu": "4.63.4", + "@rollup/rollup-win32-x64-msvc": "4.63.4", + "fsevents": "~2.3.2" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/search-insights": { + "version": "2.17.3", + "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.17.3.tgz", + "integrity": "sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sequelize": { + "version": "6.37.8", + "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.37.8.tgz", + "integrity": "sha512-HJ0IQFqcTsTiqbEgiuioYFMSD00TP6Cz7zoTti+zVVBwVe9fEhev9cH6WnM3XU31+ABS356durAb99ZuOthnKw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/sequelize" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.1.8", + "@types/validator": "^13.7.17", + "debug": "^4.3.4", + "dottie": "^2.0.6", + "inflection": "^1.13.4", + "lodash": "^4.17.21", + "moment": "^2.29.4", + "moment-timezone": "^0.5.43", + "pg-connection-string": "^2.6.1", + "retry-as-promised": "^7.0.4", + "semver": "^7.5.4", + "sequelize-pool": "^7.1.0", + "toposort-class": "^1.0.1", + "uuid": "^8.3.2", + "validator": "^13.9.0", + "wkx": "^0.5.0" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependenciesMeta": { + "ibm_db": { + "optional": true + }, + "mariadb": { + "optional": true + }, + "mysql2": { + "optional": true + }, + "oracledb": { + "optional": true + }, + "pg": { + "optional": true + }, + "pg-hstore": { + "optional": true + }, + "snowflake-sdk": { + "optional": true + }, + "sqlite3": { + "optional": true + }, + "tedious": { + "optional": true + } + } + }, + "node_modules/sequelize-pool": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/sequelize-pool/-/sequelize-pool-7.1.0.tgz", + "integrity": "sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==", + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/shell-quote": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.12.0.tgz", + "integrity": "sha512-PcByqNyT/38F2kDNi006HAMRJaULuBzq/FOsw3qdZvX/GA9W/jamDaRskgHjubHiftXK5sIFxLNkvrXUwcof6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/shiki": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-2.5.0.tgz", + "integrity": "sha512-mI//trrsaiCIPsja5CNfsyNOqgAZUb6VpJA+340toL42UpzQlXpwRV9nch69X6gaUxrr9kaOOa6e3y3uAkGFxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/core": "2.5.0", + "@shikijs/engine-javascript": "2.5.0", + "@shikijs/engine-oniguruma": "2.5.0", + "@shikijs/langs": "2.5.0", + "@shikijs/themes": "2.5.0", + "@shikijs/types": "2.5.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/speakeasy": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/speakeasy/-/speakeasy-2.0.0.tgz", + "integrity": "sha512-lW2A2s5LKi8rwu77ewisuUOtlCydF/hmQSOJjpTqTj1gZLkNgTaYnyvfxy2WBr4T/h+9c4g8HIITfj83OkFQFw==", + "license": "MIT", + "dependencies": { + "base32.js": "0.0.1" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/speakingurl": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/speakingurl/-/speakingurl-14.0.1.tgz", + "integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sqlite3": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-6.0.1.tgz", + "integrity": "sha512-X0czUUMG2tmSqJpEQa3tCuZSHKIx8PwM53vLZzKp/o6Rpy25fiVfjdbnZ988M8+O3ZWR1ih0K255VumCb3MAnQ==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^8.0.0", + "prebuild-install": "^7.1.3", + "tar": "^7.5.10" + }, + "engines": { + "node": ">=20.17.0" + }, + "optionalDependencies": { + "node-gyp": "12.x" + }, + "peerDependencies": { + "node-gyp": "12.x" + }, + "peerDependenciesMeta": { + "node-gyp": { + "optional": true + } + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dev": true, + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/superjson": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.6.tgz", + "integrity": "sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "copy-anything": "^4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tabbable": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.0.tgz", + "integrity": "sha512-wieBHXygIm7OyQOu5hQlkk62/WyCFYGlWg7L6/ZCUZwx0o398Zkn4pVmMyfYhfMG8kGrj/Krt8eIk6UKC6VzwA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tar": { + "version": "7.5.22", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.22.tgz", + "integrity": "sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/tar-fs": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.5.tgz", + "integrity": "sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-fs/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "optional": true, + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/toposort-class": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz", + "integrity": "sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg==", + "license": "MIT" + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/tsyringe": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/tsyringe/-/tsyringe-4.10.0.tgz", + "integrity": "sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==", + "license": "MIT", + "dependencies": { + "tslib": "^1.9.3" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/tsyringe/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/undici": { + "version": "6.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz", + "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18.17" + } + }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "license": "MIT" + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz", + "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/uuid": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.3.tgz", + "integrity": "sha512-Sc5u1VVln93y1Xnz4R+CunOZc7R9LUcTmhj7Rc7Eg3HVcf7rVn2FOoa812fe0W8p3jD7xeoGSYbfqCGGH2B6xw==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist-node/bin/uuid" + } + }, + "node_modules/validator": { + "version": "13.15.35", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.15.35.tgz", + "integrity": "sha512-TQ5pAGhd5whStmqWvYF4OjQROlmv9SMFVt37qoCBdqRffuuklWYQlCNnEs2ZaIBD1kZRNnikiZOS1eqgkar0iw==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vite": { + "version": "5.4.21", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz", + "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vitepress": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.6.4.tgz", + "integrity": "sha512-+2ym1/+0VVrbhNyRoFFesVvBvHAVMZMK0rw60E3X/5349M1GuVdKeazuksqopEdvkKwKGs21Q729jX81/bkBJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@docsearch/css": "3.8.2", + "@docsearch/js": "3.8.2", + "@iconify-json/simple-icons": "^1.2.21", + "@shikijs/core": "^2.1.0", + "@shikijs/transformers": "^2.1.0", + "@shikijs/types": "^2.1.0", + "@types/markdown-it": "^14.1.2", + "@vitejs/plugin-vue": "^5.2.1", + "@vue/devtools-api": "^7.7.0", + "@vue/shared": "^3.5.13", + "@vueuse/core": "^12.4.0", + "@vueuse/integrations": "^12.4.0", + "focus-trap": "^7.6.4", + "mark.js": "8.11.1", + "minisearch": "^7.1.1", + "shiki": "^2.1.0", + "vite": "^5.4.14", + "vue": "^3.5.13" + }, + "bin": { + "vitepress": "bin/vitepress.js" + }, + "peerDependencies": { + "markdown-it-mathjax3": "^4", + "postcss": "^8" + }, + "peerDependenciesMeta": { + "markdown-it-mathjax3": { + "optional": true + }, + "postcss": { + "optional": true + } + } + }, + "node_modules/vue": { + "version": "3.5.43", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.43.tgz", + "integrity": "sha512-o5qZoksdnjIKvW1srZ3ab7pcDNYAerBjRe54D0LBLfRdCYFrSgBHVXokMas35czQc0//lmx4/tuY4ZNQ+Rf2Ng==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.5.43", + "@vue/compiler-sfc": "3.5.43", + "@vue/runtime-dom": "3.5.43", + "@vue/server-renderer": "3.5.43", + "@vue/shared": "3.5.43" + }, + "peerDependencies": { + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-6.0.1.tgz", + "integrity": "sha512-oGLe46MIrCRqX7ytPUf66EAYvdeMIZYn3WaocqqKZAxrBpkqHfL/qvTyJ/bTk5+AqHCjXmrv3CEWgy368zhRUg==", + "license": "ISC", + "optional": true, + "dependencies": { + "isexe": "^4.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/wkx": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.5.0.tgz", + "integrity": "sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/wrap-ansi": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.22.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.2.tgz", + "integrity": "sha512-/rEZ2ejown2N5gxVTHUu9bVVC7ttu0/Tgzf5hbTOixR3Fs7mbbXgn2DbdbcKgJOmpQMtrIUWivtYuVMnp/W/yA==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/yargs": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz", + "integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^9.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "string-width": "^7.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^22.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } + }, + "node_modules/yargs-parser": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..b66405e --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "frislit", + "version": "0.3.0", + "description": "Self-hosted tunnels: subdomain, path and direct TCP/UDP behind one public port", + "main": "server/index.js", + "repository": "https://git.fristy.net/fristy/frislit.git", + "author": "fristy", + "license": "MIT", + "engines": { + "node": ">=22" + }, + "scripts": { + "start": "node server/index.js", + "dev:server": "node --watch server/index.js", + "dev:client": "cd client && npm run dev", + "dev": "concurrently --kill-others-on-fail \"npm run dev:server\" \"npm run dev:client\"", + "build": "cd client && npm install && npm run build", + "docs:dev": "vitepress dev docs", + "docs:build": "vitepress build docs", + "docs:preview": "vitepress preview docs", + "test": "node --test" + }, + "dependencies": { + "@simplewebauthn/server": "^14.0.3", + "acme-client": "^5.4.0", + "js-yaml": "^5.4.3", + "mmdb-lib": "^3.0.3", + "openid-client": "^6.8.8", + "sequelize": "^6.37.8", + "speakeasy": "^2.0.0", + "sqlite3": "^6.0.1", + "ws": "^8.22.0" + }, + "optionalDependencies": { + "bufferutil": "^4.1.0" + }, + "devDependencies": { + "concurrently": "^10.0.6", + "vitepress": "^1.6.4" + }, + "overrides": { + "follow-redirects": "^1.16.1", + "undici": "^6.29.1", + "uuid": "^14.0.0" + } +} diff --git a/packaging/docker-entrypoint.sh b/packaging/docker-entrypoint.sh new file mode 100644 index 0000000..78c0154 --- /dev/null +++ b/packaging/docker-entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# The data directory may come from a volume or bind mount created by an older, +# root-running image. Take ownership of it once, then drop to the node user. +set -e + +if [ "$(id -u)" = "0" ]; then + mkdir -p /app/data + chown -R node:node /app/data 2>/dev/null || true + exec su-exec node "$@" +fi + +exec "$@" diff --git a/packaging/frislit-server.service b/packaging/frislit-server.service new file mode 100644 index 0000000..0f3a29e --- /dev/null +++ b/packaging/frislit-server.service @@ -0,0 +1,28 @@ +[Unit] +Description=frislit server +Documentation=https://git.fristy.net/fristy/frislit +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +User=frislit +Group=frislit +WorkingDirectory=/var/lib/frislit-server +EnvironmentFile=-/etc/frislit-server/server.env +Environment=NODE_ENV=production +Environment=FRISLIT_DATA_DIR=/var/lib/frislit-server +Environment=FRISLIT_CONFIG=/etc/frislit-server/config.yml +ExecStart=/usr/bin/frislit-server +Restart=on-failure +RestartSec=5 + +AmbientCapabilities=CAP_NET_BIND_SERVICE +NoNewPrivileges=yes +PrivateTmp=yes +ProtectSystem=full +ProtectHome=yes +ReadWritePaths=/var/lib/frislit-server + +[Install] +WantedBy=multi-user.target diff --git a/packaging/frislit.desktop b/packaging/frislit.desktop new file mode 100644 index 0000000..e84cb1b --- /dev/null +++ b/packaging/frislit.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=frislit +Comment=Share local ports through your own frislit server +Exec=/usr/bin/frislit gui %u +Icon=frislit +Terminal=false +StartupWMClass=dev.frislit.cli +MimeType=x-scheme-handler/frislit; +Categories=Network;Utility; diff --git a/packaging/frislit.png b/packaging/frislit.png new file mode 100644 index 0000000..83a975f Binary files /dev/null and b/packaging/frislit.png differ diff --git a/packaging/frislit.svg b/packaging/frislit.svg new file mode 100644 index 0000000..cd097df --- /dev/null +++ b/packaging/frislit.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/packaging/install/install b/packaging/install/install new file mode 100644 index 0000000..0966dd5 --- /dev/null +++ b/packaging/install/install @@ -0,0 +1,56 @@ +#!/bin/sh +set -eu + +API="https://git.fristy.net/api/v1/repos/fristy/frislit/releases/latest" +BASE="https://git.fristy.net/fristy/frislit/releases/download" + +say() { printf ' %s\n' "$*"; } +fail() { printf 'frislit: %s\n' "$*" >&2; exit 1; } +have() { command -v "$1" >/dev/null 2>&1; } + +os=$(uname -s) +arch=$(uname -m) + +case "$arch" in + x86_64|amd64) arch=x64 ;; + aarch64|arm64) arch=arm64 ;; + *) fail "unsupported architecture: $arch. frislit ships for x86-64 and ARM64." ;; +esac + +[ "$os" = "Linux" ] || fail "unsupported operating system: $os. Build from source: https://git.fristy.net/fristy/frislit" + +fetch() { + if have curl; then curl -fsSL "$1" -o "$2" + elif have wget; then wget -qO "$2" "$1" + else fail "curl or wget is required" + fi +} + +if [ "$(id -u)" -eq 0 ]; then SUDO=""; elif have sudo; then SUDO="sudo"; else SUDO=""; fi + +printf '\n frislit installer (%s %s)\n\n' "$os" "$arch" + +tag=$(fetch "$API" /dev/stdout 2>/dev/null | sed -n 's/.*"tag_name":"\([^"]*\)".*/\1/p' | head -1) +[ -n "$tag" ] || fail "could not read the latest release from $API" + +asset="frislit-linux-$arch" +say "Downloading $tag/$asset" +tmp=$(mktemp) +fetch "$BASE/$tag/$asset" "$tmp" +chmod +x "$tmp" + +if [ -w /usr/local/bin ] || [ -n "$SUDO" ]; then + $SUDO install -m 755 "$tmp" /usr/local/bin/frislit + target=/usr/local/bin/frislit +else + mkdir -p "$HOME/.local/bin" + install -m 755 "$tmp" "$HOME/.local/bin/frislit" + target="$HOME/.local/bin/frislit" + case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) say "Add $HOME/.local/bin to your PATH" ;; esac +fi +rm -f "$tmp" + +printf '\n Installed %s\n\n' "$target" +if have frislit; then say "$(frislit --version)"; else say "Open a new terminal to use frislit."; fi +say "Next: frislit login" +printf '\n' diff --git a/packaging/install/install.ps1 b/packaging/install/install.ps1 new file mode 100644 index 0000000..317ebae --- /dev/null +++ b/packaging/install/install.ps1 @@ -0,0 +1,38 @@ +$ErrorActionPreference = "Stop" +$Api = "https://git.fristy.net/api/v1/repos/fristy/frislit/releases/latest" + +$arch = switch ($env:PROCESSOR_ARCHITECTURE) { + "AMD64" { "x64" } + "ARM64" { "arm64" } + default { Write-Error "unsupported architecture: $($env:PROCESSOR_ARCHITECTURE). frislit for Windows ships for x86-64 and ARM64."; exit 1 } +} + +$release = Invoke-RestMethod -Uri $Api -UseBasicParsing +$base = "https://git.fristy.net/fristy/frislit/releases/download/$($release.tag_name)" + +Write-Host "" +Write-Host " frislit installer (windows $arch)" +Write-Host "" + +$msi = Join-Path $env:TEMP "frislit-$arch.msi" +Write-Host " Downloading frislit-$arch.msi ($($release.tag_name))" +Invoke-WebRequest -Uri "$base/frislit-$arch.msi" -OutFile $msi -UseBasicParsing + +$setup = Start-Process msiexec.exe -ArgumentList "/i", "`"$msi`"", "/passive", "/norestart" -Wait -PassThru +Remove-Item $msi -ErrorAction SilentlyContinue + +if ($setup.ExitCode -ne 0) { + Write-Host " The installer did not finish (exit code $($setup.ExitCode)), installing the plain binary instead" + $dir = Join-Path $env:LOCALAPPDATA "Programs\frislit" + New-Item -ItemType Directory -Force -Path $dir | Out-Null + Invoke-WebRequest -Uri "$base/frislit-windows-$arch.exe" -OutFile (Join-Path $dir "frislit.exe") -UseBasicParsing + $path = [Environment]::GetEnvironmentVariable("Path", "User") + if (($path -split ";") -notcontains $dir) { + [Environment]::SetEnvironmentVariable("Path", "$path;$dir", "User") + } + Write-Host " Installed $dir\frislit.exe" +} + +Write-Host "" +Write-Host " Installed. Open a new terminal and run: frislit login" +Write-Host "" diff --git a/packaging/nfpm-cli-static.yaml b/packaging/nfpm-cli-static.yaml new file mode 100644 index 0000000..143a18e --- /dev/null +++ b/packaging/nfpm-cli-static.yaml @@ -0,0 +1,18 @@ +name: frislit-cli +arch: "${PKG_ARCH}" +platform: linux +version: "${PKG_VERSION}" +section: net +priority: optional +maintainer: "Mathias Wagner " +description: | + frislit CLI - shares a local port through your own frislit server +vendor: "frislit" +homepage: "https://git.fristy.net/fristy/frislit" +license: "MIT" + +contents: + - src: stage/cli/frislit + dst: /usr/bin/frislit + file_info: + mode: 0755 diff --git a/packaging/nfpm-cli.yaml b/packaging/nfpm-cli.yaml new file mode 100644 index 0000000..bbbb62e --- /dev/null +++ b/packaging/nfpm-cli.yaml @@ -0,0 +1,45 @@ +name: frislit-cli +arch: "${PKG_ARCH}" +platform: linux +version: "${PKG_VERSION}" +section: net +priority: optional +maintainer: "Mathias Wagner " +description: | + frislit CLI - shares a local port through your own frislit server +vendor: "frislit" +homepage: "https://git.fristy.net/fristy/frislit" +license: "MIT" + +overrides: + deb: + depends: + - libc6 (>= 2.35) + rpm: + depends: + - glibc >= 2.35 + +contents: + - src: stage/cli/frislit + dst: /usr/bin/frislit + file_info: + mode: 0755 + + - src: packaging/frislit.desktop + dst: /usr/share/applications/frislit.desktop + file_info: + mode: 0644 + + - src: packaging/frislit.svg + dst: /usr/share/icons/hicolor/scalable/apps/frislit.svg + file_info: + mode: 0644 + + - src: packaging/frislit.png + dst: /usr/share/icons/hicolor/256x256/apps/frislit.png + file_info: + mode: 0644 + +scripts: + postinstall: packaging/scripts/cli-postinstall.sh + postremove: packaging/scripts/cli-postremove.sh diff --git a/packaging/nfpm-server.yaml b/packaging/nfpm-server.yaml new file mode 100644 index 0000000..07df1d5 --- /dev/null +++ b/packaging/nfpm-server.yaml @@ -0,0 +1,47 @@ +name: frislit-server +arch: "${PKG_ARCH}" +platform: linux +version: "${PKG_VERSION}" +section: net +priority: optional +maintainer: "Mathias Wagner " +description: | + frislit server - tunnel server with the web interface bundled in +vendor: "frislit" +homepage: "https://git.fristy.net/fristy/frislit" +license: "MIT" + +overrides: + deb: + depends: + - libc6 + rpm: + depends: + - glibc + +contents: + - src: stage/server/frislit-server + dst: /usr/bin/frislit-server + file_info: + mode: 0755 + + - src: packaging/frislit-server.service + dst: /lib/systemd/system/frislit-server.service + file_info: + mode: 0644 + + - src: packaging/server.env + dst: /etc/frislit-server/server.env + type: config|noreplace + file_info: + mode: 0640 + + - dst: /var/lib/frislit-server + type: dir + file_info: + mode: 0750 + +scripts: + postinstall: packaging/scripts/server-postinstall.sh + preremove: packaging/scripts/server-preremove.sh + postremove: packaging/scripts/server-postremove.sh diff --git a/packaging/scripts/cli-postinstall.sh b/packaging/scripts/cli-postinstall.sh new file mode 100644 index 0000000..c3173ef --- /dev/null +++ b/packaging/scripts/cli-postinstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +if command -v update-desktop-database >/dev/null 2>&1; then + update-desktop-database /usr/share/applications >/dev/null 2>&1 || true +fi + +if command -v gtk-update-icon-cache >/dev/null 2>&1; then + gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor >/dev/null 2>&1 || true +fi + +exit 0 diff --git a/packaging/scripts/cli-postremove.sh b/packaging/scripts/cli-postremove.sh new file mode 100644 index 0000000..c3173ef --- /dev/null +++ b/packaging/scripts/cli-postremove.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +if command -v update-desktop-database >/dev/null 2>&1; then + update-desktop-database /usr/share/applications >/dev/null 2>&1 || true +fi + +if command -v gtk-update-icon-cache >/dev/null 2>&1; then + gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor >/dev/null 2>&1 || true +fi + +exit 0 diff --git a/packaging/scripts/server-postinstall.sh b/packaging/scripts/server-postinstall.sh new file mode 100644 index 0000000..586f320 --- /dev/null +++ b/packaging/scripts/server-postinstall.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +if ! getent group frislit >/dev/null 2>&1; then + groupadd --system frislit +fi +if ! getent passwd frislit >/dev/null 2>&1; then + useradd --system --gid frislit --home-dir /var/lib/frislit-server \ + --shell /usr/sbin/nologin --comment "frislit" frislit +fi + +mkdir -p /var/lib/frislit-server +chown -R frislit:frislit /var/lib/frislit-server +chmod 0750 /var/lib/frislit-server + +mkdir -p /etc/frislit-server +chown root:frislit /etc/frislit-server +chmod 0750 /etc/frislit-server +if [ -f /etc/frislit-server/server.env ]; then + chown root:frislit /etc/frislit-server/server.env + chmod 0640 /etc/frislit-server/server.env +fi + +if command -v systemctl >/dev/null 2>&1; then + systemctl daemon-reload || true + systemctl enable frislit-server.service || true +fi + +exit 0 diff --git a/packaging/scripts/server-postremove.sh b/packaging/scripts/server-postremove.sh new file mode 100644 index 0000000..c91464d --- /dev/null +++ b/packaging/scripts/server-postremove.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if command -v systemctl >/dev/null 2>&1; then + systemctl daemon-reload || true +fi + +exit 0 diff --git a/packaging/scripts/server-preremove.sh b/packaging/scripts/server-preremove.sh new file mode 100644 index 0000000..10683e5 --- /dev/null +++ b/packaging/scripts/server-preremove.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +if command -v systemctl >/dev/null 2>&1; then + systemctl stop frislit-server.service 2>/dev/null || true + systemctl disable frislit-server.service 2>/dev/null || true +fi + +exit 0 diff --git a/packaging/server.env b/packaging/server.env new file mode 100644 index 0000000..77a291f --- /dev/null +++ b/packaging/server.env @@ -0,0 +1,13 @@ +# Settings for the frislit server. Everything here is optional: the guided setup +# in the browser writes what it needs into the database. +# +# FRISLIT_BASE_DOMAIN=frislit.example.com +# FRISLIT_PUBLIC_URL=https://frislit.example.com +# +# "proxy" if nginx or Caddy terminates TLS in front of frislit, "acme" to let +# frislit hold its own certificate and serve 443 itself. +# FRISLIT_TLS_MODE=proxy +# FRISLIT_TRUST_PROXY=true +# +# FRISLIT_PORT=8080 +# LOG_LEVEL=info diff --git a/packaging/windows/frislit.wxs b/packaging/windows/frislit.wxs new file mode 100644 index 0000000..534241a --- /dev/null +++ b/packaging/windows/frislit.wxs @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..7b8bea6 --- /dev/null +++ b/renovate.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ], + "automerge": true, + "platformAutomerge": false, + "packageRules": [ + { + "matchUpdateTypes": [ + "major" + ], + "automerge": false + }, + { + "matchPackageNames": [ + "typescript" + ], + "matchUpdateTypes": [ + "major" + ], + "enabled": false + }, + { + "matchPackageNames": [ + "undici" + ], + "matchUpdateTypes": [ + "major" + ], + "enabled": false + }, + { + "matchPackageNames": [ + "ubuntu" + ], + "matchUpdateTypes": [ + "major" + ], + "enabled": false + } + ] +} diff --git a/scripts/build-sea.sh b/scripts/build-sea.sh new file mode 100644 index 0000000..61803c2 --- /dev/null +++ b/scripts/build-sea.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +BUILD_DIR="$ROOT/build/sea" +STAGE_DIR="$BUILD_DIR/stage" +PAYLOAD_DIR="$STAGE_DIR/app" +BIN_NAME="${BIN_NAME:-frislit-server}" + +NODE_BIN="${NODE_BIN:-$(command -v node)}" +NODE_MAJOR="$("$NODE_BIN" -p 'process.versions.node.split(".")[0]')" +if [ "$NODE_MAJOR" -lt 26 ]; then + echo "Node 26+ required for --build-sea (have $($NODE_BIN --version))" >&2 + exit 1 +fi + +VERSION="$("$NODE_BIN" -p 'require("'"$ROOT"'/package.json").version')" + +echo "[build-sea] node $($NODE_BIN --version) version=$VERSION" +rm -rf "$BUILD_DIR" +mkdir -p "$PAYLOAD_DIR" + +echo "[build-sea] staging app payload" +cp -r "$ROOT/server" "$PAYLOAD_DIR/server" +cp "$ROOT/package.json" "$ROOT/package-lock.json" "$PAYLOAD_DIR/" + +if [ ! -d "$ROOT/client/dist" ]; then + (cd "$ROOT/client" && npm ci && npm run build) +fi +mkdir -p "$PAYLOAD_DIR/client" +cp -r "$ROOT/client/dist" "$PAYLOAD_DIR/client/dist" + +(cd "$PAYLOAD_DIR" && npm ci --omit=dev --no-audit --no-fund) + +find "$PAYLOAD_DIR/node_modules" \ + \( -name '*.map' -o -name '*.md' -o -name '*.markdown' \ + -o -name '*.ts' ! -name '*.d.ts' \ + -o -name 'CHANGELOG*' -o -name 'AUTHORS*' \ + -o -name '.github' -o -name 'test' -o -name 'tests' -o -name '__tests__' \ + -o -name 'example' -o -name 'examples' -o -name 'docs' \ + \) -prune -exec rm -rf {} + 2>/dev/null || true + +TARBALL="$STAGE_DIR/app-payload.tar.gz" +tar -C "$STAGE_DIR" --format=ustar -cf - app | gzip -9 > "$TARBALL" +du -sh "$TARBALL" + +MANIFEST="$STAGE_DIR/app-manifest.json" +printf '{"version":"%s"}' "$VERSION" > "$MANIFEST" + +CONFIG_FILE="$STAGE_DIR/sea-config.json" +if command -v cygpath >/dev/null 2>&1; then + to_native() { cygpath -m "$1"; } +else + to_native() { printf '%s' "$1"; } +fi + +MAIN_PATH="$(to_native "$ROOT/scripts/sea-launcher.js")" +OUTPUT_PATH="$(to_native "$BUILD_DIR/$BIN_NAME")" +TARBALL_PATH="$(to_native "$TARBALL")" +MANIFEST_PATH="$(to_native "$MANIFEST")" + +cat > "$CONFIG_FILE" < { + const staging = `${cacheRoot}.tmp-${process.pid}`; + fs.rmSync(staging, { recursive: true, force: true }); + fs.mkdirSync(staging, { recursive: true }); + + const tar = zlib.gunzipSync(payload); + let offset = 0; + while (offset < tar.length) { + const header = tar.subarray(offset, offset + 512); + offset += 512; + const rawName = header.subarray(0, 100).toString("utf8").replace(/\0.*$/, ""); + if (!rawName) { + if (offset >= tar.length || tar[offset] === 0) break; + continue; + } + const prefix = header.subarray(345, 500).toString("utf8").replace(/\0.*$/, ""); + const name = prefix ? `${prefix}/${rawName}` : rawName; + const sizeOctal = header.subarray(124, 136).toString("utf8").replace(/[\0 ]+$/, ""); + const size = sizeOctal ? parseInt(sizeOctal, 8) : 0; + const typeflag = String.fromCharCode(header[156]); + const modeOctal = header.subarray(100, 108).toString("utf8").replace(/[\0 ]+$/, ""); + const mode = modeOctal ? parseInt(modeOctal, 8) : 0o644; + const data = tar.subarray(offset, offset + size); + offset += Math.ceil(size / 512) * 512; + + const target = path.join(staging, name); + if (typeflag === "5") { + fs.mkdirSync(target, { recursive: true }); + } else if (typeflag === "2") { + const linkname = header.subarray(157, 257).toString("utf8").replace(/\0.*$/, ""); + fs.mkdirSync(path.dirname(target), { recursive: true }); + try { fs.symlinkSync(linkname, target); } catch { /* a link we cannot make is not fatal */ } + } else { + fs.mkdirSync(path.dirname(target), { recursive: true }); + fs.writeFileSync(target, data, { mode }); + } + } + + try { + fs.renameSync(staging, cacheRoot); + } catch (err) { + if (err.code !== "ENOTEMPTY" && err.code !== "EEXIST") throw err; + fs.rmSync(staging, { recursive: true, force: true }); + } + fs.writeFileSync(readyMarker, ""); +}; + +if (!fs.existsSync(readyMarker)) extract(); + +const appRequire = Module.createRequire(path.join(appDir, "package.json")); +appRequire(path.join(appDir, "server", "index.js")); diff --git a/server/controllers/auth.js b/server/controllers/auth.js new file mode 100644 index 0000000..de5c12b --- /dev/null +++ b/server/controllers/auth.js @@ -0,0 +1,36 @@ +const accounts = require("../lib/accounts"); +const totp = require("../lib/totp"); +const logger = require("../utils/logger"); + +module.exports.login = async (sessions, { username, password, code }, meta) => { + if (!await accounts.count()) return { code: 409, message: "The server has not been set up yet" }; + + const account = await accounts.checkCredentials({ username, password }); + if (!account) return { code: 401, message: "Username or password incorrect" }; + + if (account.totpEnabled) { + if (!code) return { code: 202, message: "This account asks for a code from your authenticator" }; + if (!totp.verify(account.totpSecret, code)) return { code: 401, message: "That code is not right or has expired" }; + } + + const token = await sessions.create(account.id, meta); + logger.info(`${account.username} logged in`, { ip: meta.ip }); + return { token, username: account.username, role: account.role }; +}; + +module.exports.accountFromCredentials = credentials => accounts.checkCredentials(credentials); + +module.exports.checkAccountCredentials = async credentials => { + const account = await accounts.checkCredentials(credentials); + return !!account && !account.totpEnabled; +}; + +module.exports.logout = (sessions, token) => sessions.remove(token); + +module.exports.currentUser = session => ({ + id: session.account.id, + username: session.username, + role: session.role, + totpEnabled: !!session.account.totpEnabled, + createdAt: session.createdAt, +}); diff --git a/server/controllers/control.js b/server/controllers/control.js new file mode 100644 index 0000000..ac5d849 --- /dev/null +++ b/server/controllers/control.js @@ -0,0 +1,109 @@ +const { WebSocketServer } = require("ws"); +const { MuxSession } = require("../lib/MuxSession"); +const { attachJoiner } = require("./relay"); +const { randomToken } = require("../utils/ids"); +const logger = require("../utils/logger"); +const { summarizePolicy } = require("../lib/access"); +const invites = require("../lib/invites"); +const packageJson = require("../../package.json"); + +const PROTOCOL_VERSION = 1; +const HANDSHAKE_TIMEOUT = 15_000; + +const createControlServer = ({ config, auth, registry, connections, intel, visitors }) => { + const wss = new WebSocketServer({ noServer: true, perMessageDeflate: false, maxPayload: 1024 * 1024 }); + + const fail = (session, code, message, wsCode = 4000) => { + session.sendControl({ type: "error", code, message }); + session.close(wsCode, code); + }; + + wss.on("connection", (ws, req) => { + const forwarded = config.trustProxy && req.headers["x-forwarded-for"] + ? String(req.headers["x-forwarded-for"]).split(",")[0].trim() + : null; + const session = new MuxSession(ws, { parity: 0, name: `cli ${req.socket.remoteAddress}` }); + session.client = { id: randomToken(12), ip: forwarded || req.socket.remoteAddress || "", connectedAt: Date.now() }; + const headerToken = auth.bearerFromHeaders(req.headers); + let state = "hello"; + let role = null; + + const timer = setTimeout(() => { if (state !== "ready") fail(session, "bad_request", "handshake timeout"); }, HANDSHAKE_TIMEOUT); + session.once("close", () => clearTimeout(timer)); + + let queue = Promise.resolve(); + const handle = async message => { + try { + if (message.type === "bye") { + session.saidBye = true; + session.close(1000, "bye"); + return; + } + if (state === "hello") { + if (message.type !== "hello") return fail(session, "bad_request", "expected hello"); + if (message.version !== PROTOCOL_VERSION) return fail(session, "unsupported_version", `unsupported protocol version ${message.version}`); + role = message.role === "joiner" ? "joiner" : message.role === "owner" ? "owner" : null; + if (!role) return fail(session, "bad_request", "role must be owner or joiner"); + if (role === "owner") { + const device = await auth.deviceFor(headerToken || message.token); + if (!device) return fail(session, "unauthorized", "invalid token", 4401); + session.account = await auth.accountFor(device); + if (!session.account) return fail(session, "unauthorized", "the account behind this device is gone", 4401); + session.credential = device.credential; + if (device.guest) { + session.guest = device.guest.label; + await invites.used(device.guest); + } + } + session.sendControl({ type: "hello", version: PROTOCOL_VERSION, server: `frislit/${packageJson.version}`, baseDomain: config.baseDomain }); + state = "setup"; + return; + } + if (state === "setup") { + if (role === "owner") { + if (message.type !== "register") return fail(session, "bad_request", "expected register"); + const { tunnel, resumed } = await registry.register(session, message); + state = "ready"; + session.sendControl({ + type: "registered", + id: tunnel.id, + mode: tunnel.mode, + url: registry.publicUrl(tunnel), + customUrls: registry.customUrls(tunnel), + persistent: tunnel.persistent, + access: summarizePolicy(tunnel.policy), + shareCode: tunnel.shareCode, + connectUrl: registry.connectUrl(tunnel), + resumeToken: tunnel.resumeToken, + resumed, + }); + return; + } + if (message.type !== "join") return fail(session, "bad_request", "expected join"); + const tunnel = registry.join(session, message.code); + state = "ready"; + attachJoiner(tunnel, session, { connections, intel, visitors }); + session.sendControl({ type: "joined", id: tunnel.id, port: tunnel.target.port, online: tunnel.online }); + logger.info(`Joiner attached to ${tunnel.id}`, { from: req.socket.remoteAddress }); + } + } catch (err) { + fail(session, err.code || "bad_request", err.message); + } + }; + + session.on("control", message => { + queue = queue.then(() => handle(message)).catch(err => logger.error(`control failed: ${err.stack || err}`)); + }); + + session.on("stream", stream => { + if (role !== "joiner" || state !== "ready") stream.destroy(new Error("unexpected stream")); + }); + }); + + return { + handleUpgrade: (req, socket, head) => wss.handleUpgrade(req, socket, head, ws => wss.emit("connection", ws, req)), + close: () => wss.close(), + }; +}; + +module.exports = { createControlServer }; diff --git a/server/controllers/http.js b/server/controllers/http.js new file mode 100644 index 0000000..63f11dc --- /dev/null +++ b/server/controllers/http.js @@ -0,0 +1,304 @@ +const { requestInfo, classifyHost, proxyRequest, proxyUpgrade, QUERY_PARAM, REPLAY_IP } = require("../lib/proxy"); +const { SERVICE_WORKER_SOURCE, SW_PATH, injectedScript } = require("../lib/browser"); +const { evaluate, isRestricted, accountAllowed, tokenFromRequest: accessToken, basicCredentials, cookieFor } = require("../lib/access"); +const { verifyPassword } = require("../utils/password"); +const { accountFromCredentials } = require("./auth"); +const { sendJson } = require("../utils/html"); +const { sendAppState } = require("../utils/pages"); +const { sendFile, sendIndex } = require("../utils/static"); +const { createApp } = require("../utils/router"); +const { authenticate, requireAdmin } = require("../middlewares/auth"); +const { NAME_REGEX } = require("../utils/ids"); +const logger = require("../utils/logger"); + +const UI_PREFIX = "/@frislit"; +const API_PREFIX = "/@frislit/api"; +const SELECT_PAGE = "/@frislit/select"; +const GATE_PATH = "/@frislit/gate"; + +const wantsHtml = req => /\btext\/html\b/.test(req.headers.accept || ""); + +const ACME_PREFIX = "/.well-known/acme-challenge/"; + +const FLAGS = ["tor", "vpn", "datacenter", "blocklisted"]; + +const createRouter = ({ config, auth, registry, traffic, visitors, breakpoints, connections, access, stats, devices, sessions, attempts, certificates, domains, quotas, frames, intel, control }) => { + const announce = (tunnel, entry) => { + if (!tunnel.session || tunnel.session.closed) return; + const { request, response, ...rest } = entry; + const details = intel.lookup(entry.ip); + tunnel.session.sendControl({ type: "request", ...rest, country: details.country, org: details.org, flags: FLAGS.filter(flag => details[flag]) }); + }; + const record = (tunnel, entry) => { + entry.intel = intel.lookup(entry.ip); + if (entry.ip !== REPLAY_IP) visitors.seen(tunnel.id, entry.ip, entry.intel); + traffic.record(tunnel.id, entry); + stats.recordRequest(tunnel.id); + }; + const onRequest = tunnel => entry => { + announce(tunnel, entry); + record(tunnel, entry); + }; + const websocket = tunnel => ({ + open: (entry, writers) => { + record(tunnel, entry); + frames.opened(entry.connection, writers); + }, + frame: (connection, direction, opcode, payload) => frames.record(tunnel.id, connection, direction, opcode, payload), + close: (connection, entry) => { + frames.closed(connection); + traffic.finish(connection, entry.duration).catch(() => null); + announce(tunnel, entry); + }, + }); + const api = createApp(); + api.use(API_PREFIX, require("../routes/service")); + api.use(`${API_PREFIX}/setup`, require("../routes/setup")); + api.use(`${API_PREFIX}/auth`, require("../routes/auth")); + api.use(`${API_PREFIX}/tunnels`, authenticate, require("../routes/tunnels")); + api.use(`${API_PREFIX}/persistent`, authenticate, require("../routes/persistent")); + api.use(`${API_PREFIX}/quotas`, authenticate, require("../routes/quotas")); + api.use(`${API_PREFIX}/settings`, authenticate, require("../routes/settings")); + api.use(`${API_PREFIX}/devices`, authenticate, require("../routes/devices")); + api.use(`${API_PREFIX}/invites`, authenticate, require("../routes/invites")); + api.use(`${API_PREFIX}/accounts`, authenticate, requireAdmin, require("../routes/accounts")); + api.use(`${API_PREFIX}/tls`, authenticate, requireAdmin, require("../routes/tls")); + api.use(`${API_PREFIX}/oidc`, authenticate, requireAdmin, require("../routes/oidc")); + + const notFound = (req, res, id) => sendAppState(req, res, 404, { kind: "missing", id }); + const offline = (req, res, id) => sendAppState(req, res, 502, { kind: "offline", id }); + + const accepts = async (policy, credentials, tunnel) => { + if (policy.auth === "password") return verifyPassword(credentials.password, policy.passwordHash); + const account = await accountFromCredentials(credentials); + if (!account || account.totpEnabled) return false; + return accountAllowed(policy, account.id, tunnel.accountId); +}; + + const denial = async (req, res, info, tunnel) => { + const policy = tunnel.policy; + if (!isRestricted(policy)) return null; + + const details = intel.lookup(info.clientIp); + const reason = evaluate(policy, info.clientIp, details); + if (reason) { + visitors.blocked(tunnel.id, info.clientIp, details, reason); + return { deny: () => sendAppState(req, res, 403, { kind: "blocked", id: tunnel.id, ip: info.clientIp, reason }) }; + } + if (policy.auth === "none") return null; + if (access.allows(accessToken(req), tunnel.id)) return null; + + const key = `gate:${tunnel.id}:${info.clientIp}`; + const credentials = attempts.blocked(key) ? null : basicCredentials(req); + if (credentials && await accepts(policy, credentials, tunnel)) { + attempts.forget(key); + return { cookie: cookieFor(access.create(tunnel.id), info.secure) }; + } + if (credentials) { + attempts.record(key); + logger.warn(`Failed gate attempt for ${tunnel.id}`, { ip: info.clientIp }); + } + + // Browsers always send sec-fetch-mode; challenging them turns the 401 into Firefox's auth dialog. + const headers = req.headers["sec-fetch-mode"] ? {} : { "WWW-Authenticate": `Basic realm="${tunnel.id}", charset="UTF-8"` }; + const authorize = policy.auth === "frislit" ? `${config.publicUrl}${API_PREFIX}/gate/${tunnel.id}/authorize` : null; + return { deny: () => sendAppState(req, res, 401, { kind: "gate", id: tunnel.id, auth: policy.auth, authorize }, headers) }; + }; + + const completeGate = (req, res, info, url) => { + const to = url.searchParams.get("to") || ""; + const token = access.redeem(url.searchParams.get("code"), info.hostname); + res.writeHead(302, { Location: /^\/(?![/\\])/.test(to) ? to : "/", "Cache-Control": "no-store", ...(token && { "Set-Cookie": cookieFor(token, info.secure) }) }); + res.end(); + }; + + const tunnelFor = (id, modes) => { + const tunnel = registry.get(id); + if (!tunnel || !modes.includes(tunnel.mode)) return { error: "not-found" }; + if (!tunnel.online) return { error: "offline", tunnel }; + return { tunnel }; + }; + + const noTunnel = (req, res, location = SELECT_PAGE) => { + if (!wantsHtml(req)) return sendJson(res, 404, { error: "no_tunnel_selected" }); + res.writeHead(302, { Location: location, "Cache-Control": "no-store" }); + res.end(); + }; + + const handleUi = async (req, res, info, pathname) => { + if (pathname === API_PREFIX || pathname.startsWith(`${API_PREFIX}/`)) { + const handled = await api.handle(req, res, pathname, { config, auth, registry, traffic, visitors, breakpoints, connections, access, stats, devices, sessions, attempts, certificates, domains, quotas, frames, intel, onRequest, info }); + if (!handled) sendJson(res, 404, { error: "not_found" }); + return; + } + if (!["GET", "HEAD"].includes(req.method)) return sendJson(res, 405, { error: "method_not_allowed" }); + const relative = pathname === UI_PREFIX ? "" : pathname.slice(UI_PREFIX.length + 1); + if (relative && !relative.includes("..") && sendFile(req, res, relative)) return; + sendIndex(req, res); + }; + + const pathTunnel = id => { + if (!NAME_REGEX.test(id)) return null; + const tunnel = registry.get(id); + return tunnel && tunnel.mode === "path" ? tunnel : null; + }; + + const serveSelected = async (req, res, info, id) => { + const tunnel = pathTunnel(id); + if (!tunnel) return notFound(req, res, id); + if (!tunnel.online) return offline(req, res, id); + const gate = await denial(req, res, info, tunnel); + if (gate?.deny) return gate.deny(); + return proxyRequest(req, res, tunnel, info, + { pathMode: true, inject: injectedScript(id), onRequest: onRequest(tunnel), setCookie: gate?.cookie, breakpoints }); + }; + + const hostFor = hostname => { + const host = classifyHost(hostname, config.baseDomain); + if (host.kind !== "unknown") return host; + const name = domains.tunnelFor(hostname); + return name ? { kind: "custom", id: name } : host; + }; + + const hostTunnel = host => tunnelFor(host.id, host.kind === "custom" ? ["subdomain", "path"] : ["subdomain"]); + + const acmeChallenge = (req, res, pathname) => { + const response = certificates?.challengeResponse(pathname.slice(ACME_PREFIX.length)); + if (!response) return false; + res.writeHead(200, { "Content-Type": "application/octet-stream", "Content-Length": Buffer.byteLength(response) }); + res.end(req.method === "HEAD" ? undefined : response); + return true; + }; + + const handleRedirect = (req, res) => { + const url = new URL(req.url, "http://frislit.invalid"); + if (url.pathname.startsWith(ACME_PREFIX) && acmeChallenge(req, res, url.pathname)) return; + + const host = String(req.headers.host || config.baseDomain).replace(/:\d+$/, "").toLowerCase(); + if (!certificates?.covers() && !certificates?.secureContextFor(host)) return handleRequest(req, res); + + const publicPort = config.publicUrlConfigured ? new URL(config.publicUrlConfigured).port : null; + const port = publicPort === null + ? (config.httpsPort === 443 ? "" : `:${config.httpsPort}`) + : publicPort ? `:${publicPort}` : ""; + res.writeHead(308, { Location: `https://${host}${port}${req.url}`, "Cache-Control": "no-store" }); + res.end(); + }; + + const handleRequest = async (req, res) => { + const info = requestInfo(req, config); + const url = new URL(req.url, "http://frislit.invalid"); + const pathname = url.pathname; + + if (pathname.startsWith(ACME_PREFIX) && acmeChallenge(req, res, pathname)) return; + if (pathname === GATE_PATH && config.ready && !config.setupRequired) return completeGate(req, res, info, url); + const isUi = pathname === UI_PREFIX || pathname.startsWith(`${UI_PREFIX}/`); + + if (!config.ready || config.setupRequired) { + if (isUi) return handleUi(req, res, info, pathname); + return noTunnel(req, res, `${UI_PREFIX}/`); + } + + const host = hostFor(info.hostname); + + if (isUi && host.kind !== "custom") { + if (pathname === SW_PATH) { + if (!["GET", "HEAD"].includes(req.method)) return sendJson(res, 405, { error: "method_not_allowed" }); + res.writeHead(200, { + "Content-Type": "text/javascript; charset=utf-8", + "Service-Worker-Allowed": "/", + "Cache-Control": "no-cache", + "Content-Length": Buffer.byteLength(SERVICE_WORKER_SOURCE), + }); + return res.end(req.method === "HEAD" ? undefined : SERVICE_WORKER_SOURCE); + } + return handleUi(req, res, info, pathname); + } + + if (host.kind === "subdomain" || host.kind === "custom") { + const { tunnel, error } = hostTunnel(host); + if (error === "not-found" && host.kind !== "custom") return notFound(req, res, host.id); + if (error) return offline(req, res, host.id); + const gate = await denial(req, res, info, tunnel); + if (gate?.deny) return gate.deny(); + return proxyRequest(req, res, tunnel, info, + { pathMode: false, inject: null, onRequest: onRequest(tunnel), setCookie: gate?.cookie, breakpoints }); + } + + if (host.kind !== "base") return noTunnel(req, res, SELECT_PAGE); + + const selection = /^\/@([^/]+)(\/.*)?$/.exec(pathname); + if (selection) { + const id = selection[1].toLowerCase(); + if (!pathTunnel(id)) return notFound(req, res, id); + return sendAppState(req, res, 200, { kind: "attach", id, to: `${selection[2] || "/"}${url.search}` }); + } + if (url.searchParams.has(QUERY_PARAM)) { + return serveSelected(req, res, info, String(url.searchParams.get(QUERY_PARAM)).toLowerCase()); + } + + return noTunnel(req, res); + }; + + const handleUpgrade = (req, socket, head) => { + const info = requestInfo(req, config); + const pathname = new URL(req.url, "http://frislit.invalid").pathname; + const reject = (status, text) => { + socket.write(`HTTP/1.1 ${status} ${text}\r\nConnection: close\r\nContent-Length: 0\r\n\r\n`); + socket.destroy(); + }; + + if (!config.ready || config.setupRequired) return reject(503, "Setup required"); + const host = hostFor(info.hostname); + + if (host.kind === "base" && pathname === "/@frislit/ws") return control.handleUpgrade(req, socket, head); + + let target; + if (host.kind === "subdomain" || host.kind === "custom") target = hostTunnel(host); + else if (host.kind === "base") { + if (pathname.startsWith("/@")) return reject(404, "Not Found"); + const selected = new URL(req.url, "http://frislit.invalid").searchParams.get(QUERY_PARAM); + if (!selected) return reject(404, "No tunnel selected"); + target = tunnelFor(String(selected).toLowerCase(), ["path"]); + } else return reject(404, "Not Found"); + + if (target.error === "not-found" && host.kind !== "custom") return reject(404, "Tunnel not found"); + if (target.error) return reject(502, "Tunnel offline"); + if (isRestricted(target.tunnel.policy)) { + const details = intel.lookup(info.clientIp); + const reason = evaluate(target.tunnel.policy, info.clientIp, details); + if (reason) { + visitors.blocked(target.tunnel.id, info.clientIp, details, reason); + return reject(403, "Forbidden"); + } + if (target.tunnel.policy.auth !== "none" && !access.allows(accessToken(req), target.tunnel.id)) { + return reject(401, "Unauthorized"); + } + } + proxyUpgrade(req, socket, head, target.tunnel, info, { pathMode: host.kind === "base", ws: websocket(target.tunnel) }); + }; + + return { + handleRedirect, + handleRequest: (req, res) => { + Promise.resolve() + .then(() => handleRequest(req, res)) + .catch(err => { + logger.error(`request failed: ${err.stack || err}`); + if (res.writableEnded) return; + if (!res.headersSent) res.writeHead(500, { "Content-Type": "text/plain" }); + res.end("Internal error"); + }); + }, + handleUpgrade: (req, socket, head) => { + try { + handleUpgrade(req, socket, head); + } catch (err) { + logger.error(`upgrade failed: ${err.stack || err}`); + socket.destroy(); + } + }, + }; +}; + +module.exports = { createRouter }; diff --git a/server/controllers/persistent.js b/server/controllers/persistent.js new file mode 100644 index 0000000..0ac62fc --- /dev/null +++ b/server/controllers/persistent.js @@ -0,0 +1,137 @@ +const persistent = require("../lib/persistent"); +const { buildPolicy, describePolicy, emptyPolicy } = require("../lib/access"); +const { announceAccess } = require("./tunnels"); +const ids = require("../utils/ids"); + +const NOT_FOUND = { code: 404, message: "Persistent tunnel not found" }; + +const isAdmin = viewer => viewer.role === "admin"; + +const policyFrom = (input, previous) => { + try { + return { policy: buildPolicy({ ...input, password: input.password || undefined }, previous) }; + } catch (err) { + return { code: err.code === "bad_request" ? 400 : 500, message: err.message }; + } +}; + +const applyLive = (req, name, policy) => { + const live = req.registry.get(name); + if (!live) return; + live.policy = policy; + req.access.forget(name); + announceAccess(live); +}; + +const serialize = async (req, definition) => { + const live = req.registry.get(definition.name); + return { + name: definition.name, + owner: definition.owner, + accountId: definition.accountId, + access: describePolicy(definition.policy), + createdAt: definition.createdAt, + online: !!live?.online, + live: !!live, + url: req.registry.urlFor(definition.name), + domains: await req.domains.listFor(definition.name), + }; +}; + +const definitionFor = async (req, name) => { + const definition = await persistent.load(name); + if (!definition || (!isAdmin(req.session) && definition.accountId !== req.session.account.id)) return null; + return definition; +}; + +const domainOf = async (req, name, hostname) => { + if (!await definitionFor(req, name)) return null; + const normalized = String(hostname || "").trim().toLowerCase(); + return req.domains.tunnelFor(normalized) === name ? normalized : null; +}; + +module.exports.list = async req => { + const definitions = await persistent.list(isAdmin(req.session) ? null : req.session.account.id); + return Promise.all(definitions.map(definition => serialize(req, definition))); +}; + +module.exports.get = async (req, name) => { + const definition = await definitionFor(req, name); + if (!definition) return NOT_FOUND; + return { tunnel: await serialize(req, definition) }; +}; + +module.exports.create = async (req, input) => { + const name = String(input.name || "").trim().toLowerCase(); + if (!ids.isValidName(name)) return { code: 400, message: "Use 3-32 characters a-z, 0-9 or \"-\" for the name" }; + + const live = req.registry.get(name); + if (live && live.accountId !== req.session.account.id && !isAdmin(req.session)) { + return { code: 409, message: `"${name}" is in use by another account` }; + } + + const wantsPolicy = ["auth", "password", "allow", "block"].some(key => input[key] !== undefined); + const { policy, code, message } = wantsPolicy ? policyFrom(input, live ? live.policy : emptyPolicy()) : { policy: live ? live.policy : emptyPolicy() }; + if (code) return { code, message }; + + const accountId = live ? live.accountId : req.session.account.id; + let definition; + try { + await req.quotas.enforce(accountId, "persistent", (await persistent.list(accountId)).length); + definition = await persistent.create(name, accountId, policy); + } catch (err) { + return { code: { name_taken: 409, quota_exceeded: 429 }[err.code] || 500, message: err.message }; + } + definition.owner = live ? live.owner : req.session.account.username; + if (live) { + live.persistent = true; + applyLive(req, name, policy); + } + return { message: `${name} is now persistent`, tunnel: await serialize(req, definition) }; +}; + +module.exports.updateAccess = async (req, name, input) => { + const definition = await definitionFor(req, name); + if (!definition) return NOT_FOUND; + const { policy, code, message } = policyFrom(input, definition.policy); + if (code) return { code, message }; + await persistent.savePolicy(name, policy); + applyLive(req, name, policy); + return { message: "Access updated", access: describePolicy(policy) }; +}; + +module.exports.remove = async (req, name) => { + if (!await definitionFor(req, name)) return NOT_FOUND; + await req.domains.removeForTunnel(name); + await persistent.remove(name); + const live = req.registry.get(name); + if (live) live.persistent = false; + return { message: `${name} is no longer persistent` }; +}; + +module.exports.addDomain = async (req, name, input) => { + const definition = await definitionFor(req, name); + if (!definition) return NOT_FOUND; + try { + await req.quotas.enforce(definition.accountId, "domains", await req.domains.countFor(definition.accountId)); + const domain = await req.domains.add(input.hostname, name, definition.accountId); + return { message: `${domain.hostname} added`, domain }; + } catch (err) { + return { code: { bad_request: 400, conflict: 409, quota_exceeded: 429 }[err.code] || 500, message: err.message }; + } +}; + +module.exports.checkDomain = async (req, name, hostname) => { + const domain = await domainOf(req, name, hostname); + if (!domain) return { code: 404, message: "Domain not found" }; + await req.domains.check(domain); + const current = (await req.domains.listFor(name)).find(entry => entry.hostname === domain); + return { message: current.state === "active" ? `${domain} is active` : `${domain} checked`, domain: current }; +}; + +module.exports.removeDomain = async (req, name, hostname) => { + const domain = await domainOf(req, name, hostname); + if (!domain) return { code: 404, message: "Domain not found" }; + await req.domains.remove(domain); + return { message: `${domain} removed` }; +}; diff --git a/server/controllers/quotas.js b/server/controllers/quotas.js new file mode 100644 index 0000000..04e57b7 --- /dev/null +++ b/server/controllers/quotas.js @@ -0,0 +1,24 @@ +const persistent = require("../lib/persistent"); + +const usageFor = async (req, accountId) => ({ + tunnels: [...req.registry.tunnels.values()].filter(tunnel => tunnel.accountId === accountId).length, + persistent: (await persistent.list(accountId)).length, + domains: await req.domains.countFor(accountId), + traffic: await req.quotas.trafficFor(accountId), +}); + +const mine = async req => ({ + defaults: req.quotas.defaults, + limits: await req.quotas.limitsFor(req.account.id), + usage: await usageFor(req, req.account.id), +}); + +const saveDefaults = async (req, input) => { + try { + return { message: "Limits saved", defaults: await req.quotas.saveDefaults(input) }; + } catch (err) { + return { code: err.code === "bad_request" ? 400 : 500, message: err.message }; + } +}; + +module.exports = { usageFor, mine, saveDefaults }; diff --git a/server/controllers/relay.js b/server/controllers/relay.js new file mode 100644 index 0000000..f56c1b4 --- /dev/null +++ b/server/controllers/relay.js @@ -0,0 +1,81 @@ +const { PassThrough } = require("node:stream"); +const logger = require("../utils/logger"); + +const ANNOUNCE_DELAY = 150; + +const tap = observe => new PassThrough({ + transform(chunk, _encoding, callback) { + observe(chunk); + callback(null, chunk); + }, +}); + +const summary = entry => ({ + key: entry.key, + protocol: entry.protocol, + ip: entry.ip, + country: entry.intel.country, + org: entry.intel.org, + client: entry.client, + bytesIn: entry.bytesIn, + bytesOut: entry.bytesOut, + duration: (entry.endedAt || Date.now()) - entry.startedAt, + reason: entry.reason, + detail: entry.detail, +}); + +const relayStream = (tunnel, session, joinerStream, meta, { connections, intel, visitors }) => { + if (!tunnel.online) { + joinerStream.destroy(new Error("owner offline")); + return; + } + const protocol = meta.protocol === "udp" ? "udp" : "tcp"; + const ip = session.client.ip; + const details = intel.lookup(ip); + const entry = connections.open(tunnel.id, { protocol, ip, intel: details, client: meta.remote || "", joiner: session.client.id }); + visitors.seen(tunnel.id, ip, details); + const ownerStream = tunnel.session.open({ protocol, remote: meta.remote || "" }); + + const announce = event => { + if (tunnel.session && !tunnel.session.closed) tunnel.session.sendControl({ type: "connection", event, ...summary(entry) }); + }; + let announced = false; + const opened = () => { + if (announced) return; + announced = true; + clearTimeout(timer); + announce("open"); + }; + const timer = setTimeout(opened, ANNOUNCE_DELAY); + const observe = direction => chunk => { + connections.data(entry, direction, chunk); + if (entry.detail) opened(); + }; + + if (protocol === "udp") { + joinerStream.on("datagram", data => { observe("in")(data); ownerStream.sendDatagram(data); }); + ownerStream.on("datagram", data => { observe("out")(data); joinerStream.sendDatagram(data); }); + } + joinerStream.pipe(tap(observe("in"))).pipe(ownerStream); + ownerStream.pipe(tap(observe("out"))).pipe(joinerStream); + + let reason = null; + const finish = cause => { + if (!reason) reason = cause; + if (entry.endedAt) return; + connections.close(entry, reason); + opened(); + announce("close"); + }; + joinerStream.on("error", () => { finish(session.closed ? "client disconnected" : "error"); ownerStream.destroy(); }); + ownerStream.on("error", () => { finish(tunnel.session.closed ? "tunnel closed" : "error"); joinerStream.destroy(); }); + joinerStream.on("close", () => { finish("client closed"); ownerStream.destroy(); }); + ownerStream.on("close", () => { finish("app closed"); joinerStream.destroy(); }); + logger.debug(`relay ${tunnel.id}: ${protocol} stream ${joinerStream.id} -> ${ownerStream.id}`); +}; + +const attachJoiner = (tunnel, session, context) => { + session.on("stream", (stream, meta) => relayStream(tunnel, session, stream, meta, context)); +}; + +module.exports = { attachJoiner }; diff --git a/server/controllers/settings.js b/server/controllers/settings.js new file mode 100644 index 0000000..dc254b8 --- /dev/null +++ b/server/controllers/settings.js @@ -0,0 +1,38 @@ +const settingsStore = require("../lib/settings"); +const { applySettings, UI_SETTING_KEYS } = require("../utils/config"); +const { verifyPassword } = require("../utils/password"); +const accounts = require("../lib/accounts"); +const { pickSettings } = require("./setup"); +const logger = require("../utils/logger"); + +module.exports.getSettings = config => ({ + settings: Object.fromEntries(UI_SETTING_KEYS.map(key => [key, key === "publicUrl" ? config.publicUrlConfigured : config[key]])), + sources: Object.fromEntries(UI_SETTING_KEYS.map(key => [key, config.sources[key]])), + effectivePublicUrl: config.publicUrl, + listen: config.listen, + port: config.port, + configFile: config.configFile, +}); + +module.exports.updateSettings = async (config, body) => { + const settings = pickSettings(body); + if (!Object.keys(settings).length) return { code: 400, message: "No settings provided" }; + try { + applySettings(config, settings); + } catch (err) { + return { code: 400, message: err.message }; + } + await settingsStore.write(settings); + logger.info("Settings updated from the web UI", settings); + return module.exports.getSettings(config); +}; + +module.exports.changePassword = async (account, { currentPassword, newPassword }) => { + if (!await verifyPassword(typeof currentPassword === "string" ? currentPassword : "", account.passwordHash)) { + return { code: 401, message: "Current password is incorrect" }; + } + const result = await accounts.update(account.id, { password: newPassword }); + if (result.code) return result; + logger.info(`${account.username} changed the password`); + return { message: "Password changed" }; +}; diff --git a/server/controllers/setup.js b/server/controllers/setup.js new file mode 100644 index 0000000..de28f44 --- /dev/null +++ b/server/controllers/setup.js @@ -0,0 +1,51 @@ +const settingsStore = require("../lib/settings"); +const accounts = require("../lib/accounts"); +const { applySettings, UI_SETTING_KEYS } = require("../utils/config"); +const logger = require("../utils/logger"); + +module.exports.isSetupRequired = async () => !await accounts.count(); + +module.exports.getSetupStatus = async config => { + const setupRequired = await module.exports.isSetupRequired(); + const status = { setupRequired, ready: config.ready }; + if (!setupRequired) return status; + return { + ...status, + settings: Object.fromEntries(UI_SETTING_KEYS.map(key => [key, key === "publicUrl" ? config.publicUrlConfigured : config[key]])), + sources: Object.fromEntries(UI_SETTING_KEYS.map(key => [key, config.sources[key]])), + }; +}; + +module.exports.validateAccount = ({ username, password }) => accounts.validate({ username, password }); + +module.exports.pickSettings = body => { + const settings = {}; + for (const key of UI_SETTING_KEYS) if (body[key] !== undefined) settings[key] = body[key]; + if ("gracePeriod" in settings) settings.gracePeriod = Number(settings.gracePeriod); + if ("trustProxy" in settings) settings.trustProxy = settings.trustProxy === true || settings.trustProxy === "true"; + return settings; +}; + +module.exports.completeSetup = async (config, { username, password, settings }) => { + if (!await module.exports.isSetupRequired()) return { code: 409, message: "Setup has already been completed" }; + const accountError = accounts.validate({ username, password }); + if (accountError) return { code: 400, message: accountError }; + + const picked = module.exports.pickSettings(settings || {}); + const changed = Object.fromEntries(Object.entries(picked) + .filter(([key, value]) => value !== (key === "publicUrl" ? config.publicUrlConfigured : config[key]))); + try { + applySettings(config, changed); + } catch (err) { + return { code: 400, message: err.message }; + } + if (!config.ready) return { code: 400, message: "baseDomain is required" }; + + const created = await accounts.create({ username, password, role: "admin" }); + if (created.code) return created; + + await settingsStore.write(changed); + config.setupRequired = false; + logger.info(`Setup completed, admin account "${username}" created`); + return { message: "Setup complete", account: created.account }; +}; diff --git a/server/controllers/tunnels.js b/server/controllers/tunnels.js new file mode 100644 index 0000000..f29efa7 --- /dev/null +++ b/server/controllers/tunnels.js @@ -0,0 +1,217 @@ +const { endSession } = require("../lib/registry"); +const { replayRequest } = require("../lib/proxy"); +const { serialize } = require("../lib/breakpoints"); +const { buildPolicy, describePolicy, summarizePolicy } = require("../lib/access"); +const logger = require("../utils/logger"); + +const announceAccess = tunnel => { + if (tunnel.session && !tunnel.session.closed) tunnel.session.sendControl({ type: "access", access: summarizePolicy(tunnel.policy) }); +}; +module.exports.announceAccess = announceAccess; +const persistent = require("../lib/persistent"); + +const serializeTunnel = (registry, tunnel) => ({ + id: tunnel.id, + mode: tunnel.mode, + target: tunnel.target.authority, + url: registry.publicUrl(tunnel), + customUrls: registry.customUrls(tunnel), + persistent: tunnel.persistent, + shareCode: tunnel.shareCode, + online: tunnel.online, + graceUntil: tunnel.graceUntil, + joiners: tunnel.joiners.size, + createdAt: tunnel.createdAt, + owner: tunnel.owner, + guest: tunnel.guest, + access: describePolicy(tunnel.policy), +}); + +const mayTouch = (tunnel, viewer) => !!tunnel && (viewer.role === "admin" || tunnel.accountId === viewer.account.id); + +const serializeClients = tunnel => [...tunnel.joiners].map(session => ({ + id: session.client?.id || "", + ip: session.client?.ip || "", + connectedAt: session.client?.connectedAt || null, + streams: session.streams ? session.streams.size : 0, +})).sort((a, b) => (a.connectedAt || 0) - (b.connectedAt || 0)); + +module.exports.mayTouch = mayTouch; + +module.exports.getTunnel = async (registry, traffic, id, viewer) => { + const tunnel = registry.get(id); + if (!mayTouch(tunnel, viewer)) return null; + const base = { ...serializeTunnel(registry, tunnel), requests: await traffic.count(id) }; + return tunnel.mode === "tcp" ? { ...base, clients: serializeClients(tunnel) } : base; +}; + +module.exports.listTunnels = (registry, viewer) => + [...registry.tunnels.values()] + .filter(tunnel => mayTouch(tunnel, viewer)) + .sort((a, b) => b.createdAt - a.createdAt) + .map(tunnel => serializeTunnel(registry, tunnel)); + +const tcpTunnel = (registry, id, viewer) => { + const tunnel = registry.get(id); + if (!mayTouch(tunnel, viewer)) return { code: 404, message: "Tunnel not found" }; + if (tunnel.mode !== "tcp") return { code: 400, message: "Only tcp tunnels have clients" }; + return { tunnel }; +}; + +module.exports.disconnectClient = (registry, id, clientId, viewer) => { + const { tunnel, code, message } = tcpTunnel(registry, id, viewer); + if (code) return { code, message }; + const session = [...tunnel.joiners].find(joiner => joiner.client?.id === clientId); + if (!session) return { code: 404, message: "Client not connected" }; + endSession(session, "disconnected by the administrator"); + tunnel.joiners.delete(session); + return { message: "Client disconnected" }; +}; + +module.exports.disconnectAllClients = (registry, id, viewer) => { + const { tunnel, code, message } = tcpTunnel(registry, id, viewer); + if (code) return { code, message }; + const count = tunnel.joiners.size; + for (const session of tunnel.joiners) endSession(session, "disconnected by the administrator"); + tunnel.joiners.clear(); + return { message: `Disconnected ${count} ${count === 1 ? "client" : "clients"}` }; +}; + +module.exports.updateAccess = async (registry, access, id, input, viewer) => { + const tunnel = registry.get(id); + if (!mayTouch(tunnel, viewer)) return { code: 404, message: "Tunnel not found" }; + try { + tunnel.policy = buildPolicy({ ...input, password: input.password || undefined }, tunnel.policy); + } catch (err) { + return { code: err.code === "bad_request" ? 400 : 500, message: err.message }; + } + + access.forget(id); + if (tunnel.persistent) await persistent.savePolicy(tunnel.id, tunnel.policy); + announceAccess(tunnel); + return { message: "Access updated", access: describePolicy(tunnel.policy) }; +}; + +module.exports.updateMode = async (registry, id, input, viewer) => { + const tunnel = registry.get(id); + if (!mayTouch(tunnel, viewer)) return { code: 404, message: "Tunnel not found" }; + if (tunnel.mode === "tcp") return { code: 400, message: "TCP tunnels have no forwarding mode" }; + + const mode = String(input.mode || "").toLowerCase(); + if (!["path", "subdomain"].includes(mode)) return { code: 400, message: "mode must be path or subdomain" }; + if (mode === "subdomain" && registry.config.managesTls && !registry.config.wildcard) { + return { code: 400, message: "Subdomain tunnels need a wildcard certificate: set the forwarding mode to subdomain first" }; + } + + tunnel.mode = mode; + if (tunnel.persistent) await persistent.saveMode(tunnel.id, mode); + logger.info(`Forwarding of ${tunnel.id} set to ${mode}`); + return { message: `Forwarding set to ${mode}`, mode, url: registry.publicUrl(tunnel) }; +}; + +const METHOD = /^[A-Z]{3,10}$/; + +const editedPart = (stored, input) => { + const part = { ...stored }; + if (input.headers !== undefined) { + if (!Array.isArray(input.headers) || input.headers.some(pair => !Array.isArray(pair) || pair.length !== 2)) { + throw new Error("Headers must be a list of [name, value] pairs"); + } + part.headers = input.headers.map(([name, value]) => [String(name).trim(), String(value).trim()]).filter(([name]) => name); + } + if (input.body !== undefined) { + const body = Buffer.from(String(input.body), "utf8"); + part.body = body.length ? body.toString("base64") : null; + part.bytes = body.length; + part.truncated = false; + } + return part; +}; + +const edited = (stored, input) => { + const out = { ...stored, request: editedPart(stored.request, input) }; + if (input.method !== undefined) { + const method = String(input.method).trim().toUpperCase(); + if (!METHOD.test(method)) throw new Error("Invalid method"); + out.method = method; + } + if (input.path !== undefined) { + const path = String(input.path).trim(); + if (!path.startsWith("/")) throw new Error("The path must start with /"); + out.path = path; + } + return out; +}; + +const editedResponse = (stored, input) => { + const out = editedPart(stored, input); + if (input.status !== undefined) { + const status = Number(input.status); + if (!Number.isInteger(status) || status < 100 || status > 599) throw new Error("Invalid status"); + out.status = status; + } + return out; +}; + +const bufferOf = part => (part.body ? Buffer.from(part.body, "base64") : Buffer.alloc(0)); + +module.exports.replay = async (req, id, requestId, input) => { + const tunnel = req.registry.get(id); + if (!mayTouch(tunnel, req.session)) return { code: 404, message: "Tunnel not found" }; + if (!tunnel.online) return { code: 502, message: "The tunnel is offline" }; + const stored = await req.traffic.get(id, requestId); + if (!stored) return { code: 404, message: "That request is no longer stored" }; + if (stored.kind === "ws") return { code: 400, message: "WebSocket connections cannot be replayed" }; + let request; + try { + request = edited(stored, input); + } catch (err) { + return { code: 400, message: err.message }; + } + if (request.request.truncated) return { code: 400, message: "The request body was too large to store" }; + const status = await replayRequest(tunnel, request, req.onRequest(tunnel)); + return { message: `Replayed, ${status}`, status }; +}; + +module.exports.getBreakpoints = (req, id) => { + if (!mayTouch(req.registry.get(id), req.session)) return { code: 404, message: "Tunnel not found" }; + return { rules: req.breakpoints.rulesFor(id), held: req.breakpoints.list(id), now: Date.now() }; +}; + +module.exports.setBreakpoints = (req, id, input) => { + if (!mayTouch(req.registry.get(id), req.session)) return { code: 404, message: "Tunnel not found" }; + try { + return { message: "Breakpoints updated", rules: req.breakpoints.setRules(id, input.rules) }; + } catch (err) { + return { code: 400, message: err.message }; + } +}; + +module.exports.resolveBreakpoint = (req, id, holdId, input) => { + if (!mayTouch(req.registry.get(id), req.session)) return { code: 404, message: "Tunnel not found" }; + const held = req.breakpoints.get(id, holdId); + if (!held) return { code: 404, message: "That request is no longer waiting" }; + if (input.action === "drop") { + req.breakpoints.settle(holdId, { action: "drop" }); + return { message: "Dropped" }; + } + const stored = serialize(held); + try { + if (held.phase === "response") { + const response = editedResponse(stored.response, input); + req.breakpoints.settle(holdId, { action: "continue", status: response.status, headers: response.headers, body: bufferOf(response) }); + } else { + const request = edited(stored, input); + req.breakpoints.settle(holdId, { action: "continue", method: request.method, path: request.path, headers: request.request.headers, body: bufferOf(request.request) }); + } + } catch (err) { + return { code: 400, message: err.message }; + } + return { message: "Continued" }; +}; + +module.exports.closeTunnel = (registry, id, viewer) => { + if (!mayTouch(registry.get(id), viewer)) return { code: 404, message: "Tunnel not found" }; + registry.remove(id, "closed from the web UI"); + return { message: "Tunnel closed" }; +}; diff --git a/server/index.js b/server/index.js new file mode 100644 index 0000000..aec3970 --- /dev/null +++ b/server/index.js @@ -0,0 +1,196 @@ +const http = require("node:http"); +const https = require("node:https"); +const { proxyFront } = require("./lib/proxy-front"); +const { loadConfig, applyStored } = require("./utils/config"); +const { createAuth } = require("./utils/auth"); +const { Registry } = require("./lib/registry"); +const { TrafficLog } = require("./lib/traffic"); +const { Visitors } = require("./lib/visitors"); +const { Breakpoints } = require("./lib/breakpoints"); +const { ConnectionLog } = require("./lib/connections"); +const { Stats } = require("./lib/stats"); +const { AccessStore } = require("./lib/access"); +const { DeviceStore } = require("./lib/devices"); +const { SessionStore } = require("./lib/sessions"); +const { AttemptLimiter } = require("./utils/attempts"); +const { CertificateManager } = require("./lib/tls/manager"); +const { DomainManager } = require("./lib/domains"); +const { Quotas } = require("./lib/quotas"); +const { FrameLog } = require("./lib/wsframes"); +const { Intel } = require("./lib/intel"); +const { isSetupRequired } = require("./controllers/setup"); +const db = require("./utils/database"); +const { runMigrations } = require("./utils/migrationRunner"); +const { dataDir } = require("./utils/paths"); +const { hasBuild } = require("./utils/static"); +const { createControlServer } = require("./controllers/control"); +const { createRouter } = require("./controllers/http"); +const logger = require("./utils/logger"); +const packageJson = require("../package.json"); + +let config; +try { + config = loadConfig(); +} catch (err) { + logger.error(err.message); + process.exit(1); +} + +const devices = new DeviceStore(); +const auth = createAuth(devices); +const certificates = new CertificateManager(config); +const domains = new DomainManager({ config, certificates }); +const quotas = new Quotas(); +const intel = new Intel(); +const registry = new Registry(config, domains, quotas, intel); +const traffic = new TrafficLog(); +const visitors = new Visitors(); +const breakpoints = new Breakpoints(); +const connections = new ConnectionLog(); +const frames = new FrameLog(); +const access = new AccessStore(); +const stats = new Stats(registry, quotas); +quotas.on("exceeded", accountId => registry.closeFor(accountId, "monthly traffic limit reached")); +registry.on("blocked", (tunnel, ip, details, reason) => visitors.blocked(tunnel.id, ip, details, reason)); +registry.on("forget", tunnel => { + traffic.forget(tunnel.id).catch(err => logger.warn(`Could not drop stored requests: ${err.message}`)); + visitors.forget(tunnel.id).catch(err => logger.warn(`Could not drop stored visitors: ${err.message}`)); + breakpoints.forget(tunnel.id); + connections.forget(tunnel.id).catch(err => logger.warn(`Could not drop stored connections: ${err.message}`)); + access.forget(tunnel.id); + stats.forget(tunnel.id); +}); +const sessions = new SessionStore(); +const attempts = new AttemptLimiter(); +const control = createControlServer({ config, auth, registry, connections, intel, visitors }); +const router = createRouter({ config, auth, registry, traffic, visitors, breakpoints, connections, access, stats, devices, sessions, attempts, certificates, domains, quotas, frames, intel, control }); + +const SERVER_OPTIONS = { keepAliveTimeout: 65_000, requestTimeout: 0, headersTimeout: 60_000 }; + +const onClientError = (err, socket) => { + if (err.code === "ECONNRESET" || !socket.writable) return socket.destroy(); + socket.end("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n"); +}; + +const onListenError = (name, port) => err => { + if (err.code === "EADDRINUSE") logger.error(`${config.listen}:${port} is already in use, stop whatever is listening there first`); + else if (err.code === "EACCES") logger.error(`Not allowed to listen on ${config.listen}:${port}. Ports below 1024 need CAP_NET_BIND_SERVICE`); + else logger.error(`${name} server error: ${err.stack || err}`); + process.exit(1); +}; + +const attach = (server, port, name) => { + server.on("upgrade", router.handleUpgrade); + server.on("clientError", onClientError); + server.on("error", onListenError(name, port)); + return server; +}; + +const servers = []; + +const buildServers = () => { + if (!config.managesTls) { + const server = attach(http.createServer(SERVER_OPTIONS, router.handleRequest), config.port, "http"); + servers.push({ server, port: config.port, name: "http" }); + return; + } + + const secureOptions = { + ...SERVER_OPTIONS, + SNICallback: (servername, callback) => { + const context = certificates.secureContextFor(servername); + if (!context) return callback(new Error("frislit has no certificate yet")); + callback(null, context); + }, + }; + const secure = https.createServer(secureOptions, router.handleRequest); + secure.on("upgrade", router.handleUpgrade); + secure.on("clientError", onClientError); + + const front = proxyFront(secureOptions, tunnel => secure.emit("secureConnection", tunnel)); + + servers.push({ server: attach(front, config.httpsPort, "https"), port: config.httpsPort, name: "https" }); + + const redirect = http.createServer(SERVER_OPTIONS, router.handleRedirect); + redirect.on("upgrade", router.handleUpgrade); + redirect.on("clientError", onClientError); + redirect.on("error", onListenError("redirect", config.redirectPort)); + servers.push({ server: redirect, port: config.redirectPort, name: "redirect" }); +}; + +const start = async () => { + try { + await db.authenticate(); + } catch (err) { + logger.error(`Could not open ${db.storagePath}: ${err.message}`); + process.exit(1); + } + await runMigrations(); + config.setupRequired = await isSetupRequired(); + try { + applyStored(config, await require("./lib/settings").read()); + } catch (err) { + logger.error(err.message); + process.exit(1); + } + logger.info(`Database ready at ${db.storagePath}`); + + if (config.managesTls) { + await certificates.load(); + await certificates.loadExtra(); + certificates.start(); + if (!certificates.covers()) { + logger.warn(`No certificate for ${certificates.status().domains.join(", ")} yet`); + logger.warn(`Until there is one, the web UI is served over plain HTTP on port ${config.redirectPort}`); + } + } + + await domains.load(); + if (config.ready) domains.start(); + await quotas.load(); + quotas.start(); + await intel.load(); + intel.start(); + stats.start(); + traffic.start(); + visitors.start(); + connections.start(); + frames.start(); + buildServers(); + let remaining = servers.length; + for (const { server, port, name } of servers) { + server.listen(port, config.listen, () => { + logger.info(`frislit ${packageJson.version} listening on ${config.listen}:${port} (${name})`); + if (--remaining) return; + if (config.ready) logger.info(`Base domain: ${config.baseDomain} (public URL ${config.publicUrl}, tls=${config.tlsMode}, trustProxy=${config.trustProxy})`); + else logger.warn("baseDomain missing: only the web UI is served until the guided setup is completed"); + if (config.setupRequired) logger.warn(`No admin account yet, open ${config.publicUrl || `http://localhost:${config.port}`}/@frislit/ to run the guided setup`); + logger.info(`Data directory: ${dataDir()}`); + if (!hasBuild()) logger.warn("client/dist not found: run `npm run build` in client/ to serve the web UI"); + }); + } +}; + +start().catch(err => { + logger.error(`Could not start: ${err.stack || err}`); + process.exit(1); +}); + +const shutdown = signal => { + logger.info(`Received ${signal}, shutting down`); + control.close(); + quotas.stop(); + quotas.flush().catch(() => null); + domains.stop(); + certificates.stop(); + stats.stop(); + traffic.stop(); + frames.stop(); + intel.stop(); + for (const { server } of servers) server.close(); + setTimeout(() => process.exit(0), 3000).unref(); +}; +process.on("SIGINT", () => shutdown("SIGINT")); +process.on("SIGTERM", () => shutdown("SIGTERM")); +process.on("uncaughtException", err => logger.error(`uncaught exception: ${err.stack || err}`)); +process.on("unhandledRejection", err => logger.error(`unhandled rejection: ${err?.stack || err}`)); diff --git a/server/lib/MuxSession.js b/server/lib/MuxSession.js new file mode 100644 index 0000000..fe506fd --- /dev/null +++ b/server/lib/MuxSession.js @@ -0,0 +1,297 @@ +const { EventEmitter } = require("node:events"); +const { Duplex } = require("node:stream"); +const { TYPES, WINDOW_SIZE, CHUNK_SIZE, MAX_DATAGRAM, encode, decode } = require("./frames"); +const logger = require("../utils/logger"); + +const WS_HIGH_WATER = 4 * 1024 * 1024; +const PING_INTERVAL = 20_000; +const DRAIN_INTERVAL = 20; +const DEAD_AFTER = 60_000; + +class MuxStream extends Duplex { + constructor(session, id, meta) { + super({ readableHighWaterMark: 64 * 1024, writableHighWaterMark: 64 * 1024, allowHalfOpen: true }); + this.session = session; + this.id = id; + this.meta = meta; + this.protocol = meta.protocol === "udp" ? "udp" : "tcp"; + this.sendWindow = WINDOW_SIZE; + this.pendingUpdate = 0; + this.writeQueue = []; + this.closeSent = false; + this.closeReceived = false; + this.finished = false; + } + + setTimeout() { return this; } + setNoDelay() { return this; } + setKeepAlive() { return this; } + ref() { return this; } + unref() { return this; } + address() { return {}; } + get remoteAddress() { return this.meta.remote || ""; } + + _read() { + if (this.pendingUpdate > 0 && !this.finished && !this.closeReceived) { + const amount = this.pendingUpdate; + this.pendingUpdate = 0; + const payload = Buffer.allocUnsafe(4); + payload.writeUInt32BE(amount, 0); + this.session._send(TYPES.WINDOW_UPDATE, this.id, payload); + } + } + + _write(chunk, _encoding, callback) { + if (this.finished) return callback(); + let offset = 0; + const pieces = []; + while (offset < chunk.length) { + pieces.push(chunk.subarray(offset, offset + CHUNK_SIZE)); + offset += CHUNK_SIZE; + } + this.writeQueue.push({ pieces, index: 0, callback }); + this._flushWrites(); + } + + _flushWrites() { + while (this.writeQueue.length && !this.finished) { + const item = this.writeQueue[0]; + while (item.index < item.pieces.length) { + const piece = item.pieces[item.index]; + if (this.sendWindow < piece.length || this.session.bufferedAmount() > WS_HIGH_WATER) { + this.session._wantDrain(this); + return; + } + this.sendWindow -= piece.length; + this.session._send(TYPES.DATA, this.id, piece); + item.index++; + } + this.writeQueue.shift(); + item.callback(); + } + if (this.writeQueue.length === 0 && this.finalCallback) { + const cb = this.finalCallback; + this.finalCallback = null; + this._sendClose(); + cb(); + } + } + + _final(callback) { + if (this.finished) return callback(); + this.finalCallback = callback; + this._flushWrites(); + } + + _sendClose() { + if (this.closeSent || this.finished) return; + this.closeSent = true; + this.session._send(TYPES.CLOSE, this.id); + this._maybeFinish(); + } + + _destroy(err, callback) { + for (const item of this.writeQueue) item.callback(err || new Error("stream destroyed")); + this.writeQueue = []; + if (!this.finished) { + this.finished = true; + if (!this.resetReceived && !(this.closeSent && this.closeReceived)) this.session._send(TYPES.RESET, this.id); + this.session._forget(this.id); + } + callback(err); + } + + sendDatagram(data) { + if (this.finished || data.length > MAX_DATAGRAM) return false; + if (this.session.bufferedAmount() > WS_HIGH_WATER) return false; + this.session._send(TYPES.DATAGRAM, this.id, data); + return true; + } + + _maybeFinish() { + if (this.closeSent && this.closeReceived && !this.finished) { + this.finished = true; + this.session._forget(this.id); + } + } + + _onData(payload) { + if (this.closeReceived || this.finished) return; + this.pendingUpdate += payload.length; + this.push(Buffer.from(payload)); + } + + _onClose() { + if (this.closeReceived) return; + this.closeReceived = true; + this.push(null); + this._maybeFinish(); + } + + _onReset() { + this.resetReceived = true; + this.destroy(new Error("stream reset by peer")); + } + + _onWindowUpdate(amount) { + this.sendWindow += amount; + this._flushWrites(); + } + + _onDatagram(payload) { + if (this.finished) return; + this.emit("datagram", Buffer.from(payload)); + } +} + +class MuxSession extends EventEmitter { + constructor(ws, { parity = 0, name = "mux" } = {}) { + super(); + this.ws = ws; + this.name = name; + this.streams = new Map(); + this.nextId = parity === 0 ? 2 : 1; + this.closed = false; + this.waitingForDrain = new Set(); + this.drainTimer = null; + this.lastActivity = Date.now(); + this.bytesSent = 0; + this.bytesReceived = 0; + + ws.on("message", (data, isBinary) => { + this.lastActivity = Date.now(); + if (isBinary) this._onFrame(data); + else this._onControl(data); + }); + ws.on("close", (code, reason) => this._onSocketClose(code, reason)); + ws.on("error", err => logger.debug(`${name}: websocket error: ${err.message}`)); + + this.pingTimer = setInterval(() => { + if (Date.now() - this.lastActivity > DEAD_AFTER) { + logger.info(`${name}: peer timed out`); + this.close(4008, "timeout"); + return; + } + this.sendControl({ type: "ping" }); + }, PING_INTERVAL); + } + + bufferedAmount() { + return this.ws.bufferedAmount || 0; + } + + _wantDrain(stream) { + this.waitingForDrain.add(stream); + if (this.drainTimer) return; + this.drainTimer = setInterval(() => this._drain(), DRAIN_INTERVAL); + } + + _stopDraining() { + if (!this.drainTimer) return; + clearInterval(this.drainTimer); + this.drainTimer = null; + } + + _drain() { + if (!this.waitingForDrain.size) return this._stopDraining(); + if (this.bufferedAmount() > WS_HIGH_WATER) return; + const waiting = [...this.waitingForDrain]; + this.waitingForDrain.clear(); + for (const stream of waiting) stream._flushWrites(); + if (!this.waitingForDrain.size) this._stopDraining(); + } + + sendControl(message) { + if (this.closed || this.ws.readyState !== this.ws.OPEN) return; + this.ws.send(JSON.stringify(message)); + } + + _send(type, streamId, payload) { + if (process.env.FRISLIT_MUX_DEBUG) logger.debug(`${this.name} > type=${type} stream=${streamId} len=${payload ? payload.length : 0}`); + if (this.closed || this.ws.readyState !== this.ws.OPEN) return; + if (payload && (type === TYPES.DATA || type === TYPES.DATAGRAM)) this.bytesSent += payload.length; + this.ws.send(encode(type, streamId, payload), { binary: true }); + } + + open(meta) { + if (this.closed) throw new Error("session closed"); + const id = this.nextId; + this.nextId += 2; + const stream = new MuxStream(this, id, meta); + this.streams.set(id, stream); + this._send(TYPES.OPEN, id, JSON.stringify(meta)); + return stream; + } + + _forget(id) { + this.streams.delete(id); + } + + _onControl(data) { + let message; + try { + message = JSON.parse(data.toString()); + } catch { + return; + } + if (!message || typeof message.type !== "string") return; + if (message.type === "ping") return this.sendControl({ type: "pong" }); + if (message.type === "pong") return; + this.emit("control", message); + } + + _onFrame(data) { + const frame = decode(data); + if (!frame) return; + const { type, streamId, payload } = frame; + if (payload && (type === TYPES.DATA || type === TYPES.DATAGRAM)) this.bytesReceived += payload.length; + const stream = this.streams.get(streamId); + if (process.env.FRISLIT_MUX_DEBUG) logger.debug(`${this.name} < type=${type} stream=${streamId} len=${payload.length} known=${!!stream}`); + + if (type === TYPES.OPEN) { + if (stream) return; + let meta = {}; + try { + meta = JSON.parse(payload.toString("utf8")) || {}; + } catch { } + const created = new MuxStream(this, streamId, meta); + this.streams.set(streamId, created); + this.emit("stream", created, meta); + return; + } + if (!stream) return; + switch (type) { + case TYPES.DATA: return stream._onData(payload); + case TYPES.CLOSE: return stream._onClose(); + case TYPES.RESET: return stream._onReset(); + case TYPES.DATAGRAM: return stream._onDatagram(payload); + case TYPES.WINDOW_UPDATE: + if (payload.length >= 4) stream._onWindowUpdate(payload.readUInt32BE(0)); + return; + default: + return; + } + } + + _onSocketClose(code, reason) { + if (this.closed) return; + this.closed = true; + clearInterval(this.pingTimer); + this._stopDraining(); + for (const stream of [...this.streams.values()]) { + stream.resetReceived = true; + stream.destroy(new Error("session closed")); + } + this.streams.clear(); + this.emit("close", code, reason?.toString()); + } + + close(code = 1000, reason = "") { + if (this.ws.readyState === this.ws.OPEN || this.ws.readyState === this.ws.CONNECTING) { + try { this.ws.close(code, reason); } catch { } + } + setTimeout(() => { try { this.ws.terminate(); } catch { } }, 2000).unref(); + } +} + +module.exports = { MuxSession }; diff --git a/server/lib/access.js b/server/lib/access.js new file mode 100644 index 0000000..bc098c0 --- /dev/null +++ b/server/lib/access.js @@ -0,0 +1,257 @@ +const { randomToken } = require("../utils/ids"); +const { hashPassword } = require("../utils/password"); + +const COOKIE_NAME = "frislit-access"; +const TTL = 12 * 60 * 60 * 1000; +const AUTH_MODES = ["none", "password", "frislit"]; + +const stripScope = address => String(address || "").replace(/%.*$/, ""); + +const toBytes = address => { + const value = stripScope(address).replace(/^\[|\]$/g, ""); + const mapped = /^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(value); + const plain = mapped ? mapped[1] : value; + + if (/^\d+\.\d+\.\d+\.\d+$/.test(plain)) { + const parts = plain.split(".").map(Number); + if (parts.some(part => !Number.isInteger(part) || part < 0 || part > 255)) return null; + return Buffer.from(parts); + } + if (!value.includes(":")) return null; + + const [head, tail = ""] = value.split("::"); + const expand = part => (part ? part.split(":").filter(Boolean) : []); + const left = expand(head); + const right = expand(tail); + const missing = 8 - left.length - right.length; + if (missing < 0 || (missing > 0 && !value.includes("::"))) return null; + const groups = [...left, ...Array(Math.max(missing, 0)).fill("0"), ...right]; + if (groups.length !== 8) return null; + + const bytes = Buffer.alloc(16); + for (let i = 0; i < 8; i++) { + const group = parseInt(groups[i], 16); + if (Number.isNaN(group) || group < 0 || group > 0xffff) return null; + bytes.writeUInt16BE(group, i * 2); + } + return bytes; +}; + +const parseRule = rule => { + const text = String(rule || "").trim(); + if (!text) return null; + const [address, prefix] = text.split("/"); + const bytes = toBytes(address); + if (!bytes) return null; + const bits = prefix === undefined ? bytes.length * 8 : Number(prefix); + if (!Number.isInteger(bits) || bits < 0 || bits > bytes.length * 8) return null; + return { bytes, bits, text }; +}; + +const matchesRule = (address, rule) => { + const bytes = toBytes(address); + if (!bytes || bytes.length !== rule.bytes.length) return false; + const whole = rule.bits >> 3; + if (!bytes.subarray(0, whole).equals(rule.bytes.subarray(0, whole))) return false; + const remainder = rule.bits & 7; + if (!remainder) return true; + const mask = 0xff << (8 - remainder) & 0xff; + return (bytes[whole] & mask) === (rule.bytes[whole] & mask); +}; + +const isAllowed = (address, rules = []) => { + if (!rules.length) return true; + return rules.map(parseRule).filter(Boolean).some(rule => matchesRule(address, rule)); +}; + +const CATEGORIES = ["tor", "vpn", "datacenter", "blocklist"]; +const CATEGORY_KEYS = { tor: "tor", vpn: "vpn", datacenter: "datacenter", blocklist: "blocklisted" }; +const CATEGORY_LABELS = { tor: "Tor exit nodes", vpn: "VPN services", datacenter: "datacenters", blocklist: "blocklisted addresses" }; + +const fail = message => Object.assign(new Error(message), { code: "bad_request" }); + +const emptyPolicy = () => ({ + auth: "none", + passwordHash: null, + accounts: [], + allow: { ips: [], countries: [] }, + block: { ips: [], countries: [], categories: [] }, +}); + +const accountIds = value => { + const ids = [...new Set((Array.isArray(value) ? value : []).map(Number))]; + for (const id of ids) if (!Number.isInteger(id) || id <= 0) throw fail("Accounts must be account ids"); + if (ids.length > 100) throw fail("At most 100 accounts"); + return ids; +}; + +const accountAllowed = (policy, accountId, ownerId) => + !policy.accounts?.length || accountId === ownerId || policy.accounts.includes(accountId); + +const listOf = value => (Array.isArray(value) ? value : String(value).split(",")).map(entry => String(entry).trim()).filter(Boolean); + +const ipRules = value => { + const rules = listOf(value); + for (const rule of rules) if (!parseRule(rule)) throw fail(`"${rule}" is not an IP address or CIDR range`); + if (rules.length > 64) throw fail("At most 64 IP rules"); + return rules; +}; + +const countryCodes = value => { + const codes = [...new Set(listOf(value).map(code => code.toUpperCase()))]; + for (const code of codes) if (!/^[A-Z]{2}$/.test(code)) throw fail(`"${code}" is not a country code`); + return codes; +}; + +const categories = value => { + const list = [...new Set(listOf(value).map(entry => entry.toLowerCase()))]; + for (const entry of list) if (!CATEGORIES.includes(entry)) throw fail(`"${entry}" is not one of ${CATEGORIES.join(", ")}`); + return list; +}; + +const buildPolicy = (input = {}, previous = emptyPolicy()) => { + const policy = { ...previous, allow: { ...previous.allow }, block: { ...previous.block } }; + + if (input.allow?.ips !== undefined) policy.allow.ips = ipRules(input.allow.ips); + if (input.allow?.countries !== undefined) policy.allow.countries = countryCodes(input.allow.countries); + if (input.block?.ips !== undefined) policy.block.ips = ipRules(input.block.ips); + if (input.block?.countries !== undefined) policy.block.countries = countryCodes(input.block.countries); + if (input.block?.categories !== undefined) policy.block.categories = categories(input.block.categories); + if (input.accounts !== undefined) policy.accounts = accountIds(input.accounts); + + if (input.auth !== undefined) { + const auth = String(input.auth || "none"); + if (!AUTH_MODES.includes(auth)) throw Object.assign(new Error(`auth must be one of ${AUTH_MODES.join(", ")}`), { code: "bad_request" }); + policy.auth = auth; + } + + if (input.password) { + const password = String(input.password); + if (password.length < 4) throw Object.assign(new Error("The tunnel password must be at least 4 characters"), { code: "bad_request" }); + + policy.passwordHash = hashPassword(password); + if (input.auth === undefined) policy.auth = "password"; + } + + if (policy.auth === "password" && !policy.passwordHash) { + throw Object.assign(new Error("Password protection needs a password"), { code: "bad_request" }); + } + if (policy.auth !== "password") policy.passwordHash = null; + return policy; +}; + +const describePolicy = (policy = emptyPolicy()) => ({ + auth: policy.auth, + hasPassword: !!policy.passwordHash, + accounts: policy.accounts || [], + allow: policy.allow, + block: policy.block, +}); + +const hasRules = policy => policy.allow.ips.length + policy.allow.countries.length + policy.block.ips.length + policy.block.countries.length + policy.block.categories.length > 0; + +const isRestricted = (policy = emptyPolicy()) => policy.auth !== "none" || hasRules(policy); + +const evaluate = (policy, ip, intel) => { + if (!hasRules(policy)) return null; + const { allow, block } = policy; + if (block.ips.length && isAllowed(ip, block.ips)) return "address"; + if (block.countries.includes(intel.country)) return "country"; + const category = block.categories.find(entry => intel[CATEGORY_KEYS[entry]]); + if (category) return category; + if (allow.ips.length && !isAllowed(ip, allow.ips)) return "address"; + if (allow.countries.length && !allow.countries.includes(intel.country)) return "country"; + return null; +}; + +const summarizePolicy = policy => { + const parts = []; + if (policy.auth === "frislit") parts.push("frislit login required"); + if (policy.auth === "password") parts.push("password protected"); + if (policy.allow.ips.length) parts.push(`allowed: ${policy.allow.ips.join(", ")}`); + if (policy.allow.countries.length) parts.push(`only ${policy.allow.countries.join(", ")}`); + if (policy.block.ips.length) parts.push(`blocked: ${policy.block.ips.join(", ")}`); + if (policy.block.countries.length) parts.push(`not ${policy.block.countries.join(", ")}`); + if (policy.block.categories.length) parts.push(`no ${policy.block.categories.map(entry => CATEGORY_LABELS[entry]).join(", ")}`); + return parts.join(" · ") || null; +}; + +const CODE_TTL = 60 * 1000; + +class AccessStore { + constructor(ttl = TTL) { + this.ttl = ttl; + this.tokens = new Map(); + this.codes = new Map(); + this.sweeper = setInterval(() => this.sweep(), 10 * 60 * 1000); + this.sweeper.unref(); + } + + create(tunnelId) { + const token = randomToken(32); + this.tokens.set(token, { tunnelId, expiresAt: Date.now() + this.ttl }); + return token; + } + + issueCode(tunnelId, host) { + const code = randomToken(32); + this.codes.set(code, { tunnelId, host, expiresAt: Date.now() + CODE_TTL }); + return code; + } + + redeem(code, host) { + const entry = code && this.codes.get(code); + if (!entry) return null; + this.codes.delete(code); + if (entry.expiresAt < Date.now() || entry.host !== host) return null; + return this.create(entry.tunnelId); + } + + allows(token, tunnelId) { + const entry = token && this.tokens.get(token); + if (!entry) return false; + if (entry.expiresAt < Date.now()) { + this.tokens.delete(token); + return false; + } + return entry.tunnelId === tunnelId; + } + + forget(tunnelId) { + for (const [token, entry] of this.tokens) if (entry.tunnelId === tunnelId) this.tokens.delete(token); + } + + sweep() { + const now = Date.now(); + for (const [token, entry] of this.tokens) if (entry.expiresAt < now) this.tokens.delete(token); + for (const [code, entry] of this.codes) if (entry.expiresAt < now) this.codes.delete(code); + } +} + +const cookieFor = (token, secure) => + `${COOKIE_NAME}=${token}; Path=/; HttpOnly; SameSite=Lax; Max-Age=${Math.floor(TTL / 1000)}${secure ? "; Secure" : ""}`; + +const tokenFromRequest = req => { + for (const part of String(req.headers.cookie || "").split(";")) { + const index = part.indexOf("="); + if (index === -1) continue; + if (part.slice(0, index).trim() === COOKIE_NAME) return part.slice(index + 1).trim(); + } + return null; +}; + +const basicCredentials = req => { + const header = req.headers.authorization; + const match = header && /^Basic\s+(.+)$/i.exec(header.trim()); + if (!match) return null; + const decoded = Buffer.from(match[1], "base64").toString("utf8"); + const separator = decoded.indexOf(":"); + if (separator === -1) return null; + return { username: decoded.slice(0, separator), password: decoded.slice(separator + 1) }; +}; + + +module.exports = { + AccessStore, isAllowed, emptyPolicy, buildPolicy, describePolicy, summarizePolicy, isRestricted, evaluate, + accountAllowed, cookieFor, tokenFromRequest, basicCredentials, +}; diff --git a/server/lib/accounts.js b/server/lib/accounts.js new file mode 100644 index 0000000..6ba95d2 --- /dev/null +++ b/server/lib/accounts.js @@ -0,0 +1,91 @@ +const Account = require("../models/Account"); +const Session = require("../models/Session"); +const Device = require("../models/Device"); +const Invite = require("../models/Invite"); +const { hashPassword, verifyPassword } = require("../utils/password"); + +const ABSENT = hashPassword("account-that-does-not-exist"); + +const USERNAME_REGEX = /^[a-zA-Z0-9._-]{3,32}$/; +const ROLES = ["admin", "user"]; + +const describe = account => ({ + id: account.id, + username: account.username, + role: account.role, + quotas: account.quotas ? JSON.parse(account.quotas) : null, + createdAt: account.createdAt, +}); + +const validate = ({ username, password }) => { + if (username !== undefined && !USERNAME_REGEX.test(String(username || ""))) { + return "The username must be 3 to 32 letters, digits, dots, dashes or underscores"; + } + if (password !== undefined && String(password || "").length < 8) return "The password must be at least 8 characters"; + return null; +}; + +const count = () => Account.count(); + +const byUsername = username => Account.findOne({ where: { username: String(username || "") } }); + +const byId = id => Account.findByPk(id); + +const list = () => Account.findAll({ order: [["id", "ASC"]] }).then(rows => rows.map(describe)); + +const create = async ({ username, password, role = "user" }) => { + const problem = validate({ username, password }); + if (problem) return { code: 400, message: problem }; + if (!ROLES.includes(role)) return { code: 400, message: `The role must be one of ${ROLES.join(", ")}` }; + if (await byUsername(username)) return { code: 409, message: "That username is taken" }; + + await Account.create({ username, passwordHash: hashPassword(password), role }); + return { account: describe(await byUsername(username)) }; +}; + +const adminCount = () => Account.count({ where: { role: "admin" } }); + +const update = async (id, { role, password, quotas }) => { + const account = await byId(id); + if (!account) return { code: 404, message: "That account does not exist" }; + + const values = {}; + + if (role !== undefined && role !== account.role) { + if (!ROLES.includes(role)) return { code: 400, message: `The role must be one of ${ROLES.join(", ")}` }; + if (account.role === "admin" && await adminCount() <= 1) return { code: 409, message: "The last admin cannot lose the role" }; + values.role = role; + } + + if (password !== undefined) { + const problem = validate({ password }); + if (problem) return { code: 400, message: problem }; + values.passwordHash = hashPassword(password); + await Session.destroy({ where: { accountId: account.id } }); + } + + if (quotas !== undefined) values.quotas = quotas ? JSON.stringify(quotas) : null; + + if (Object.keys(values).length) await Account.update(values, { where: { id: account.id } }); + return { account: describe(await byId(account.id)) }; +}; + +const remove = async id => { + const account = await byId(id); + if (!account) return { code: 404, message: "That account does not exist" }; + if (account.role === "admin" && await adminCount() <= 1) return { code: 409, message: "The last admin cannot be deleted" }; + + await Session.destroy({ where: { accountId: account.id } }); + await Device.destroy({ where: { accountId: account.id } }); + await Invite.destroy({ where: { accountId: account.id } }); + await Account.destroy({ where: { id: account.id } }); + return { message: "Account deleted" }; +}; + +const checkCredentials = async ({ username, password } = {}) => { + const account = await byUsername(username); + const matches = await verifyPassword(String(password || ""), account ? account.passwordHash : ABSENT); + return account && matches ? account : null; +}; + +module.exports = { describe, validate, count, byId, byUsername, list, create, update, remove, checkCredentials, USERNAME_REGEX }; diff --git a/server/lib/breakpoints.js b/server/lib/breakpoints.js new file mode 100644 index 0000000..6fc8151 --- /dev/null +++ b/server/lib/breakpoints.js @@ -0,0 +1,89 @@ +const { randomToken } = require("../utils/ids"); + +const MAX_RULES = 32; +const METHOD = /^[A-Z]{3,10}$/; +const PHASES = ["request", "response", "both"]; + +const fail = message => Object.assign(new Error(message), { code: "bad_request" }); + +const normalizeRules = input => { + if (!Array.isArray(input)) throw fail("rules must be a list"); + if (input.length > MAX_RULES) throw fail(`At most ${MAX_RULES} breakpoints`); + return input.map(rule => { + const method = rule.method ? String(rule.method).trim().toUpperCase() : null; + if (method && !METHOD.test(method)) throw fail(`"${rule.method}" is not a method`); + const path = String(rule.path).trim(); + if (!path.startsWith("/")) throw fail("A breakpoint path must start with /"); + const phase = String(rule.phase); + if (!PHASES.includes(phase)) throw fail(`phase must be one of ${PHASES.join(", ")}`); + return { method, path, phase }; + }); +}; + +class Breakpoints { + constructor() { + this.rules = new Map(); + this.held = new Map(); + } + + rulesFor(tunnel) { + return this.rules.get(tunnel) || []; + } + + setRules(tunnel, input) { + const rules = normalizeRules(input); + if (rules.length) this.rules.set(tunnel, rules); else this.rules.delete(tunnel); + return rules; + } + + matches(tunnel, method, path, phase) { + return this.rulesFor(tunnel).some(rule => (rule.phase === phase || rule.phase === "both") && (!rule.method || rule.method === method) && path.startsWith(rule.path)); + } + + hold(tunnel, request) { + const id = randomToken(12); + let resolve; + const decision = new Promise(done => { resolve = done; }); + this.held.set(id, { id, tunnel, ...request, resolve }); + return { id, decision }; + } + + settle(id, decision) { + const entry = this.held.get(id); + if (!entry) return false; + this.held.delete(id); + entry.resolve(decision); + return true; + } + + get(tunnel, id) { + const entry = this.held.get(id); + return entry && entry.tunnel === tunnel ? entry : null; + } + + list(tunnel) { + return [...this.held.values()].filter(entry => entry.tunnel === tunnel).map(serialize); + } + + forget(tunnel) { + this.rules.delete(tunnel); + for (const entry of this.held.values()) if (entry.tunnel === tunnel) this.settle(entry.id, { action: "cancel" }); + } +} + +const part = ({ headers, body, bytes, truncated }) => ({ headers, body: body ? body.toString("base64") : null, bytes, truncated }); + +const serialize = entry => ({ + id: entry.id, + phase: entry.phase, + time: entry.time, + method: entry.method, + path: entry.path, + ip: entry.ip, + host: entry.host, + status: entry.response?.status, + request: part(entry.request), + ...(entry.response ? { response: { status: entry.response.status, ...part(entry.response) } } : {}), +}); + +module.exports = { Breakpoints, serialize }; diff --git a/server/lib/browser.js b/server/lib/browser.js new file mode 100644 index 0000000..52e3468 --- /dev/null +++ b/server/lib/browser.js @@ -0,0 +1,96 @@ +const { QUERY_PARAM } = require("./proxy"); + +const UI_PREFIX = "/@frislit"; +const SW_PATH = `${UI_PREFIX}/sw.js`; +const STORAGE_KEY = "frislit-tunnel"; + +const serviceWorker = () => `const PARAM = ${JSON.stringify(QUERY_PARAM)}; +const UI_PREFIX = ${JSON.stringify(UI_PREFIX)}; + +const bindings = new Map(); + +self.addEventListener("install", () => self.skipWaiting()); +self.addEventListener("activate", event => event.waitUntil(self.clients.claim())); + +self.addEventListener("message", event => { + const data = event.data || {}; + if (data.type !== "frislit-bind" || !data.tunnel || !event.source) return; + bindings.set(event.source.id, data.tunnel); + event.source.postMessage({ type: "frislit-bound", tunnel: data.tunnel }); +}); + +const ATTACH_PATH = new RegExp("^/@[a-z0-9-]{3,32}(/|$)"); +const isOwnPath = url => url.pathname === UI_PREFIX || url.pathname.startsWith(UI_PREFIX + "/") + || ATTACH_PATH.test(url.pathname); + +const forward = async (request, tunnel, navigation) => { + const url = new URL(request.url); + url.searchParams.set(PARAM, tunnel); + const init = { + method: request.method, + headers: request.headers, + credentials: request.credentials, + redirect: navigation ? "manual" : "follow", + }; + if (request.method !== "GET" && request.method !== "HEAD") init.body = await request.blob(); + return fetch(new Request(url.toString(), init)); +}; + +self.addEventListener("fetch", event => { + const request = event.request; + let url; + try { + url = new URL(request.url); + } catch { + return; + } + if (url.origin !== self.location.origin) return; + if (isOwnPath(url) || url.searchParams.has(PARAM)) return; + + const navigation = request.mode === "navigate"; + const tunnel = bindings.get(event.clientId); + + if (tunnel) { + if (navigation && event.resultingClientId) bindings.set(event.resultingClientId, tunnel); + event.respondWith(forward(request, tunnel, navigation)); + return; + } + + if (navigation) { + const target = new URL(UI_PREFIX + "/reattach", self.location.origin); + target.searchParams.set("to", request.url); + event.respondWith(Response.redirect(target.toString(), 302)); + } +}); +`; + +const injectedScript = id => ``; + +const SERVICE_WORKER_SOURCE = serviceWorker(); + +try { + new Function(SERVICE_WORKER_SOURCE); +} catch (err) { + throw new Error(`The generated service worker does not parse: ${err.message}`); +} + +module.exports = { SERVICE_WORKER_SOURCE, SW_PATH, injectedScript }; diff --git a/server/lib/capture.js b/server/lib/capture.js new file mode 100644 index 0000000..2c686da --- /dev/null +++ b/server/lib/capture.js @@ -0,0 +1,36 @@ +const { Transform } = require("node:stream"); + +const MAX_BODY = 64 * 1024; + +class Tap extends Transform { + constructor(limit = MAX_BODY) { + super(); + this.limit = limit; + this.chunks = []; + this.kept = 0; + this.total = 0; + } + + _transform(chunk, _encoding, callback) { + this.total += chunk.length; + if (this.kept < this.limit) { + const room = this.limit - this.kept; + const piece = chunk.length > room ? chunk.subarray(0, room) : chunk; + this.chunks.push(piece); + this.kept += piece.length; + } + callback(null, chunk); + } + + result() { + return { + body: this.chunks.length ? Buffer.concat(this.chunks, this.kept) : null, + bytes: this.total, + truncated: this.total > this.kept, + }; + } +} + +const headerList = headers => Object.entries(headers).flatMap(([name, value]) => [].concat(value).map(one => [name, String(one)])); + +module.exports = { Tap, headerList, MAX_BODY }; diff --git a/server/lib/connections.js b/server/lib/connections.js new file mode 100644 index 0000000..0116ff6 --- /dev/null +++ b/server/lib/connections.js @@ -0,0 +1,149 @@ +const { Op } = require("sequelize"); +const Connection = require("../models/Connection"); +const { randomToken } = require("../utils/ids"); +const { sniff } = require("./sniff"); +const logger = require("../utils/logger"); + +const PER_TUNNEL_LIMIT = 500; +const PAGE_SIZE = 50; +const FLUSH_INTERVAL = 500; +const SORTABLE = { started: "startedAt", in: "bytesIn", out: "bytesOut", ip: "ip" }; + +const serialize = row => ({ + key: row.key, + protocol: row.protocol, + ip: row.ip, + intel: JSON.parse(row.intel), + client: row.client, + joiner: row.joiner, + startedAt: new Date(row.startedAt).getTime(), + endedAt: row.endedAt ? new Date(row.endedAt).getTime() : null, + bytesIn: row.bytesIn, + bytesOut: row.bytesOut, + reason: row.reason, + detail: row.detail && JSON.parse(row.detail), +}); + +class ConnectionLog { + constructor() { + this.live = new Map(); + this.inserts = []; + this.dirty = new Set(); + this.timer = null; + } + + start() { + if (this.timer) return; + this.timer = setInterval(() => this.flush(), FLUSH_INTERVAL); + this.timer.unref(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + open(tunnel, { protocol, ip, intel, client, joiner }) { + const entry = { + key: randomToken(16), tunnel, protocol, ip, intel, client, joiner, + startedAt: Date.now(), endedAt: null, bytesIn: 0, bytesOut: 0, reason: null, detail: null, + sniffed: { in: false, out: false }, + }; + this.live.set(entry.key, entry); + this.inserts.push(entry); + return entry; + } + + data(entry, direction, buffer) { + entry[direction === "in" ? "bytesIn" : "bytesOut"] += buffer.length; + if (!entry.sniffed[direction]) { + entry.sniffed[direction] = true; + if (!entry.detail) { + entry.detail = sniff(entry.protocol, direction, buffer); + if (entry.detail) this.dirty.add(entry.key); + } + } + } + + close(entry, reason) { + entry.endedAt = Date.now(); + entry.reason = reason; + this.dirty.add(entry.key); + } + + async flush() { + const inserts = this.inserts; + const dirty = [...this.dirty]; + this.inserts = []; + this.dirty.clear(); + if (!inserts.length && !dirty.length) return; + try { + if (inserts.length) { + await Connection.bulkCreate(inserts.map(entry => ({ ...entry, intel: JSON.stringify(entry.intel), detail: entry.detail && JSON.stringify(entry.detail), startedAt: new Date(entry.startedAt), endedAt: entry.endedAt && new Date(entry.endedAt) }))); + for (const tunnel of new Set(inserts.map(entry => entry.tunnel))) await this.prune(tunnel); + } + const fresh = new Set(inserts.map(entry => entry.key)); + for (const key of dirty) { + const entry = this.live.get(key); + if (!fresh.has(key)) await this.update(entry); + if (entry.endedAt) this.live.delete(key); + } + } catch (err) { + logger.warn(`Could not store connections: ${err.message}`); + } + } + + update(entry) { + return Connection.update({ + bytesIn: entry.bytesIn, bytesOut: entry.bytesOut, reason: entry.reason, + detail: entry.detail && JSON.stringify(entry.detail), endedAt: entry.endedAt && new Date(entry.endedAt), + }, { where: { key: entry.key } }); + } + + async prune(tunnel) { + const rows = await Connection.findAll({ + where: { tunnel, endedAt: { [Op.ne]: null } }, order: [["startedAt", "DESC"]], offset: PER_TUNNEL_LIMIT, limit: 1, attributes: ["startedAt"], + }); + if (!rows.length) return; + await Connection.destroy({ where: { tunnel, endedAt: { [Op.ne]: null }, startedAt: { [Op.lte]: rows[0].startedAt } } }); + } + + current(row) { + const live = this.live.get(row.key); + return live ? { ...serialize(row), bytesIn: live.bytesIn, bytesOut: live.bytesOut, detail: live.detail } : serialize(row); + } + + async list(tunnel, { sort = "started", order = "desc", offset = 0, limit = PAGE_SIZE } = {}) { + await this.flush(); + const rows = await Connection.findAll({ + where: { tunnel }, + order: [[SORTABLE[sort] || "startedAt", order === "asc" ? "ASC" : "DESC"], ["id", "DESC"]], + offset: Math.max(offset, 0), + limit: Math.min(Math.max(limit, 1), PER_TUNNEL_LIMIT), + }); + return rows.map(row => this.current(row)); + } + + count(tunnel) { + return Connection.count({ where: { tunnel } }); + } + + async get(tunnel, key) { + await this.flush(); + const row = await Connection.findOne({ where: { tunnel, key } }); + return row ? this.current(row) : null; + } + + async clear(tunnel) { + await this.flush(); + await Connection.destroy({ where: { tunnel, endedAt: { [Op.ne]: null } } }); + } + + async forget(tunnel) { + for (const [key, entry] of this.live) if (entry.tunnel === tunnel) this.live.delete(key); + this.inserts = this.inserts.filter(entry => entry.tunnel !== tunnel); + await Connection.destroy({ where: { tunnel } }); + } +} + +module.exports = { ConnectionLog }; diff --git a/server/lib/devices.js b/server/lib/devices.js new file mode 100644 index 0000000..9539ebc --- /dev/null +++ b/server/lib/devices.js @@ -0,0 +1,150 @@ +const crypto = require("node:crypto"); +const Device = require("../models/Device"); +const Account = require("../models/Account"); +const { hashToken, randomToken } = require("../utils/ids"); +const logger = require("../utils/logger"); + +const CODE_TTL = 10 * 60 * 1000; +const CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; +const CODE_LENGTH = 8; +const TOUCH_AFTER = 60_000; + +const humanCode = () => { + const bytes = crypto.randomBytes(CODE_LENGTH); + let code = ""; + for (let i = 0; i < CODE_LENGTH; i++) { + if (i === 4) code += "-"; + code += CODE_ALPHABET[bytes[i] % CODE_ALPHABET.length]; + } + return code; +}; + +const describeDevice = (device, owner) => ({ + id: device.id, + name: device.name, + kind: device.kind, + owner: owner || null, + createdAt: device.createdAt, + lastUsedAt: device.lastUsedAt, + ip: device.ip, + userAgent: device.userAgent, +}); + +class DeviceStore { + constructor() { + this.pending = new Map(); + this.sweeper = setInterval(() => this.sweep(), 60_000); + this.sweeper.unref(); + } + + sweep() { + const now = Date.now(); + for (const [code, request] of this.pending) if (request.expiresAt < now) this.pending.delete(code); + } + + createCode({ client = "cli", ip = "", userAgent = "" } = {}) { + this.sweep(); + const code = humanCode(); + const pollToken = randomToken(32); + const expiresAt = Date.now() + CODE_TTL; + this.pending.set(code, { code, pollToken, client, ip, userAgent, createdAt: Date.now(), expiresAt, status: "pending", issued: null }); + logger.info(`Device code ${code} requested`, { ip, client }); + return { code, pollToken, expiresAt }; + } + + get(code) { + this.sweep(); + return this.pending.get(String(code || "").toUpperCase().trim()) || null; + } + + describe(code) { + const request = this.get(code); + if (!request) return null; + return { + code: request.code, client: request.client, ip: request.ip, + userAgent: request.userAgent, createdAt: request.createdAt, + expiresAt: request.expiresAt, status: request.status, + }; + } + + async createKey(accountId, name) { + const label = String(name || "").trim(); + if (!label) return { code: 400, message: "Give the key a name" }; + const token = randomToken(48); + const device = await Device.create({ accountId, name: label, kind: "key", tokenHash: hashToken(token) }); + logger.info(`API key "${label}" created`, { id: device.id }); + return { device: describeDevice(device), token }; + } + + async approve(code, { name, accountId } = {}) { + const request = this.get(code); + if (!request) return { code: 404, message: "That code is unknown or has expired" }; + if (request.status !== "pending") return { code: 409, message: "That code was already used" }; + + const token = randomToken(48); + const device = await Device.create({ + accountId, + name: String(name || "").trim() || request.client || "CLI", + tokenHash: hashToken(token), + ip: request.ip || null, + userAgent: request.userAgent || null, + }); + + request.status = "authorized"; + request.issued = token; + logger.info(`Device "${device.name}" authorized`, { id: device.id, ip: request.ip }); + return { device: describeDevice(device) }; + } + + deny(code) { + const request = this.get(code); + if (!request) return { code: 404, message: "That code is unknown or has expired" }; + this.pending.delete(request.code); + logger.info(`Device code ${request.code} denied`); + return { message: "Request denied" }; + } + + poll(pollToken) { + this.sweep(); + for (const request of this.pending.values()) { + if (request.pollToken !== pollToken) continue; + if (request.status !== "authorized") return { status: "pending" }; + const token = request.issued; + this.pending.delete(request.code); + return { status: "authorized", token }; + } + return { status: "invalid" }; + } + + async verify(token) { + if (typeof token !== "string" || !token) return null; + const device = await Device.findOne({ where: { tokenHash: hashToken(token) } }); + if (!device) return null; + + if (!device.lastUsedAt || Date.now() - new Date(device.lastUsedAt).getTime() > TOUCH_AFTER) { + await Device.update({ lastUsedAt: new Date() }, { where: { id: device.id } }); + } + return device; + } + + async list(accountId) { + const where = accountId === undefined ? {} : { accountId }; + const devices = await Device.findAll({ where, order: [["createdAt", "DESC"]] }); + if (accountId !== undefined) return devices.map(device => describeDevice(device)); + + const accounts = await Account.findAll(); + const names = new Map(accounts.map(account => [account.id, account.username])); + return devices.map(device => describeDevice(device, names.get(device.accountId))); + } + + async revoke(id, accountId) { + const where = accountId === undefined ? { id } : { id, accountId }; + const device = await Device.findOne({ where }); + if (!device) return { code: 404, message: "Device not found" }; + await Device.destroy({ where: { id: device.id } }); + logger.info(`Device "${device.name}" revoked`, { id }); + return { message: `${device.name} revoked` }; + } +} + +module.exports = { DeviceStore }; diff --git a/server/lib/domains.js b/server/lib/domains.js new file mode 100644 index 0000000..5de3677 --- /dev/null +++ b/server/lib/domains.js @@ -0,0 +1,139 @@ +const dns = require("node:dns").promises; +const Domain = require("../models/Domain"); +const logger = require("../utils/logger"); + +const RECHECK_INTERVAL = 5 * 60 * 1000; +const HOSTNAME = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,62}$/; +const UNSETTLED = ["pending", "issuing", "error"]; + +const normalize = hostname => String(hostname || "").trim().toLowerCase().replace(/\.$/, ""); + +const fail = (message, code) => Object.assign(new Error(message), { code }); + +class DomainManager { + constructor({ config, certificates }) { + this.config = config; + this.certificates = certificates; + this.byHost = new Map(); + this.checking = new Map(); + this.timer = null; + } + + async load() { + const rows = await Domain.findAll(); + this.byHost = new Map(rows.map(row => [row.hostname, row.tunnelName])); + } + + start() { + if (this.timer) return; + const recheck = () => this.recheck().catch(err => logger.warn(`Domain check failed: ${err.message}`)); + this.timer = setInterval(recheck, RECHECK_INTERVAL); + this.timer.unref(); + recheck(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + tunnelFor(hostname) { + return this.byHost.get(hostname) || null; + } + + countFor(accountId) { + return Domain.count({ where: { accountId } }); + } + + hostsFor(tunnelName) { + return [...this.byHost].filter(([, name]) => name === tunnelName).map(([hostname]) => hostname); + } + + describe(row) { + return { + hostname: row.hostname, + tunnel: row.tunnelName, + state: row.state, + error: row.lastError || null, + checkedAt: row.checkedAt, + createdAt: row.createdAt, + url: `${this.config.publicScheme}://${row.hostname}`, + certificate: this.certificates.info(row.hostname), + }; + } + + validate(hostname) { + const base = this.config.baseDomain; + if (!HOSTNAME.test(hostname)) throw fail(`"${hostname}" is not a valid hostname`, "bad_request"); + if (hostname === base || hostname.endsWith(`.${base}`)) throw fail(`Names under ${base} are handled by the server itself`, "bad_request"); + return hostname; + } + + async listFor(tunnelName) { + const rows = await Domain.findAll({ where: { tunnelName }, order: [["hostname", "ASC"]] }); + return rows.map(row => this.describe(row)); + } + + async add(rawHostname, tunnelName, accountId) { + const hostname = this.validate(normalize(rawHostname)); + if (this.byHost.has(hostname)) throw fail(`${hostname} is already in use`, "conflict"); + const row = await Domain.create({ hostname, tunnelName, accountId }); + this.byHost.set(hostname, tunnelName); + logger.info(`Domain ${hostname} added for ${tunnelName}`); + this.check(hostname).catch(err => logger.warn(`Domain check for ${hostname} failed: ${err.message}`)); + return this.describe(row); + } + + async remove(hostname) { + await Domain.destroy({ where: { hostname } }); + this.byHost.delete(hostname); + await this.certificates.forget(hostname); + logger.info(`Domain ${hostname} removed`); + } + + async removeForTunnel(tunnelName) { + for (const hostname of this.hostsFor(tunnelName)) await this.remove(hostname); + } + + async recheck() { + const rows = await Domain.findAll({ where: { state: UNSETTLED }, attributes: ["hostname"] }); + for (const row of rows) await this.check(row.hostname).catch(err => logger.warn(`Domain check for ${row.hostname} failed: ${err.message}`)); + } + + async pointsHere(hostname) { + const base = this.config.baseDomain; + const cnames = await dns.resolveCname(hostname).catch(() => []); + if (cnames.some(target => normalize(target) === base)) return true; + + const addresses = async name => [ + ...await dns.resolve4(name).catch(() => []), + ...await dns.resolve6(name).catch(() => []), + ]; + const expected = new Set(await addresses(base)); + if (!expected.size) return false; + return (await addresses(hostname)).some(address => expected.has(address)); + } + + check(hostname) { + if (!this.byHost.has(hostname)) return Promise.resolve(); + if (!this.checking.has(hostname)) { + this.checking.set(hostname, this.verify(hostname).finally(() => this.checking.delete(hostname))); + } + return this.checking.get(hostname); + } + + async verify(hostname) { + const update = (state, lastError = null) => Domain.update({ state, lastError, checkedAt: new Date() }, { where: { hostname } }); + try { + if (!await this.pointsHere(hostname)) return await update("pending", `${hostname} does not point at ${this.config.baseDomain} yet`); + if (!this.config.managesTls || !this.certificates.dueFor(hostname)) return await update("active"); + await update("issuing"); + await this.certificates.issueFor(hostname); + await update("active"); + } catch (err) { + await update("error", err.message); + } + } +} + +module.exports = { DomainManager }; diff --git a/server/lib/frames.js b/server/lib/frames.js new file mode 100644 index 0000000..b3c24ca --- /dev/null +++ b/server/lib/frames.js @@ -0,0 +1,21 @@ +const TYPES = { OPEN: 0x01, DATA: 0x02, CLOSE: 0x03, WINDOW_UPDATE: 0x04, DATAGRAM: 0x05, RESET: 0x06 }; +const HEADER_SIZE = 5; +const WINDOW_SIZE = 1024 * 1024; +const CHUNK_SIZE = 64 * 1024; +const MAX_DATAGRAM = 65507; + +const encode = (type, streamId, payload) => { + const body = payload ? (Buffer.isBuffer(payload) ? payload : Buffer.from(payload)) : Buffer.alloc(0); + const frame = Buffer.allocUnsafe(HEADER_SIZE + body.length); + frame[0] = type; + frame.writeUInt32BE(streamId >>> 0, 1); + body.copy(frame, HEADER_SIZE); + return frame; +}; + +const decode = buffer => { + if (!Buffer.isBuffer(buffer) || buffer.length < HEADER_SIZE) return null; + return { type: buffer[0], streamId: buffer.readUInt32BE(1), payload: buffer.subarray(HEADER_SIZE) }; +}; + +module.exports = { TYPES, WINDOW_SIZE, CHUNK_SIZE, MAX_DATAGRAM, encode, decode }; diff --git a/server/lib/har.js b/server/lib/har.js new file mode 100644 index 0000000..b3c5976 --- /dev/null +++ b/server/lib/har.js @@ -0,0 +1,63 @@ +const packageJson = require("../../package.json"); + +const pairs = list => list.map(([name, value]) => ({ name, value })); + +const header = (list, wanted) => list.find(([name]) => name.toLowerCase() === wanted)?.[1] ?? ""; + +const text = body => { + if (!body) return undefined; + const bytes = Buffer.from(body, "base64"); + const decoded = bytes.toString("utf8"); + return Buffer.from(decoded, "utf8").equals(bytes) ? { text: decoded } : { text: body, encoding: "base64" }; +}; + +const message = frame => ({ + type: frame.direction === "in" ? "send" : "receive", + time: frame.time / 1000, + opcode: frame.opcode, + data: frame.payload ? Buffer.from(frame.payload, "base64").toString(frame.opcode === 1 ? "utf8" : "base64") : "", +}); + +const entry = (row, scheme, frames) => { + const url = new URL(row.path, `${scheme}://${row.host}`); + return { + startedDateTime: new Date(row.time).toISOString(), + time: row.duration, + request: { + method: row.kind === "ws" ? "GET" : row.method, + url: url.toString(), + httpVersion: "HTTP/1.1", + cookies: [], + headers: pairs(row.request.headers), + queryString: pairs([...url.searchParams]), + headersSize: -1, + bodySize: row.request.bytes, + ...(row.request.body && { postData: { mimeType: header(row.request.headers, "content-type"), ...text(row.request.body) } }), + }, + response: { + status: row.status ?? 0, + statusText: "", + httpVersion: "HTTP/1.1", + cookies: [], + headers: pairs(row.response.headers), + content: { size: row.response.bytes, mimeType: header(row.response.headers, "content-type"), ...text(row.response.body) }, + redirectURL: header(row.response.headers, "location"), + headersSize: -1, + bodySize: row.response.bytes, + }, + cache: {}, + timings: { send: 0, wait: row.duration, receive: 0 }, + ...(row.ip && { serverIPAddress: row.ip }), + ...(row.kind === "ws" && { _webSocketMessages: (frames.get(row.connection) || []).map(message) }), + }; +}; + +const toHar = (rows, scheme, frames) => ({ + log: { + version: "1.2", + creator: { name: "frislit", version: packageJson.version }, + entries: rows.map(row => entry(row, scheme, frames)), + }, +}); + +module.exports = { toHar }; diff --git a/server/lib/intel.js b/server/lib/intel.js new file mode 100644 index 0000000..df04503 --- /dev/null +++ b/server/lib/intel.js @@ -0,0 +1,179 @@ +const fs = require("node:fs/promises"); +const path = require("node:path"); +const zlib = require("node:zlib"); +const { Reader } = require("mmdb-lib"); +const { dataDir } = require("../utils/paths"); +const logger = require("../utils/logger"); + +const DAY = 24 * 60 * 60 * 1000; +const LISTS = { + tor: "https://check.torproject.org/torbulkexitlist", + datacenter: "https://raw.githubusercontent.com/X4BNet/lists_vpn/main/output/datacenter/ipv4.txt", + vpn: "https://raw.githubusercontent.com/X4BNet/lists_vpn/main/output/vpn/ipv4.txt", + blocklist: "https://raw.githubusercontent.com/firehol/blocklist-ipsets/master/firehol_level1.netset", +}; +const DATABASES = { country: "dbip-country-lite", asn: "dbip-asn-lite" }; + +const PRIVATE = [ + ["10.0.0.0", 8], ["172.16.0.0", 12], ["192.168.0.0", 16], ["127.0.0.0", 8], ["169.254.0.0", 16], ["100.64.0.0", 10], ["0.0.0.0", 8], +].map(([base, bits]) => [ipv4(base) >>> 0, bits]); + +function ipv4(text) { + const parts = text.split("."); + if (parts.length !== 4) return null; + let value = 0; + for (const part of parts) { + const octet = Number(part); + if (!Number.isInteger(octet) || octet < 0 || octet > 255) return null; + value = value * 256 + octet; + } + return value; +} + +const normalize = address => { + const text = String(address || "").replace(/%.*$/, "").replace(/^\[|\]$/g, ""); + const mapped = /^::ffff:(\d+\.\d+\.\d+\.\d+)$/i.exec(text); + return mapped ? mapped[1] : text; +}; + +const isPrivate = ip => { + const value = ipv4(ip); + if (value !== null) return PRIVATE.some(([base, bits]) => (value >>> (32 - bits)) === (base >>> (32 - bits))); + return /^(::1$|fc|fd|fe80)/i.test(ip); +}; + +class RangeSet { + constructor(lines) { + this.ranges = []; + for (const line of lines) { + const text = line.trim(); + if (!text || text.startsWith("#")) continue; + const [address, prefix = "32"] = text.split("/"); + const start = ipv4(address); + const bits = Number(prefix); + if (start === null || !Number.isInteger(bits) || bits < 0 || bits > 32) continue; + const size = 2 ** (32 - bits); + const from = Math.floor(start / size) * size; + this.ranges.push([from, from + size - 1]); + } + this.ranges.sort((a, b) => a[0] - b[0]); + } + + has(ip) { + const value = ipv4(ip); + if (value === null) return false; + let low = 0; + let high = this.ranges.length - 1; + while (low <= high) { + const middle = (low + high) >> 1; + const [from, to] = this.ranges[middle]; + if (value < from) high = middle - 1; + else if (value > to) low = middle + 1; + else return true; + } + return false; + } +} + +const months = () => { + const now = new Date(); + const stamp = date => `${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, "0")}`; + return [stamp(now), stamp(new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() - 1, 1)))]; +}; + +class Intel { + constructor() { + this.dir = path.join(dataDir(), "intel"); + this.readers = {}; + this.lists = {}; + this.timer = null; + this.updatedAt = {}; + } + + async load() { + await fs.mkdir(this.dir, { recursive: true }); + for (const name of Object.keys(DATABASES)) await this.loadDatabase(name).catch(() => null); + for (const name of Object.keys(LISTS)) await this.loadList(name).catch(() => null); + } + + async loadDatabase(name) { + const file = path.join(this.dir, `${name}.mmdb`); + this.readers[name] = new Reader(await fs.readFile(file)); + this.updatedAt[name] = (await fs.stat(file)).mtime; + } + + async loadList(name) { + const file = path.join(this.dir, `${name}.txt`); + this.lists[name] = new RangeSet((await fs.readFile(file, "utf8")).split("\n")); + this.updatedAt[name] = (await fs.stat(file)).mtime; + } + + start() { + if (this.timer) return; + const refresh = () => this.refresh().catch(err => logger.warn(`IP intelligence update failed: ${err.message}`)); + this.timer = setInterval(refresh, DAY); + this.timer.unref(); + refresh(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + stale(name, maxAge) { + return !this.updatedAt[name] || Date.now() - this.updatedAt[name].getTime() > maxAge; + } + + async fetch(url) { + const response = await globalThis.fetch(url, { headers: { "user-agent": "frislit" } }); + if (!response.ok) throw new Error(`${url} answered ${response.status}`); + return Buffer.from(await response.arrayBuffer()); + } + + async refresh() { + for (const [name, base] of Object.entries(DATABASES)) { + if (!this.stale(name, 7 * DAY)) continue; + for (const month of months()) { + try { + const body = await this.fetch(`https://download.db-ip.com/free/${base}-${month}.mmdb.gz`); + await fs.writeFile(path.join(this.dir, `${name}.mmdb`), zlib.gunzipSync(body)); + await this.loadDatabase(name); + logger.info(`IP intelligence: ${base} ${month} loaded`); + break; + } catch (err) { + logger.debug(`IP intelligence: ${base} ${month} not available: ${err.message}`); + } + } + } + for (const [name, url] of Object.entries(LISTS)) { + if (!this.stale(name, DAY)) continue; + const body = await this.fetch(url); + await fs.writeFile(path.join(this.dir, `${name}.txt`), body); + await this.loadList(name); + } + } + + lookup(address) { + const ip = normalize(address); + if (isPrivate(ip)) return { ip, private: true }; + const valid = /^[0-9a-f.:]+$/i.test(ip); + const country = valid ? this.readers.country?.get(ip) : null; + const asn = valid ? this.readers.asn?.get(ip) : null; + return { + ip, + private: false, + country: country?.country?.iso_code || null, + continent: country?.continent?.code || null, + eu: !!country?.country?.is_in_european_union, + asn: asn?.autonomous_system_number || null, + org: asn?.autonomous_system_organization || null, + tor: !!this.lists.tor?.has(ip), + vpn: !!this.lists.vpn?.has(ip), + datacenter: !!this.lists.datacenter?.has(ip), + blocklisted: !!this.lists.blocklist?.has(ip), + }; + } +} + +module.exports = { Intel }; diff --git a/server/lib/invites.js b/server/lib/invites.js new file mode 100644 index 0000000..da6e719 --- /dev/null +++ b/server/lib/invites.js @@ -0,0 +1,49 @@ +const Invite = require("../models/Invite"); +const Account = require("../models/Account"); +const { hashToken, randomToken } = require("../utils/ids"); +const logger = require("../utils/logger"); + +const describe = (invite, owner) => ({ + id: invite.id, + label: invite.label, + owner: owner || null, + createdAt: invite.createdAt, + lastUsedAt: invite.lastUsedAt, + uses: invite.uses, +}); + +const linkFor = (publicUrl, token) => `${publicUrl}/@frislit/invite/${token}`; + +const create = async (accountId, label) => { + const name = String(label || "").trim(); + if (!name) return { code: 400, message: "Give the invite a label" }; + const token = randomToken(48); + const invite = await Invite.create({ accountId, label: name, tokenHash: hashToken(token) }); + logger.info(`Invite "${name}" created`, { id: invite.id }); + return { invite: describe(invite), token }; +}; + +const list = async accountId => { + const where = accountId === undefined ? {} : { accountId }; + const invites = await Invite.findAll({ where, order: [["createdAt", "DESC"]] }); + if (accountId !== undefined) return invites.map(invite => describe(invite)); + const names = new Map((await Account.findAll()).map(account => [account.id, account.username])); + return invites.map(invite => describe(invite, names.get(invite.accountId))); +}; + +const revoke = async (id, accountId) => { + const where = accountId === undefined ? { id } : { id, accountId }; + const invite = await Invite.findOne({ where }); + if (!invite) return { code: 404, message: "Invite not found" }; + await Invite.destroy({ where: { id: invite.id } }); + logger.info(`Invite "${invite.label}" revoked`, { id }); + return { message: `${invite.label} revoked` }; +}; + +const verify = token => (typeof token === "string" && token ? Invite.findOne({ where: { tokenHash: hashToken(token) } }) : null); + +const used = async invite => { + await Invite.update({ lastUsedAt: new Date(), uses: invite.uses + 1 }, { where: { id: invite.id } }); +}; + +module.exports = { create, list, revoke, verify, used, linkFor }; diff --git a/server/lib/oidc.js b/server/lib/oidc.js new file mode 100644 index 0000000..63e5a3c --- /dev/null +++ b/server/lib/oidc.js @@ -0,0 +1,160 @@ +const client = require("openid-client"); +const crypto = require("node:crypto"); +const OidcProvider = require("../models/OidcProvider"); +const accounts = require("./accounts"); +const logger = require("../utils/logger"); + +const STATE_TTL = 10 * 60 * 1000; +const states = new Map(); + +const remember = (state, data) => { + const now = Date.now(); + for (const [key, entry] of states) if (now - entry.at > STATE_TTL) states.delete(key); + states.set(state, { at: now, ...data }); +}; + +const take = state => { + const entry = states.get(state); + states.delete(state); + if (!entry || Date.now() - entry.at > STATE_TTL) return null; + return entry; +}; + +const redirectUri = config => `${config.publicUrl}/@frislit/api/auth/oidc/callback`; + +const describe = provider => ({ + id: provider.id, + name: provider.name, + issuer: provider.issuer, + clientId: provider.clientId, + hasSecret: !!provider.clientSecret, + scope: provider.scope, + usernameClaim: provider.usernameClaim, + createAccounts: !!provider.createAccounts, + enabled: !!provider.enabled, +}); + +const list = async () => (await OidcProvider.findAll({ order: [["id", "ASC"]] })).map(describe); + +const enabled = async () => + (await OidcProvider.findAll({ where: { enabled: true }, order: [["id", "ASC"]] })) + .map(provider => ({ id: provider.id, name: provider.name })); + +const LOOPBACK = new Set(["localhost", "127.0.0.1", "[::1]", "::1"]); + +const discover = provider => { + const issuer = new URL(provider.issuer); + const options = issuer.protocol === "http:" && LOOPBACK.has(issuer.hostname) + ? { execute: [client.allowInsecureRequests] } + : undefined; + return client.discovery(issuer, provider.clientId, provider.clientSecret || undefined, undefined, options); +}; + +const save = async (id, values) => { + if (values.issuer !== undefined) { + let issuer; + try { + issuer = new URL(values.issuer); + } catch { + return { code: 400, message: "The issuer must be a URL" }; + } + if (issuer.protocol === "http:" && !LOOPBACK.has(issuer.hostname)) { + return { code: 400, message: "The issuer must be https, except on localhost" }; + } + } + if (id) { + const provider = await OidcProvider.findByPk(id); + if (!provider) return { code: 404, message: "That provider does not exist" }; + await OidcProvider.update(values, { where: { id } }); + return { provider: describe(await OidcProvider.findByPk(id)) }; + } + for (const key of ["name", "issuer", "clientId"]) { + if (!String(values[key] || "").trim()) return { code: 400, message: `${key} is required` }; + } + const created = await OidcProvider.create(values); + return { provider: describe(created) }; +}; + +const remove = async id => { + const provider = await OidcProvider.findByPk(id); + if (!provider) return { code: 404, message: "That provider does not exist" }; + await OidcProvider.destroy({ where: { id } }); + return { message: `${provider.name} removed` }; +}; + +const begin = async (id, config, next) => { + const provider = await OidcProvider.findOne({ where: { id, enabled: true } }); + if (!provider) return { code: 404, message: "That provider is not available" }; + + try { + const configuration = await discover(provider); + const state = client.randomState(); + const nonce = client.randomNonce(); + const codeVerifier = client.randomPKCECodeVerifier(); + const codeChallenge = await client.calculatePKCECodeChallenge(codeVerifier); + + remember(state, { nonce, codeVerifier, providerId: provider.id, next }); + + const url = client.buildAuthorizationUrl(configuration, { + redirect_uri: redirectUri(config), + scope: provider.scope, + state, nonce, + code_challenge: codeChallenge, + code_challenge_method: "S256", + }); + return { url: url.href }; + } catch (err) { + logger.error(`Could not reach the OIDC provider ${provider.name}: ${err.message}`); + return { code: 502, message: `Could not reach ${provider.name}: ${err.message}` }; + } +}; + +const complete = async (query, config) => { + const entry = take(query.state); + if (!entry) return { code: 400, message: "That sign-in has expired, start again" }; + + const provider = await OidcProvider.findByPk(entry.providerId); + if (!provider) return { code: 404, message: "That provider is gone" }; + + try { + const configuration = await discover(provider); + const url = new URL(`${redirectUri(config)}?${new URLSearchParams(query).toString()}`); + const tokens = await client.authorizationCodeGrant(configuration, url, { + expectedState: query.state, + expectedNonce: entry.nonce, + pkceCodeVerifier: entry.codeVerifier, + }); + + let claims = tokens.claims(); + try { + claims = await client.fetchUserInfo(configuration, tokens.access_token, claims.sub); + } catch (err) { + logger.debug(`userinfo not available, using the id token: ${err.message}`); + } + + const raw = claims[provider.usernameClaim] || claims.preferred_username || claims.email || claims.sub; + const username = String(raw || "").split("@")[0].replace(/[^a-zA-Z0-9._-]/g, "").slice(0, 32); + if (username.length < 3) return { code: 400, message: `"${raw}" is not a usable username` }; + + let account = await accounts.byUsername(username); + if (!account) { + if (!provider.createAccounts) return { code: 403, message: `${username} has no account here` }; + const created = await accounts.create({ + username, + password: crypto.randomBytes(24).toString("base64url"), + role: "user", + }); + if (created.code) return created; + account = await accounts.byUsername(username); + logger.info(`Created ${username} from ${provider.name}`); + } + + logger.info(`${account.username} signed in through ${provider.name}`); + return { account, next: entry.next }; + } catch (err) { + logger.error(`OIDC sign-in failed: ${err.message}`); + return { code: 502, message: err.message }; + } +}; + +module.exports = { list, enabled, save, remove, begin, complete, describe, redirectUri }; diff --git a/server/lib/passkeys.js b/server/lib/passkeys.js new file mode 100644 index 0000000..ad44bac --- /dev/null +++ b/server/lib/passkeys.js @@ -0,0 +1,166 @@ +const { + generateRegistrationOptions, verifyRegistrationResponse, + generateAuthenticationOptions, verifyAuthenticationResponse, +} = require("@simplewebauthn/server"); +const Passkey = require("../models/Passkey"); +const Account = require("../models/Account"); +const logger = require("../utils/logger"); + +const RP_NAME = "frislit"; +const CHALLENGE_TTL = 5 * 60 * 1000; + +const challenges = new Map(); + +const remember = (challenge, data) => { + const now = Date.now(); + for (const [key, entry] of challenges) if (now - entry.at > CHALLENGE_TTL) challenges.delete(key); + challenges.set(challenge, { at: now, ...data }); +}; + +const take = challenge => { + const entry = challenges.get(challenge); + challenges.delete(challenge); + if (!entry || Date.now() - entry.at > CHALLENGE_TTL) return null; + return entry; +}; + +const challengeOf = response => + JSON.parse(Buffer.from(response.response.clientDataJSON, "base64url").toString()).challenge; + +const transportsOf = passkey => (passkey.transports ? JSON.parse(passkey.transports) : undefined); + +const describe = passkey => ({ + id: passkey.id, + name: passkey.name, + createdAt: passkey.createdAt, + lastUsedAt: passkey.lastUsedAt, +}); + +const relyingParty = origin => ({ origin, rpID: new URL(origin).hostname }); + +const startRegistration = async (account, origin) => { + const { rpID } = relyingParty(origin); + const existing = await Passkey.findAll({ where: { accountId: account.id } }); + + const options = await generateRegistrationOptions({ + rpName: RP_NAME, + rpID, + userID: Buffer.from(String(account.id)), + userName: account.username, + userDisplayName: account.username, + attestationType: "none", + excludeCredentials: existing.map(passkey => ({ + id: passkey.credentialId, type: "public-key", transports: transportsOf(passkey), + })), + authenticatorSelection: { residentKey: "preferred", userVerification: "preferred" }, + }); + + remember(options.challenge, { kind: "registration", accountId: account.id }); + return options; +}; + +const finishRegistration = async (account, response, name, origin) => { + const entry = take(challengeOf(response)); + if (!entry || entry.kind !== "registration" || entry.accountId !== account.id) { + return { code: 400, message: "That registration has expired, start again" }; + } + + try { + const { origin: expectedOrigin, rpID } = relyingParty(origin); + const verification = await verifyRegistrationResponse({ + response, + expectedChallenge: challengeOf(response), + expectedOrigin, + expectedRPID: rpID, + }); + if (!verification.verified || !verification.registrationInfo) { + return { code: 400, message: "The passkey could not be verified" }; + } + + const { credential, credentialDeviceType, credentialBackedUp } = verification.registrationInfo; + await Passkey.create({ + accountId: account.id, + name: String(name || "").trim().slice(0, 40) || "Passkey", + credentialId: credential.id, + publicKey: Buffer.from(credential.publicKey).toString("base64url"), + counter: credential.counter, + deviceType: credentialDeviceType, + backedUp: credentialBackedUp, + transports: response.response.transports ? JSON.stringify(response.response.transports) : null, + }); + + logger.info(`${account.username} added a passkey`); + return { message: "Passkey added" }; + } catch (err) { + logger.warn(`Passkey registration failed: ${err.message}`); + return { code: 400, message: err.message }; + } +}; + +const startAuthentication = async (username, origin) => { + const { rpID } = relyingParty(origin); + let allowCredentials; + + if (username) { + const account = await Account.findOne({ where: { username: String(username) } }); + const passkeys = account ? await Passkey.findAll({ where: { accountId: account.id } }) : []; + if (passkeys.length) { + allowCredentials = passkeys.map(passkey => ({ + id: passkey.credentialId, type: "public-key", transports: transportsOf(passkey), + })); + } + } + + const options = await generateAuthenticationOptions({ rpID, allowCredentials, userVerification: "preferred" }); + remember(options.challenge, { kind: "authentication" }); + return options; +}; + +const finishAuthentication = async (response, origin) => { + const entry = take(challengeOf(response)); + if (!entry || entry.kind !== "authentication") return { code: 400, message: "That sign-in has expired, try again" }; + + const passkey = await Passkey.findOne({ where: { credentialId: response.id } }); + if (!passkey) return { code: 401, message: "This passkey is not registered here" }; + + const account = await Account.findByPk(passkey.accountId); + if (!account) return { code: 401, message: "The account behind this passkey is gone" }; + + try { + const { origin: expectedOrigin, rpID } = relyingParty(origin); + const verification = await verifyAuthenticationResponse({ + response, + expectedChallenge: challengeOf(response), + expectedOrigin, + expectedRPID: rpID, + credential: { + id: passkey.credentialId, + publicKey: new Uint8Array(Buffer.from(passkey.publicKey, "base64url")), + counter: passkey.counter, + transports: transportsOf(passkey), + }, + }); + if (!verification.verified) return { code: 401, message: "The passkey could not be verified" }; + + await Passkey.update( + { counter: verification.authenticationInfo.newCounter, lastUsedAt: new Date() }, + { where: { id: passkey.id } }, + ); + return { account }; + } catch (err) { + logger.warn(`Passkey sign-in failed: ${err.message}`); + return { code: 401, message: err.message }; + } +}; + +const list = async accountId => + (await Passkey.findAll({ where: { accountId }, order: [["createdAt", "DESC"]] })).map(describe); + +const remove = async (accountId, id) => { + const passkey = await Passkey.findOne({ where: { id, accountId } }); + if (!passkey) return { code: 404, message: "Passkey not found" }; + await Passkey.destroy({ where: { id: passkey.id } }); + return { message: `${passkey.name} removed` }; +}; + +module.exports = { startRegistration, finishRegistration, startAuthentication, finishAuthentication, list, remove }; diff --git a/server/lib/persistent.js b/server/lib/persistent.js new file mode 100644 index 0000000..c0b9491 --- /dev/null +++ b/server/lib/persistent.js @@ -0,0 +1,47 @@ +const TunnelModel = require("../models/Tunnel"); +const Account = require("../models/Account"); +const { emptyPolicy } = require("./access"); + +const toPolicy = row => ({ ...emptyPolicy(), ...JSON.parse(row.rules), auth: row.auth, passwordHash: row.passwordHash || null }); + +const columns = policy => ({ + rules: JSON.stringify({ allow: policy.allow, block: policy.block, accounts: policy.accounts || [] }), + auth: policy.auth, + passwordHash: policy.passwordHash || null, +}); + +const toDefinition = row => ({ + name: row.name, + accountId: row.accountId, + mode: row.mode || null, + policy: toPolicy(row), + createdAt: row.createdAt, +}); + +const load = async name => { + const row = await TunnelModel.findOne({ where: { name } }); + return row ? toDefinition(row) : null; +}; + +const list = async accountId => { + const rows = await TunnelModel.findAll({ where: accountId ? { accountId } : {}, order: [["name", "ASC"]] }); + const accounts = await Account.findAll({ where: { id: [...new Set(rows.map(row => row.accountId))] }, attributes: ["id", "username"] }); + const names = new Map(accounts.map(account => [account.id, account.username])); + return rows.map(row => ({ ...toDefinition(row), owner: names.get(row.accountId) || null })); +}; + +const create = async (name, accountId, policy = emptyPolicy()) => { + if (await TunnelModel.findOne({ where: { name } })) { + throw Object.assign(new Error(`"${name}" is already a persistent tunnel`), { code: "name_taken" }); + } + await TunnelModel.create({ name, accountId, ...columns(policy) }); + return load(name); +}; + +const savePolicy = (name, policy) => TunnelModel.update(columns(policy), { where: { name } }); + +const saveMode = (name, mode) => TunnelModel.update({ mode }, { where: { name } }); + +const remove = name => TunnelModel.destroy({ where: { name } }); + +module.exports = { load, list, create, savePolicy, saveMode, remove }; diff --git a/server/lib/proxy-front.js b/server/lib/proxy-front.js new file mode 100644 index 0000000..c81c9eb --- /dev/null +++ b/server/lib/proxy-front.js @@ -0,0 +1,31 @@ +const net = require("node:net"); +const tls = require("node:tls"); +const proxyProtocol = require("./proxy-protocol"); + +const proxyFront = (secureOptions, onConnection) => net.createServer(socket => { + let buffer = Buffer.alloc(0); + + const hand = (rest, ip) => { + if (rest.length) socket.unshift(rest); + const tunnel = new tls.TLSSocket(socket, { isServer: true, SNICallback: secureOptions.SNICallback }); + if (ip) tunnel.frislitIp = ip; + onConnection(tunnel); + }; + + const read = () => { + let chunk; + while ((chunk = socket.read()) !== null) buffer = Buffer.concat([buffer, chunk]); + if (!proxyProtocol.isPrefix(buffer)) return hand(buffer, null); + const parsed = proxyProtocol.parse(buffer); + if (!parsed) { + if (buffer.length > 4096) return socket.destroy(); + return socket.once("readable", read); + } + hand(buffer.subarray(parsed.length), parsed.ip); + }; + + socket.pause(); + socket.once("readable", read); +}); + +module.exports = { proxyFront }; diff --git a/server/lib/proxy-front.test.js b/server/lib/proxy-front.test.js new file mode 100644 index 0000000..51a9634 --- /dev/null +++ b/server/lib/proxy-front.test.js @@ -0,0 +1,48 @@ +const test = require("node:test"); +const assert = require("node:assert"); +const net = require("node:net"); +const { SIGNATURE } = require("./proxy-protocol"); +const { proxyFront } = require("./proxy-front"); + +const header = ip => { + const address = Buffer.from(ip.split(".").map(Number)); + const body = Buffer.concat([address, address, Buffer.alloc(4)]); + const buffer = Buffer.alloc(16 + body.length); + SIGNATURE.copy(buffer, 0); + buffer[12] = 0x21; + buffer[13] = 0x11; + buffer.writeUInt16BE(body.length, 14); + body.copy(buffer, 16); + return buffer; +}; + +const withFront = async (payload, assertOnTunnel) => new Promise((resolve, reject) => { + const front = proxyFront({}, tunnel => { + try { + assertOnTunnel(tunnel); + tunnel.destroy(); + front.close(() => resolve()); + } catch (error) { + front.close(() => reject(error)); + } + }); + + front.listen(0, "127.0.0.1", () => { + const socket = net.connect(front.address().port, "127.0.0.1"); + socket.on("connect", () => socket.write(payload)); + socket.on("error", () => {}); + }); + setTimeout(() => reject(new Error("the front did not hand over a connection")), 3000).unref(); +}); + +test("hands the source address of a proxied connection to the TLS socket", async () => { + await withFront(header("203.0.113.7"), tunnel => { + assert.strictEqual(tunnel.frislitIp, "203.0.113.7"); + }); +}); + +test("passes a direct connection through untouched", async () => { + await withFront(Buffer.from([0x16, 0x03, 0x01, 0x00, 0x2a]), tunnel => { + assert.strictEqual(tunnel.frislitIp, undefined); + }); +}); diff --git a/server/lib/proxy-protocol.js b/server/lib/proxy-protocol.js new file mode 100644 index 0000000..18ebe77 --- /dev/null +++ b/server/lib/proxy-protocol.js @@ -0,0 +1,30 @@ +const SIGNATURE = Buffer.from([0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a, 0x51, 0x55, 0x49, 0x54, 0x0a]); + +const isPrefix = buffer => buffer.length < SIGNATURE.length + ? SIGNATURE.subarray(0, buffer.length).equals(buffer) + : buffer.subarray(0, SIGNATURE.length).equals(SIGNATURE); + +const ipv6 = buffer => { + const parts = []; + for (let i = 0; i < 8; i++) parts.push(buffer.readUInt16BE(i * 2).toString(16)); + return parts.join(":"); +}; + +const parse = buffer => { + if (buffer.length < 16) return null; + if ((buffer[12] >> 4) !== 2) return null; + + const length = buffer.readUInt16BE(14); + if (buffer.length < 16 + length) return null; + + const command = buffer[12] & 0x0f; + const family = buffer[13] >> 4; + const total = 16 + length; + + if (command !== 1) return { ip: null, length: total }; + if (family === 1) return { ip: `${buffer[16]}.${buffer[17]}.${buffer[18]}.${buffer[19]}`, length: total }; + if (family === 2) return { ip: ipv6(buffer.subarray(16, 32)), length: total }; + return { ip: null, length: total }; +}; + +module.exports = { SIGNATURE, isPrefix, parse }; diff --git a/server/lib/proxy-protocol.test.js b/server/lib/proxy-protocol.test.js new file mode 100644 index 0000000..a346299 --- /dev/null +++ b/server/lib/proxy-protocol.test.js @@ -0,0 +1,43 @@ +const test = require("node:test"); +const assert = require("node:assert"); +const { SIGNATURE, isPrefix, parse } = require("./proxy-protocol"); + +const header = (family, source, destination, command = 0x21) => { + const body = Buffer.concat([source, destination, Buffer.alloc(4)]); + const buffer = Buffer.alloc(16 + body.length); + SIGNATURE.copy(buffer, 0); + buffer[12] = command; + buffer[13] = family; + buffer.writeUInt16BE(body.length, 14); + body.copy(buffer, 16); + return buffer; +}; + +test("parses an IPv4 source address", () => { + const parsed = parse(header(0x11, Buffer.from([203, 0, 113, 7]), Buffer.from([10, 0, 0, 1]))); + assert.strictEqual(parsed.ip, "203.0.113.7"); + assert.strictEqual(parsed.length, 16 + 12); +}); + +test("parses an IPv6 source address", () => { + const source = Buffer.from([0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); + const parsed = parse(header(0x21, source, Buffer.alloc(16))); + assert.strictEqual(parsed.ip, "2001:db8:0:0:0:0:0:1"); +}); + +test("returns null until the header is complete", () => { + const buffer = header(0x11, Buffer.from([1, 2, 3, 4]), Buffer.from([5, 6, 7, 8])); + assert.strictEqual(parse(buffer.subarray(0, 10)), null); + assert.strictEqual(parse(buffer.subarray(0, 20)), null); +}); + +test("has no address for a LOCAL command", () => { + const parsed = parse(header(0x00, Buffer.alloc(0), Buffer.alloc(0), 0x20)); + assert.strictEqual(parsed.ip, null); +}); + +test("tells the signature apart from a TLS handshake", () => { + assert.strictEqual(isPrefix(SIGNATURE.subarray(0, 5)), true); + assert.strictEqual(isPrefix(SIGNATURE), true); + assert.strictEqual(isPrefix(Buffer.from([0x16, 0x03, 0x01, 0x00])), false); +}); diff --git a/server/lib/proxy.js b/server/lib/proxy.js new file mode 100644 index 0000000..58b46a5 --- /dev/null +++ b/server/lib/proxy.js @@ -0,0 +1,466 @@ +const http = require("node:http"); +const zlib = require("node:zlib"); +const { Transform } = require("node:stream"); +const { randomToken } = require("../utils/ids"); +const { FrameParser, encodeFrame } = require("./websocket"); +const { sendAppState } = require("../utils/pages"); +const { Tap, headerList } = require("./capture"); +const logger = require("../utils/logger"); + +const REPLAY_IP = "replay"; +const HOP_BY_HOP = new Set(["connection", "keep-alive", "proxy-authenticate", "proxy-authorization", "proxy-connection", "te", "trailer", "transfer-encoding", "upgrade"]); +const QUERY_PARAM = "frislit-tunnel"; +const LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "[::1]", "::1", "0.0.0.0"]); + +const requestInfo = (req, config) => { + const trust = config.trustProxy; + const forwardedHost = trust && req.headers["x-forwarded-host"] ? String(req.headers["x-forwarded-host"]).split(",")[0].trim() : null; + const hostHeader = forwardedHost || req.headers.host || ""; + const hostname = hostHeader.replace(/:\d+$/, "").toLowerCase(); + const forwardedProto = trust && req.headers["x-forwarded-proto"] ? String(req.headers["x-forwarded-proto"]).split(",")[0].trim().toLowerCase() : null; + const proto = forwardedProto || (req.socket.encrypted ? "https" : "http"); + const forwardedFor = trust && req.headers["x-forwarded-for"] ? String(req.headers["x-forwarded-for"]).split(",")[0].trim() : null; + const clientIp = req.socket?.frislitIp || forwardedFor || req.socket.remoteAddress || ""; + return { host: hostHeader, hostname, proto, secure: proto === "https", clientIp }; +}; + +const classifyHost = (hostname, baseDomain) => { + if (hostname === baseDomain) return { kind: "base" }; + if (hostname.endsWith(`.${baseDomain}`)) { + const label = hostname.slice(0, -(baseDomain.length + 1)); + if (label && !label.includes(".")) return { kind: "subdomain", id: label }; + } + return { kind: "unknown" }; +}; + +const stripQueryParam = url => { + const idx = url.indexOf("?"); + if (idx === -1) return url; + const path = url.slice(0, idx); + const params = new URLSearchParams(url.slice(idx + 1)); + if (!params.has(QUERY_PARAM)) return url; + params.delete(QUERY_PARAM); + const rest = params.toString(); + return rest ? `${path}?${rest}` : path; +}; + +const hostHeader = target => (target.port === 80 || target.port === 443 ? target.host : target.authority); + +const buildUpstreamHeaders = (req, info, tunnel, { pathMode }) => { + const headers = {}; + for (const [name, value] of Object.entries(req.headers)) { + if (HOP_BY_HOP.has(name) || name === "host") continue; + headers[name] = value; + } + headers.host = tunnel.keepHost ? info.host : hostHeader(tunnel.target); + headers["x-forwarded-host"] = info.host; + headers["x-forwarded-proto"] = info.proto; + headers["x-forwarded-for"] = req.headers["x-forwarded-for"] && !headers["x-forwarded-for"] ? req.headers["x-forwarded-for"] : (info.clientIp || ""); + if (headers["x-forwarded-for"] === "") delete headers["x-forwarded-for"]; + return headers; +}; + +const appendCookie = (headers, cookie) => { + const name = Object.keys(headers).find(key => key.toLowerCase() === "set-cookie") || "set-cookie"; + const existing = headers[name]; + headers[name] = existing ? [...(Array.isArray(existing) ? existing : [existing]), cookie] : [cookie]; +}; + +const sameAuthority = (a, b) => { + if (a === b) return true; + const pa = a.match(/^(.*):(\d+)$/), pb = b.match(/^(.*):(\d+)$/); + if (!pa || !pb || pa[2] !== pb[2]) return false; + return LOCAL_HOSTS.has(pa[1].toLowerCase()) && LOCAL_HOSTS.has(pb[1].toLowerCase()); +}; + +const authorityOf = url => (url.port ? url.host : `${url.hostname}:${url.protocol === "https:" ? 443 : 80}`); + +const rewriteLocation = (location, tunnel, info, { pathMode }) => { + let url; + try { + url = new URL(location, `http://${tunnel.target.authority}/`); + } catch { + return location; + } + if (!/^https?:$/.test(url.protocol)) return location; + if (!sameAuthority(authorityOf(url), tunnel.target.authority)) return location; + const rest = `${url.pathname}${url.search}${url.hash}`; + return pathMode ? rest : `${info.proto}://${info.host}${rest}`; +}; + +const rewriteSetCookie = value => { + const parts = String(value).split(";").map(p => p.trim()).filter(Boolean); + if (!parts.length) return value; + const out = [parts[0]]; + for (const attr of parts.slice(1)) { + const [name, ...rest] = attr.split("="); + const key = name.trim().toLowerCase(); + if (key === "domain") continue; + if (key === "expires") { + const date = Date.parse(rest.join("=")); + if (!Number.isNaN(date) && date >= Date.now()) continue; + } + out.push(attr); + } + return out.join("; "); +}; + +const buildDownstreamHeaders = (upstream, tunnel, info, { pathMode }) => { + const headers = {}; + for (let i = 0; i < upstream.rawHeaders.length; i += 2) { + const name = upstream.rawHeaders[i]; + const key = name.toLowerCase(); + let value = upstream.rawHeaders[i + 1]; + if (HOP_BY_HOP.has(key)) continue; + if (key === "location") value = rewriteLocation(value, tunnel, info, { pathMode }); + if (key === "set-cookie" && pathMode) value = rewriteSetCookie(value); + if (headers[name] === undefined) headers[name] = value; + else if (Array.isArray(headers[name])) headers[name].push(value); + else headers[name] = [headers[name], value]; + } + return headers; +}; + +class InjectTransform extends Transform { + constructor(snippet) { + super(); + this.snippet = Buffer.from(snippet); + this.carry = Buffer.alloc(0); + this.done = false; + } + + _transform(chunk, _enc, cb) { + if (this.done) return cb(null, chunk); + const buf = this.carry.length ? Buffer.concat([this.carry, chunk]) : chunk; + const lower = buf.toString("latin1").toLowerCase(); + const idx = lower.indexOf(""); + if (idx !== -1) { + this.done = true; + this.carry = Buffer.alloc(0); + return cb(null, Buffer.concat([buf.subarray(0, idx), this.snippet, buf.subarray(idx)])); + } + const keep = Math.min(6, buf.length); + this.carry = Buffer.from(buf.subarray(buf.length - keep)); + cb(null, buf.subarray(0, buf.length - keep)); + } + + _flush(cb) { + if (this.done) return cb(null, this.carry); + cb(null, Buffer.concat([this.carry, this.snippet])); + } +} + +const decoderFor = encoding => { + switch ((encoding || "").trim().toLowerCase()) { + case "gzip": case "x-gzip": return zlib.createGunzip(); + case "deflate": return zlib.createInflate(); + case "br": return zlib.createBrotliDecompress(); + case "zstd": return typeof zlib.createZstdDecompress === "function" ? zlib.createZstdDecompress() : null; + case "": case "identity": return "identity"; + default: return null; + } +}; + +const HOLD_LIMIT = 8 * 1024 * 1024; + +const collect = (source, limit) => new Promise((resolve, reject) => { + const chunks = []; + let total = 0; + const onData = chunk => { + chunks.push(chunk); + total += chunk.length; + if (total > limit) { + source.off("data", onData).off("end", onEnd).pause(); + resolve({ overflow: chunks }); + } + }; + const onEnd = () => resolve({ body: Buffer.concat(chunks) }); + source.on("data", onData).once("end", onEnd).once("error", reject); +}); + +const decodeBody = (body, encoding) => { + try { + switch ((encoding || "").trim().toLowerCase()) { + case "gzip": case "x-gzip": return zlib.gunzipSync(body); + case "deflate": return zlib.inflateSync(body); + case "br": return zlib.brotliDecompressSync(body); + case "zstd": return zlib.zstdDecompressSync(body); + case "": case "identity": return body; + default: return null; + } + } catch { + return null; + } +}; + +const injectInto = (body, snippet) => { + const index = body.toString("latin1").toLowerCase().indexOf(""); + const marker = Buffer.from(snippet); + return index === -1 ? Buffer.concat([body, marker]) : Buffer.concat([body.subarray(0, index), marker, body.subarray(index)]); +}; + +const captureOf = body => ({ body: body.length ? body : null, bytes: body.length, truncated: false }); + +const headersFromPairs = pairs => { + const headers = {}; + for (const [name, value] of pairs) { + const key = name.toLowerCase(); + headers[key] = headers[key] === undefined ? value : [].concat(headers[key], value); + } + return headers; +}; + +const observe = (shape, info, onRequest) => { + let done = false; + return (status, captured) => { + if (done) return; + done = true; + onRequest({ + time: shape.time, + duration: Date.now() - shape.time, + kind: "http", + method: shape.method, + path: shape.path, + status, + ip: info.clientIp, + host: info.host, + request: { headers: shape.headers, ...captured.request }, + response: captured.response, + }); + }; +}; + +const proxyRequest = async (req, res, tunnel, info, { pathMode, inject: snippet, onRequest, setCookie, breakpoints }) => { + const shape = { time: Date.now(), method: req.method, path: stripQueryParam(req.url), headers: headerList(req.headers) }; + let incoming = req.headers; + let body = null; + + if (breakpoints.matches(tunnel.id, shape.method, shape.path, "request")) { + const collected = await collect(req, HOLD_LIMIT).catch(() => null); + if (!collected) return res.destroy(); + if (collected.overflow) return res.writeHead(413, { "Content-Type": "text/plain" }).end("Request too large to hold"); + body = collected.body; + const hold = breakpoints.hold(tunnel.id, { ...shape, phase: "request", ip: info.clientIp, host: info.host, request: { headers: shape.headers, ...captureOf(body) } }); + res.on("close", () => breakpoints.settle(hold.id, { action: "cancel" })); + const decision = await hold.decision; + if (decision.action === "cancel") return; + if (decision.action === "drop") { + observe(shape, info, onRequest)(503, { request: captureOf(body), response: {} }); + res.writeHead(503, { "Content-Type": "text/plain" }).end("Dropped at a breakpoint"); + return; + } + shape.method = decision.method; + shape.path = decision.path; + shape.headers = decision.headers; + incoming = headersFromPairs(decision.headers); + body = decision.body; + } + + const stream = tunnel.session.open({ protocol: "tcp", remote: info.clientIp }); + const headers = buildUpstreamHeaders({ headers: incoming }, info, tunnel, { pathMode }); + const wantsHtml = pathMode && (/text\/html/i.test(incoming.accept || "") || incoming["sec-fetch-dest"] === "document"); + if (wantsHtml) delete headers["accept-encoding"]; + if (body) { + if (body.length) headers["content-length"] = body.length; else delete headers["content-length"]; + } + + const upstream = http.request({ + createConnection: () => stream, + method: shape.method, + path: shape.path, + headers, + setHost: false, + }); + + const finish = observe(shape, info, onRequest); + const requestTap = body ? null : new Tap(); + let responseTap = null; + const captured = () => ({ + request: requestTap ? requestTap.result() : captureOf(body), + response: responseTap ? responseTap.result() : {}, + }); + let responded = false; + const fail = (status, message) => { + if (responded || res.headersSent) return res.destroy(); + responded = true; + logger.debug(`proxy ${tunnel.id}: ${message}`); + finish(status, captured()); + + if (status === 502) sendAppState(req, res, 502, { kind: "offline", id: tunnel.id }); + else res.writeHead(status, { "Content-Type": "text/plain" }).end(message); + }; + + upstream.on("error", err => fail(502, `upstream error: ${err.message}`)); + stream.on("error", () => {}); + req.on("error", () => upstream.destroy()); + res.on("close", () => { if (!res.writableFinished) upstream.destroy(); }); + + const isHtml = headers => /^text\/html/i.test(String(headers["content-type"] || "")); + + upstream.on("response", async upstreamRes => { + responded = true; + responseTap = new Tap(); + const outcome = { status: upstreamRes.statusCode, headers: headerList(upstreamRes.headers), body: null }; + res.on("close", () => finish(outcome.status, { + ...captured(), + response: { ...(outcome.body ? captureOf(outcome.body) : responseTap.result()), headers: outcome.headers }, + })); + let outHeaders = buildDownstreamHeaders(upstreamRes, tunnel, info, { pathMode }); + let out = upstreamRes; + + if (breakpoints.matches(tunnel.id, shape.method, shape.path, "response")) { + const collected = await collect(upstreamRes, HOLD_LIMIT).catch(() => null); + if (!collected) return res.destroy(); + if (collected.body) { + const decoded = decodeBody(collected.body, upstreamRes.headers["content-encoding"]); + const dropped = new Set([...HOP_BY_HOP, ...(decoded ? ["content-encoding", "content-length"] : [])]); + const heldHeaders = outcome.headers.filter(([name]) => !dropped.has(name.toLowerCase())); + const hold = breakpoints.hold(tunnel.id, { + ...shape, phase: "response", ip: info.clientIp, host: info.host, + request: { headers: shape.headers, ...captured().request }, + response: { status: upstreamRes.statusCode, headers: heldHeaders, ...captureOf(decoded || collected.body) }, + }); + res.on("close", () => breakpoints.settle(hold.id, { action: "cancel" })); + const decision = await hold.decision; + if (decision.action === "cancel") return; + if (decision.action === "drop") { + outcome.status = 503; + outcome.headers = []; + outcome.body = Buffer.alloc(0); + return res.writeHead(503, { "Content-Type": "text/plain" }).end("Dropped at a breakpoint"); + } + const replyHeaders = headersFromPairs(decision.headers); + outHeaders = buildDownstreamHeaders({ rawHeaders: decision.headers.flat() }, tunnel, info, { pathMode }); + const reply = snippet && decision.status === 200 && isHtml(replyHeaders) ? injectInto(decision.body, snippet) : decision.body; + for (const name of Object.keys(outHeaders)) if (name.toLowerCase() === "content-length") delete outHeaders[name]; + outHeaders["content-length"] = reply.length; + if (setCookie) appendCookie(outHeaders, setCookie); + outcome.status = decision.status; + outcome.headers = decision.headers; + outcome.body = reply; + return res.writeHead(decision.status, outHeaders).end(reply); + } + res.writeHead(upstreamRes.statusCode, upstreamRes.statusMessage, outHeaders); + responseTap.pipe(res); + for (const chunk of collected.overflow) responseTap.write(chunk); + upstreamRes.pipe(responseTap); + upstreamRes.on("error", () => res.destroy()); + return; + } + + const inject = !!snippet && upstreamRes.statusCode === 200 && isHtml(upstreamRes.headers); + + if (inject) { + const decoder = decoderFor(upstreamRes.headers["content-encoding"]); + if (decoder) { + for (const name of Object.keys(outHeaders)) { + const key = name.toLowerCase(); + if (key === "content-length" || key === "content-encoding") delete outHeaders[name]; + } + if (decoder !== "identity") { + decoder.on("error", () => res.destroy()); + out = upstreamRes.pipe(decoder); + } + out = out.pipe(new InjectTransform(snippet)); + } + } + if (setCookie) appendCookie(outHeaders, setCookie); + res.writeHead(upstreamRes.statusCode, upstreamRes.statusMessage, outHeaders); + out = out.pipe(responseTap); + out.pipe(res); + upstreamRes.on("error", () => res.destroy()); + }); + + if (requestTap) req.pipe(requestTap).pipe(upstream); + else upstream.end(body); +}; + +const replayRequest = (tunnel, stored, onRequest) => new Promise(resolve => { + const headers = {}; + for (const [name, value] of stored.request.headers) { + const key = name.toLowerCase(); + if (HOP_BY_HOP.has(key) || key === "host" || key === "content-length") continue; + headers[name] = headers[name] === undefined ? value : [].concat(headers[name], value); + } + headers.host = tunnel.keepHost ? stored.host : hostHeader(tunnel.target); + headers["x-forwarded-host"] = stored.host; + const body = stored.request.body ? Buffer.from(stored.request.body, "base64") : null; + if (body) headers["content-length"] = body.length; + + const startedAt = Date.now(); + const stream = tunnel.session.open({ protocol: "tcp", remote: "replay" }); + const upstream = http.request({ createConnection: () => stream, method: stored.method, path: stored.path, headers, setHost: false }); + let settled = false; + const done = (status, response) => { + if (settled) return; + settled = true; + onRequest({ + time: startedAt, + duration: Date.now() - startedAt, + kind: "http", + method: stored.method, + path: stored.path, + status, + ip: REPLAY_IP, + host: stored.host, + request: { headers: headerList(headers), body, bytes: body?.length || 0, truncated: false }, + response, + }); + resolve(status); + }; + + stream.on("error", () => {}); + upstream.on("error", () => done(502, {})); + upstream.on("response", response => { + const tap = new Tap(); + response.on("error", () => done(502, {})); + response.pipe(tap).on("finish", () => done(response.statusCode, { ...tap.result(), headers: headerList(response.headers) })).resume(); + }); + upstream.end(body); +}); + +const tap = parser => new Transform({ + transform(chunk, _encoding, callback) { + parser.push(chunk); + callback(null, chunk); + }, +}); + +const proxyUpgrade = (req, socket, head, tunnel, info, { pathMode, ws }) => { + const stream = tunnel.session.open({ protocol: "tcp", remote: info.clientIp }); + const headers = buildUpstreamHeaders(req, info, tunnel, { pathMode }); + headers.connection = "Upgrade"; + headers.upgrade = req.headers.upgrade; + + let raw = `${req.method} ${stripQueryParam(req.url)} HTTP/1.1\r\n`; + for (const [name, value] of Object.entries(headers)) { + for (const v of [].concat(value)) raw += `${name}: ${v}\r\n`; + } + raw += "\r\n"; + + const connection = randomToken(16); + const startedAt = Date.now(); + const entry = { time: startedAt, kind: "ws", method: req.method, path: stripQueryParam(req.url), status: 101, ip: info.clientIp, host: info.host, connection }; + ws.open({ ...entry, duration: 0, request: { headers: headerList(req.headers) }, response: {} }, { + in: payload => stream.write(encodeFrame(1, payload, true)), + out: payload => socket.write(encodeFrame(1, payload, false)), + }); + socket.on("close", () => ws.close(connection, { ...entry, duration: Date.now() - startedAt })); + const incoming = new FrameParser((opcode, payload) => ws.frame(connection, "in", opcode, payload)); + const outgoing = new FrameParser((opcode, payload) => ws.frame(connection, "out", opcode, payload), { skipHead: true }); + + stream.write(raw); + if (head.length) { + stream.write(head); + incoming.push(head); + } + socket.setNoDelay(true); + socket.pipe(tap(incoming)).pipe(stream).pipe(tap(outgoing)).pipe(socket); + const bail = () => { socket.destroy(); stream.destroy(); }; + stream.on("error", bail); + socket.on("error", bail); + socket.on("close", () => stream.destroy()); + stream.on("close", () => socket.destroy()); +}; + +module.exports = { requestInfo, classifyHost, proxyRequest, proxyUpgrade, replayRequest, QUERY_PARAM, REPLAY_IP }; diff --git a/server/lib/quotas.js b/server/lib/quotas.js new file mode 100644 index 0000000..1d29635 --- /dev/null +++ b/server/lib/quotas.js @@ -0,0 +1,110 @@ +const { EventEmitter } = require("node:events"); +const Account = require("../models/Account"); +const Usage = require("../models/Usage"); +const settings = require("./settings"); +const logger = require("../utils/logger"); + +const KEYS = ["tunnels", "persistent", "domains", "traffic"]; +const LABELS = { tunnels: "tunnels", persistent: "persistent tunnels", domains: "custom domains", traffic: "monthly traffic" }; +const FLUSH_INTERVAL = 30 * 1000; + +const month = () => new Date().toISOString().slice(0, 7); + +const fail = (message, code) => Object.assign(new Error(message), { code }); + +const parseLimits = (input = {}, partial = false) => { + const limits = {}; + for (const key of KEYS) { + const raw = input[key]; + if (raw === undefined || raw === null || raw === "") { + if (!partial) limits[key] = 0; + continue; + } + const value = Number(raw); + if (!Number.isInteger(value) || value < 0) throw fail(`${LABELS[key]} must be a whole number, 0 for no limit`, "bad_request"); + limits[key] = value; + } + return limits; +}; + +const NONE = parseLimits(); + +class Quotas extends EventEmitter { + constructor() { + super(); + this.defaults = NONE; + this.pending = new Map(); + this.timer = null; + } + + async load() { + this.defaults = parseLimits((await settings.read()).quotas); + } + + async saveDefaults(input) { + this.defaults = parseLimits(input); + await settings.write({ quotas: this.defaults }); + return this.defaults; + } + + static parseOverride(input) { + if (input === null) return null; + const limits = parseLimits(input, true); + return Object.keys(limits).length ? limits : null; + } + + async limitsFor(accountId) { + const account = await Account.findByPk(accountId, { attributes: ["role", "quotas"] }); + if (!account || account.role === "admin") return NONE; + return { ...this.defaults, ...(account.quotas ? JSON.parse(account.quotas) : {}) }; + } + + async trafficFor(accountId) { + const row = await Usage.findOne({ where: { accountId, month: month() } }); + return row ? Number(row.bytesIn) + Number(row.bytesOut) : 0; + } + + async enforce(accountId, key, used) { + const limit = (await this.limitsFor(accountId))[key]; + if (limit && used >= limit) throw fail(`Limit of ${limit} ${LABELS[key]} reached`, "quota_exceeded"); + } + + async enforceTraffic(accountId) { + const limit = (await this.limitsFor(accountId)).traffic; + if (limit && await this.trafficFor(accountId) >= limit) throw fail("Monthly traffic limit reached", "quota_exceeded"); + } + + record(accountId, bytesIn, bytesOut, requests) { + if (!(bytesIn || bytesOut || requests)) return; + const entry = this.pending.get(accountId) || { bytesIn: 0, bytesOut: 0, requests: 0 }; + entry.bytesIn += bytesIn; + entry.bytesOut += bytesOut; + entry.requests += requests; + this.pending.set(accountId, entry); + } + + start() { + if (this.timer) return; + this.timer = setInterval(() => this.flush().catch(err => logger.warn(`Could not store usage: ${err.message}`)), FLUSH_INTERVAL); + this.timer.unref(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + async flush() { + const batch = this.pending; + this.pending = new Map(); + const current = month(); + for (const [accountId, delta] of batch) { + const [row] = await Usage.findOrCreate({ where: { accountId, month: current } }); + await Usage.increment(delta, { where: { id: row.id } }); + const limit = (await this.limitsFor(accountId)).traffic; + if (limit && await this.trafficFor(accountId) >= limit) this.emit("exceeded", accountId); + } + } +} + +module.exports = { Quotas }; diff --git a/server/lib/registry.js b/server/lib/registry.js new file mode 100644 index 0000000..27eea9c --- /dev/null +++ b/server/lib/registry.js @@ -0,0 +1,260 @@ +const { EventEmitter } = require("node:events"); +const crypto = require("node:crypto"); +const ids = require("../utils/ids"); +const { emptyPolicy, buildPolicy, evaluate } = require("./access"); +const persistent = require("./persistent"); +const { safeEqual } = require("../utils/auth"); +const logger = require("../utils/logger"); + +const endSession = (session, reason, code = 4003) => { + if (!session || session.closed) return; + session.sendControl({ type: "bye", reason }); + session.close(code, reason); +}; + +class Tunnel { + constructor({ id, mode, target, keepHost, accountId, owner, guest }) { + this.id = id; + this.accountId = accountId || null; + this.owner = owner || null; + this.guest = guest || null; + this.mode = mode; + this.target = target; + this.keepHost = !!keepHost; + this.session = null; + this.resumeToken = ids.randomToken(32); + this.secret = mode === "tcp" ? ids.randomSecret() : null; + this.secretHash = this.secret ? ids.hashSecret(this.secret) : null; + this.joiners = new Set(); + this.graceTimer = null; + this.graceUntil = null; + this.createdAt = Date.now(); + this.policy = emptyPolicy(); + this.persistent = false; + } + + get online() { + return !!this.session && !this.session.closed; + } + + get shareCode() { + return this.secret ? `${this.id}${this.secret}` : null; + } +} + +const parseTarget = raw => { + if (typeof raw !== "string") return null; + let value = raw.trim(); + if (/^\d+$/.test(value)) value = `127.0.0.1:${value}`; + const match = /^(\[[^\]]+\]|[^:]+):(\d{1,5})$/.exec(value); + if (!match) return null; + const port = Number(match[2]); + if (port < 1 || port > 65535) return null; + const host = match[1]; + return { host, port, authority: `${host}:${port}` }; +}; + +class Registry extends EventEmitter { + constructor(config, domains, quotas, intel) { + super(); + this.config = config; + this.domains = domains; + this.quotas = quotas; + this.intel = intel; + this.tunnels = new Map(); + } + + get(id) { + return this.tunnels.get(id) || null; + } + + async _allocateId(requested, account) { + if (requested !== undefined && requested !== null && requested !== "") { + const name = String(requested).toLowerCase(); + if (ids.isReserved(name)) throw Object.assign(new Error(`The name "${name}" is taken by the server itself`), { code: "invalid_name" }); + if (!ids.isValidName(name)) throw Object.assign(new Error(`Invalid name "${name}": use 3-32 characters a-z, 0-9 or "-"`), { code: "invalid_name" }); + if (this.tunnels.has(name)) throw Object.assign(new Error(`The name "${name}" is already in use`), { code: "name_taken" }); + const definition = await persistent.load(name); + if (definition && definition.accountId !== account.id) { + throw Object.assign(new Error(`The name "${name}" is reserved by another account`), { code: "name_reserved" }); + } + return { id: name, definition }; + } + for (let i = 0; i < 50; i++) { + const id = ids.randomId(6); + if (!this.tunnels.has(id) && !ids.isReserved(id) && !await persistent.load(id)) return { id, definition: null }; + } + throw Object.assign(new Error("Could not allocate a tunnel id"), { code: "bad_request" }); + } + + async register(session, { mode, httpMode, target, name, keepHost, resume, policy, share }) { + if (!["http", "tcp"].includes(mode)) throw Object.assign(new Error("mode must be http or tcp"), { code: "bad_request" }); + + if (mode === "http") { + const requested = httpMode === undefined || httpMode === null || httpMode === "" ? this.config.httpMode : String(httpMode).toLowerCase(); + if (!["path", "subdomain"].includes(requested)) throw Object.assign(new Error(`Unknown forwarding mode "${httpMode}": use path or subdomain`), { code: "bad_request" }); + if (requested === "subdomain" && this.config.managesTls && !this.config.wildcard) { + throw Object.assign(new Error("Subdomain tunnels need a wildcard certificate: set the forwarding mode to subdomain first"), { code: "bad_request" }); + } + mode = requested; + } else { + mode = "tcp"; + } + const parsedTarget = parseTarget(target); + if (!parsedTarget) throw Object.assign(new Error("target must be a port or host:port"), { code: "bad_request" }); + + const account = session.account || {}; + + if (typeof resume === "string" && resume.length) { + const existing = this._findByResumeToken(resume); + if (existing && existing.mode === mode && existing.accountId === account.id) { + if (policy) { + existing.policy = buildPolicy(policy); + if (existing.persistent) await persistent.savePolicy(existing.id, existing.policy); + } + this._attach(existing, session, parsedTarget, keepHost); + logger.info(`Tunnel ${existing.id} resumed`, { mode }); + return { tunnel: existing, resumed: true }; + } + } + + const owned = [...this.tunnels.values()].filter(tunnel => tunnel.accountId === account.id).length; + await this.quotas.enforce(account.id, "tunnels", owned); + await this.quotas.enforceTraffic(account.id); + + const previous = mode === "tcp" ? ids.splitShareCode(share) : null; + const wanted = name || (previous && !this.tunnels.has(previous.id) ? previous.id : undefined); + const { id, definition } = await this._allocateId(wanted, account); + if (!httpMode && mode !== "tcp" && (definition?.mode === "path" || definition?.mode === "subdomain")) { + const sticky = definition.mode; + if (sticky !== "subdomain" || !this.config.managesTls || this.config.wildcard) mode = sticky; + } + const tunnel = new Tunnel({ id, mode, target: parsedTarget, keepHost, accountId: account.id, owner: account.username, guest: session.guest }); + if (previous && previous.id === id) { + tunnel.secret = previous.secret; + tunnel.secretHash = ids.hashSecret(previous.secret); + } + + if (definition) { + tunnel.persistent = true; + tunnel.policy = definition.policy; + if (httpMode) await persistent.saveMode(id, mode); + } + if (policy) { + tunnel.policy = buildPolicy(policy); + if (definition) await persistent.savePolicy(id, tunnel.policy); + } + + this.tunnels.set(id, tunnel); + this._attach(tunnel, session, parsedTarget, keepHost); + logger.info(`Tunnel ${id} registered`, { mode, target: parsedTarget.authority, owner: account.username, guest: session.guest }); + return { tunnel, resumed: false }; + } + + _findByResumeToken(token) { + for (const tunnel of this.tunnels.values()) { + if (safeEqual(tunnel.resumeToken, token)) return tunnel; + } + return null; + } + + _attach(tunnel, session, target, keepHost) { + tunnel.credential = session.credential; + if (tunnel.graceTimer) { + clearTimeout(tunnel.graceTimer); + tunnel.graceTimer = null; + } + tunnel.graceUntil = null; + if (tunnel.session && tunnel.session !== session && !tunnel.session.closed) { + endSession(tunnel.session, "replaced by a newer connection", 4001); + } + tunnel.session = session; + tunnel.target = target; + tunnel.keepHost = !!keepHost; + session.tunnel = tunnel; + session.once("close", () => { + if (tunnel.session !== session) return; + tunnel.session = null; + if (session.saidBye) return this.remove(tunnel.id, "closed by owner"); + this._startGrace(tunnel); + }); + this.emit("online", tunnel); + } + + _startGrace(tunnel) { + const seconds = this.config.gracePeriod; + logger.info(`Tunnel ${tunnel.id} offline, reserved for ${seconds}s`); + this.emit("offline", tunnel); + if (seconds <= 0) return this.remove(tunnel.id, "grace period is 0"); + tunnel.graceUntil = Date.now() + seconds * 1000; + tunnel.graceTimer = setTimeout(() => this.remove(tunnel.id, "grace period expired"), seconds * 1000); + } + + remove(id, reason) { + const tunnel = this.tunnels.get(id); + if (!tunnel) return; + this.emit("forget", tunnel); + this.tunnels.delete(id); + if (tunnel.graceTimer) clearTimeout(tunnel.graceTimer); + endSession(tunnel.session, `tunnel closed (${reason})`, 4004); + for (const joiner of tunnel.joiners) endSession(joiner, "tunnel closed", 4004); + tunnel.joiners.clear(); + logger.info(`Tunnel ${id} removed`, { reason }); + this.emit("removed", tunnel); + } + + closeFor(accountId, reason) { + for (const tunnel of [...this.tunnels.values()]) { + if (tunnel.accountId === accountId) this.remove(tunnel.id, reason); + } + } + + closeCredential(credential, reason) { + for (const tunnel of [...this.tunnels.values()]) { + if (tunnel.credential === credential) this.remove(tunnel.id, reason); + } + } + + join(session, code) { + const parts = ids.splitShareCode(code); + if (!parts) throw Object.assign(new Error("Invalid share code"), { code: "invalid_code" }); + const tunnel = this.tunnels.get(parts.id); + if (!tunnel || tunnel.mode !== "tcp" || !tunnel.secretHash) throw Object.assign(new Error("Invalid share code"), { code: "invalid_code" }); + if (!crypto.timingSafeEqual(tunnel.secretHash, ids.hashSecret(parts.secret))) throw Object.assign(new Error("Invalid share code"), { code: "invalid_code" }); + const ip = session.client?.ip; + const details = this.intel.lookup(ip); + const reason = evaluate(tunnel.policy, ip, details); + if (reason) { + this.emit("blocked", tunnel, ip, details, reason); + throw Object.assign(new Error("Your address is not allowed to use this tunnel"), { code: "forbidden" }); + } + tunnel.joiners.add(session); + session.tunnel = tunnel; + session.once("close", () => tunnel.joiners.delete(session)); + return tunnel; + } + + connectUrl(tunnel) { + return tunnel.shareCode ? `${this.config.publicUrl}/@frislit/connect/${tunnel.shareCode}` : null; + } + + publicUrl(tunnel) { + return tunnel.mode === "tcp" ? null : this.urlFor(tunnel.id, tunnel.mode); + } + + urlFor(name, mode = this.config.httpMode) { + const { publicScheme, baseDomain, publicUrl } = this.config; + if (mode === "subdomain") { + const port = new URL(publicUrl).port; + return `${publicScheme}://${name}.${baseDomain}${port ? `:${port}` : ""}`; + } + return `${publicUrl}/@${name}`; + } + + customUrls(tunnel) { + if (tunnel.mode === "tcp") return []; + return this.domains.hostsFor(tunnel.id).map(hostname => `${this.config.publicScheme}://${hostname}`); + } +} + +module.exports = { Registry, endSession }; diff --git a/server/lib/sessions.js b/server/lib/sessions.js new file mode 100644 index 0000000..cb40e86 --- /dev/null +++ b/server/lib/sessions.js @@ -0,0 +1,75 @@ +const { Op } = require("sequelize"); +const Session = require("../models/Session"); +const Account = require("../models/Account"); + +const COOKIE_NAME = "frislit-admin"; +const TTL = 7 * 24 * 60 * 60 * 1000; +const TOUCH_AFTER = 60_000; + +class SessionStore { + constructor() { + this.sweeper = setInterval(() => this.sweep(), 60 * 60 * 1000); + this.sweeper.unref(); + } + + async create(accountId, meta = {}) { + const session = await Session.create({ accountId, ip: meta.ip || null, userAgent: meta.userAgent || null }); + return session.get ? session.get("token") : session.token; + } + + async get(token) { + if (!token) return null; + const session = await Session.findOne({ where: { token: String(token) } }); + if (!session) return null; + + if (Date.now() - new Date(session.lastSeen).getTime() > TTL) { + await Session.destroy({ where: { id: session.id } }); + return null; + } + + const account = await Account.findByPk(session.accountId); + if (!account) { + await Session.destroy({ where: { id: session.id } }); + return null; + } + + if (Date.now() - new Date(session.lastSeen).getTime() > TOUCH_AFTER) { + await Session.update({ lastSeen: new Date() }, { where: { id: session.id } }); + } + + return { id: session.id, account, username: account.username, role: account.role, createdAt: session.createdAt }; + } + + remove(token) { + return Session.destroy({ where: { token: String(token || "") } }); + } + + forAccount(accountId) { + return Session.destroy({ where: { accountId } }); + } + + sweep() { + return Session.destroy({ where: { lastSeen: { [Op.lt]: new Date(Date.now() - TTL) } } }); + } +} + +const parseCookies = header => { + const out = []; + for (const part of String(header || "").split(";")) { + const index = part.indexOf("="); + if (index === -1) continue; + const name = part.slice(0, index).trim(); + if (name) out.push({ name, value: part.slice(index + 1).trim() }); + } + return out; +}; + +const tokenFromRequest = req => parseCookies(req.headers.cookie).find(cookie => cookie.name === COOKIE_NAME)?.value || null; + +const sessionCookie = (token, secure) => + `${COOKIE_NAME}=${token}; Path=/@frislit; HttpOnly; SameSite=Lax; Max-Age=${TTL / 1000}${secure ? "; Secure" : ""}`; + +const clearSessionCookie = secure => + `${COOKIE_NAME}=; Path=/@frislit; HttpOnly; SameSite=Lax; Max-Age=0${secure ? "; Secure" : ""}`; + +module.exports = { SessionStore, tokenFromRequest, sessionCookie, clearSessionCookie }; diff --git a/server/lib/settings.js b/server/lib/settings.js new file mode 100644 index 0000000..9e6a7e2 --- /dev/null +++ b/server/lib/settings.js @@ -0,0 +1,25 @@ +const Setting = require("../models/Setting"); + +const read = async () => { + const rows = await Setting.findAll(); + const values = {}; + for (const row of rows) { + try { + values[row.key] = JSON.parse(row.value); + } catch { + values[row.key] = row.value; + } + } + return values; +}; + +const write = async values => { + for (const [key, value] of Object.entries(values)) { + const encoded = JSON.stringify(value); + const row = await Setting.findOne({ where: { key } }); + if (row) await Setting.update({ value: encoded }, { where: { key } }); + else await Setting.create({ key, value: encoded }); + } +}; + +module.exports = { read, write }; diff --git a/server/lib/sniff.js b/server/lib/sniff.js new file mode 100644 index 0000000..cac42e9 --- /dev/null +++ b/server/lib/sniff.js @@ -0,0 +1,139 @@ +const METHODS = /^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|CONNECT|TRACE) (\S+) HTTP\/1\.[01]\r\n/; + +const varint = (buffer, offset) => { + let value = 0; + let shift = 0; + for (let i = offset; i < buffer.length && shift < 35; i++) { + value |= (buffer[i] & 0x7f) << shift; + if ((buffer[i] & 0x80) === 0) return [value, i + 1]; + shift += 7; + } + return null; +}; + +const tls = buffer => { + if (buffer.length < 44 || buffer[0] !== 0x16 || buffer[1] !== 0x03 || buffer[5] !== 0x01) return null; + let at = 43; + at += 1 + buffer[at]; + if (at + 2 > buffer.length) return { name: "TLS", info: null }; + at += 2 + buffer.readUInt16BE(at); + if (at + 1 > buffer.length) return { name: "TLS", info: null }; + at += 1 + buffer[at]; + if (at + 2 > buffer.length) return { name: "TLS", info: null }; + const end = Math.min(buffer.length, at + 2 + buffer.readUInt16BE(at)); + at += 2; + let sni = null; + const alpn = []; + while (at + 4 <= end) { + const type = buffer.readUInt16BE(at); + const length = buffer.readUInt16BE(at + 2); + const body = buffer.subarray(at + 4, Math.min(end, at + 4 + length)); + if (type === 0 && body.length >= 5) sni = body.subarray(5, 5 + body.readUInt16BE(3)).toString("utf8"); + if (type === 16 && body.length >= 2) { + let cursor = 2; + while (cursor < body.length) { + const size = body[cursor]; + alpn.push(body.subarray(cursor + 1, cursor + 1 + size).toString("utf8")); + cursor += 1 + size; + } + } + at += 4 + length; + } + return { name: "TLS", info: [sni, alpn.length ? alpn.join(", ") : null].filter(Boolean).join(" · ") || null }; +}; + +const http = buffer => { + const head = buffer.subarray(0, 2048).toString("latin1"); + if (head.startsWith("PRI * HTTP/2.0\r\n")) return { name: "HTTP/2", info: null }; + const match = METHODS.exec(head); + if (!match) return null; + const host = /\r\nhost:\s*([^\r\n]+)/i.exec(head); + return { name: "HTTP", info: [host?.[1], `${match[1]} ${match[2]}`].filter(Boolean).join(" · ") }; +}; + +const ssh = buffer => { + if (!buffer.subarray(0, 4).equals(Buffer.from("SSH-"))) return null; + return { name: "SSH", info: buffer.subarray(0, 64).toString("latin1").split("\r\n")[0].slice(0, 48) }; +}; + +const postgres = buffer => { + if (buffer.length < 8) return null; + const length = buffer.readUInt32BE(0); + const code = buffer.readUInt32BE(4); + if (code === 80877103 || code === 80877104) return { name: "PostgreSQL", info: null }; + if (code !== 196608 || length > 10000) return null; + const params = buffer.subarray(8, Math.min(length, buffer.length)).toString("utf8").split("\0"); + const pairs = {}; + for (let i = 0; i + 1 < params.length; i += 2) pairs[params[i]] = params[i + 1]; + return { name: "PostgreSQL", info: [pairs.user, pairs.database].filter(Boolean).join(" @ ") || null }; +}; + +const mysql = buffer => { + if (buffer.length < 6 || buffer[3] !== 0 || buffer[4] !== 0x0a) return null; + const end = buffer.indexOf(0, 5); + if (end === -1 || end > 64) return null; + return { name: "MySQL", info: buffer.subarray(5, end).toString("latin1") }; +}; + +const redis = buffer => { + const head = buffer.subarray(0, 64).toString("latin1"); + const match = /^\*\d+\r\n\$\d+\r\n([A-Za-z]+)\r\n/.exec(head); + return match ? { name: "Redis", info: match[1].toUpperCase() } : null; +}; + +const mqtt = buffer => { + if (buffer[0] !== 0x10) return null; + const head = varint(buffer, 1); + if (!head) return null; + const at = head[1]; + if (buffer.length < at + 6 || buffer.readUInt16BE(at) !== 4 || buffer.subarray(at + 2, at + 6).toString("latin1") !== "MQTT") return null; + return { name: "MQTT", info: null }; +}; + +const minecraft = buffer => { + const length = varint(buffer, 0); + if (!length || buffer[length[1]] !== 0) return null; + const version = varint(buffer, length[1] + 1); + if (!version) return null; + const host = varint(buffer, version[1]); + if (!host || host[0] > 255 || host[1] + host[0] + 3 > buffer.length) return null; + const name = buffer.subarray(host[1], host[1] + host[0]).toString("utf8"); + const port = buffer.readUInt16BE(host[1] + host[0]); + const state = buffer[host[1] + host[0] + 2]; + if (!/^[\w.:-]+$/.test(name) || (state !== 1 && state !== 2)) return null; + return { name: "Minecraft", info: `${name}:${port} · ${state === 1 ? "status" : "login"}` }; +}; + +const dns = buffer => { + if (buffer.length < 17 || (buffer[2] & 0x80) !== 0 || buffer.readUInt16BE(4) !== 1) return null; + const labels = []; + let at = 12; + while (at < buffer.length && buffer[at] !== 0) { + const size = buffer[at]; + if (size > 63 || at + 1 + size > buffer.length) return null; + labels.push(buffer.subarray(at + 1, at + 1 + size).toString("latin1")); + at += 1 + size; + } + if (!labels.length) return null; + return { name: "DNS", info: labels.join(".") }; +}; + +const wireguard = buffer => (buffer.length === 148 && buffer[0] === 1 && buffer[1] === 0 && buffer[2] === 0 && buffer[3] === 0 ? { name: "WireGuard", info: null } : null); + +const quic = buffer => (buffer.length >= 5 && (buffer[0] & 0xc0) === 0xc0 && buffer.readUInt32BE(1) === 1 ? { name: "QUIC", info: null } : null); + +const TCP_IN = [tls, http, ssh, postgres, redis, mqtt, minecraft]; +const TCP_OUT = [ssh, mysql]; +const UDP = [dns, quic, wireguard]; + +const sniff = (protocol, direction, buffer) => { + if (!buffer.length) return null; + const detectors = protocol === "udp" ? UDP : direction === "in" ? TCP_IN : TCP_OUT; + for (const detector of detectors) { + const result = detector(buffer); + if (result) return result; + } + return null; +}; + +module.exports = { sniff }; diff --git a/server/lib/stats.js b/server/lib/stats.js new file mode 100644 index 0000000..4abb3e2 --- /dev/null +++ b/server/lib/stats.js @@ -0,0 +1,104 @@ +const INTERVAL = 2000; +const BUCKETS = 90; + +const empty = () => ({ + buckets: [], + totals: { in: 0, out: 0, requests: 0 }, + pendingRequests: 0, + lastSent: 0, + lastReceived: 0, + session: null, +}); + +class Stats { + constructor(registry, quotas, { interval = INTERVAL, buckets = BUCKETS } = {}) { + this.registry = registry; + this.quotas = quotas; + this.interval = interval; + this.limit = buckets; + this.series = new Map(); + this.timer = null; + } + + start() { + if (this.timer) return; + this.timer = setInterval(() => this.sample(), this.interval); + this.timer.unref(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + _for(tunnelId) { + let entry = this.series.get(tunnelId); + if (!entry) { + entry = empty(); + this.series.set(tunnelId, entry); + } + return entry; + } + + recordRequest(tunnelId) { + this._for(tunnelId).pendingRequests += 1; + } + + sample() { + const now = Date.now(); + for (const tunnel of this.registry.tunnels.values()) { + const entry = this._for(tunnel.id); + const session = tunnel.session; + + let inBytes = 0; + let outBytes = 0; + if (session && !session.closed) { + if (entry.session !== session) { + entry.session = session; + entry.lastSent = 0; + entry.lastReceived = 0; + } + inBytes = Math.max(0, session.bytesSent - entry.lastSent); + outBytes = Math.max(0, session.bytesReceived - entry.lastReceived); + entry.lastSent = session.bytesSent; + entry.lastReceived = session.bytesReceived; + } else { + entry.session = null; + } + + const requests = entry.pendingRequests; + entry.pendingRequests = 0; + entry.totals.in += inBytes; + entry.totals.out += outBytes; + entry.totals.requests += requests; + this.quotas.record(tunnel.accountId, inBytes, outBytes, requests); + + entry.buckets.push({ t: now, in: inBytes, out: outBytes, requests }); + if (entry.buckets.length > this.limit) entry.buckets.splice(0, entry.buckets.length - this.limit); + } + } + + read(tunnelId) { + const entry = this.series.get(tunnelId); + const seconds = this.interval / 1000; + if (!entry) return { interval: seconds, buckets: [], totals: { in: 0, out: 0, requests: 0 }, rates: { in: 0, out: 0 } }; + + const recent = entry.buckets.slice(-5); + const average = key => recent.length + ? recent.reduce((sum, bucket) => sum + bucket[key], 0) / (recent.length * seconds) + : 0; + + return { + interval: seconds, + buckets: entry.buckets, + totals: { ...entry.totals }, + rates: { in: Math.round(average("in")), out: Math.round(average("out")) }, + }; + } + + forget(tunnelId) { + this.series.delete(tunnelId); + } +} + +module.exports = { Stats }; diff --git a/server/lib/tls/manager.js b/server/lib/tls/manager.js new file mode 100644 index 0000000..27c324c --- /dev/null +++ b/server/lib/tls/manager.js @@ -0,0 +1,285 @@ +const tls = require("node:tls"); +const dns = require("node:dns").promises; +const acme = require("acme-client"); +const store = require("./store"); +const providers = require("./providers"); +const logger = require("../../utils/logger"); + +const RENEW_BEFORE = 30 * 24 * 60 * 60 * 1000; +const CHECK_INTERVAL = 12 * 60 * 60 * 1000; +const TXT_TIMEOUT = 120 * 1000; +const TXT_STEP = 5 * 1000; + +const waitForTxt = async (record, value) => { + for (let deadline = Date.now() + TXT_TIMEOUT; Date.now() < deadline;) { + const rows = await dns.resolveTxt(record).catch(() => []); + if (rows.some(parts => parts.join("") === value)) return; + await new Promise(resolve => setTimeout(resolve, TXT_STEP)); + } + throw new Error(`The TXT record ${record} did not show up within ${TXT_TIMEOUT / 1000}s`); +}; + +const domainsFor = config => config.wildcard ? [config.baseDomain, `*.${config.baseDomain}`] : [config.baseDomain]; + +class CertificateManager { + constructor(config) { + this.config = config; + this.context = null; + this.current = null; + this.state = "none"; + this.error = null; + this.busy = false; + this.challenges = new Map(); + this.timer = null; + this.extra = new Map(); + this.issuing = new Set(); + } + + get domain() { + return this.config.baseDomain; + } + + async load() { + const row = await store.certificate(this.domain); + if (!row) { + this.state = "none"; + return null; + } + this.current = { + domain: row.domain, + altNames: JSON.parse(row.altNames || "[]"), + issuedAt: row.issuedAt, + expiresAt: row.expiresAt, + }; + this.context = tls.createSecureContext({ key: row.privateKey, cert: row.chain }); + this.state = new Date(row.expiresAt).getTime() < Date.now() ? "expired" : "ready"; + return this.current; + } + + async loadExtra() { + this.extra.clear(); + for (const row of await store.certificates()) { + if (row.domain === this.domain) continue; + this.extra.set(row.domain, { + context: tls.createSecureContext({ key: row.privateKey, cert: row.chain }), + expiresAt: new Date(row.expiresAt), + }); + } + } + + secureContextFor(servername) { + const name = String(servername || "").toLowerCase(); + return this.extra.get(name)?.context || this.context; + } + + info(hostname) { + const entry = this.extra.get(hostname); + return entry ? { expiresAt: entry.expiresAt } : null; + } + + dueFor(hostname) { + const entry = this.extra.get(hostname); + return !entry || entry.expiresAt.getTime() - Date.now() < RENEW_BEFORE; + } + + async issueFor(hostname) { + if (this.issuing.has(hostname)) throw new Error(`A certificate request for ${hostname} is already running`); + if (!this.config.managesTls) throw new Error("frislit does not manage certificates on this server"); + this.issuing.add(hostname); + try { + const { settings, client } = await this.client(); + const [key, csr] = await acme.crypto.createCsr({ commonName: hostname, altNames: [hostname] }); + const handlers = this.challengeHandlers(settings); + const chain = await client.auto({ + csr, + email: settings.email || undefined, + termsOfServiceAgreed: true, + skipChallengeVerification: true, + challengePriority: ["http-01"], + challengeCreateFn: handlers.create, + challengeRemoveFn: handlers.remove, + }); + const info = acme.crypto.readCertificateInfo(chain); + await store.saveCertificate({ + domain: hostname, altNames: [hostname], + privateKey: key.toString(), chain: chain.toString(), + expiresAt: info.notAfter, + }); + this.extra.set(hostname, { + context: tls.createSecureContext({ key: key.toString(), cert: chain.toString() }), + expiresAt: info.notAfter, + }); + logger.info(`Certificate issued for ${hostname}, valid until ${info.notAfter.toISOString()}`); + } finally { + this.issuing.delete(hostname); + } + } + + async forget(hostname) { + this.extra.delete(hostname); + await store.forgetCertificate(hostname); + } + + covers() { + if (!this.current) return false; + const wanted = domainsFor(this.config); + return wanted.every(name => this.current.altNames.includes(name)); + } + + dueForRenewal() { + if (!this.current) return true; + if (!this.covers()) return true; + return new Date(this.current.expiresAt).getTime() - Date.now() < RENEW_BEFORE; + } + + status() { + const state = this.busy ? this.state + : !this.current ? (this.error ? "error" : "none") + : !this.covers() ? "stale" + : new Date(this.current.expiresAt).getTime() < Date.now() ? "expired" : "ready"; + + return { + state, + busy: this.busy, + error: this.error, + domains: domainsFor(this.config), + certificate: this.current, + dueForRenewal: this.dueForRenewal(), + pendingRecords: providers.get("manual").records(), + }; + } + + async client() { + const settings = await store.settings(); + let accountKey = settings.accountKey; + if (!accountKey) { + accountKey = (await acme.crypto.createPrivateKey()).toString(); + await store.saveSettings({ accountKey }); + } + const directoryUrl = this.config.acmeDirectoryUrl || acme.directory.letsencrypt.production; + return { settings, client: new acme.Client({ directoryUrl, accountKey }) }; + } + + challengeHandlers(settings) { + const provider = providers.get(settings.provider) || providers.get("manual"); + + const create = async (authz, challenge, keyAuthorization) => { + if (challenge.type === "http-01") { + this.challenges.set(challenge.token, keyAuthorization); + return; + } + const record = `_acme-challenge.${authz.identifier.value.replace(/^\*\./, "")}`; + logger.info(`Adding DNS challenge for ${record} via ${provider.id}`); + await provider.create(settings.credential, record, keyAuthorization); + if (challenge.type === "dns-01") await waitForTxt(record, keyAuthorization); + }; + + const remove = async (authz, challenge, keyAuthorization) => { + if (challenge.type === "http-01") { + this.challenges.delete(challenge.token); + return; + } + const record = `_acme-challenge.${authz.identifier.value.replace(/^\*\./, "")}`; + try { + await provider.remove(settings.credential, record, keyAuthorization); + } catch (err) { + logger.warn(`Could not remove the DNS challenge for ${record}: ${err.message}`); + } + }; + + return { create, remove }; + } + + async request() { + if (this.busy) return { code: 409, message: "A certificate request is already running" }; + if (!this.config.ready) return { code: 400, message: "Set the base domain first" }; + + const { settings, client } = await this.client(); + if (this.config.wildcard && settings.provider === "http") { + return { code: 400, message: "Subdomain forwarding needs a wildcard certificate, which requires a DNS provider" }; + } + const provider = providers.get(settings.provider); + if (!provider) return { code: 400, message: `Unknown DNS provider "${settings.provider}"` }; + if (provider.needsCredential && !settings.credential) return { code: 400, message: `${provider.title} needs an API token` }; + + this.busy = true; + this.run(settings, client).catch(err => logger.error(`Certificate request crashed: ${err.stack || err}`)); + return { message: "Requesting a certificate", status: this.status() }; + } + + async run(settings, client) { + this.state = "requesting"; + this.error = null; + const altNames = domainsFor(this.config); + + try { + const [key, csr] = await acme.crypto.createCsr({ commonName: altNames[0], altNames }); + const handlers = this.challengeHandlers(settings); + const chain = await client.auto({ + csr, + email: settings.email || undefined, + termsOfServiceAgreed: true, + skipChallengeVerification: true, + challengePriority: settings.provider === "http" ? ["http-01"] : ["dns-01"], + challengeCreateFn: handlers.create, + challengeRemoveFn: handlers.remove, + }); + + const info = acme.crypto.readCertificateInfo(chain); + await store.saveCertificate({ + domain: this.domain, altNames, + privateKey: key.toString(), chain: chain.toString(), + expiresAt: info.notAfter, + }); + providers.get("manual").reset(); + await this.load(); + logger.info(`Certificate issued for ${altNames.join(", ")}, valid until ${info.notAfter.toISOString()}`); + } catch (err) { + this.error = err.message; + this.state = this.current ? "ready" : "error"; + providers.get("manual").reset(); + logger.error(`Certificate request failed: ${err.message}`); + } finally { + this.busy = false; + } + } + + continueManual() { + return providers.get("manual").continue(); + } + + challengeResponse(token) { + return this.challenges.get(token) || null; + } + + secureContext() { + return this.context; + } + + start() { + if (this.timer) return; + this.timer = setInterval(() => this.maybeRenew(), CHECK_INTERVAL); + this.timer.unref(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + async maybeRenew() { + if (!this.config.managesTls || !this.config.ready) return; + if (!this.busy && this.dueForRenewal()) { + logger.info("Certificate is due for renewal"); + const result = await this.request(); + if (result.code) logger.warn(`Renewal could not start: ${result.message}`); + } + for (const hostname of this.extra.keys()) { + if (!this.dueFor(hostname)) continue; + logger.info(`Certificate for ${hostname} is due for renewal`); + await this.issueFor(hostname).catch(err => logger.warn(`Renewal for ${hostname} failed: ${err.message}`)); + } + } +} + +module.exports = { CertificateManager, domainsFor }; diff --git a/server/lib/tls/providers/cloudflare.js b/server/lib/tls/providers/cloudflare.js new file mode 100644 index 0000000..d5da37b --- /dev/null +++ b/server/lib/tls/providers/cloudflare.js @@ -0,0 +1,53 @@ +const API = "https://api.cloudflare.com/client/v4"; + +const call = async (token, path, options = {}) => { + const response = await fetch(`${API}${path}`, { + ...options, + headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json", ...options.headers }, + }); + const body = await response.json().catch(() => ({})); + if (!response.ok || body.success === false) { + const detail = body.errors?.map(error => error.message).join(", ") || response.statusText; + throw new Error(`Cloudflare: ${detail}`); + } + return body.result; +}; + +const zoneFor = async (token, hostname) => { + const labels = hostname.split("."); + for (let i = 0; i < labels.length - 1; i++) { + const candidate = labels.slice(i).join("."); + const zones = await call(token, `/zones?name=${encodeURIComponent(candidate)}`); + if (zones?.length) return zones[0]; + } + throw new Error(`Cloudflare: no zone found for ${hostname}. Check that the token can read this zone.`); +}; + +module.exports = { + id: "cloudflare", + title: "Cloudflare", + needsCredential: true, + credentialLabel: "API token", + + async verify(token, hostname) { + const zone = await zoneFor(token, hostname); + return { message: `Token works, zone ${zone.name} found` }; + }, + + async create(token, record, value) { + const zone = await zoneFor(token, record); + return call(token, `/zones/${zone.id}/dns_records`, { + method: "POST", + body: JSON.stringify({ type: "TXT", name: record, content: value, ttl: 60 }), + }); + }, + + async remove(token, record, value) { + const zone = await zoneFor(token, record); + const existing = await call(token, `/zones/${zone.id}/dns_records?type=TXT&name=${encodeURIComponent(record)}`); + for (const entry of existing || []) { + if (entry.content !== value) continue; + await call(token, `/zones/${zone.id}/dns_records/${entry.id}`, { method: "DELETE" }); + } + }, +}; diff --git a/server/lib/tls/providers/index.js b/server/lib/tls/providers/index.js new file mode 100644 index 0000000..5f321fc --- /dev/null +++ b/server/lib/tls/providers/index.js @@ -0,0 +1,18 @@ +const cloudflare = require("./cloudflare"); +const manual = require("./manual"); + +const http = { id: "http", title: "No DNS provider", needsCredential: false, httpOnly: true }; + +const PROVIDERS = { cloudflare, manual, http }; + +const get = id => PROVIDERS[id] || null; + +const describe = () => Object.values(PROVIDERS).map(provider => ({ + id: provider.id, + title: provider.title, + needsCredential: !!provider.needsCredential, + credentialLabel: provider.credentialLabel || null, + httpOnly: !!provider.httpOnly, +})); + +module.exports = { get, describe, PROVIDERS }; diff --git a/server/lib/tls/providers/manual.js b/server/lib/tls/providers/manual.js new file mode 100644 index 0000000..129a48e --- /dev/null +++ b/server/lib/tls/providers/manual.js @@ -0,0 +1,40 @@ +const WAIT_TIMEOUT = 15 * 60 * 1000; + +const pending = new Map(); + +const settle = (key, error) => { + const entry = pending.get(key); + if (!entry) return; + pending.delete(key); + clearTimeout(entry.timer); + if (error) entry.reject(error); else entry.resolve(); +}; + +module.exports = { + id: "manual", + title: "Add the record yourself", + needsCredential: false, + + records: () => [...pending.values()].map(({ record, value }) => ({ record, value })), + + create(_token, record, value) { + const key = `${record}:${value}`; + return new Promise((resolve, reject) => { + const timer = setTimeout(() => settle(key, new Error("Timed out waiting for the TXT record to be added")), WAIT_TIMEOUT); + timer.unref(); + pending.set(key, { record, value, timer, resolve, reject }); + }); + }, + + remove() {}, + + continue() { + const keys = [...pending.keys()]; + for (const key of keys) settle(key); + return keys.length > 0; + }, + + reset() { + for (const key of [...pending.keys()]) settle(key, new Error("Cancelled")); + }, +}; diff --git a/server/lib/tls/store.js b/server/lib/tls/store.js new file mode 100644 index 0000000..f9ee58c --- /dev/null +++ b/server/lib/tls/store.js @@ -0,0 +1,33 @@ +const Acme = require("../../models/Acme"); +const Certificate = require("../../models/Certificate"); + +const DEFAULTS = { email: null, provider: "manual", credential: null, accountKey: null }; + +const settings = async () => { + const row = await Acme.findOne(); + return row ? { ...DEFAULTS, ...row } : { ...DEFAULTS }; +}; + +const saveSettings = async values => { + const row = await Acme.findOne(); + if (row) return Acme.update(values, { where: { id: row.id } }); + return Acme.create({ ...DEFAULTS, ...values }); +}; + +const certificate = domain => Certificate.findOne({ where: { domain } }); + +const certificates = () => Certificate.findAll(); + +const saveCertificate = async ({ domain, altNames, privateKey, chain, expiresAt }) => { + const values = { + domain, altNames: JSON.stringify(altNames), privateKey, chain, + issuedAt: new Date(), expiresAt, + }; + const row = await Certificate.findOne({ where: { domain } }); + if (row) return Certificate.update(values, { where: { id: row.id } }); + return Certificate.create(values); +}; + +const forgetCertificate = domain => Certificate.destroy({ where: { domain } }); + +module.exports = { settings, saveSettings, certificate, certificates, saveCertificate, forgetCertificate }; diff --git a/server/lib/totp.js b/server/lib/totp.js new file mode 100644 index 0000000..1d87684 --- /dev/null +++ b/server/lib/totp.js @@ -0,0 +1,52 @@ +const speakeasy = require("speakeasy"); +const Account = require("../models/Account"); +const Session = require("../models/Session"); +const logger = require("../utils/logger"); + +const WINDOW = 1; + +const secretFor = async account => { + if (account.totpSecret) return account.totpSecret; + const secret = speakeasy.generateSecret({ length: 20 }).base32; + await Account.update({ totpSecret: secret }, { where: { id: account.id } }); + return secret; +}; + +const otpauthUrl = (secret, username, issuer) => + `otpauth://totp/${encodeURIComponent(issuer)}:${encodeURIComponent(username)}` + + `?secret=${secret}&issuer=${encodeURIComponent(issuer)}`; + +const verify = (secret, code) => speakeasy.totp.verify({ + secret: secret || "", + encoding: "base32", + token: String(code || "").replace(/\s/g, ""), + window: WINDOW, +}); + +const begin = async (account, issuer) => { + if (account.totpEnabled) return { code: 409, message: "Two-factor is already on for this account" }; + const secret = await secretFor(account); + return { secret, url: otpauthUrl(secret, account.username, issuer) }; +}; + +const enable = async (account, code) => { + if (account.totpEnabled) return { code: 409, message: "Two-factor is already on for this account" }; + if (!account.totpSecret) return { code: 409, message: "Start the setup first" }; + if (!verify(account.totpSecret, code)) return { code: 401, message: "That code is not right. Check your clock and try the next one." }; + + await Account.update({ totpEnabled: true }, { where: { id: account.id } }); + await Session.destroy({ where: { accountId: account.id } }); + logger.info(`${account.username} turned on two-factor`); + return { message: "Two-factor is on" }; +}; + +const disable = async (account, code) => { + if (!account.totpEnabled) return { code: 409, message: "Two-factor is already off" }; + if (!verify(account.totpSecret, code)) return { code: 401, message: "That code is not right" }; + + await Account.update({ totpEnabled: false, totpSecret: null }, { where: { id: account.id } }); + logger.info(`${account.username} turned off two-factor`); + return { message: "Two-factor is off" }; +}; + +module.exports = { begin, enable, disable, verify }; diff --git a/server/lib/traffic.js b/server/lib/traffic.js new file mode 100644 index 0000000..7c3fc4a --- /dev/null +++ b/server/lib/traffic.js @@ -0,0 +1,189 @@ +const { Op, fn, col, literal, where: sqlWhere } = require("sequelize"); + +const country = () => fn("json_extract", col("intel"), literal("'$.country'")); +const Request = require("../models/Request"); +const Frame = require("../models/Frame"); +const logger = require("../utils/logger"); + +const PER_TUNNEL_LIMIT = 200; +const PAGE_SIZE = 50; +const SORTABLE = { time: "id", status: "status", duration: "duration", path: "path", method: "method" }; + +const criteria = (tunnelId, { search, methods = [], statuses = [], countries = [] }) => { + const where = { tunnel: tunnelId }; + if (search) where[Op.or] = [{ path: { [Op.like]: `%${search}%` } }, { ip: { [Op.like]: `%${search}%` } }]; + if (methods.length) { + const wantsWs = methods.includes("WS"); + const plain = methods.filter(method => method !== "WS"); + const options = []; + if (plain.length) options.push({ kind: "http", method: plain }); + if (wantsWs) options.push({ kind: "ws" }); + where[Op.and] = [...(where[Op.and] || []), { [Op.or]: options }]; + } + if (statuses.length) { + where[Op.and] = [...(where[Op.and] || []), { [Op.or]: statuses.map(hundreds => ({ status: { [Op.between]: [hundreds * 100, hundreds * 100 + 99] } })) }]; + } + if (countries.length) { + where[Op.and] = [...(where[Op.and] || []), sqlWhere(country(), { [Op.in]: countries })]; + } + return where; +}; +const FLUSH_INTERVAL = 500; + +const toText = body => (body ? Buffer.from(body).toString("base64") : null); + +const summarise = row => ({ + id: row.id, + time: new Date(row.time).getTime(), + duration: row.duration, + kind: row.kind, + connection: row.connection, + intel: row.intel ? JSON.parse(row.intel) : null, + method: row.method, + path: row.path, + status: row.status, + ip: row.ip, + host: row.host, + requestBytes: row.requestBytes, + responseBytes: row.responseBytes, +}); + +const detail = row => ({ + ...summarise(row), + request: { + headers: JSON.parse(row.requestHeaders || "[]"), + body: toText(row.requestBody), + bytes: row.requestBytes, + truncated: !!row.requestTruncated, + }, + response: { + headers: JSON.parse(row.responseHeaders || "[]"), + body: toText(row.responseBody), + bytes: row.responseBytes, + truncated: !!row.responseTruncated, + }, +}); + +class TrafficLog { + constructor({ limit = PER_TUNNEL_LIMIT, interval = FLUSH_INTERVAL } = {}) { + this.limit = limit; + this.interval = interval; + this.pending = []; + this.counts = new Map(); + this.timer = null; + } + + start() { + if (this.timer) return; + this.timer = setInterval(() => this.flush(), this.interval); + this.timer.unref(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + record(tunnelId, entry) { + this.pending.push({ + tunnel: tunnelId, + time: new Date(entry.time), + duration: entry.duration || 0, + kind: entry.kind || "http", + connection: entry.connection || null, + intel: entry.intel ? JSON.stringify(entry.intel) : null, + method: entry.method || null, + path: entry.path || null, + status: entry.status || null, + ip: entry.ip || null, + host: entry.host || null, + requestHeaders: JSON.stringify(entry.request?.headers || []), + requestBody: entry.request?.body || null, + requestBytes: entry.request?.bytes || 0, + requestTruncated: !!entry.request?.truncated, + responseHeaders: JSON.stringify(entry.response?.headers || []), + responseBody: entry.response?.body || null, + responseBytes: entry.response?.bytes || 0, + responseTruncated: !!entry.response?.truncated, + }); + this.counts.set(tunnelId, (this.counts.get(tunnelId) || 0) + 1); + } + + async flush() { + if (!this.pending.length) return; + const batch = this.pending; + this.pending = []; + + try { + await Request.bulkCreate(batch); + for (const tunnel of new Set(batch.map(row => row.tunnel))) await this.prune(tunnel); + } catch (err) { + logger.warn(`Could not store ${batch.length} request(s): ${err.message}`); + } + } + + async prune(tunnel) { + const rows = await Request.findAll({ + where: { tunnel }, order: [["id", "DESC"]], offset: this.limit, limit: 1, attributes: ["id"], + }); + if (!rows.length) return; + const stale = { tunnel, id: { [Op.lte]: rows[0].id } }; + const connections = (await Request.findAll({ where: { ...stale, connection: { [Op.ne]: null } }, attributes: ["connection"] })).map(row => row.connection); + if (connections.length) await Frame.destroy({ where: { connection: connections } }); + await Request.destroy({ where: stale }); + } + + async finish(connection, duration) { + const row = this.pending.find(entry => entry.connection === connection); + if (row) row.duration = duration; + else await Request.update({ duration }, { where: { connection } }); + } + + async list(tunnelId, { filter = {}, sort = "time", order = "desc", offset = 0, limit = PAGE_SIZE } = {}) { + await this.flush(); + const column = SORTABLE[sort] || "id"; + const rows = await Request.findAll({ + where: criteria(tunnelId, filter), + order: [[column, order === "asc" ? "ASC" : "DESC"], ["id", "DESC"]], + offset: Math.max(offset, 0), + limit: Math.min(Math.max(limit, 1), PER_TUNNEL_LIMIT), + attributes: { exclude: ["requestBody", "responseBody", "requestHeaders", "responseHeaders"] }, + }); + return rows.map(summarise); + } + + async all(tunnelId) { + await this.flush(); + const rows = await Request.findAll({ where: { tunnel: tunnelId }, order: [["id", "ASC"]] }); + return rows.map(detail); + } + + async get(tunnelId, id) { + await this.flush(); + const row = await Request.findOne({ where: { tunnel: tunnelId, id } }); + return row ? detail(row) : null; + } + + count(tunnelId, filter = {}) { + return Request.count({ where: criteria(tunnelId, filter) }); + } + + async countries(tunnelId) { + const rows = await Request.findAll({ + where: { tunnel: tunnelId }, + attributes: [[country(), "code"], [fn("COUNT", col("id")), "count"]], + group: ["code"], + }); + return rows.filter(row => row.code).map(row => ({ code: row.code, count: row.count })).sort((a, b) => b.count - a.count); + } + + async forget(tunnelId) { + this.pending = this.pending.filter(row => row.tunnel !== tunnelId); + this.counts.delete(tunnelId); + await Frame.destroy({ where: { tunnel: tunnelId } }); + const removed = await Request.destroy({ where: { tunnel: tunnelId } }); + if (removed) logger.debug(`Dropped ${removed} stored request(s) for ${tunnelId}`); + } +} + +module.exports = { TrafficLog }; diff --git a/server/lib/visitors.js b/server/lib/visitors.js new file mode 100644 index 0000000..fd77219 --- /dev/null +++ b/server/lib/visitors.js @@ -0,0 +1,113 @@ +const { Op } = require("sequelize"); +const Visitor = require("../models/Visitor"); +const logger = require("../utils/logger"); + +const PER_TUNNEL_LIMIT = 500; +const PAGE_SIZE = 50; +const FLUSH_INTERVAL = 500; +const SORTABLE = { last: "lastSeen", first: "firstSeen", requests: "requests", blocked: "blocked", ip: "ip" }; + +const summarise = row => ({ + ip: row.ip, + intel: JSON.parse(row.intel), + requests: row.requests, + blocked: row.blocked, + reason: row.reason, + firstSeen: new Date(row.firstSeen).getTime(), + lastSeen: new Date(row.lastSeen).getTime(), +}); + +class Visitors { + constructor({ limit = PER_TUNNEL_LIMIT, interval = FLUSH_INTERVAL } = {}) { + this.limit = limit; + this.interval = interval; + this.pending = new Map(); + this.timer = null; + } + + start() { + if (this.timer) return; + this.timer = setInterval(() => this.flush(), this.interval); + this.timer.unref(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + touch(tunnel, ip, intel) { + const key = `${tunnel}\n${ip}`; + const entry = this.pending.get(key) || { tunnel, ip, requests: 0, blocked: 0, reason: null, firstSeen: Date.now() }; + entry.intel = intel; + entry.lastSeen = Date.now(); + this.pending.set(key, entry); + return entry; + } + + seen(tunnel, ip, intel) { + this.touch(tunnel, ip, intel).requests += 1; + } + + blocked(tunnel, ip, intel, reason) { + const entry = this.touch(tunnel, ip, intel); + entry.blocked += 1; + entry.reason = reason; + } + + async flush() { + if (!this.pending.size) return; + const batch = [...this.pending.values()]; + this.pending.clear(); + + try { + for (const entry of batch) { + const intel = JSON.stringify(entry.intel); + const row = await Visitor.findOne({ where: { tunnel: entry.tunnel, ip: entry.ip } }); + if (row) { + await Visitor.update({ + intel, + requests: row.requests + entry.requests, + blocked: row.blocked + entry.blocked, + reason: entry.reason || row.reason, + lastSeen: new Date(entry.lastSeen), + }, { where: { id: row.id } }); + } else { + await Visitor.create({ ...entry, intel, firstSeen: new Date(entry.firstSeen), lastSeen: new Date(entry.lastSeen) }); + } + } + for (const tunnel of new Set(batch.map(entry => entry.tunnel))) await this.prune(tunnel); + } catch (err) { + logger.warn(`Could not store ${batch.length} visitor(s): ${err.message}`); + } + } + + async prune(tunnel) { + const rows = await Visitor.findAll({ + where: { tunnel }, order: [["lastSeen", "DESC"]], offset: this.limit, limit: 1, attributes: ["lastSeen"], + }); + if (rows.length) await Visitor.destroy({ where: { tunnel, lastSeen: { [Op.lte]: rows[0].lastSeen } } }); + } + + async list(tunnel, { sort = "last", order = "desc", offset = 0, limit = PAGE_SIZE } = {}) { + await this.flush(); + const rows = await Visitor.findAll({ + where: { tunnel }, + order: [[SORTABLE[sort] || "lastSeen", order === "asc" ? "ASC" : "DESC"], ["id", "DESC"]], + offset: Math.max(offset, 0), + limit: Math.min(Math.max(limit, 1), PER_TUNNEL_LIMIT), + }); + return rows.map(summarise); + } + + count(tunnel) { + return Visitor.count({ where: { tunnel } }); + } + + async forget(tunnel) { + for (const [key, entry] of this.pending) if (entry.tunnel === tunnel) this.pending.delete(key); + await Visitor.destroy({ where: { tunnel } }); + } +} + +module.exports = { Visitors }; diff --git a/server/lib/websocket.js b/server/lib/websocket.js new file mode 100644 index 0000000..cbd1d67 --- /dev/null +++ b/server/lib/websocket.js @@ -0,0 +1,91 @@ +const { randomBytes } = require("node:crypto"); + +const MAX_FRAME = 16 * 1024 * 1024; + +class FrameParser { + constructor(onMessage, { skipHead = false } = {}) { + this.onMessage = onMessage; + this.buffer = Buffer.alloc(0); + this.fragments = null; + this.dead = false; + this.awaitingHead = skipHead; + } + + push(chunk) { + if (this.dead) return; + this.buffer = this.buffer.length ? Buffer.concat([this.buffer, chunk]) : chunk; + if (this.awaitingHead) { + const end = this.buffer.indexOf("\r\n\r\n"); + if (end === -1) return; + this.buffer = this.buffer.subarray(end + 4); + this.awaitingHead = false; + } + this.drain(); + } + + drain() { + for (;;) { + const buffer = this.buffer; + if (buffer.length < 2) return; + const fin = (buffer[0] & 0x80) !== 0; + const opcode = buffer[0] & 0x0f; + const masked = (buffer[1] & 0x80) !== 0; + let length = buffer[1] & 0x7f; + let offset = 2; + if (length === 126) { + if (buffer.length < 4) return; + length = buffer.readUInt16BE(2); + offset = 4; + } else if (length === 127) { + if (buffer.length < 10) return; + length = Number(buffer.readBigUInt64BE(2)); + offset = 10; + } + if (length > MAX_FRAME) { + this.dead = true; + this.buffer = Buffer.alloc(0); + return; + } + const start = offset + (masked ? 4 : 0); + if (buffer.length < start + length) return; + let payload = Buffer.from(buffer.subarray(start, start + length)); + if (masked) { + const key = buffer.subarray(offset, offset + 4); + for (let i = 0; i < length; i++) payload[i] ^= key[i & 3]; + } + this.buffer = buffer.subarray(start + length); + + if (opcode >= 8) { + this.onMessage(opcode, payload); + } else if (opcode === 0) { + if (!this.fragments) continue; + this.fragments.parts.push(payload); + if (fin) { + const { opcode: first, parts } = this.fragments; + this.fragments = null; + this.onMessage(first, Buffer.concat(parts)); + } + } else if (fin) { + this.onMessage(opcode, payload); + } else { + this.fragments = { opcode, parts: [payload] }; + } + } + } +} + +const encodeFrame = (opcode, payload, masked) => { + const length = payload.length; + const header = [0x80 | opcode]; + if (length < 126) header.push(length); + else if (length < 65536) header.push(126, length >> 8, length & 0xff); + else header.push(127, 0, 0, 0, 0, length >>> 24, (length >>> 16) & 0xff, (length >>> 8) & 0xff, length & 0xff); + if (!masked) return Buffer.concat([Buffer.from(header), payload]); + header[1] |= 0x80; + const key = randomBytes(4); + const body = Buffer.allocUnsafe(length); + for (let i = 0; i < length; i++) body[i] = payload[i] ^ key[i & 3]; + return Buffer.concat([Buffer.from(header), key, body]); +}; + +module.exports = { FrameParser, encodeFrame }; diff --git a/server/lib/wsframes.js b/server/lib/wsframes.js new file mode 100644 index 0000000..f21527a --- /dev/null +++ b/server/lib/wsframes.js @@ -0,0 +1,104 @@ +const { Op } = require("sequelize"); +const Frame = require("../models/Frame"); +const logger = require("../utils/logger"); + +const MAX_PAYLOAD = 16 * 1024; +const PER_CONNECTION = 500; +const FLUSH_INTERVAL = 500; + +const summarise = row => ({ + id: row.id, + direction: row.direction, + opcode: row.opcode, + time: new Date(row.time).getTime(), + bytes: row.bytes, + truncated: !!row.truncated, + payload: row.payload ? Buffer.from(row.payload).toString("base64") : null, +}); + +class FrameLog { + constructor() { + this.pending = []; + this.open = new Map(); + this.timer = null; + } + + start() { + if (this.timer) return; + this.timer = setInterval(() => this.flush(), FLUSH_INTERVAL); + this.timer.unref(); + } + + stop() { + if (this.timer) clearInterval(this.timer); + this.timer = null; + } + + opened(connection, writers) { + this.open.set(connection, writers); + } + + closed(connection) { + this.open.delete(connection); + } + + isOpen(connection) { + return this.open.has(connection); + } + + inject(tunnel, connection, direction, payload) { + const writers = this.open.get(connection); + if (!writers) return false; + writers[direction](payload); + this.record(tunnel, connection, direction, 1, payload); + return true; + } + + record(tunnel, connection, direction, opcode, payload) { + this.pending.push({ + tunnel, connection, direction, opcode, + time: new Date(), + bytes: payload.length, + payload: payload.length ? payload.subarray(0, MAX_PAYLOAD) : null, + truncated: payload.length > MAX_PAYLOAD, + }); + } + + async flush() { + if (!this.pending.length) return; + const batch = this.pending; + this.pending = []; + try { + await Frame.bulkCreate(batch); + for (const connection of new Set(batch.map(row => row.connection))) await this.prune(connection); + } catch (err) { + logger.warn(`Could not store ${batch.length} frame(s): ${err.message}`); + } + } + + async prune(connection) { + const rows = await Frame.findAll({ where: { connection }, order: [["id", "DESC"]], offset: PER_CONNECTION, limit: 1, attributes: ["id"] }); + if (rows.length) await Frame.destroy({ where: { connection, id: { [Op.lte]: rows[0].id } } }); + } + + async list(tunnel, connection, after = 0) { + await this.flush(); + const where = { tunnel, connection }; + if (after) where.id = { [Op.gt]: after }; + const rows = await Frame.findAll({ where, order: [["id", "ASC"]], limit: PER_CONNECTION }); + return rows.map(summarise); + } + + async forConnections(tunnel, connections) { + await this.flush(); + const rows = await Frame.findAll({ where: { tunnel, connection: connections }, order: [["id", "ASC"]] }); + const grouped = new Map(); + for (const row of rows) { + if (!grouped.has(row.connection)) grouped.set(row.connection, []); + grouped.get(row.connection).push(summarise(row)); + } + return grouped; + } +} + +module.exports = { FrameLog }; diff --git a/server/middlewares/auth.js b/server/middlewares/auth.js new file mode 100644 index 0000000..39bdfcf --- /dev/null +++ b/server/middlewares/auth.js @@ -0,0 +1,34 @@ +const { tokenFromRequest } = require("../lib/sessions"); +const { isSetupRequired } = require("../controllers/setup"); + +const deviceSession = async req => { + const device = await req.auth.deviceFor(req.auth.bearerFromHeaders(req.headers)); + if (!device || device.guest) return null; + const account = await req.auth.accountFor(device); + return account && { account, username: account.username, role: account.role, device: true }; +}; + +module.exports.authenticate = async (req, res, next) => { + const token = tokenFromRequest(req.raw); + const session = await req.sessions.get(token) || await deviceSession(req); + if (!session) return res.status(401).json({ code: 401, message: "You need to be logged in" }); + req.session = session; + req.account = session.account; + req.sessionToken = token; + next(); +}; + +module.exports.requireBrowser = (req, res, next) => { + if (req.session.device) return res.status(403).json({ code: 403, message: "Sign in on the website for that" }); + next(); +}; + +module.exports.requireAdmin = (req, res, next) => { + if (req.session.role !== "admin") return res.status(403).json({ code: 403, message: "Only an admin can do that" }); + next(); +}; + +module.exports.requireSetupComplete = async (req, res, next) => { + if (await isSetupRequired()) return res.status(409).json({ code: 409, message: "The server has not been set up yet" }); + next(); +}; diff --git a/server/migrations/0001-schema.js b/server/migrations/0001-schema.js new file mode 100644 index 0000000..83a8920 --- /dev/null +++ b/server/migrations/0001-schema.js @@ -0,0 +1,115 @@ +const { DataTypes } = require("sequelize"); + +const id = { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false }; +const owner = { type: DataTypes.INTEGER, allowNull: false, references: { model: "accounts", key: "id" }, onDelete: "CASCADE" }; +const created = { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW }; + +const TABLES = { + accounts: { + id, + username: { type: DataTypes.STRING, allowNull: false, unique: true }, + passwordHash: { type: DataTypes.STRING, allowNull: false }, + role: { type: DataTypes.STRING, allowNull: false, defaultValue: "user" }, + totpSecret: { type: DataTypes.STRING, allowNull: true }, + totpEnabled: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, + createdAt: created, + }, + sessions: { + id, + accountId: owner, + token: { type: DataTypes.STRING, allowNull: false, unique: true }, + ip: { type: DataTypes.STRING, allowNull: true }, + userAgent: { type: DataTypes.STRING, allowNull: true }, + createdAt: created, + lastSeen: created, + }, + devices: { + id, + accountId: owner, + name: { type: DataTypes.STRING, allowNull: false }, + tokenHash: { type: DataTypes.STRING, allowNull: false, unique: true }, + ip: { type: DataTypes.STRING, allowNull: true }, + userAgent: { type: DataTypes.STRING, allowNull: true }, + createdAt: created, + lastUsedAt: { type: DataTypes.DATE, allowNull: true }, + }, + passkeys: { + id, + accountId: owner, + name: { type: DataTypes.STRING, allowNull: false, defaultValue: "Passkey" }, + credentialId: { type: DataTypes.TEXT, allowNull: false, unique: true }, + publicKey: { type: DataTypes.TEXT, allowNull: false }, + counter: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + deviceType: { type: DataTypes.STRING, allowNull: true }, + backedUp: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, + transports: { type: DataTypes.TEXT, allowNull: true }, + createdAt: created, + lastUsedAt: { type: DataTypes.DATE, allowNull: true }, + }, + oidc_providers: { + id, + name: { type: DataTypes.STRING, allowNull: false }, + issuer: { type: DataTypes.STRING, allowNull: false }, + clientId: { type: DataTypes.STRING, allowNull: false }, + clientSecret: { type: DataTypes.TEXT, allowNull: true }, + scope: { type: DataTypes.STRING, allowNull: false, defaultValue: "openid profile email" }, + usernameClaim: { type: DataTypes.STRING, allowNull: false, defaultValue: "preferred_username" }, + createAccounts: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true }, + enabled: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true }, + createdAt: created, + }, + tunnels: { + id, + name: { type: DataTypes.STRING, allowNull: false, unique: true }, + accountId: owner, + allowedIps: { type: DataTypes.TEXT, allowNull: false, defaultValue: "[]" }, + auth: { type: DataTypes.STRING, allowNull: false, defaultValue: "none" }, + passwordHash: { type: DataTypes.STRING, allowNull: true }, + createdAt: created, + }, + requests: { + id, + tunnel: { type: DataTypes.STRING, allowNull: false }, + time: { type: DataTypes.DATE, allowNull: false }, + duration: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + kind: { type: DataTypes.STRING, allowNull: false, defaultValue: "http" }, + method: { type: DataTypes.STRING, allowNull: true }, + path: { type: DataTypes.TEXT, allowNull: true }, + status: { type: DataTypes.INTEGER, allowNull: true }, + ip: { type: DataTypes.STRING, allowNull: true }, + host: { type: DataTypes.STRING, allowNull: true }, + requestHeaders: { type: DataTypes.TEXT, allowNull: true }, + requestBody: { type: DataTypes.BLOB, allowNull: true }, + requestBytes: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + requestTruncated: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, + responseHeaders: { type: DataTypes.TEXT, allowNull: true }, + responseBody: { type: DataTypes.BLOB, allowNull: true }, + responseBytes: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + responseTruncated: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, + }, + certificates: { + id, + domain: { type: DataTypes.STRING, allowNull: false, unique: true }, + altNames: { type: DataTypes.TEXT, allowNull: false, defaultValue: "[]" }, + privateKey: { type: DataTypes.TEXT, allowNull: false }, + chain: { type: DataTypes.TEXT, allowNull: false }, + issuedAt: created, + expiresAt: { type: DataTypes.DATE, allowNull: false }, + }, + acme: { + id, + email: { type: DataTypes.STRING, allowNull: true }, + provider: { type: DataTypes.STRING, allowNull: false, defaultValue: "manual" }, + credential: { type: DataTypes.TEXT, allowNull: true }, + accountKey: { type: DataTypes.TEXT, allowNull: true }, + }, + settings: { + key: { type: DataTypes.STRING, allowNull: false, primaryKey: true }, + value: { type: DataTypes.TEXT, allowNull: true }, + }, +}; + +module.exports.up = async queryInterface => { + for (const [name, columns] of Object.entries(TABLES)) await queryInterface.createTable(name, columns); + await queryInterface.addIndex("requests", ["tunnel", "id"]); +}; diff --git a/server/migrations/0002-persistent-tunnels.js b/server/migrations/0002-persistent-tunnels.js new file mode 100644 index 0000000..616b998 --- /dev/null +++ b/server/migrations/0002-persistent-tunnels.js @@ -0,0 +1,17 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.bulkDelete("tunnels", {}); + + await queryInterface.createTable("domains", { + id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false }, + hostname: { type: DataTypes.STRING, allowNull: false, unique: true }, + tunnelName: { type: DataTypes.STRING, allowNull: false }, + accountId: { type: DataTypes.INTEGER, allowNull: false, references: { model: "accounts", key: "id" }, onDelete: "CASCADE" }, + state: { type: DataTypes.STRING, allowNull: false, defaultValue: "pending" }, + lastError: { type: DataTypes.TEXT, allowNull: true }, + checkedAt: { type: DataTypes.DATE, allowNull: true }, + createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW }, + }); + await queryInterface.addIndex("domains", ["tunnelName"]); +}; diff --git a/server/migrations/0003-quotas.js b/server/migrations/0003-quotas.js new file mode 100644 index 0000000..fe70123 --- /dev/null +++ b/server/migrations/0003-quotas.js @@ -0,0 +1,15 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.addColumn("accounts", "quotas", { type: DataTypes.TEXT, allowNull: true }); + + await queryInterface.createTable("usage", { + id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false }, + accountId: { type: DataTypes.INTEGER, allowNull: false, references: { model: "accounts", key: "id" }, onDelete: "CASCADE" }, + month: { type: DataTypes.STRING, allowNull: false }, + bytesIn: { type: DataTypes.BIGINT, allowNull: false, defaultValue: 0 }, + bytesOut: { type: DataTypes.BIGINT, allowNull: false, defaultValue: 0 }, + requests: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + }); + await queryInterface.addIndex("usage", ["accountId", "month"], { unique: true }); +}; diff --git a/server/migrations/0004-websocket-frames.js b/server/migrations/0004-websocket-frames.js new file mode 100644 index 0000000..00f81db --- /dev/null +++ b/server/migrations/0004-websocket-frames.js @@ -0,0 +1,20 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.addColumn("requests", "connection", { type: DataTypes.STRING, allowNull: true }); + await queryInterface.addIndex("requests", ["connection"]); + + await queryInterface.createTable("frames", { + id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false }, + tunnel: { type: DataTypes.STRING, allowNull: false }, + connection: { type: DataTypes.STRING, allowNull: false }, + direction: { type: DataTypes.STRING, allowNull: false }, + opcode: { type: DataTypes.INTEGER, allowNull: false }, + time: { type: DataTypes.DATE, allowNull: false }, + bytes: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + payload: { type: DataTypes.BLOB, allowNull: true }, + truncated: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, + }); + await queryInterface.addIndex("frames", ["connection", "id"]); + await queryInterface.addIndex("frames", ["tunnel"]); +}; diff --git a/server/migrations/0005-ip-intel.js b/server/migrations/0005-ip-intel.js new file mode 100644 index 0000000..5f5ae3b --- /dev/null +++ b/server/migrations/0005-ip-intel.js @@ -0,0 +1,5 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.addColumn("requests", "intel", { type: DataTypes.TEXT, allowNull: true }); +}; diff --git a/server/migrations/0006-access-rules.js b/server/migrations/0006-access-rules.js new file mode 100644 index 0000000..6f85330 --- /dev/null +++ b/server/migrations/0006-access-rules.js @@ -0,0 +1,11 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async (queryInterface, db) => { + await queryInterface.addColumn("tunnels", "rules", { type: DataTypes.TEXT, allowNull: false, defaultValue: "{}" }); + const rows = await db.query("SELECT id, allowedIps FROM tunnels", { type: db.QueryTypes.SELECT }); + for (const row of rows) { + const rules = JSON.stringify({ allow: { ips: JSON.parse(row.allowedIps || "[]"), countries: [] }, block: { ips: [], countries: [], categories: [] } }); + await db.query("UPDATE tunnels SET rules = ? WHERE id = ?", { replacements: [rules, row.id] }); + } + await queryInterface.removeColumn("tunnels", "allowedIps"); +}; diff --git a/server/migrations/0007-visitors.js b/server/migrations/0007-visitors.js new file mode 100644 index 0000000..e9c6b14 --- /dev/null +++ b/server/migrations/0007-visitors.js @@ -0,0 +1,17 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.createTable("visitors", { + id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false }, + tunnel: { type: DataTypes.STRING, allowNull: false }, + ip: { type: DataTypes.STRING, allowNull: false }, + intel: { type: DataTypes.TEXT, allowNull: true }, + requests: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + blocked: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + reason: { type: DataTypes.STRING, allowNull: true }, + firstSeen: { type: DataTypes.DATE, allowNull: false }, + lastSeen: { type: DataTypes.DATE, allowNull: false }, + }); + await queryInterface.addIndex("visitors", ["tunnel", "ip"], { unique: true }); + await queryInterface.addIndex("visitors", ["tunnel", "lastSeen"]); +}; diff --git a/server/migrations/0008-connections.js b/server/migrations/0008-connections.js new file mode 100644 index 0000000..f6c58e8 --- /dev/null +++ b/server/migrations/0008-connections.js @@ -0,0 +1,21 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.createTable("connections", { + id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false }, + tunnel: { type: DataTypes.STRING, allowNull: false }, + key: { type: DataTypes.STRING, allowNull: false, unique: true }, + protocol: { type: DataTypes.STRING, allowNull: false }, + ip: { type: DataTypes.STRING, allowNull: false }, + intel: { type: DataTypes.TEXT, allowNull: false }, + client: { type: DataTypes.STRING, allowNull: false }, + joiner: { type: DataTypes.STRING, allowNull: false }, + startedAt: { type: DataTypes.DATE, allowNull: false }, + endedAt: { type: DataTypes.DATE, allowNull: true }, + bytesIn: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + bytesOut: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + reason: { type: DataTypes.STRING, allowNull: true }, + detail: { type: DataTypes.TEXT, allowNull: true }, + }); + await queryInterface.addIndex("connections", ["tunnel", "startedAt"]); +}; diff --git a/server/migrations/0009-invites.js b/server/migrations/0009-invites.js new file mode 100644 index 0000000..9c710af --- /dev/null +++ b/server/migrations/0009-invites.js @@ -0,0 +1,13 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.createTable("invites", { + id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false }, + accountId: { type: DataTypes.INTEGER, allowNull: false }, + label: { type: DataTypes.STRING, allowNull: false }, + tokenHash: { type: DataTypes.STRING, allowNull: false, unique: true }, + createdAt: { type: DataTypes.DATE, allowNull: false }, + lastUsedAt: { type: DataTypes.DATE, allowNull: true }, + uses: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 }, + }); +}; diff --git a/server/migrations/0010-api-keys.js b/server/migrations/0010-api-keys.js new file mode 100644 index 0000000..0301d8e --- /dev/null +++ b/server/migrations/0010-api-keys.js @@ -0,0 +1,5 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.addColumn("devices", "kind", { type: DataTypes.STRING, allowNull: false, defaultValue: "device" }); +}; diff --git a/server/migrations/0011-tunnel-mode.js b/server/migrations/0011-tunnel-mode.js new file mode 100644 index 0000000..767a248 --- /dev/null +++ b/server/migrations/0011-tunnel-mode.js @@ -0,0 +1,5 @@ +const { DataTypes } = require("sequelize"); + +module.exports.up = async queryInterface => { + await queryInterface.addColumn("tunnels", "mode", { type: DataTypes.STRING, allowNull: true }); +}; diff --git a/server/models/Account.js b/server/models/Account.js new file mode 100644 index 0000000..49b3661 --- /dev/null +++ b/server/models/Account.js @@ -0,0 +1,12 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("accounts", { + username: {type: Sequelize.STRING, allowNull: false, unique: true}, + passwordHash: {type: Sequelize.STRING, allowNull: false}, + role: {type: Sequelize.STRING, allowNull: false, defaultValue: "user"}, + totpSecret: {type: Sequelize.STRING}, + totpEnabled: {type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false}, + quotas: {type: Sequelize.TEXT}, + createdAt: {type: Sequelize.DATE, defaultValue: Sequelize.NOW}, +}, {freezeTableName: true, updatedAt: false}); diff --git a/server/models/Acme.js b/server/models/Acme.js new file mode 100644 index 0000000..915f6e8 --- /dev/null +++ b/server/models/Acme.js @@ -0,0 +1,9 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("acme", { + email: { type: Sequelize.STRING }, + provider: { type: Sequelize.STRING, allowNull: false, defaultValue: "manual" }, + credential: { type: Sequelize.TEXT }, + accountKey: { type: Sequelize.TEXT }, +}, { freezeTableName: true, timestamps: false }); diff --git a/server/models/Certificate.js b/server/models/Certificate.js new file mode 100644 index 0000000..533a2bc --- /dev/null +++ b/server/models/Certificate.js @@ -0,0 +1,11 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("certificates", { + domain: { type: Sequelize.STRING, allowNull: false, unique: true }, + altNames: { type: Sequelize.TEXT, allowNull: false, defaultValue: "[]" }, + privateKey: { type: Sequelize.TEXT, allowNull: false }, + chain: { type: Sequelize.TEXT, allowNull: false }, + issuedAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, + expiresAt: { type: Sequelize.DATE, allowNull: false }, +}, { freezeTableName: true, updatedAt: false, createdAt: false }); diff --git a/server/models/Connection.js b/server/models/Connection.js new file mode 100644 index 0000000..3f38fb9 --- /dev/null +++ b/server/models/Connection.js @@ -0,0 +1,18 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("connections", { + tunnel: { type: Sequelize.STRING, allowNull: false }, + key: { type: Sequelize.STRING, allowNull: false, unique: true }, + protocol: { type: Sequelize.STRING, allowNull: false }, + ip: { type: Sequelize.STRING, allowNull: false }, + intel: { type: Sequelize.TEXT, allowNull: false }, + client: { type: Sequelize.STRING, allowNull: false }, + joiner: { type: Sequelize.STRING, allowNull: false }, + startedAt: { type: Sequelize.DATE, allowNull: false }, + endedAt: { type: Sequelize.DATE }, + bytesIn: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + bytesOut: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + reason: { type: Sequelize.STRING }, + detail: { type: Sequelize.TEXT }, +}, { freezeTableName: true, timestamps: false }); diff --git a/server/models/Device.js b/server/models/Device.js new file mode 100644 index 0000000..29b0c69 --- /dev/null +++ b/server/models/Device.js @@ -0,0 +1,13 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("devices", { + accountId: { type: Sequelize.INTEGER, allowNull: false }, + name: { type: Sequelize.STRING, allowNull: false }, + tokenHash: { type: Sequelize.STRING, allowNull: false, unique: true }, + kind: { type: Sequelize.STRING, allowNull: false, defaultValue: "device" }, + ip: { type: Sequelize.STRING }, + userAgent: { type: Sequelize.STRING }, + createdAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, + lastUsedAt: { type: Sequelize.DATE }, +}, { freezeTableName: true, updatedAt: false }); diff --git a/server/models/Domain.js b/server/models/Domain.js new file mode 100644 index 0000000..8001e2e --- /dev/null +++ b/server/models/Domain.js @@ -0,0 +1,12 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("domains", { + hostname: { type: Sequelize.STRING, allowNull: false, unique: true }, + tunnelName: { type: Sequelize.STRING, allowNull: false }, + accountId: { type: Sequelize.INTEGER, allowNull: false }, + state: { type: Sequelize.STRING, allowNull: false, defaultValue: "pending" }, + lastError: { type: Sequelize.TEXT }, + checkedAt: { type: Sequelize.DATE }, + createdAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, +}, { freezeTableName: true, updatedAt: false }); diff --git a/server/models/Frame.js b/server/models/Frame.js new file mode 100644 index 0000000..bdab457 --- /dev/null +++ b/server/models/Frame.js @@ -0,0 +1,13 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("frames", { + tunnel: { type: Sequelize.STRING, allowNull: false }, + connection: { type: Sequelize.STRING, allowNull: false }, + direction: { type: Sequelize.STRING, allowNull: false }, + opcode: { type: Sequelize.INTEGER, allowNull: false }, + time: { type: Sequelize.DATE, allowNull: false }, + bytes: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + payload: { type: Sequelize.BLOB }, + truncated: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false }, +}, { freezeTableName: true, timestamps: false }); diff --git a/server/models/Invite.js b/server/models/Invite.js new file mode 100644 index 0000000..045ad90 --- /dev/null +++ b/server/models/Invite.js @@ -0,0 +1,11 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("invites", { + accountId: { type: Sequelize.INTEGER, allowNull: false }, + label: { type: Sequelize.STRING, allowNull: false }, + tokenHash: { type: Sequelize.STRING, allowNull: false, unique: true }, + createdAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, + lastUsedAt: { type: Sequelize.DATE }, + uses: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, +}, { freezeTableName: true, updatedAt: false }); diff --git a/server/models/OidcProvider.js b/server/models/OidcProvider.js new file mode 100644 index 0000000..6a34bbf --- /dev/null +++ b/server/models/OidcProvider.js @@ -0,0 +1,14 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("oidc_providers", { + name: { type: Sequelize.STRING, allowNull: false }, + issuer: { type: Sequelize.STRING, allowNull: false }, + clientId: { type: Sequelize.STRING, allowNull: false }, + clientSecret: { type: Sequelize.TEXT }, + scope: { type: Sequelize.STRING, allowNull: false, defaultValue: "openid profile email" }, + usernameClaim: { type: Sequelize.STRING, allowNull: false, defaultValue: "preferred_username" }, + createAccounts: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: true }, + enabled: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: true }, + createdAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, +}, { freezeTableName: true, updatedAt: false }); diff --git a/server/models/Passkey.js b/server/models/Passkey.js new file mode 100644 index 0000000..fa16384 --- /dev/null +++ b/server/models/Passkey.js @@ -0,0 +1,15 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("passkeys", { + accountId: { type: Sequelize.INTEGER, allowNull: false }, + name: { type: Sequelize.STRING, allowNull: false, defaultValue: "Passkey" }, + credentialId: { type: Sequelize.TEXT, allowNull: false, unique: true }, + publicKey: { type: Sequelize.TEXT, allowNull: false }, + counter: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + deviceType: { type: Sequelize.STRING }, + backedUp: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false }, + transports: { type: Sequelize.TEXT }, + createdAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, + lastUsedAt: { type: Sequelize.DATE }, +}, { freezeTableName: true, updatedAt: false }); diff --git a/server/models/Request.js b/server/models/Request.js new file mode 100644 index 0000000..ee6a0bc --- /dev/null +++ b/server/models/Request.js @@ -0,0 +1,24 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("requests", { + tunnel: { type: Sequelize.STRING, allowNull: false }, + time: { type: Sequelize.DATE, allowNull: false }, + duration: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + kind: { type: Sequelize.STRING, allowNull: false, defaultValue: "http" }, + connection: { type: Sequelize.STRING }, + intel: { type: Sequelize.TEXT }, + method: { type: Sequelize.STRING }, + path: { type: Sequelize.TEXT }, + status: { type: Sequelize.INTEGER }, + ip: { type: Sequelize.STRING }, + host: { type: Sequelize.STRING }, + requestHeaders: { type: Sequelize.TEXT }, + requestBody: { type: Sequelize.BLOB }, + requestBytes: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + requestTruncated: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false }, + responseHeaders: { type: Sequelize.TEXT }, + responseBody: { type: Sequelize.BLOB }, + responseBytes: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + responseTruncated: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false }, +}, { freezeTableName: true, timestamps: false }); diff --git a/server/models/Session.js b/server/models/Session.js new file mode 100644 index 0000000..f6e83dd --- /dev/null +++ b/server/models/Session.js @@ -0,0 +1,12 @@ +const crypto = require("node:crypto"); +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("sessions", { + accountId: { type: Sequelize.INTEGER, allowNull: false }, + token: { type: Sequelize.STRING, allowNull: false, unique: true, defaultValue: () => crypto.randomBytes(32).toString("base64url") }, + ip: { type: Sequelize.STRING }, + userAgent: { type: Sequelize.STRING }, + createdAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, + lastSeen: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, +}, { freezeTableName: true, updatedAt: false }); diff --git a/server/models/Setting.js b/server/models/Setting.js new file mode 100644 index 0000000..97aee7a --- /dev/null +++ b/server/models/Setting.js @@ -0,0 +1,7 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("settings", { + key: { type: Sequelize.STRING, allowNull: false, primaryKey: true }, + value: { type: Sequelize.TEXT }, +}, { freezeTableName: true, timestamps: false }); diff --git a/server/models/Tunnel.js b/server/models/Tunnel.js new file mode 100644 index 0000000..16834d3 --- /dev/null +++ b/server/models/Tunnel.js @@ -0,0 +1,11 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("tunnels", { + name: { type: Sequelize.STRING, allowNull: false, unique: true }, + accountId: { type: Sequelize.INTEGER, allowNull: false }, + rules: { type: Sequelize.TEXT, allowNull: false, defaultValue: "{}" }, + auth: { type: Sequelize.STRING, allowNull: false, defaultValue: "none" }, + passwordHash: { type: Sequelize.STRING }, + createdAt: { type: Sequelize.DATE, defaultValue: Sequelize.NOW }, +}, { freezeTableName: true, updatedAt: false }); diff --git a/server/models/Usage.js b/server/models/Usage.js new file mode 100644 index 0000000..54e0d0c --- /dev/null +++ b/server/models/Usage.js @@ -0,0 +1,10 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("usage", { + accountId: { type: Sequelize.INTEGER, allowNull: false }, + month: { type: Sequelize.STRING, allowNull: false }, + bytesIn: { type: Sequelize.BIGINT, allowNull: false, defaultValue: 0 }, + bytesOut: { type: Sequelize.BIGINT, allowNull: false, defaultValue: 0 }, + requests: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, +}, { freezeTableName: true, timestamps: false }); diff --git a/server/models/Visitor.js b/server/models/Visitor.js new file mode 100644 index 0000000..d787a41 --- /dev/null +++ b/server/models/Visitor.js @@ -0,0 +1,13 @@ +const Sequelize = require("sequelize"); +const db = require("../utils/database"); + +module.exports = db.define("visitors", { + tunnel: { type: Sequelize.STRING, allowNull: false }, + ip: { type: Sequelize.STRING, allowNull: false }, + intel: { type: Sequelize.TEXT }, + requests: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + blocked: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, + reason: { type: Sequelize.STRING }, + firstSeen: { type: Sequelize.DATE, allowNull: false }, + lastSeen: { type: Sequelize.DATE, allowNull: false }, +}, { freezeTableName: true, timestamps: false }); diff --git a/server/routes/accounts.js b/server/routes/accounts.js new file mode 100644 index 0000000..e563b25 --- /dev/null +++ b/server/routes/accounts.js @@ -0,0 +1,51 @@ +const { Router } = require("../utils/router"); +const accounts = require("../lib/accounts"); +const { Quotas } = require("../lib/quotas"); +const { usageFor } = require("../controllers/quotas"); +const logger = require("../utils/logger"); + +const app = Router(); + +app.get("/", async (req, res) => { + const list = await Promise.all((await accounts.list()).map(async account => ({ + ...account, + limits: await req.quotas.limitsFor(account.id), + usage: await usageFor(req, account.id), + }))); + res.json({ accounts: list, defaults: req.quotas.defaults }); +}); + +app.post("/", async (req, res) => { + const result = await accounts.create({ username: req.body.username, password: req.body.password, role: req.body.role }); + if (result.code) return res.status(result.code).json(result); + logger.info(`${req.session.username} created the account "${result.account.username}"`); + res.json({ message: `${result.account.username} created`, account: result.account }); +}); + +app.put("/:id", async (req, res) => { + const id = Number(req.params.id); + if (id === req.account.id && req.body.role !== undefined && req.body.role !== req.session.role) { + return res.status(409).json({ code: 409, message: "You cannot change your own role" }); + } + let quotas; + try { + quotas = req.body.quotas === undefined ? undefined : Quotas.parseOverride(req.body.quotas); + } catch (err) { + return res.status(400).json({ code: 400, message: err.message }); + } + const result = await accounts.update(id, { role: req.body.role, password: req.body.password, quotas }); + if (result.code) return res.status(result.code).json(result); + logger.info(`${req.session.username} updated the account "${result.account.username}"`); + res.json({ message: `${result.account.username} updated`, account: result.account }); +}); + +app.delete("/:id", async (req, res) => { + const id = Number(req.params.id); + if (id === req.account.id) return res.status(409).json({ code: 409, message: "You cannot delete your own account" }); + const result = await accounts.remove(id); + if (result.code) return res.status(result.code).json(result); + logger.info(`${req.session.username} deleted an account`, { id }); + res.json(result); +}); + +module.exports = app; diff --git a/server/routes/auth.js b/server/routes/auth.js new file mode 100644 index 0000000..627e823 --- /dev/null +++ b/server/routes/auth.js @@ -0,0 +1,152 @@ +const { Router } = require("../utils/router"); +const { login, logout, currentUser } = require("../controllers/auth"); +const { authenticate, requireSetupComplete } = require("../middlewares/auth"); +const { sessionCookie, clearSessionCookie } = require("../lib/sessions"); +const passkeys = require("../lib/passkeys"); +const oidc = require("../lib/oidc"); +const totp = require("../lib/totp"); + +const app = Router(); + +const originOf = req => `${req.info.proto}://${req.info.host}`; + +const signIn = async (req, res, account, extra = {}) => { + const token = await req.sessions.create(account.id, { + ip: req.info.clientIp, userAgent: req.headers["user-agent"] || "", + }); + res.header("Set-Cookie", sessionCookie(token, req.info.secure)) + .json({ username: account.username, role: account.role, message: "Logged in", ...extra }); +}; + +app.post("/login", requireSetupComplete, async (req, res) => { + const key = `login:${req.info.clientIp}`; + if (req.attempts.blocked(key)) return res.status(429).json({ code: 429, message: "Too many login attempts. Please try again later." }); + + const result = await login(req.sessions, req.body, { ip: req.info.clientIp, userAgent: req.headers["user-agent"] || "" }); + if (result.code) { + if (result.code === 401) req.attempts.record(key); + if (result.code === 202) return res.status(202).json({ totpRequired: true, message: result.message }); + return res.status(result.code).json(result); + } + + req.attempts.forget(key); + res.header("Set-Cookie", sessionCookie(result.token, req.info.secure)) + .json({ username: result.username, role: result.role, message: "Logged in" }); +}); + +app.post("/logout", authenticate, async (req, res) => { + await logout(req.sessions, req.sessionToken); + res.header("Set-Cookie", clearSessionCookie(req.info.secure)).json({ message: "Logged out" }); +}); + +app.get("/me", authenticate, (req, res) => { + res.json(currentUser(req.session)); +}); + +app.post("/device/create", (req, res) => { + const key = `device:${req.info.clientIp}`; + if (req.attempts.blocked(key)) return res.status(429).json({ code: 429, message: "Too many device codes requested. Please try again later." }); + req.attempts.record(key); + + const { code, pollToken, expiresAt } = req.devices.createCode({ + client: String(req.body.client || "cli").slice(0, 40), + ip: req.info.clientIp, + userAgent: String(req.headers["user-agent"] || "").slice(0, 200), + }); + res.json({ code, pollToken, expiresAt, handoffUrl: `${req.config.publicUrl || ""}/@frislit/handoff?code=${encodeURIComponent(code)}` }); +}); + +app.post("/device/poll", (req, res) => { + res.json(req.devices.poll(String(req.body.pollToken || ""))); +}); + +app.get("/providers", async (req, res) => { + res.json({ providers: await oidc.enabled() }); +}); + +const safeNext = next => (typeof next === "string" && /^\/@frislit\/[^/\\]/.test(next) ? next : null); + +app.post("/oidc/:id/start", async (req, res) => { + const result = await oidc.begin(Number(req.params.id), req.config, safeNext(req.body.next)); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.get("/oidc/callback", async (req, res) => { + const query = Object.fromEntries(req.query); + const result = await oidc.complete(query, req.config); + const target = `${req.config.publicUrl}/@frislit/`; + + if (result.code) { + return res.raw.writeHead(302, { + Location: `${target}login?error=${encodeURIComponent(result.message)}`, + "Cache-Control": "no-store", + }).end(); + } + + const token = await req.sessions.create(result.account.id, { + ip: req.info.clientIp, userAgent: req.headers["user-agent"] || "", + }); + res.raw.writeHead(302, { + Location: result.next ? `${req.config.publicUrl}${result.next}` : target, + "Set-Cookie": sessionCookie(token, req.info.secure), + "Cache-Control": "no-store", + }).end(); +}); + +app.post("/passkey/options", async (req, res) => { + res.json(await passkeys.startAuthentication(req.body.username, originOf(req))); +}); + +app.post("/passkey/verify", async (req, res) => { + const key = `passkey:${req.info.clientIp}`; + if (req.attempts.blocked(key)) return res.status(429).json({ code: 429, message: "Too many attempts. Please try again later." }); + + const result = await passkeys.finishAuthentication(req.body.response, originOf(req)); + if (result.code) { + req.attempts.record(key); + return res.status(result.code).json(result); + } + req.attempts.forget(key); + await signIn(req, res, result.account); +}); + +app.get("/totp/setup", authenticate, async (req, res) => { + const result = await totp.begin(req.account, req.config.baseDomain || "frislit"); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.post("/totp/enable", authenticate, async (req, res) => { + const result = await totp.enable(req.account, req.body.code); + if (result.code) return res.status(result.code).json(result); + res.header("Set-Cookie", clearSessionCookie(req.info.secure)).json(result); +}); + +app.post("/totp/disable", authenticate, async (req, res) => { + const result = await totp.disable(req.account, req.body.code); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.get("/passkeys", authenticate, async (req, res) => { + res.json({ passkeys: await passkeys.list(req.account.id) }); +}); + +app.post("/passkeys/options", authenticate, async (req, res) => { + res.json(await passkeys.startRegistration(req.account, originOf(req))); +}); + +app.post("/passkeys", authenticate, async (req, res) => { + const result = await passkeys.finishRegistration(req.account, req.body.response, req.body.name, originOf(req)); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.delete("/passkeys/:id", authenticate, async (req, res) => { + const result = await passkeys.remove(req.account.id, Number(req.params.id)); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +module.exports = app; diff --git a/server/routes/devices.js b/server/routes/devices.js new file mode 100644 index 0000000..2528d9b --- /dev/null +++ b/server/routes/devices.js @@ -0,0 +1,41 @@ +const { Router } = require("../utils/router"); + +const app = Router(); + +app.get("/", async (req, res) => { + res.json({ devices: await req.devices.list(req.session.role === "admin" ? undefined : req.account.id) }); +}); + +app.post("/", async (req, res) => { + const result = await req.devices.createKey(req.account.id, req.body.name); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.get("/pending/:code", (req, res) => { + const request = req.devices.describe(req.params.code); + if (!request) return res.status(404).json({ error: "not_found", message: "That code is unknown or has expired" }); + res.json({ request }); +}); + +app.post("/pending/:code/approve", async (req, res) => { + const result = await req.devices.approve(req.params.code, { name: req.body.name, accountId: req.account.id }); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.post("/pending/:code/deny", (req, res) => { + const result = req.devices.deny(req.params.code); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.delete("/:id", async (req, res) => { + const id = Number(req.params.id); + const result = await req.devices.revoke(id, req.session.role === "admin" ? undefined : req.account.id); + if (result.code) return res.status(result.code).json(result); + req.registry.closeCredential(`device:${id}`, "device revoked"); + res.json(result); +}); + +module.exports = app; diff --git a/server/routes/invites.js b/server/routes/invites.js new file mode 100644 index 0000000..b456b3f --- /dev/null +++ b/server/routes/invites.js @@ -0,0 +1,26 @@ +const { Router } = require("../utils/router"); +const invites = require("../lib/invites"); + +const app = Router(); + +const scope = req => (req.session.role === "admin" ? undefined : req.account.id); + +app.get("/", async (req, res) => { + res.json({ invites: await invites.list(scope(req)) }); +}); + +app.post("/", async (req, res) => { + const result = await invites.create(req.account.id, req.body.label); + if (result.code) return res.status(result.code).json(result); + res.json({ invite: result.invite, link: invites.linkFor(req.config.publicUrl, result.token) }); +}); + +app.delete("/:id", async (req, res) => { + const id = Number(req.params.id); + const result = await invites.revoke(id, scope(req)); + if (result.code) return res.status(result.code).json(result); + req.registry.closeCredential(`invite:${id}`, "invite revoked"); + res.json(result); +}); + +module.exports = app; diff --git a/server/routes/oidc.js b/server/routes/oidc.js new file mode 100644 index 0000000..793e7b7 --- /dev/null +++ b/server/routes/oidc.js @@ -0,0 +1,43 @@ +const { Router } = require("../utils/router"); +const oidc = require("../lib/oidc"); +const logger = require("../utils/logger"); + +const app = Router(); + +const pick = body => { + const values = {}; + for (const key of ["name", "issuer", "clientId", "scope", "usernameClaim"]) { + if (body[key] !== undefined) values[key] = String(body[key]).trim(); + } + if (body.clientSecret !== undefined && body.clientSecret !== "") values.clientSecret = String(body.clientSecret); + for (const key of ["createAccounts", "enabled"]) { + if (body[key] !== undefined) values[key] = body[key] === true || body[key] === "true"; + } + return values; +}; + +app.get("/", async (req, res) => { + res.json({ providers: await oidc.list(), redirectUri: oidc.redirectUri(req.config) }); +}); + +app.post("/", async (req, res) => { + const result = await oidc.save(null, pick(req.body || {})); + if (result.code) return res.status(result.code).json(result); + logger.info(`${req.session.username} added the login provider "${result.provider.name}"`); + res.json({ message: `${result.provider.name} added`, provider: result.provider }); +}); + +app.put("/:id", async (req, res) => { + const result = await oidc.save(Number(req.params.id), pick(req.body || {})); + if (result.code) return res.status(result.code).json(result); + res.json({ message: "Saved", provider: result.provider }); +}); + +app.delete("/:id", async (req, res) => { + const result = await oidc.remove(Number(req.params.id)); + if (result.code) return res.status(result.code).json(result); + logger.info(`${req.session.username} removed a login provider`); + res.json(result); +}); + +module.exports = app; diff --git a/server/routes/persistent.js b/server/routes/persistent.js new file mode 100644 index 0000000..41bd3cc --- /dev/null +++ b/server/routes/persistent.js @@ -0,0 +1,29 @@ +const { Router } = require("../utils/router"); +const controller = require("../controllers/persistent"); + +const app = Router(); + +const reply = (res, result) => { + if (result.code) return res.status(result.code).json(result); + res.json(result); +}; + +app.get("/", async (req, res) => { + res.json({ tunnels: await controller.list(req), now: Date.now() }); +}); + +app.post("/", async (req, res) => reply(res, await controller.create(req, req.body || {}))); + +app.get("/:name", async (req, res) => reply(res, await controller.get(req, req.params.name.toLowerCase()))); + +app.put("/:name/access", async (req, res) => reply(res, await controller.updateAccess(req, req.params.name.toLowerCase(), req.body || {}))); + +app.delete("/:name", async (req, res) => reply(res, await controller.remove(req, req.params.name.toLowerCase()))); + +app.post("/:name/domains", async (req, res) => reply(res, await controller.addDomain(req, req.params.name.toLowerCase(), req.body || {}))); + +app.post("/:name/domains/:hostname/check", async (req, res) => reply(res, await controller.checkDomain(req, req.params.name.toLowerCase(), req.params.hostname))); + +app.delete("/:name/domains/:hostname", async (req, res) => reply(res, await controller.removeDomain(req, req.params.name.toLowerCase(), req.params.hostname))); + +module.exports = app; diff --git a/server/routes/quotas.js b/server/routes/quotas.js new file mode 100644 index 0000000..6de3072 --- /dev/null +++ b/server/routes/quotas.js @@ -0,0 +1,15 @@ +const { Router } = require("../utils/router"); +const { requireAdmin } = require("../middlewares/auth"); +const { mine, saveDefaults } = require("../controllers/quotas"); + +const app = Router(); + +app.get("/", async (req, res) => res.json(await mine(req))); + +app.put("/", requireAdmin, async (req, res) => { + const result = await saveDefaults(req, req.body || {}); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +module.exports = app; diff --git a/server/routes/service.js b/server/routes/service.js new file mode 100644 index 0000000..6e83cbe --- /dev/null +++ b/server/routes/service.js @@ -0,0 +1,88 @@ +const { Router } = require("../utils/router"); +const packageJson = require("../../package.json"); +const { evaluate, accountAllowed, cookieFor } = require("../lib/access"); +const { verifyPassword } = require("../utils/password"); +const { tokenFromRequest: sessionToken } = require("../lib/sessions"); +const { classifyHost, QUERY_PARAM } = require("../lib/proxy"); +const logger = require("../utils/logger"); + +const app = Router(); + +app.get("/info", (req, res) => { + res.json({ name: "frislit", version: packageJson.version, baseDomain: req.config.baseDomain, publicUrl: req.config.publicUrl }); +}); + +app.get("/whoami", async (req, res) => { + const device = req.config.ready ? await req.auth.deviceFor(req.auth.bearerFromHeaders(req.headers)) : null; + if (!device) return res.status(401).json({ error: "unauthorized" }); + const account = await req.auth.accountFor(device); + if (!account) return res.status(401).json({ error: "unauthorized" }); + res.json({ ok: true, role: "owner", username: account.username, guest: device.guest?.label ?? null }); +}); + +app.get("/status/:id", (req, res) => { + const tunnel = req.registry.get(String(req.params.id || "").toLowerCase()); + res.json({ exists: !!tunnel, online: !!tunnel && tunnel.online }); +}); + +app.post("/gate/:id", async (req, res) => { + const tunnel = req.registry.get(String(req.params.id || "").toLowerCase()); + if (!tunnel) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + + const policy = tunnel.policy; + if (evaluate(policy, req.info.clientIp, req.intel.lookup(req.info.clientIp))) { + return res.status(403).json({ error: "forbidden", message: "Your address is not allowed to use this tunnel" }); + } + if (policy.auth !== "password") return res.status(400).json({ error: "bad_request", message: "This tunnel does not use a password" }); + + const key = `gate:${tunnel.id}:${req.info.clientIp}`; + if (req.attempts.blocked(key)) { + return res.status(429).json({ error: "too_many_attempts", message: "Too many attempts. Please try again later." }); + } + + if (!await verifyPassword(String(req.body.password || ""), policy.passwordHash)) { + req.attempts.record(key); + logger.warn(`Failed gate attempt for ${tunnel.id}`, { ip: req.info.clientIp }); + return res.status(401).json({ error: "unauthorized", message: "Wrong password" }); + } + + req.attempts.forget(key); + const token = req.access.create(tunnel.id); + res.header("Set-Cookie", cookieFor(token, req.info.secure)).json({ ok: true }); +}); + +const redirect = (res, location) => res.raw.writeHead(302, { Location: location, "Cache-Control": "no-store" }).end(); + +const returnTarget = (req, tunnel, raw) => { + const url = URL.parse(raw); + if (!url || !["http:", "https:"].includes(url.protocol)) return null; + const host = classifyHost(url.hostname, req.config.baseDomain); + if (host.kind === "base") { + url.searchParams.delete(QUERY_PARAM); + return { url, to: `/@${tunnel.id}${url.pathname}${url.search}` }; + } + const owner = host.kind === "subdomain" ? host.id : req.domains.tunnelFor(url.hostname); + return owner === tunnel.id ? { url, to: `${url.pathname}${url.search}` } : null; +}; + +app.get("/gate/:id/authorize", async (req, res) => { + const tunnel = req.registry.get(req.params.id.toLowerCase()); + if (!tunnel || tunnel.policy.auth !== "frislit") return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + if (evaluate(tunnel.policy, req.info.clientIp, req.intel.lookup(req.info.clientIp))) { + return res.status(403).json({ error: "forbidden", message: "Your address is not allowed to use this tunnel" }); + } + const target = returnTarget(req, tunnel, req.query.get("return")); + if (!target) return res.status(400).json({ error: "bad_request", message: "That return address does not belong to this tunnel" }); + + if (!await req.sessions.get(sessionToken(req.raw))) return redirect(res, `/@frislit/login?next=${encodeURIComponent(req.raw.url)}`); + + const session = await req.sessions.get(sessionToken(req.raw)); + if (!accountAllowed(tunnel.policy, session.account.id, tunnel.accountId)) { + return res.status(403).json({ error: "forbidden", message: "Your account is not allowed to use this tunnel" }); + } + + const code = req.access.issueCode(tunnel.id, target.url.hostname); + redirect(res, `${target.url.origin}/@frislit/gate?code=${code}&to=${encodeURIComponent(target.to)}`); +}); + +module.exports = app; diff --git a/server/routes/settings.js b/server/routes/settings.js new file mode 100644 index 0000000..a62037a --- /dev/null +++ b/server/routes/settings.js @@ -0,0 +1,23 @@ +const { Router } = require("../utils/router"); +const { getSettings, updateSettings, changePassword } = require("../controllers/settings"); +const { requireAdmin, requireBrowser } = require("../middlewares/auth"); + +const app = Router(); + +app.get("/", (req, res) => { + res.json(getSettings(req.config)); +}); + +app.put("/", requireAdmin, async (req, res) => { + const result = await updateSettings(req.config, req.body); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.put("/password", requireBrowser, async (req, res) => { + const result = await changePassword(req.account, req.body); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +module.exports = app; diff --git a/server/routes/setup.js b/server/routes/setup.js new file mode 100644 index 0000000..28fff87 --- /dev/null +++ b/server/routes/setup.js @@ -0,0 +1,18 @@ +const { Router } = require("../utils/router"); +const { getSetupStatus, completeSetup } = require("../controllers/setup"); +const { sessionCookie } = require("../lib/sessions"); + +const app = Router(); + +app.get("/status", async (req, res) => { + res.json(await getSetupStatus(req.config)); +}); + +app.post("/complete", async (req, res) => { + const result = await completeSetup(req.config, req.body); + if (result.code) return res.status(result.code).json(result); + const token = await req.sessions.create(result.account.id, { ip: req.info.clientIp, userAgent: req.headers["user-agent"] || "" }); + res.header("Set-Cookie", sessionCookie(token, req.info.secure)).json({ message: result.message }); +}); + +module.exports = app; diff --git a/server/routes/tls.js b/server/routes/tls.js new file mode 100644 index 0000000..044244a --- /dev/null +++ b/server/routes/tls.js @@ -0,0 +1,81 @@ +const { Router } = require("../utils/router"); +const store = require("../lib/tls/store"); +const providers = require("../lib/tls/providers"); +const logger = require("../utils/logger"); + +const app = Router(); + +const describeSettings = settings => ({ + email: settings.email, + provider: settings.provider, + hasCredential: !!settings.credential, +}); + +app.get("/", async (req, res) => { + const settings = await store.settings(); + res.json({ + mode: req.config.tlsMode, + wildcard: req.config.wildcard, + httpsPort: req.config.httpsPort, + redirectPort: req.config.redirectPort, + providers: providers.describe(), + acme: describeSettings(settings), + status: req.certificates.status(), + }); +}); + +app.put("/", async (req, res) => { + const { email, provider, credential } = req.body || {}; + const values = {}; + + if (email !== undefined) { + const trimmed = String(email || "").trim(); + if (trimmed && !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(trimmed)) { + return res.status(400).json({ code: 400, message: "That does not look like an email address" }); + } + values.email = trimmed || null; + } + if (provider !== undefined) { + if (!providers.get(provider)) return res.status(400).json({ code: 400, message: `Unknown DNS provider "${provider}"` }); + values.provider = provider; + } + if (credential !== undefined) values.credential = String(credential || "").trim() || null; + + if (!Object.keys(values).length) return res.status(400).json({ code: 400, message: "Nothing to change" }); + await store.saveSettings(values); + logger.info(`${req.session.username} updated the certificate settings`, { provider: values.provider }); + res.json({ message: "Saved", acme: describeSettings(await store.settings()) }); +}); + +app.post("/verify", async (req, res) => { + const settings = await store.settings(); + const provider = providers.get(settings.provider); + if (!provider?.verify) return res.status(400).json({ code: 400, message: "This provider has nothing to verify" }); + if (!settings.credential) return res.status(400).json({ code: 400, message: `${provider.title} needs an API token` }); + + try { + const result = await provider.verify(settings.credential, req.config.baseDomain); + res.json(result); + } catch (error) { + res.status(502).json({ code: 502, message: error.message }); + } +}); + +app.post("/request", async (req, res) => { + const result = await req.certificates.request(); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.post("/continue", (req, res) => { + if (!req.certificates.continueManual()) { + return res.status(409).json({ code: 409, message: "Nothing is waiting for a DNS record right now" }); + } + res.json({ message: "Checking the record" }); +}); + +app.get("/status", (req, res) => { + res.json({ status: req.certificates.status() }); +}); + +module.exports = app; diff --git a/server/routes/tunnels.js b/server/routes/tunnels.js new file mode 100644 index 0000000..f6aa7cd --- /dev/null +++ b/server/routes/tunnels.js @@ -0,0 +1,179 @@ +const { Router } = require("../utils/router"); +const { listTunnels, closeTunnel, getTunnel, disconnectClient, disconnectAllClients, updateAccess, updateMode, replay, mayTouch, getBreakpoints, setBreakpoints, resolveBreakpoint } = require("../controllers/tunnels"); +const accounts = require("../lib/accounts"); +const persistent = require("../lib/persistent"); + +const reply = (res, result) => (result.code ? res.status(result.code).json(result) : res.json(result)); +const { toHar } = require("../lib/har"); + +const app = Router(); + +app.get("/", (req, res) => { + res.json({ tunnels: listTunnels(req.registry, req.session), gracePeriod: req.config.gracePeriod, httpMode: req.config.httpMode, now: Date.now() }); +}); + +app.get("/:id", async (req, res) => { + const tunnel = await getTunnel(req.registry, req.traffic, req.params.id.toLowerCase(), req.session); + if (!tunnel) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + res.json({ tunnel, gracePeriod: req.config.gracePeriod, now: Date.now() }); +}); + +app.get("/:id/requests.har", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const rows = await req.traffic.all(id); + const frames = await req.frames.forConnections(id, rows.filter(row => row.connection).map(row => row.connection)); + res.header("Content-Disposition", `attachment; filename="${id}.har"`).json(toHar(rows, req.config.publicScheme, frames)); +}); + +app.get("/:id/requests", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const list = key => (req.query.get(key) || "").split(",").map(value => value.trim()).filter(Boolean); + const filter = { + search: (req.query.get("search") || "").trim().slice(0, 200), + methods: list("methods").map(method => method.toUpperCase()), + statuses: list("statuses").map(Number).filter(value => value >= 1 && value <= 5), + countries: list("countries").map(code => code.toUpperCase()).filter(code => /^[A-Z]{2}$/.test(code)), + }; + const options = { filter, sort: req.query.get("sort") || "time", order: req.query.get("order") || "desc", offset: Number(req.query.get("offset")) || 0, limit: Number(req.query.get("limit")) || undefined }; + const [requests, total, countries] = await Promise.all([req.traffic.list(id, options), req.traffic.count(id, filter), req.traffic.countries(id)]); + res.json({ requests, total, countries, now: Date.now() }); +}); + +app.get("/:id/visitors", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const options = { sort: req.query.get("sort") || "last", order: req.query.get("order") || "desc", offset: Number(req.query.get("offset")) || 0, limit: Number(req.query.get("limit")) || undefined }; + const visitors = await req.visitors.list(id, options); + const total = await req.visitors.count(id); + res.json({ visitors, total, now: Date.now() }); +}); + +app.delete("/:id/visitors", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + await req.visitors.forget(id); + res.json({ message: "Visitors cleared" }); +}); + +app.get("/:id/connections", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const options = { sort: req.query.get("sort") || "started", order: req.query.get("order") || "desc", offset: Number(req.query.get("offset")) || 0, limit: Number(req.query.get("limit")) || undefined }; + const connections = await req.connections.list(id, options); + const total = await req.connections.count(id); + res.json({ connections, total, now: Date.now() }); +}); + +app.get("/:id/connections/:key", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const connection = await req.connections.get(id, req.params.key); + if (!connection) return res.status(404).json({ error: "not_found", message: "Connection not found" }); + res.json({ connection, now: Date.now() }); +}); + +app.delete("/:id/connections", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + await req.connections.clear(id); + res.json({ message: "Connections cleared" }); +}); + +app.delete("/:id/requests", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + await req.traffic.forget(id); + res.json({ message: "Requests cleared" }); +}); + +app.get("/:id/requests/:requestId/frames", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const entry = await req.traffic.get(id, Number(req.params.requestId)); + if (!entry?.connection) return res.status(404).json({ error: "not_found", message: "No frames for that request" }); + const after = Number(req.query.get("after")) || 0; + res.json({ frames: await req.frames.list(id, entry.connection, after), open: req.frames.isOpen(entry.connection), now: Date.now() }); +}); + +app.post("/:id/requests/:requestId/frames", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const entry = await req.traffic.get(id, Number(req.params.requestId)); + if (!entry?.connection) return res.status(404).json({ error: "not_found", message: "No such connection" }); + const { direction, text } = req.body; + if (!["in", "out"].includes(direction)) return res.status(400).json({ code: 400, message: "direction must be in or out" }); + if (typeof text !== "string" || !text) return res.status(400).json({ code: 400, message: "Nothing to send" }); + if (!req.frames.inject(id, entry.connection, direction, Buffer.from(text, "utf8"))) return res.status(409).json({ code: 409, message: "The connection is closed" }); + res.json({ message: "Sent" }); +}); + +app.get("/:id/requests/:requestId", async (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const entry = await req.traffic.get(id, Number(req.params.requestId)); + if (!entry) return res.status(404).json({ error: "not_found", message: "That request is no longer stored" }); + res.json({ request: entry }); +}); + +app.post("/:id/requests/:requestId/replay", async (req, res) => { + const result = await replay(req, req.params.id.toLowerCase(), Number(req.params.requestId), req.body || {}); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.get("/:id/breakpoints", (req, res) => reply(res, getBreakpoints(req, req.params.id.toLowerCase()))); + +app.put("/:id/breakpoints", (req, res) => reply(res, setBreakpoints(req, req.params.id.toLowerCase(), req.body || {}))); + +app.post("/:id/breakpoints/:holdId", (req, res) => reply(res, resolveBreakpoint(req, req.params.id.toLowerCase(), req.params.holdId, req.body || {}))); + +app.get("/:id/stats", (req, res) => { + const id = req.params.id.toLowerCase(); + if (!mayTouch(req.registry.get(id), req.session)) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + res.json({ stats: req.stats.read(id), now: Date.now() }); +}); + +app.put("/:id/access", async (req, res) => { + const result = await updateAccess(req.registry, req.access, req.params.id.toLowerCase(), req.body || {}, req.session); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.get("/:id/access/accounts", async (req, res) => { + const id = req.params.id.toLowerCase(); + const live = req.registry.get(id); + const definition = live ? null : await persistent.load(id); + const owner = live ? live.accountId : definition?.accountId; + const allowed = !!owner && (req.session.role === "admin" || owner === req.session.account.id); + if (!allowed) return res.status(404).json({ error: "not_found", message: "Tunnel not found" }); + const list = (await accounts.list()).map(account => ({ id: account.id, username: account.username })); + res.json({ accounts: list }); +}); + +app.put("/:id/mode", async (req, res) => { + const result = await updateMode(req.registry, req.params.id.toLowerCase(), req.body || {}, req.session); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.delete("/:id/clients", (req, res) => { + const result = disconnectAllClients(req.registry, req.params.id.toLowerCase(), req.session); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.delete("/:id/clients/:clientId", (req, res) => { + const result = disconnectClient(req.registry, req.params.id.toLowerCase(), req.params.clientId, req.session); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +app.delete("/:id", (req, res) => { + const result = closeTunnel(req.registry, req.params.id.toLowerCase(), req.session); + if (result.code) return res.status(result.code).json(result); + res.json(result); +}); + +module.exports = app; diff --git a/server/utils/attempts.js b/server/utils/attempts.js new file mode 100644 index 0000000..7c82af7 --- /dev/null +++ b/server/utils/attempts.js @@ -0,0 +1,40 @@ +const WINDOW = 15 * 60 * 1000; +const MAX_FAILURES = 20; +const MAX_KEYS = 10_000; + +class AttemptLimiter { + constructor({ window = WINDOW, max = MAX_FAILURES } = {}) { + this.window = window; + this.max = max; + this.failures = new Map(); + this.sweeper = setInterval(() => this.sweep(), window); + this.sweeper.unref(); + } + + blocked(key) { + const entry = this.failures.get(key); + if (!entry) return false; + if (Date.now() - entry.since > this.window) { this.failures.delete(key); return false; } + return entry.count >= this.max; + } + + record(key) { + const now = Date.now(); + const entry = this.failures.get(key); + if (entry && now - entry.since <= this.window) { entry.count += 1; return; } + if (this.failures.size >= MAX_KEYS) this.sweep(); + if (this.failures.size >= MAX_KEYS) this.failures.delete(this.failures.keys().next().value); + this.failures.set(key, { count: 1, since: now }); + } + + forget(key) { + this.failures.delete(key); + } + + sweep() { + const now = Date.now(); + for (const [key, entry] of this.failures) if (now - entry.since > this.window) this.failures.delete(key); + } +} + +module.exports = { AttemptLimiter }; diff --git a/server/utils/auth.js b/server/utils/auth.js new file mode 100644 index 0000000..1ee05b7 --- /dev/null +++ b/server/utils/auth.js @@ -0,0 +1,34 @@ +const crypto = require("node:crypto"); +const accounts = require("../lib/accounts"); +const invites = require("../lib/invites"); + +const safeEqual = (a, b) => { + const ha = crypto.createHash("sha256").update(String(a)).digest(); + const hb = crypto.createHash("sha256").update(String(b)).digest(); + return crypto.timingSafeEqual(ha, hb); +}; + +const createAuth = devices => ({ + deviceFor: async presented => { + const device = await devices.verify(presented); + if (device) return { accountId: device.accountId, credential: `device:${device.id}` }; + const invite = await invites.verify(presented); + return invite && { accountId: invite.accountId, credential: `invite:${invite.id}`, guest: invite }; + }, + + accountFor: async device => { + const account = await accounts.byId(device.accountId); + return account ? { id: account.id, username: account.username, role: account.role } : null; + }, + + verifyToken: async presented => !!await devices.verify(presented), + + bearerFromHeaders: headers => { + const value = headers["authorization"]; + if (!value) return null; + const match = /^Bearer\s+(.+)$/i.exec(value.trim()); + return match ? match[1].trim() : null; + }, +}); + +module.exports = { createAuth, safeEqual }; diff --git a/server/utils/config.js b/server/utils/config.js new file mode 100644 index 0000000..94a5e0b --- /dev/null +++ b/server/utils/config.js @@ -0,0 +1,149 @@ +const fs = require("node:fs"); +const path = require("node:path"); +const yaml = require("js-yaml"); +const logger = require("./logger"); + +const DEFAULTS = { + listen: "0.0.0.0", + port: 8080, + httpsPort: 443, + redirectPort: 80, + baseDomain: "", + publicUrl: "", + tlsMode: "proxy", + acmeDirectoryUrl: "", + trustProxy: false, + httpMode: "subdomain", + gracePeriod: 30, +}; + +const ENV = { + listen: "FRISLIT_LISTEN", + port: "FRISLIT_PORT", + httpsPort: "FRISLIT_HTTPS_PORT", + redirectPort: "FRISLIT_REDIRECT_PORT", + tlsMode: "FRISLIT_TLS_MODE", + acmeDirectoryUrl: "FRISLIT_ACME_DIRECTORY", + baseDomain: "FRISLIT_BASE_DOMAIN", + publicUrl: "FRISLIT_PUBLIC_URL", + trustProxy: "FRISLIT_TRUST_PROXY", + httpMode: "FRISLIT_HTTP_MODE", + gracePeriod: "FRISLIT_GRACE_PERIOD", +}; + +const UI_SETTING_KEYS = ["baseDomain", "publicUrl", "httpMode", "gracePeriod", "tlsMode", "trustProxy"]; +const PINNED_BY_ENV = { tlsMode: "The HTTPS mode" }; + +// A deployment configured for tunlit keeps working: FRISLIT_* wins, TUNLIT_* is the fallback. +const readEnv = name => { + const value = process.env[name]; + if (value !== undefined && value !== "") return value; + const old = name.replace(/^FRISLIT_/, "TUNLIT_"); + const legacy = process.env[old]; + if (legacy !== undefined && legacy !== "") { + logger.warn(`Using the deprecated ${old}; rename it to ${name}`); + return legacy; + } + return undefined; +}; + +const pinned = (config, key) => key in PINNED_BY_ENV && config.sources[key] === "env"; + +const parseBool = value => ["1", "true", "yes", "on"].includes(String(value).trim().toLowerCase()); + +const normalize = config => { + config.port = Number(config.port); + config.httpsPort = Number(config.httpsPort); + config.redirectPort = Number(config.redirectPort); + config.gracePeriod = Number(config.gracePeriod); + config.baseDomain = String(config.baseDomain || "").trim().toLowerCase().replace(/^\.+/, "").replace(/\.+$/, ""); + config.httpMode = String(config.httpMode || "subdomain").trim().toLowerCase(); + config.tlsMode = String(config.tlsMode || "proxy").trim().toLowerCase(); + config.acmeDirectoryUrl = String(config.acmeDirectoryUrl || "").trim(); + + config.managesTls = config.tlsMode === "acme"; + config.trustProxy = config.managesTls + ? false + : typeof config.trustProxy === "boolean" ? config.trustProxy : parseBool(config.trustProxy); + + config.publicUrlConfigured = String(config.publicUrlConfigured ?? config.publicUrl ?? "").trim().replace(/\/+$/, ""); + config.publicUrl = config.publicUrlConfigured || (config.baseDomain ? `https://${config.baseDomain}` : ""); + config.publicScheme = config.publicUrl.startsWith("http://") ? "http" : "https"; + config.wildcard = config.httpMode === "subdomain"; + config.ready = !!config.baseDomain; +}; + +const validate = config => { + const problems = []; + if (!["subdomain", "path"].includes(config.httpMode)) problems.push("httpMode must be \"subdomain\" or \"path\""); + if (!["proxy", "acme"].includes(config.tlsMode)) problems.push("tlsMode must be \"proxy\" or \"acme\""); + for (const key of ["port", "httpsPort", "redirectPort"]) { + if (!Number.isInteger(config[key]) || config[key] < 1 || config[key] > 65535) problems.push(`${key} must be a number between 1 and 65535`); + } + if (!Number.isFinite(config.gracePeriod) || config.gracePeriod < 0) problems.push("gracePeriod must be a non-negative number of seconds"); + if (config.publicUrlConfigured && !/^https?:\/\/[^/\s]+$/.test(config.publicUrlConfigured)) problems.push("publicUrl must look like https://host[:port] without a path"); + if (config.baseDomain && !/^[a-z0-9.-]+$/.test(config.baseDomain)) problems.push("baseDomain must be a hostname"); + return problems; +}; + +const loadConfig = () => { + const file = readEnv("FRISLIT_CONFIG") || path.join(process.cwd(), "config.yml"); + let fromFile = {}; + if (fs.existsSync(file)) { + const parsed = yaml.load(fs.readFileSync(file, "utf8")); + if (parsed && typeof parsed !== "object") throw new Error(`${file} must contain a YAML mapping`); + fromFile = parsed || {}; + } + + const config = { ...DEFAULTS }; + const sources = Object.fromEntries(Object.keys(DEFAULTS).map(key => [key, "default"])); + for (const key of Object.keys(DEFAULTS)) { + if (fromFile[key] !== undefined && fromFile[key] !== null && fromFile[key] !== "") { config[key] = fromFile[key]; sources[key] = "file"; } + } + for (const [key, name] of Object.entries(ENV)) { + const value = readEnv(name); + if (value !== undefined) { config[key] = value; sources[key] = "env"; } + } + + normalize(config); + const problems = validate(config); + if (problems.length) throw new Error("Invalid configuration:\n - " + problems.join("\n - ")); + + config.sources = sources; + config.configFile = file; + return config; +}; + +const applySettings = (config, requested) => { + const settings = { ...requested }; + for (const key of Object.keys(settings).filter(key => pinned(config, key))) { + if (String(settings[key]).trim().toLowerCase() !== config[key]) { + throw Object.assign(new Error(`${PINNED_BY_ENV[key]} is set by ${ENV[key]}`), { code: "invalid_settings" }); + } + delete settings[key]; + } + const next = { ...config, ...settings }; + if ("publicUrl" in settings) next.publicUrlConfigured = settings.publicUrl; + normalize(next); + const problems = validate(next); + if (problems.length) throw Object.assign(new Error(problems.join(", ")), { code: "invalid_settings" }); + Object.assign(config, next); + for (const key of Object.keys(settings)) config.sources[key] = "ui"; + return config; +}; + +const applyStored = (config, stored) => { + for (const key of UI_SETTING_KEYS) { + const value = stored[key]; + if (value === undefined || value === null || value === "" || pinned(config, key)) continue; + config[key] = value; + config.sources[key] = "ui"; + } + if ("publicUrl" in stored) config.publicUrlConfigured = stored.publicUrl; + normalize(config); + const problems = validate(config); + if (problems.length) throw new Error("Stored settings are invalid:\n - " + problems.join("\n - ")); + return config; +}; + +module.exports = { loadConfig, applySettings, applyStored, UI_SETTING_KEYS }; diff --git a/server/utils/database.js b/server/utils/database.js new file mode 100644 index 0000000..b7282b7 --- /dev/null +++ b/server/utils/database.js @@ -0,0 +1,42 @@ +const fs = require("node:fs"); +const path = require("node:path"); +const { Sequelize } = require("sequelize"); +const { dataDir } = require("./paths"); +const logger = require("./logger"); + +const storage = adoptLegacyDatabase(path.join(dataDir(), "frislit.db")); + +/* + * A data directory that was served by tunlit still holds tunlit.db. Rename it + * instead of starting from an empty database; if the rename fails (read-only + * mount, different filesystem), use the old file in place. + */ +function adoptLegacyDatabase(target) { + const legacy = path.join(path.dirname(target), "tunlit.db"); + if (fs.existsSync(target) || !fs.existsSync(legacy)) return target; + + try { + fs.renameSync(legacy, target); + for (const suffix of ["-wal", "-shm"]) { + if (fs.existsSync(legacy + suffix)) fs.renameSync(legacy + suffix, target + suffix); + } + logger.info(`Adopted the tunlit database as ${path.basename(target)}`); + return target; + } catch (error) { + logger.warn(`Could not rename tunlit.db (${error.message}), using it in place`); + return legacy; + } +} + +Sequelize.DATE.prototype._stringify = function (date) { + return (date instanceof Date ? date : new Date(date)).toISOString(); +}; + +module.exports = new Sequelize({ + dialect: "sqlite", + storage, + logging: message => logger.debug(message), + query: { raw: true }, +}); + +module.exports.storagePath = storage; diff --git a/server/utils/html.js b/server/utils/html.js new file mode 100644 index 0000000..5e5e7df --- /dev/null +++ b/server/utils/html.js @@ -0,0 +1,7 @@ +const sendJson = (res, status, data, extraHeaders = {}) => { + const body = JSON.stringify(data); + res.writeHead(status, { "Content-Type": "application/json; charset=utf-8", "Content-Length": Buffer.byteLength(body), "Cache-Control": "no-store", ...extraHeaders }); + res.end(body); +}; + +module.exports = { sendJson }; diff --git a/server/utils/ids.js b/server/utils/ids.js new file mode 100644 index 0000000..48436fe --- /dev/null +++ b/server/utils/ids.js @@ -0,0 +1,31 @@ +const crypto = require("node:crypto"); + +const ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789"; +const MIXED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; +const NAME_REGEX = /^[a-z0-9-]{3,32}$/; +const RESERVED = new Set(["frislit"]); +const SECRET_LENGTH = 26; + +const randomFrom = (alphabet, length) => { + const bytes = crypto.randomBytes(length); + let out = ""; + for (let i = 0; i < length; i++) out += alphabet[bytes[i] % alphabet.length]; + return out; +}; + +const randomId = (length = 6) => randomFrom(ALPHABET, length); +const randomSecret = () => randomFrom(MIXED, SECRET_LENGTH); +const randomToken = (length = 32) => randomFrom(MIXED, length); + +const isValidName = name => NAME_REGEX.test(name) && !RESERVED.has(name); +const isReserved = name => RESERVED.has(name); + +const hashSecret = secret => crypto.createHash("sha256").update(secret).digest(); +const hashToken = token => crypto.createHash("sha256").update(String(token)).digest("hex"); + +const splitShareCode = code => { + if (typeof code !== "string" || !/^[a-z0-9-]+[A-Za-z0-9]{26}$/.test(code)) return null; + return { id: code.slice(0, -SECRET_LENGTH), secret: code.slice(-SECRET_LENGTH) }; +}; + +module.exports = { randomId, randomSecret, randomToken, isValidName, isReserved, hashSecret, hashToken, splitShareCode, NAME_REGEX }; diff --git a/server/utils/logger.js b/server/utils/logger.js new file mode 100644 index 0000000..35018c5 --- /dev/null +++ b/server/utils/logger.js @@ -0,0 +1,24 @@ +const LEVELS = { error: 0, warn: 1, info: 2, debug: 3 }; +const COLORS = { error: "\x1b[31m", warn: "\x1b[33m", info: "\x1b[32m", debug: "\x1b[35m" }; +const RESET = "\x1b[0m"; + +const level = LEVELS[process.env.LOG_LEVEL] ?? LEVELS.info; +const useColor = process.stdout.isTTY && !process.env.NO_COLOR; + +const log = (lvl, message, meta) => { + if (LEVELS[lvl] > level) return; + const time = new Date().toISOString(); + const tag = useColor ? `${COLORS[lvl]}${lvl.padEnd(5)}${RESET}` : lvl.padEnd(5); + const extra = meta && Object.keys(meta).length + ? " " + Object.entries(meta).map(([k, v]) => `${k}=${typeof v === "object" ? JSON.stringify(v) : v}`).join(" ") + : ""; + const line = `${time} ${tag} ${message}${extra}`; + (lvl === "error" || lvl === "warn" ? console.error : console.log)(line); +}; + +module.exports = { + error: (m, meta) => log("error", m, meta), + warn: (m, meta) => log("warn", m, meta), + info: (m, meta) => log("info", m, meta), + debug: (m, meta) => log("debug", m, meta), +}; diff --git a/server/utils/migrationRunner.js b/server/utils/migrationRunner.js new file mode 100644 index 0000000..546e4ab --- /dev/null +++ b/server/utils/migrationRunner.js @@ -0,0 +1,41 @@ +const fs = require("node:fs"); +const path = require("node:path"); +const { DataTypes } = require("sequelize"); +const db = require("./database"); +const logger = require("./logger"); + +const MIGRATION_DIR = path.join(__dirname, "..", "migrations"); + +const ensureTable = async queryInterface => { + const tables = await queryInterface.showAllTables(); + if (tables.includes("SequelizeMeta")) return; + await queryInterface.createTable("SequelizeMeta", { + name: { type: DataTypes.STRING, allowNull: false, primaryKey: true }, + }); +}; + +const executed = async () => { + const rows = await db.query("SELECT name FROM SequelizeMeta ORDER BY name ASC", { type: db.QueryTypes.SELECT }); + return rows.map(row => row.name); +}; + +const runMigrations = async () => { + const queryInterface = db.getQueryInterface(); + await ensureTable(queryInterface); + + const done = new Set(await executed()); + const files = fs.existsSync(MIGRATION_DIR) + ? fs.readdirSync(MIGRATION_DIR).filter(file => file.endsWith(".js")).sort() + : []; + const pending = files.filter(file => !done.has(file)); + if (!pending.length) return; + + for (const file of pending) { + const migration = require(path.join(MIGRATION_DIR, file)); + await migration.up(queryInterface, db); + await db.query("INSERT INTO SequelizeMeta (name) VALUES (?)", { replacements: [file] }); + logger.info(`Applied migration ${file}`); + } +}; + +module.exports = { runMigrations }; diff --git a/server/utils/pages.js b/server/utils/pages.js new file mode 100644 index 0000000..3770f41 --- /dev/null +++ b/server/utils/pages.js @@ -0,0 +1,27 @@ +const { readIndex } = require("./static"); +const { sendJson } = require("./html"); + +const isNavigation = req => { + const dest = req.headers["sec-fetch-dest"]; + if (dest === "document") return true; + if (dest && dest !== "empty") return false; + return /\btext\/html\b/.test(req.headers.accept || ""); +}; + +const sendAppState = (req, res, status, state, extraHeaders = {}) => { + const html = readIndex(); + + if (!isNavigation(req) || !html) return sendJson(res, status, { error: state.kind, ...state }, extraHeaders); + + const payload = JSON.stringify(state).replace(/", ``); + res.writeHead(status, { + "Content-Type": "text/html; charset=utf-8", + "Content-Length": Buffer.byteLength(body), + "Cache-Control": "no-store", + ...extraHeaders, + }); + res.end(req.method === "HEAD" ? undefined : body); +}; + +module.exports = { sendAppState, isNavigation }; diff --git a/server/utils/password.js b/server/utils/password.js new file mode 100644 index 0000000..20b2abf --- /dev/null +++ b/server/utils/password.js @@ -0,0 +1,24 @@ +const crypto = require("node:crypto"); + +const KEY_LENGTH = 64; +const SCRYPT_OPTIONS = { N: 16384, r: 8, p: 1 }; + +const scrypt = (password, salt, length) => new Promise((resolve, reject) => { + crypto.scrypt(password, salt, length, SCRYPT_OPTIONS, (err, derived) => err ? reject(err) : resolve(derived)); +}); + +const hashPassword = password => { + const salt = crypto.randomBytes(16); + const hash = crypto.scryptSync(password, salt, KEY_LENGTH, SCRYPT_OPTIONS); + return `scrypt$${salt.toString("hex")}$${hash.toString("hex")}`; +}; + +const verifyPassword = async (password, stored) => { + const [scheme, saltHex, hashHex] = String(stored || "").split("$"); + if (scheme !== "scrypt" || !saltHex || !hashHex) return false; + const expected = Buffer.from(hashHex, "hex"); + const actual = await scrypt(String(password), Buffer.from(saltHex, "hex"), expected.length); + return crypto.timingSafeEqual(actual, expected); +}; + +module.exports = { hashPassword, verifyPassword }; diff --git a/server/utils/paths.js b/server/utils/paths.js new file mode 100644 index 0000000..97ca1dd --- /dev/null +++ b/server/utils/paths.js @@ -0,0 +1,5 @@ +const path = require("node:path"); + +const dataDir = () => process.env.FRISLIT_DATA_DIR || process.env.TUNLIT_DATA_DIR || path.join(process.cwd(), "data"); + +module.exports = { dataDir }; diff --git a/server/utils/router.js b/server/utils/router.js new file mode 100644 index 0000000..91ab9be --- /dev/null +++ b/server/utils/router.js @@ -0,0 +1,79 @@ +const { sendJson } = require("./html"); + +const MAX_BODY = 64 * 1024; + +const readBody = req => new Promise((resolve, reject) => { + const chunks = []; + let size = 0; + req.on("data", chunk => { + size += chunk.length; + if (size > MAX_BODY) { reject(Object.assign(new Error("Request body too large"), { status: 413 })); req.destroy(); return; } + chunks.push(chunk); + }); + req.on("end", () => { + if (!chunks.length) return resolve({}); + try { resolve(JSON.parse(Buffer.concat(chunks).toString("utf8"))); } catch { reject(Object.assign(new Error("Body must be valid JSON"), { status: 400 })); } + }); + req.on("error", reject); +}); + +const compile = pattern => { + const keys = []; + const source = pattern.replace(/\/:([a-zA-Z]+)/g, (_, key) => { keys.push(key); return "/([^/]+)"; }); + return { regex: new RegExp(`^${source}/?$`), keys }; +}; + +const Router = () => { + const routes = []; + const add = method => (pattern, ...handlers) => routes.push({ method, ...compile(pattern), handlers }); + return { routes, get: add("GET"), post: add("POST"), put: add("PUT"), patch: add("PATCH"), delete: add("DELETE") }; +}; + +const createResponse = res => ({ + raw: res, + statusCode: 200, + headers: {}, + status(code) { this.statusCode = code; return this; }, + header(name, value) { this.headers[name] = value; return this; }, + json(data) { sendJson(res, this.statusCode, data, this.headers); }, +}); + +const createApp = () => { + const mounts = []; + const app = { + use: (prefix, ...args) => { + const router = args.pop(); + mounts.push({ prefix, middlewares: args, router }); + }, + handle: async (req, res, pathname, context) => { + const url = new URL(req.url, "http://frislit.invalid"); + for (const mount of mounts) { + if (pathname !== mount.prefix && !pathname.startsWith(`${mount.prefix}/`)) continue; + const rest = pathname.slice(mount.prefix.length) || "/"; + for (const route of mount.router.routes) { + if (route.method !== req.method) continue; + const match = route.regex.exec(rest); + if (!match) continue; + const request = { raw: req, method: req.method, headers: req.headers, query: url.searchParams, params: Object.fromEntries(route.keys.map((key, i) => [key, decodeURIComponent(match[i + 1])])), body: {}, ...context }; + const response = createResponse(res); + try { + if (["POST", "PUT", "PATCH"].includes(req.method)) request.body = await readBody(req); + for (const handler of [...mount.middlewares, ...route.handlers]) { + let proceed = false; + await handler(request, response, () => { proceed = true; }); + if (!proceed) return true; + } + } catch (err) { + if (!res.headersSent) sendJson(res, err.status || 500, { code: err.status || 500, message: err.status ? err.message : "Internal error" }); + if (!err.status) throw err; + } + return true; + } + } + return false; + }, + }; + return app; +}; + +module.exports = { Router, createApp }; diff --git a/server/utils/static.js b/server/utils/static.js new file mode 100644 index 0000000..a4d0b36 --- /dev/null +++ b/server/utils/static.js @@ -0,0 +1,60 @@ +const fs = require("node:fs"); +const path = require("node:path"); + +const DIST_DIR = path.join(__dirname, "..", "..", "client", "dist"); + +const MIME = { + ".html": "text/html; charset=utf-8", + ".js": "text/javascript; charset=utf-8", + ".css": "text/css; charset=utf-8", + ".svg": "image/svg+xml", + ".png": "image/png", + ".ico": "image/x-icon", + ".json": "application/json; charset=utf-8", + ".woff": "font/woff", + ".woff2": "font/woff2", + ".txt": "text/plain; charset=utf-8", + ".map": "application/json; charset=utf-8", +}; + +const hasBuild = () => fs.existsSync(path.join(DIST_DIR, "index.html")); + +let cached = null; +const readIndex = () => { + const file = path.join(DIST_DIR, "index.html"); + if (!fs.existsSync(file)) return null; + const stamp = fs.statSync(file).mtimeMs; + if (!cached || cached.stamp !== stamp) cached = { stamp, html: fs.readFileSync(file, "utf8") }; + return cached.html; +}; + +const sendFile = (req, res, relative) => { + const file = path.normalize(path.join(DIST_DIR, relative)); + if (!file.startsWith(DIST_DIR + path.sep)) return false; + let stats; + try { + stats = fs.statSync(file); + } catch { + return false; + } + if (!stats.isFile()) return false; + const immutable = relative.startsWith("assets/"); + res.writeHead(200, { + "Content-Type": MIME[path.extname(file).toLowerCase()] || "application/octet-stream", + "Content-Length": stats.size, + "Cache-Control": immutable ? "public, max-age=31536000, immutable" : "no-cache", + }); + if (req.method === "HEAD") return res.end(), true; + fs.createReadStream(file).pipe(res); + return true; +}; + +const MISSING_BUILD = `frislit

Web UI not built

Run npm run build in client/ (or use npm run dev for the Vite dev server) and reload.

`; + +const sendIndex = (req, res) => { + if (sendFile(req, res, "index.html")) return; + res.writeHead(503, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store" }); + res.end(MISSING_BUILD); +}; + +module.exports = { hasBuild, readIndex, sendFile, sendIndex };