Merge wip/hardening: notices, crash reports, CI hardening, release docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
commit
604acfa1ff
20 files changed
+13326
-5
No files matched your search
@@ -0,0 +1,21 @@
|
||||
name: Security audit
|
||||
|
||||
# RustSec advisories for Cargo.lock (what `cargo audit` checks), daily, so
|
||||
# new advisories show up without a push. CI's cargo-deny job checks the same
|
||||
# on every push together with licenses and sources.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "41 4 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
advisories:
|
||||
name: cargo-deny advisories
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: EmbarkStudios/cargo-deny-action@v2
|
||||
with:
|
||||
command: check advisories
|
||||
arguments: --workspace
|
||||
@@ -84,14 +84,14 @@ jobs:
|
||||
run: |
|
||||
mkdir -p dist
|
||||
cp target/release/tsc-desktop dist/
|
||||
cp packaging/linux/* dist/
|
||||
cp packaging/linux/* THIRD_PARTY_NOTICES.md dist/
|
||||
# The installer is built when NSIS is on the runner; unsigned.
|
||||
- name: Stage (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force dist | Out-Null
|
||||
Copy-Item target\release\tsc-desktop.exe dist\
|
||||
Copy-Item target\release\tsc-desktop.exe, THIRD_PARTY_NOTICES.md dist\
|
||||
$makensis = (Get-Command makensis -ErrorAction SilentlyContinue).Source
|
||||
if (-not $makensis) {
|
||||
$makensis = "${env:ProgramFiles(x86)}\NSIS\makensis.exe"
|
||||
@@ -110,6 +110,8 @@ jobs:
|
||||
path: dist/
|
||||
if-no-files-found: error
|
||||
|
||||
# Licenses, bans, sources and RustSec advisories (the `cargo audit`
|
||||
# database); audit.yml repeats the advisories check daily.
|
||||
deny:
|
||||
name: cargo-deny
|
||||
runs-on: ubuntu-24.04
|
||||
@@ -121,10 +123,33 @@ jobs:
|
||||
with:
|
||||
arguments: --workspace
|
||||
|
||||
# THIRD_PARTY_NOTICES.md (shown in the About page) must match Cargo.lock.
|
||||
# cargo-about's output is independent of the host (the graph is filtered
|
||||
# by the targets in about.toml), so the committed file is compared exactly.
|
||||
notices:
|
||||
name: third-party notices
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install toolchain (rust-toolchain.toml)
|
||||
run: rustup toolchain install
|
||||
# Caches ~/.cargo/bin too, so cargo-about is built once.
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
key: notices
|
||||
- name: Install cargo-about
|
||||
run: cargo install cargo-about --locked --version 0.9.2 --features cli
|
||||
- name: Check THIRD_PARTY_NOTICES.md
|
||||
run: scripts/notices.sh --check
|
||||
|
||||
# tsctl, the gateway, the engine and tsc-stream against real TS3 and TS6
|
||||
# servers, including a synthetic VP8 + Opus stream through the TS6 server
|
||||
# (scripts/it-smoke.sh).
|
||||
smoke:
|
||||
name: integration smoke (TS3 + TS6)
|
||||
runs-on: ubuntu-24.04
|
||||
needs: test
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/system-deps
|
||||
@@ -138,3 +163,45 @@ jobs:
|
||||
- name: Server logs
|
||||
if: failure()
|
||||
run: docker compose -f dev/docker-compose.yml logs --no-color
|
||||
# Client, gateway and stream logs the script keeps in dev/.state.
|
||||
- name: Upload smoke logs
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: smoke-logs
|
||||
path: dev/.state/*.log
|
||||
if-no-files-found: ignore
|
||||
|
||||
# Our WebRTC peers against Chromium's (libwebrtc, as in the official TS6
|
||||
# client); see tests/interop/README.md. Informational: a failure is
|
||||
# reported on the job but does not fail the workflow, since it depends on
|
||||
# a browser download and the runner's network interfaces.
|
||||
browser-interop:
|
||||
name: browser interop (tsc-stream, Chromium)
|
||||
runs-on: ubuntu-24.04
|
||||
needs: test
|
||||
continue-on-error: true
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
PLAYWRIGHT_VERSION: 1.56.1
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/system-deps
|
||||
- name: Install toolchain (rust-toolchain.toml)
|
||||
run: rustup toolchain install
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ env.PLAYWRIGHT_VERSION }}-chromium
|
||||
# Global install: the test finds Playwright through `npm root -g`.
|
||||
- name: Install Playwright and Chromium
|
||||
run: |
|
||||
npm install -g "playwright@$PLAYWRIGHT_VERSION"
|
||||
playwright install --with-deps chromium
|
||||
- name: Browser interop test
|
||||
run: TSC_INTEROP=1 cargo test --locked -p tsc-stream --test browser_interop -- --nocapture
|
||||
@@ -0,0 +1,23 @@
|
||||
# Changelog
|
||||
|
||||
User-visible changes of the apps and the `tsgw` gateway. The format follows
|
||||
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
||||
[docs/release.md](docs/release.md#versioning).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
The first release is in preparation.
|
||||
|
||||
### Added
|
||||
|
||||
- Desktop app (Linux Wayland/X11, Windows): servers and bookmarks, channel
|
||||
tree with talking indicators, server and channel chat, voice with
|
||||
push-to-talk (global hotkeys), voice activation, echo cancellation, noise
|
||||
suppression and gain control, per-user volume.
|
||||
- Observing a server invisibly and chatting in channels without joining
|
||||
them, through the `tsgw` gateway or own ServerQuery credentials.
|
||||
- TeamSpeak 6 streams: watching and sharing screens with sound (VP8, VP9,
|
||||
optional H.264 through Cisco's OpenH264, AV1 decoding).
|
||||
- `tsgw`: companion gateway for server admins (presence, channel chat
|
||||
relay, history).
|
||||
- Opt-in local crash reports; third-party notices in the About page.
|
||||
@@ -95,5 +95,9 @@ The vendored crates in `crates/proto/` are `MIT OR Apache-2.0` (upstream
|
||||
`LICENSE-MIT` / `LICENSE-APACHE` are kept there). New crates are declared under
|
||||
the same terms in `Cargo.toml`.
|
||||
|
||||
Third-party notices: the UI toolkit, Slint, is used under its royalty-free license, which
|
||||
requires an attribution in the app's About page.
|
||||
Third-party notices: [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md), generated from
|
||||
`Cargo.lock` by `scripts/notices.sh` and shown in the app's About page. The UI toolkit,
|
||||
Slint, is used under its royalty-free license, which requires an attribution in the
|
||||
About page.
|
||||
|
||||
Security issues: see [SECURITY.md](SECURITY.md). Releases: [docs/release.md](docs/release.md).
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# Security
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
Please report security problems privately through GitHub: **Security >
|
||||
Report a vulnerability** on
|
||||
https://github.com/Faumaray/teamspeak_client_rs (private vulnerability
|
||||
reporting). Do not open a public issue for them. If private reporting is not
|
||||
available, open an issue asking for a contact, without details.
|
||||
|
||||
Include what is affected (desktop app, Android app, `tsgw` gateway, `tsctl`),
|
||||
the version or commit, and how to reproduce. You should get an answer within
|
||||
a week. Fixes are released as soon as they are ready and credited in the
|
||||
changelog unless you prefer otherwise.
|
||||
|
||||
Supported versions: until 1.0, only the latest release gets fixes.
|
||||
|
||||
In scope: this repository's code and its packages. Problems in TeamSpeak
|
||||
servers or the official clients belong to TeamSpeak Systems GmbH; problems in
|
||||
dependencies to their projects (tell us too if this client is affected).
|
||||
|
||||
## What the client stores
|
||||
|
||||
Everything stays on the device; there is no telemetry and no account with
|
||||
us.
|
||||
|
||||
| What | Where | Protection |
|
||||
|---|---|---|
|
||||
| Identities (TeamSpeak private keys) | SQLite database `client.db` in the data directory (`~/.local/share/tsc`, Flatpak `~/.var/app/<app id>/data/tsc`, `%APPDATA%\tsc`, Android app storage) | File permissions of the user account only; not encrypted. An identity is the account on every server that knows it: back it up, do not share the file |
|
||||
| Server and ServerQuery passwords | OS keyring (Secret Service, Windows Credential Manager, Android Keystore), service `tsc-client` | Keyring; kept in memory for the session only when there is no keyring |
|
||||
| Bookmarks, settings, chat history | `client.db` | File permissions; history stays until deleted |
|
||||
| Crash reports (opt-in) | `crash-reports` in the state directory (`~/.local/state/tsc`, `%LOCALAPPDATA%\tsc`) | Local only, never uploaded. They contain the panic message and a backtrace, which may include server addresses or names; review before attaching one to an issue |
|
||||
| OpenH264 (opt-in) | Downloaded from Cisco into the app's directories | Loaded only if its SHA-256 matches a known Cisco build |
|
||||
|
||||
## What others can see
|
||||
|
||||
- **Voice connections** use the TeamSpeak protocol's encryption. The server
|
||||
and its admins see what any client sees: your nickname, identity, IP
|
||||
address, channel and messages.
|
||||
- **Streams (TeamSpeak 6)** are peer-to-peer WebRTC (DTLS-SRTP). Viewers and
|
||||
streamers exchange ICE candidates, so **they learn each other's IP
|
||||
addresses**, including local network addresses. Only watch and share
|
||||
streams with people you are fine sharing your address with.
|
||||
- **Relayed channel chat** (gateway or own ServerQuery login) is posted by a
|
||||
query client as `[Nick] text`; people in that channel see it came through
|
||||
a relay.
|
||||
|
||||
## What the gateway (`tsgw`) stores
|
||||
|
||||
The gateway is run by a server admin (see
|
||||
[docs/gateway-admin.md](docs/gateway-admin.md)). In its SQLite database
|
||||
(`history.path`, default `tsgw.db`):
|
||||
|
||||
| Table | Contents | Retention |
|
||||
|---|---|---|
|
||||
| `tokens` | SHA-256 hashes of login tokens (never the tokens), the user's unique id and database id, expiry | Removed after expiry (`auth.token_ttl_hours`, default 30 days) |
|
||||
| `messages` | Relayed server and channel chat: target, time, author unique id and name, text | `history.retention_days` (default 30); disable with `history.enabled = false` |
|
||||
| `audit` | Time, unique id and action of every login and post | Not pruned automatically; the admin should rotate it |
|
||||
|
||||
It holds no voice and no passwords of users: users log in by signing a
|
||||
challenge with their identity key. The gateway's own ServerQuery credentials
|
||||
(usually with admin rights) are in its config file, a password file or
|
||||
`TSGW_QUERY_PASSWORD`: keep them readable only by the gateway's user. Serve
|
||||
the gateway over TLS (`wss://`) only; tokens travel in its messages.
|
||||
+11591
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,156 @@
|
||||
# Third-party notices
|
||||
|
||||
<!-- Generated by scripts/notices.sh (cargo-about, about.toml, about.hbs) from
|
||||
Cargo.lock. Do not edit; regenerate after changing dependencies. -->
|
||||
|
||||
This app is licensed under MIT OR Apache-2.0. It contains the third-party
|
||||
software listed here, whose licenses require these notices.
|
||||
|
||||
## Slint
|
||||
|
||||
The user interface is built with Slint (https://slint.dev), used under the
|
||||
Slint Royalty-free Desktop, Mobile, and Web Applications License 2.0
|
||||
(LicenseRef-Slint-Royalty-free-2.0, full text below). As that license requires,
|
||||
the About page shows the AboutSlint widget.
|
||||
|
||||
## OpenH264
|
||||
|
||||
OpenH264 Video Codec provided by Cisco Systems, Inc.
|
||||
|
||||
The app does not include OpenH264. Only when you enable H.264 does it download
|
||||
Cisco's prebuilt OpenH264 binary from ciscobinary.openh264.org, check it
|
||||
against known checksums and load it at runtime; you can disable it again at
|
||||
any time. Cisco distributes that binary under the BSD-2-Clause license
|
||||
(Copyright (c) 2013, Cisco Systems; text below, used by openh264-sys2) and
|
||||
covers the MPEG LA H.264 patent royalties for it.
|
||||
|
||||
## tsclientlib
|
||||
|
||||
The TeamSpeak protocol implementation is a fork of tsclientlib
|
||||
(https://github.com/ReSpeak/tsclientlib), licensed under MIT OR Apache-2.0:
|
||||
|
||||
````text
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2020 tsclientlib contributors
|
||||
|
||||
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.
|
||||
````
|
||||
|
||||
## Native libraries
|
||||
|
||||
- Opus (libopus), compiled into the app: BSD-3-Clause, Copyright 2001-2023
|
||||
Xiph.Org and contributors; text below, used by libopus_sys.
|
||||
- AWS-LC (with code from BoringSSL and OpenSSL), compiled into the app:
|
||||
notices and texts below under ISC, used by aws-lc-sys.
|
||||
- libvpx (VP8 and VP9): the system library on Linux, compiled into the app on
|
||||
Windows. Its license and patent grant:
|
||||
|
||||
````text
|
||||
Copyright (c) 2010, The WebM Project authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google, nor the WebM Project, nor the names
|
||||
of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Additional IP Rights Grant (Patents)
|
||||
------------------------------------
|
||||
|
||||
"These implementations" means the copyrightable works that implement the WebM
|
||||
codecs distributed by Google as part of the WebM Project.
|
||||
|
||||
Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge,
|
||||
royalty-free, irrevocable (except as stated in this section) patent license to
|
||||
make, have made, use, offer to sell, sell, import, transfer, and otherwise
|
||||
run, modify and propagate the contents of these implementations of WebM, where
|
||||
such license applies only to those patent claims, both currently owned by
|
||||
Google and acquired in the future, licensable by Google that are necessarily
|
||||
infringed by these implementations of WebM. This grant does not include claims
|
||||
that would be infringed only as a consequence of further modification of these
|
||||
implementations. If you or your agent or exclusive licensee institute or order
|
||||
or agree to the institution of patent litigation or any other patent
|
||||
enforcement activity against any entity (including a cross-claim or
|
||||
counterclaim in a lawsuit) alleging that any of these implementations of WebM
|
||||
or any code incorporated within any of these implementations of WebM
|
||||
constitute direct or contributory patent infringement, or inducement of
|
||||
patent infringement, then any patent rights granted to you under this License
|
||||
for these implementations of WebM shall terminate as of the date such
|
||||
litigation is filed.
|
||||
````
|
||||
|
||||
Other system libraries the app uses at runtime (ALSA, PipeWire, fontconfig,
|
||||
xkbcommon, the C and C++ runtimes) belong to the operating system and are not
|
||||
distributed with it.
|
||||
|
||||
## Rust crates
|
||||
|
||||
Licenses of the Rust crates compiled into the apps, with the crates using
|
||||
each text. Where a crate offers a choice of licenses, the one shown is the one
|
||||
this app uses. Texts marked "standard text" were not included in the crate;
|
||||
the crate's authors are listed as its copyright holders.
|
||||
|
||||
| License | Crates |
|
||||
|---|---|
|
||||
{{#each overview}}
|
||||
| {{{name}}} | {{count}} |
|
||||
{{/each}}
|
||||
{{#each licenses}}
|
||||
{{#if first_of_kind}}
|
||||
|
||||
### {{{name}}}
|
||||
{{/if}}
|
||||
|
||||
{{#if source_path}}
|
||||
Used by: {{#each used_by}}{{#unless @first}}, {{/unless}}{{{crate.name}}} {{{crate.version}}}{{/each}}
|
||||
{{else}}
|
||||
Standard text, used by:
|
||||
{{#each used_by}}
|
||||
- {{{crate.name}}} {{{crate.version}}}{{#if crate.authors}}: {{#each crate.authors}}{{#unless @first}}, {{/unless}}{{{this}}}{{/each}}{{/if}}{{#if crate.repository}} ({{{crate.repository}}}){{/if}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
||||
````text
|
||||
{{{text}}}
|
||||
````
|
||||
{{/each}}
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
# cargo-about configuration for THIRD_PARTY_NOTICES.md: scripts/notices.sh
|
||||
# renders about.hbs with it (see docs/release.md). Reference:
|
||||
# https://embarkstudios.github.io/cargo-about/cli/generate/config.html
|
||||
#
|
||||
# The accepted licenses are deny.toml's `[licenses] allow` list; their order is
|
||||
# the preference when a crate offers a choice ("MIT OR Apache-2.0" shows MIT).
|
||||
|
||||
accepted = [
|
||||
"MIT",
|
||||
"Apache-2.0",
|
||||
"Apache-2.0 WITH LLVM-exception",
|
||||
"BSD-2-Clause",
|
||||
"BSD-3-Clause",
|
||||
"ISC",
|
||||
"Zlib",
|
||||
"Unicode-3.0",
|
||||
"CDLA-Permissive-2.0",
|
||||
"MPL-2.0",
|
||||
"BSL-1.0",
|
||||
"Unlicense",
|
||||
# Slint: GPL-3.0-only OR royalty-free OR commercial. We use the royalty-free
|
||||
# license, which requires the AboutSlint widget in the About page.
|
||||
"LicenseRef-Slint-Royalty-free-2.0",
|
||||
# libbz2-rs-sys (unpacks Cisco's OpenH264 download in tsc-media).
|
||||
"bzip2-1.0.6",
|
||||
]
|
||||
|
||||
# What the apps ship on: the desktop app on Linux (x86_64, and aarch64 for
|
||||
# Flathub) and Windows, and the Android app. Crates used only on other
|
||||
# platforms (macOS, iOS, wasm) are left out.
|
||||
targets = [
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"x86_64-pc-windows-msvc",
|
||||
"aarch64-linux-android",
|
||||
"armv7-linux-androideabi",
|
||||
"x86_64-linux-android",
|
||||
]
|
||||
|
||||
# Build tools (cc, cmake, bindgen, slint-build) and test-only crates are not
|
||||
# part of any binary we distribute.
|
||||
ignore-build-dependencies = true
|
||||
ignore-dev-dependencies = true
|
||||
|
||||
# Our own crates (publish = false). The vendored tsclientlib crates in
|
||||
# crates/proto are credited in about.hbs instead.
|
||||
private = { ignore = true }
|
||||
|
||||
workarounds = ["chrono", "ring", "rustls"]
|
||||
|
||||
# Crate specific configuration must come last.
|
||||
#
|
||||
# Clarifications replace the license files cargo-about would find; each file
|
||||
# is pinned by its SHA-256, so a changed text fails generation and gets
|
||||
# reviewed. After a dependency update: `sha256sum <file>` in the new crate
|
||||
# version (~/.cargo/registry/src/*/<crate>-<version>/).
|
||||
|
||||
# libopus_sys compiles the bundled libopus (opus/, BSD-3-Clause) into the app.
|
||||
# The crate itself is MIT; LICENSE-old is the ISC license of the code it was
|
||||
# derived from (audiopus_sys).
|
||||
[libopus_sys.clarify]
|
||||
license = "MIT AND ISC AND BSD-3-Clause"
|
||||
[[libopus_sys.clarify.files]]
|
||||
path = "LICENSE"
|
||||
license = "MIT"
|
||||
checksum = "c5512e4899a9b06c3a286bf69444ebc5314d506e437c334bfd66a2eac7bca3ef"
|
||||
[[libopus_sys.clarify.files]]
|
||||
path = "LICENSE-old"
|
||||
license = "ISC"
|
||||
checksum = "a6c8bb45880edc99bb13feb04d69fb2f0f73b565dfe209affa60414d2aa4c1a7"
|
||||
[[libopus_sys.clarify.files]]
|
||||
path = "opus/COPYING"
|
||||
license = "BSD-3-Clause"
|
||||
checksum = "01e1167d54a096d123cf6dfbbeb19587278845c6481d2d66d545669846079551"
|
||||
|
||||
# Only the bindings are compiled (tsc-media loads Cisco's binary at runtime),
|
||||
# but without this every header of the vendored OpenH264 sources would be
|
||||
# listed. upstream/LICENSE is also the license of Cisco's binary.
|
||||
[openh264-sys2.clarify]
|
||||
license = "BSD-2-Clause"
|
||||
[[openh264-sys2.clarify.files]]
|
||||
path = "upstream/LICENSE"
|
||||
checksum = "dd5c1c9668512530fa5a96e4c29ac4033d70a7eeb0eed7a42fddb6dd794ebdbb"
|
||||
|
||||
# AWS-LC (DTLS for WebRTC through str0m): LICENSE holds the attributions of
|
||||
# BoringSSL, OpenSSL and the bundled third-party code plus all license texts.
|
||||
# It is shown once, under ISC; the other licenses of the expression get their
|
||||
# standard texts.
|
||||
[aws-lc-sys.clarify]
|
||||
license = "ISC AND (Apache-2.0 OR ISC) AND Apache-2.0 AND MIT AND BSD-3-Clause AND (Apache-2.0 OR ISC OR MIT) AND (Apache-2.0 OR ISC OR MIT-0)"
|
||||
[[aws-lc-sys.clarify.files]]
|
||||
path = "LICENSE"
|
||||
license = "ISC"
|
||||
checksum = "728536b4160e051f86d7c9c388f704866b3d512cd7df97ac3516c65279523c4e"
|
||||
|
||||
# Slint keeps its license texts in LICENSES/, which cargo-about does not match
|
||||
# to the LicenseRef without a clarification. cargo-about 0.9.2 skips clarified
|
||||
# files whose `license` names the LicenseRef they are the text of (an inverted
|
||||
# check in generate.rs), so the file is tagged with a distinct LicenseRef; the
|
||||
# text is still shown under LicenseRef-Slint-Royalty-free-2.0. Revisit when
|
||||
# updating cargo-about (scripts/notices.sh fails if the text goes missing).
|
||||
[slint.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[slint.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[slint-macros.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[slint-macros.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-common.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-common.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-compiler.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-compiler.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-core.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-core.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-core-macros.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-core-macros.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-backend-selector.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-backend-selector.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-backend-winit.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-backend-winit.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
# Android (tsc-android).
|
||||
[i-slint-backend-android-activity.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-backend-android-activity.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-renderer-software.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-renderer-software.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-renderer-femtovg.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-renderer-femtovg.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
|
||||
[i-slint-renderer-skia.clarify]
|
||||
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
|
||||
[[i-slint-renderer-skia.clarify.files]]
|
||||
path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md"
|
||||
license = "LicenseRef-Slint-Royalty-free-2.0-text"
|
||||
checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe"
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "tsc-platform"
|
||||
version = "0.1.0"
|
||||
description = "Desktop integration: global push-to-talk hotkeys, notifications and app directories."
|
||||
description = "Desktop integration: global push-to-talk hotkeys, notifications, app directories, crash reports and third-party notices."
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
@@ -0,0 +1,456 @@
|
||||
//! Local crash reports (opt-in).
|
||||
//!
|
||||
//! [`install`] sets a panic hook that, while reports are enabled, writes one
|
||||
//! plain-text file per panic into the reports directory: time, app version,
|
||||
//! OS, thread, panic message and location, and a backtrace. Only the newest
|
||||
//! [`DEFAULT_KEEP`] reports are kept. Nothing is ever uploaded: the UI lists
|
||||
//! [`pending_reports`] after a crash and offers to open the folder (so the
|
||||
//! user can attach a report to an issue) or [`clear`] it.
|
||||
//!
|
||||
//! The hook chains to the previous one, so panics still print to stderr and
|
||||
//! abort or unwind as before. Reports may contain what a panic message
|
||||
//! includes (e.g. a server address); they stay on the device.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! let dir = tsc_platform::crash::default_dir();
|
||||
//! tsc_platform::crash::set_app_version(env!("CARGO_PKG_VERSION"));
|
||||
//! tsc_platform::crash::install(&dir, true); // the user's opt-in setting
|
||||
//! for report in tsc_platform::crash::pending_reports()? {
|
||||
//! println!("{}: {}", report.path.display(), report.summary);
|
||||
//! }
|
||||
//! # Ok::<(), std::io::Error>(())
|
||||
//! ```
|
||||
|
||||
use std::backtrace::Backtrace;
|
||||
use std::cell::Cell;
|
||||
use std::fmt::Write as _;
|
||||
use std::io;
|
||||
use std::panic::PanicHookInfo;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
|
||||
use std::sync::{Mutex, MutexGuard, Once, PoisonError};
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
|
||||
use crate::{APP_NAME, paths};
|
||||
|
||||
/// Directory name of the reports under the state directory.
|
||||
pub const DIR_NAME: &str = "crash-reports";
|
||||
/// Reports kept by default; older ones are deleted when a new one is written.
|
||||
pub const DEFAULT_KEEP: usize = 10;
|
||||
|
||||
const PREFIX: &str = "crash-";
|
||||
const SUFFIX: &str = ".txt";
|
||||
|
||||
/// `<state dir>/crash-reports` (`%LOCALAPPDATA%\tsc\crash-reports` on
|
||||
/// Windows, `~/.local/state/tsc/crash-reports` on Linux).
|
||||
pub fn default_dir() -> PathBuf {
|
||||
paths::state_dir().join(DIR_NAME)
|
||||
}
|
||||
|
||||
struct Config {
|
||||
dir: Option<PathBuf>,
|
||||
version: String,
|
||||
keep: usize,
|
||||
/// Collected at install time, so the hook does no more IO than needed.
|
||||
system: String,
|
||||
}
|
||||
|
||||
static CONFIG: Mutex<Config> = Mutex::new(Config {
|
||||
dir: None,
|
||||
version: String::new(),
|
||||
keep: DEFAULT_KEEP,
|
||||
system: String::new(),
|
||||
});
|
||||
static ENABLED: AtomicBool = AtomicBool::new(false);
|
||||
static HOOK: Once = Once::new();
|
||||
/// Orders reports written by this process within the same millisecond.
|
||||
static SEQUENCE: AtomicU32 = AtomicU32::new(0);
|
||||
|
||||
thread_local! {
|
||||
/// Set while this thread writes a report: a panic inside the hook must not
|
||||
/// recurse.
|
||||
static IN_HOOK: Cell<bool> = const { Cell::new(false) };
|
||||
}
|
||||
|
||||
fn config() -> MutexGuard<'static, Config> {
|
||||
CONFIG.lock().unwrap_or_else(PoisonError::into_inner)
|
||||
}
|
||||
|
||||
/// Set the panic hook (once per process) and where reports go. `enabled` is
|
||||
/// the user's opt-in; while it is false panics are not recorded. Calling it
|
||||
/// again changes the directory and the switch. Existing reports older than
|
||||
/// the newest [`DEFAULT_KEEP`] (or [`set_keep`]) are deleted.
|
||||
pub fn install(dir: impl Into<PathBuf>, enabled: bool) {
|
||||
let dir = dir.into();
|
||||
{
|
||||
let mut config = config();
|
||||
if config.version.is_empty() {
|
||||
config.version = env!("CARGO_PKG_VERSION").into();
|
||||
}
|
||||
config.system = system_info();
|
||||
prune(&dir, config.keep);
|
||||
config.dir = Some(dir);
|
||||
}
|
||||
ENABLED.store(enabled, Ordering::SeqCst);
|
||||
HOOK.call_once(|| {
|
||||
let previous = std::panic::take_hook();
|
||||
std::panic::set_hook(Box::new(move |info| {
|
||||
hook(info);
|
||||
previous(info);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
/// Panic if the `TSC_TEST_CRASH` environment variable is set, so testers can
|
||||
/// check crash reports with a release build (docs/testing/manual-matrix.md).
|
||||
/// Call right after [`install`].
|
||||
pub fn test_crash_if_requested() {
|
||||
if std::env::var_os("TSC_TEST_CRASH").is_some_and(|v| !v.is_empty()) {
|
||||
panic!("test crash requested with TSC_TEST_CRASH");
|
||||
}
|
||||
}
|
||||
|
||||
/// Turn recording on or off (the settings switch). No effect before
|
||||
/// [`install`].
|
||||
pub fn set_enabled(enabled: bool) {
|
||||
ENABLED.store(enabled, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
pub fn is_enabled() -> bool {
|
||||
ENABLED.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
/// The app's version for reports; defaults to this crate's version. Call
|
||||
/// with the binary's `env!("CARGO_PKG_VERSION")`.
|
||||
pub fn set_app_version(version: impl Into<String>) {
|
||||
config().version = version.into();
|
||||
}
|
||||
|
||||
/// How many reports to keep (at least one).
|
||||
pub fn set_keep(keep: usize) {
|
||||
config().keep = keep.max(1);
|
||||
}
|
||||
|
||||
/// The directory given to [`install`].
|
||||
pub fn dir() -> Option<PathBuf> {
|
||||
config().dir.clone()
|
||||
}
|
||||
|
||||
/// A report on disk.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Report {
|
||||
pub path: PathBuf,
|
||||
/// When the panic happened, from the file name.
|
||||
pub time: SystemTime,
|
||||
/// The panic message's first line.
|
||||
pub summary: String,
|
||||
}
|
||||
|
||||
/// Reports in the [`install`]ed directory, oldest first; empty before
|
||||
/// [`install`] or when the directory does not exist.
|
||||
pub fn pending_reports() -> io::Result<Vec<Report>> {
|
||||
match dir() {
|
||||
Some(dir) => reports_in(&dir),
|
||||
None => Ok(Vec::new()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Delete all reports in the [`install`]ed directory; returns how many.
|
||||
pub fn clear() -> io::Result<usize> {
|
||||
match dir() {
|
||||
Some(dir) => clear_in(&dir),
|
||||
None => Ok(0),
|
||||
}
|
||||
}
|
||||
|
||||
/// Reports in `dir`, oldest first.
|
||||
pub fn reports_in(dir: &Path) -> io::Result<Vec<Report>> {
|
||||
let mut reports = Vec::new();
|
||||
for path in report_files(dir)? {
|
||||
let Some(time) = path.file_name().and_then(|n| n.to_str()).and_then(parse_file_time) else {
|
||||
continue;
|
||||
};
|
||||
let text = std::fs::read_to_string(&path).unwrap_or_default();
|
||||
let summary = text
|
||||
.lines()
|
||||
.find_map(|line| line.strip_prefix("Message:"))
|
||||
.map(|m| m.trim().to_string())
|
||||
.unwrap_or_default();
|
||||
reports.push(Report { path, time, summary });
|
||||
}
|
||||
Ok(reports)
|
||||
}
|
||||
|
||||
/// Delete all reports in `dir`; returns how many.
|
||||
pub fn clear_in(dir: &Path) -> io::Result<usize> {
|
||||
let files = report_files(dir)?;
|
||||
for path in &files {
|
||||
std::fs::remove_file(path)?;
|
||||
}
|
||||
Ok(files.len())
|
||||
}
|
||||
|
||||
/// Report files in `dir`, sorted by name, which is by time.
|
||||
fn report_files(dir: &Path) -> io::Result<Vec<PathBuf>> {
|
||||
let entries = match std::fs::read_dir(dir) {
|
||||
Ok(entries) => entries,
|
||||
Err(e) if e.kind() == io::ErrorKind::NotFound => return Ok(Vec::new()),
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
let mut files: Vec<PathBuf> = entries
|
||||
.filter_map(|e| e.ok())
|
||||
.map(|e| e.path())
|
||||
.filter(|p| {
|
||||
p.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.is_some_and(|n| n.starts_with(PREFIX) && n.ends_with(SUFFIX))
|
||||
})
|
||||
.collect();
|
||||
files.sort();
|
||||
Ok(files)
|
||||
}
|
||||
|
||||
/// Keep the newest `keep` reports.
|
||||
fn prune(dir: &Path, keep: usize) {
|
||||
if let Ok(files) = report_files(dir) {
|
||||
for path in files.iter().take(files.len().saturating_sub(keep)) {
|
||||
let _ = std::fs::remove_file(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn hook(info: &PanicHookInfo<'_>) {
|
||||
if !is_enabled() || IN_HOOK.with(|h| h.replace(true)) {
|
||||
return;
|
||||
}
|
||||
match write_report(info) {
|
||||
Ok(Some(path)) => eprintln!("crash report written to {}", path.display()),
|
||||
Ok(None) => {}
|
||||
Err(e) => eprintln!("could not write a crash report: {e}"),
|
||||
}
|
||||
IN_HOOK.with(|h| h.set(false));
|
||||
}
|
||||
|
||||
fn write_report(info: &PanicHookInfo<'_>) -> io::Result<Option<PathBuf>> {
|
||||
// Captured before taking the lock: other threads may panic meanwhile.
|
||||
let backtrace = Backtrace::force_capture();
|
||||
let (dir, version, keep, system) = {
|
||||
let config = config();
|
||||
let Some(dir) = config.dir.clone() else { return Ok(None) };
|
||||
(dir, config.version.clone(), config.keep, config.system.clone())
|
||||
};
|
||||
let now = SystemTime::now();
|
||||
let thread = std::thread::current();
|
||||
let report = format_report(&ReportFields {
|
||||
time: now,
|
||||
version: &version,
|
||||
system: &system,
|
||||
thread: thread.name().unwrap_or("<unnamed>"),
|
||||
thread_id: &format!("{:?}", thread.id()),
|
||||
location: &info.location().map(|l| l.to_string()).unwrap_or_default(),
|
||||
message: info.payload_as_str().unwrap_or("<non-string panic payload>"),
|
||||
backtrace: &backtrace.to_string(),
|
||||
});
|
||||
|
||||
std::fs::create_dir_all(&dir)?;
|
||||
let name = file_name(now, SEQUENCE.fetch_add(1, Ordering::SeqCst), std::process::id());
|
||||
let path = dir.join(&name);
|
||||
// Written under another name first, so a half-written file is never listed.
|
||||
let partial = dir.join(format!("{name}.partial"));
|
||||
std::fs::write(&partial, report)?;
|
||||
std::fs::rename(&partial, &path)?;
|
||||
prune(&dir, keep);
|
||||
Ok(Some(path))
|
||||
}
|
||||
|
||||
struct ReportFields<'a> {
|
||||
time: SystemTime,
|
||||
version: &'a str,
|
||||
system: &'a str,
|
||||
thread: &'a str,
|
||||
thread_id: &'a str,
|
||||
location: &'a str,
|
||||
message: &'a str,
|
||||
backtrace: &'a str,
|
||||
}
|
||||
|
||||
fn format_report(r: &ReportFields<'_>) -> String {
|
||||
let mut out = String::new();
|
||||
let _ = writeln!(out, "{APP_NAME} crash report");
|
||||
let _ = writeln!(out);
|
||||
let _ = writeln!(out, "Time: {}", rfc3339(r.time));
|
||||
let _ = writeln!(out, "Version: {}", r.version);
|
||||
let _ = writeln!(out, "System: {}", r.system);
|
||||
let _ = writeln!(out, "Thread: {} ({})", r.thread, r.thread_id);
|
||||
let _ = writeln!(out, "Location: {}", r.location);
|
||||
// The message may span lines; the first stays on the "Message:" line.
|
||||
let mut lines = r.message.lines();
|
||||
let _ = writeln!(out, "Message: {}", lines.next().unwrap_or(""));
|
||||
for line in lines {
|
||||
let _ = writeln!(out, " {line}");
|
||||
}
|
||||
let _ = writeln!(out);
|
||||
let _ = writeln!(out, "Backtrace:");
|
||||
let _ = writeln!(out, "{}", r.backtrace);
|
||||
out
|
||||
}
|
||||
|
||||
/// OS, architecture, distribution and session: what helps to reproduce.
|
||||
fn system_info() -> String {
|
||||
let mut info = format!("{} {}", std::env::consts::OS, std::env::consts::ARCH);
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let os_release = std::fs::read_to_string("/etc/os-release")
|
||||
.or_else(|_| std::fs::read_to_string("/usr/lib/os-release"))
|
||||
.unwrap_or_default();
|
||||
if let Some(name) = os_release
|
||||
.lines()
|
||||
.find_map(|l| l.strip_prefix("PRETTY_NAME="))
|
||||
.map(|v| v.trim_matches('"'))
|
||||
{
|
||||
let _ = write!(info, ", {name}");
|
||||
}
|
||||
if let Ok(kernel) = std::fs::read_to_string("/proc/sys/kernel/osrelease") {
|
||||
let _ = write!(info, ", kernel {}", kernel.trim());
|
||||
}
|
||||
}
|
||||
let _ = write!(info, ", {:?}", paths::display_server());
|
||||
if paths::is_flatpak() {
|
||||
info.push_str(", Flatpak");
|
||||
}
|
||||
info
|
||||
}
|
||||
|
||||
/// `crash-20260926T101500.123Z-0001-4242.txt`: time, sequence, process id.
|
||||
/// Sorting the names sorts the reports by time.
|
||||
fn file_name(time: SystemTime, sequence: u32, pid: u32) -> String {
|
||||
let (date, clock, millis) = civil(time);
|
||||
let (y, mo, d) = date;
|
||||
let (h, mi, s) = clock;
|
||||
format!(
|
||||
"{PREFIX}{y:04}{mo:02}{d:02}T{h:02}{mi:02}{s:02}.{millis:03}Z-{:04}-{pid}{SUFFIX}",
|
||||
sequence % 10_000
|
||||
)
|
||||
}
|
||||
|
||||
/// The time from a name made by [`file_name`].
|
||||
fn parse_file_time(name: &str) -> Option<SystemTime> {
|
||||
let stamp = name.strip_prefix(PREFIX)?.get(..19)?;
|
||||
let num = |range: std::ops::Range<usize>| stamp.get(range)?.parse::<u64>().ok();
|
||||
let (y, mo, d) = (num(0..4)?, num(4..6)?, num(6..8)?);
|
||||
let (h, mi, s, ms) = (num(9..11)?, num(11..13)?, num(13..15)?, num(16..19)?);
|
||||
if stamp.as_bytes()[8] != b'T' || stamp.as_bytes()[15] != b'.' || !(1..=12).contains(&mo) {
|
||||
return None;
|
||||
}
|
||||
let days = days_from_civil(y as i64, mo as u32, d as u32);
|
||||
let secs = u64::try_from(days).ok()? * 86_400 + h * 3600 + mi * 60 + s;
|
||||
Some(UNIX_EPOCH + Duration::from_secs(secs) + Duration::from_millis(ms))
|
||||
}
|
||||
|
||||
/// UTC, `2026-09-26T10:15:00.123Z`.
|
||||
fn rfc3339(time: SystemTime) -> String {
|
||||
let ((y, mo, d), (h, mi, s), ms) = civil(time);
|
||||
format!("{y:04}-{mo:02}-{d:02}T{h:02}:{mi:02}:{s:02}.{ms:03}Z")
|
||||
}
|
||||
|
||||
type Date = (i64, u32, u32);
|
||||
type Clock = (u32, u32, u32);
|
||||
|
||||
/// UTC calendar date, time of day and milliseconds (clamped to the epoch).
|
||||
fn civil(time: SystemTime) -> (Date, Clock, u32) {
|
||||
let since = time.duration_since(UNIX_EPOCH).unwrap_or_default();
|
||||
let secs = since.as_secs();
|
||||
let days = (secs / 86_400) as i64;
|
||||
let rem = (secs % 86_400) as u32;
|
||||
(civil_from_days(days), (rem / 3600, rem / 60 % 60, rem % 60), since.subsec_millis())
|
||||
}
|
||||
|
||||
// Howard Hinnant's algorithms (http://howardhinnant.github.io/date_algorithms.html).
|
||||
fn civil_from_days(days: i64) -> Date {
|
||||
let z = days + 719_468;
|
||||
let era = z.div_euclid(146_097);
|
||||
let doe = z.rem_euclid(146_097);
|
||||
let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;
|
||||
let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
||||
let mp = (5 * doy + 2) / 153;
|
||||
let d = (doy - (153 * mp + 2) / 5 + 1) as u32;
|
||||
let m = if mp < 10 { mp + 3 } else { mp - 9 } as u32;
|
||||
let y = yoe + era * 400 + i64::from(m <= 2);
|
||||
(y, m, d)
|
||||
}
|
||||
|
||||
fn days_from_civil(y: i64, m: u32, d: u32) -> i64 {
|
||||
let y = if m <= 2 { y - 1 } else { y };
|
||||
let era = y.div_euclid(400);
|
||||
let yoe = y.rem_euclid(400);
|
||||
let mp = i64::from(if m > 2 { m - 3 } else { m + 9 });
|
||||
let doy = (153 * mp + 2) / 5 + i64::from(d) - 1;
|
||||
let doe = yoe * 365 + yoe / 4 - yoe / 100 + doy;
|
||||
era * 146_097 + doe - 719_468
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn at(secs: u64, millis: u64) -> SystemTime {
|
||||
UNIX_EPOCH + Duration::from_secs(secs) + Duration::from_millis(millis)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dates() {
|
||||
assert_eq!(rfc3339(UNIX_EPOCH), "1970-01-01T00:00:00.000Z");
|
||||
// 2026-09-26T10:15:00Z
|
||||
assert_eq!(rfc3339(at(1_790_417_700, 123)), "2026-09-26T10:15:00.123Z");
|
||||
// Leap day.
|
||||
assert_eq!(rfc3339(at(951_825_600, 0)), "2000-02-29T12:00:00.000Z");
|
||||
for days in [-1, 0, 59, 60, 365, 11_016, 20_722, 40_000] {
|
||||
let (y, m, d) = civil_from_days(days);
|
||||
assert_eq!(days_from_civil(y, m, d), days);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn file_names_sort_and_parse() {
|
||||
let time = at(1_790_417_700, 7);
|
||||
let name = file_name(time, 3, 4242);
|
||||
assert_eq!(name, "crash-20260926T101500.007Z-0003-4242.txt");
|
||||
assert_eq!(parse_file_time(&name), Some(time));
|
||||
assert!(file_name(time, 3, 1) < file_name(time, 4, 1));
|
||||
assert!(file_name(time, 9, 1) < file_name(at(1_790_417_700, 8), 0, 1));
|
||||
assert_eq!(parse_file_time("crash-garbage.txt"), None);
|
||||
assert_eq!(parse_file_time("crash-20261326T101500.007Z-0-1.txt"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn report_format() {
|
||||
let report = format_report(&ReportFields {
|
||||
time: at(1_790_417_700, 0),
|
||||
version: "1.2.3",
|
||||
system: "linux x86_64",
|
||||
thread: "audio",
|
||||
thread_id: "ThreadId(7)",
|
||||
location: "src/audio.rs:10:5",
|
||||
message: "first\nsecond",
|
||||
backtrace: " 0: frame",
|
||||
});
|
||||
assert!(report.starts_with(&format!("{APP_NAME} crash report\n")));
|
||||
assert!(report.contains("Time: 2026-09-26T10:15:00.000Z\n"));
|
||||
assert!(report.contains("Version: 1.2.3\n"));
|
||||
assert!(report.contains("Thread: audio (ThreadId(7))\n"));
|
||||
assert!(report.contains("Message: first\n second\n"));
|
||||
assert!(report.contains("Backtrace:\n 0: frame\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_info_names_os() {
|
||||
assert!(system_info().starts_with(std::env::consts::OS));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_dir_has_no_reports() {
|
||||
let dir = std::env::temp_dir().join(format!("tsc-crash-missing-{}", std::process::id()));
|
||||
assert!(reports_in(&dir).unwrap().is_empty());
|
||||
assert_eq!(clear_in(&dir).unwrap(), 0);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,12 @@
|
||||
//! Windows)
|
||||
//! - [`notify`]: desktop notifications
|
||||
//! - [`paths`]: data, config, cache and state directories
|
||||
//! - [`crash`]: opt-in local crash reports (panic hook)
|
||||
//! - [`notices`]: third-party notices for the About page
|
||||
|
||||
pub mod crash;
|
||||
pub mod hotkey;
|
||||
pub mod notices;
|
||||
pub mod notify;
|
||||
pub mod paths;
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//! Third-party notices for the About page.
|
||||
//!
|
||||
//! `THIRD_PARTY_NOTICES.md` at the repository root is generated from
|
||||
//! `Cargo.lock` by `scripts/notices.sh` (cargo-about) and embedded here; CI
|
||||
//! fails when it is stale. It is Markdown: an introduction (Slint, OpenH264,
|
||||
//! tsclientlib, native libraries), then each license text in a fenced block
|
||||
//! with the crates that use it. About 500 KB, so show it in a scrolling view
|
||||
//! (or write it to a file and open that), not in a single label.
|
||||
|
||||
/// The full notices, Markdown.
|
||||
pub fn text() -> &'static str {
|
||||
include_str!("../../../THIRD_PARTY_NOTICES.md")
|
||||
}
|
||||
|
||||
/// Attribution the OpenH264 license asks for wherever H.264 can be enabled
|
||||
/// (the same text as `tsc_media::codec::h264::OPENH264_ATTRIBUTION`).
|
||||
pub const OPENH264_ATTRIBUTION: &str = "OpenH264 Video Codec provided by Cisco Systems, Inc.";
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn notices_cover_required_attributions() {
|
||||
let text = text();
|
||||
assert!(text.starts_with("# Third-party notices"));
|
||||
// Slint's royalty-free license text, OpenH264 and the vendored
|
||||
// protocol library must be credited.
|
||||
assert!(text.contains("Slint Royalty-free Desktop, Mobile, and Web Applications License"));
|
||||
assert!(text.contains(OPENH264_ATTRIBUTION));
|
||||
assert!(text.contains("tsclientlib contributors"));
|
||||
// Bundled C libraries.
|
||||
assert!(text.contains("Xiph.Org"));
|
||||
assert!(text.contains("The WebM Project authors"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
//! The crash report panic hook, with real panics in threads and in a child
|
||||
//! process. Its own test binary: the hook is process-wide.
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::thread;
|
||||
|
||||
use tsc_platform::crash;
|
||||
|
||||
fn temp_dir(name: &str) -> PathBuf {
|
||||
let dir = std::env::temp_dir().join(format!("tsc-crash-{name}-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
dir
|
||||
}
|
||||
|
||||
/// Panic in a named thread and wait for it.
|
||||
fn panic_in_thread(name: &str, message: String) {
|
||||
let result =
|
||||
thread::Builder::new().name(name.into()).spawn(move || panic!("{message}")).unwrap().join();
|
||||
assert!(result.is_err(), "the thread should have panicked");
|
||||
}
|
||||
|
||||
// The only test that installs the hook in this process: the hook and its
|
||||
// settings are global. The child process test below only spawns.
|
||||
#[test]
|
||||
fn panic_hook_writes_reports() {
|
||||
let dir = temp_dir("hook");
|
||||
crash::set_app_version("9.8.7-test");
|
||||
crash::install(&dir, false);
|
||||
assert_eq!(crash::dir().as_deref(), Some(dir.as_path()));
|
||||
|
||||
// Disabled: nothing is written.
|
||||
panic_in_thread("quiet", "not recorded".into());
|
||||
assert!(crash::pending_reports().unwrap().is_empty());
|
||||
|
||||
// Enabled: one report with the details.
|
||||
crash::set_enabled(true);
|
||||
assert!(crash::is_enabled());
|
||||
panic_in_thread("crash-test", "boom 42\nsecond line".into());
|
||||
let reports = crash::pending_reports().unwrap();
|
||||
assert_eq!(reports.len(), 1, "{reports:?}");
|
||||
let report = &reports[0];
|
||||
assert_eq!(report.summary, "boom 42");
|
||||
let age = report.time.elapsed().unwrap_or_default();
|
||||
assert!(age.as_secs() < 60, "report time {:?} ago", age);
|
||||
let text = std::fs::read_to_string(&report.path).unwrap();
|
||||
eprintln!("{text}");
|
||||
assert!(text.contains("Version: 9.8.7-test"), "{text}");
|
||||
assert!(text.contains("Thread: crash-test ("), "{text}");
|
||||
assert!(text.contains("Message: boom 42\n second line"), "{text}");
|
||||
assert!(text.contains(&format!("System: {}", std::env::consts::OS)), "{text}");
|
||||
// The path separator is the platform's.
|
||||
let location = text.lines().find(|l| l.starts_with("Location: ")).unwrap_or_default();
|
||||
assert!(location.contains("tests") && location.contains("crash.rs:"), "{text}");
|
||||
assert!(text.contains("Backtrace:\n"), "{text}");
|
||||
// Symbols resolve on Linux (MSVC needs the PDB files next to the binary).
|
||||
if cfg!(target_os = "linux") {
|
||||
assert!(text.contains("panic_in_thread"), "{text}");
|
||||
}
|
||||
// No partial files are left behind.
|
||||
assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1);
|
||||
|
||||
// Only the newest reports are kept.
|
||||
crash::set_keep(3);
|
||||
for i in 0..5 {
|
||||
panic_in_thread("crash-test", format!("panic {i}"));
|
||||
}
|
||||
let summaries: Vec<_> =
|
||||
crash::pending_reports().unwrap().into_iter().map(|r| r.summary).collect();
|
||||
assert_eq!(summaries, ["panic 2", "panic 3", "panic 4"]);
|
||||
|
||||
// Reports survive a restart (a new install) and can be deleted.
|
||||
crash::install(&dir, true);
|
||||
assert_eq!(crash::pending_reports().unwrap().len(), 3);
|
||||
assert_eq!(crash::clear().unwrap(), 3);
|
||||
assert!(crash::pending_reports().unwrap().is_empty());
|
||||
|
||||
// A directory that does not exist yet is created on the first report.
|
||||
let nested = dir.join("a").join("b");
|
||||
crash::install(&nested, true);
|
||||
panic_in_thread("crash-test", "into a new directory".into());
|
||||
assert_eq!(crash::reports_in(&nested).unwrap().len(), 1);
|
||||
|
||||
crash::set_enabled(false);
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
|
||||
/// Runs only as the child of `test_crash_in_child_process`: a start with
|
||||
/// `TSC_TEST_CRASH` set, as a tester would do with the app.
|
||||
#[test]
|
||||
fn child_process_crash() {
|
||||
let Some(dir) = std::env::var_os("TSC_CRASH_CHILD_DIR") else { return };
|
||||
crash::set_app_version("child");
|
||||
crash::install(PathBuf::from(dir), true);
|
||||
crash::test_crash_if_requested();
|
||||
unreachable!("TSC_TEST_CRASH is set");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_crash_in_child_process() {
|
||||
let dir = temp_dir("child");
|
||||
// Captured: the child's "FAILED" would look like a failure of this run.
|
||||
let output = std::process::Command::new(std::env::current_exe().unwrap())
|
||||
.args(["--exact", "child_process_crash", "--test-threads=1"])
|
||||
.env("TSC_CRASH_CHILD_DIR", &dir)
|
||||
.env("TSC_TEST_CRASH", "1")
|
||||
.output()
|
||||
.unwrap();
|
||||
let log = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(!output.status.success(), "the child should have panicked: {log}");
|
||||
// The next start finds the report.
|
||||
let reports = crash::reports_in(&dir).unwrap();
|
||||
assert_eq!(reports.len(), 1, "{reports:?}");
|
||||
assert_eq!(reports[0].summary, "test crash requested with TSC_TEST_CRASH");
|
||||
let text = std::fs::read_to_string(&reports[0].path).unwrap();
|
||||
assert!(text.contains("Version: child"), "{text}");
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
# Translations
|
||||
|
||||
The UI is translated with Slint's gettext-based translations: strings in
|
||||
`.slint` files are marked with `@tr(...)`, extracted into a `.pot` template,
|
||||
translated in `.po` files, and **compiled into the binary** (Slint's bundled
|
||||
translations). Nothing is loaded at runtime, so there is no dependency on
|
||||
GNU gettext (LGPL) and it works the same on Linux, Windows and Android.
|
||||
|
||||
## Marking strings
|
||||
|
||||
In `.slint` files every user-visible string goes through `@tr`:
|
||||
|
||||
```slint
|
||||
Button { text: @tr("Connect"); }
|
||||
Text { text: @tr("Connected to {}", server-name); } // arguments: {} or {0} {1}
|
||||
Text { text: @tr("{n} user online" | "{n} users online" % count); } // plurals
|
||||
Text { text: @tr("menu" => "Quit"); } // explicit context
|
||||
```
|
||||
|
||||
- Whole sentences with placeholders, never concatenated fragments: word
|
||||
order differs between languages. Use `{0}`, `{1}` when there are several
|
||||
arguments, so translators can reorder them.
|
||||
- Plurals always with the `|` / `%` form, even if English only needs two
|
||||
forms; other languages have more.
|
||||
- Not translated: nicknames, channel and server names, chat text, protocol
|
||||
identifiers, the product name, log messages.
|
||||
- By default the context of a string is the name of the component it is in,
|
||||
so the same English word can be translated differently in different
|
||||
places. Renaming a component therefore invalidates its translations until
|
||||
they are merged again (`msgmerge` keeps them as fuzzy).
|
||||
|
||||
Strings produced in Rust (error messages, notification texts, status lines)
|
||||
cannot use `@tr`. Keep the wording in Slint: an exported global with pure
|
||||
functions that the Rust code calls, e.g.
|
||||
|
||||
```slint
|
||||
export global Strings {
|
||||
pure public function connection-lost(reason: string) -> string {
|
||||
return @tr("Connection lost: {}", reason);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```rust
|
||||
let text = window.global::<Strings>().invoke_connection_lost(reason.into());
|
||||
```
|
||||
|
||||
Errors from lower layers (protocol, IO) are shown as details after a
|
||||
translated sentence; they stay in English.
|
||||
|
||||
## Files
|
||||
|
||||
```
|
||||
crates/tsc-ui/lang/
|
||||
tsc-ui.pot template, generated
|
||||
de/LC_MESSAGES/tsc-ui.po one directory per language (gettext locale name)
|
||||
pt_BR/LC_MESSAGES/tsc-ui.po
|
||||
```
|
||||
|
||||
The file name is the translation domain, which is the crate name
|
||||
(`tsc-ui`); Slint's build looks for `lang/<lang>/LC_MESSAGES/<crate>.po`.
|
||||
|
||||
## Workflow
|
||||
|
||||
Tools (developer machines only): `cargo install slint-tr-extractor`, and
|
||||
GNU gettext for `msgmerge` / `msginit` (`gettext` package; on Windows from
|
||||
MSYS2 or Git for Windows' bundled tools).
|
||||
|
||||
```sh
|
||||
# 1. Extract the template after changing strings
|
||||
slint-tr-extractor --package-name tsc-ui crates/tsc-ui/ui/*.slint -o crates/tsc-ui/lang/tsc-ui.pot
|
||||
|
||||
# 2. Update every translation (new strings empty, changed ones fuzzy)
|
||||
for po in crates/tsc-ui/lang/*/LC_MESSAGES/tsc-ui.po; do
|
||||
msgmerge --update --backup=none "$po" crates/tsc-ui/lang/tsc-ui.pot
|
||||
done
|
||||
|
||||
# 3. Start a new language
|
||||
mkdir -p crates/tsc-ui/lang/de/LC_MESSAGES
|
||||
msginit --no-translator --locale=de --input=crates/tsc-ui/lang/tsc-ui.pot \
|
||||
--output-file=crates/tsc-ui/lang/de/LC_MESSAGES/tsc-ui.po
|
||||
```
|
||||
|
||||
Translators edit the `.po` files (Poedit, Lokalize, or a hosted service
|
||||
such as Weblate pointed at `crates/tsc-ui/lang`). Fuzzy and untranslated
|
||||
entries fall back to English. Run the extraction when strings change and
|
||||
before each release (string freeze, see [release.md](release.md)). The
|
||||
template carries a creation date and source line numbers, so CI does not
|
||||
compare it exactly; a stale template only means new strings are not
|
||||
translatable yet.
|
||||
|
||||
## Bundling and language selection
|
||||
|
||||
`crates/tsc-ui/build.rs` compiles the translations into the binary:
|
||||
|
||||
```rust
|
||||
slint_build::compile_with_config(
|
||||
"ui/app.slint",
|
||||
slint_build::CompilerConfiguration::new()
|
||||
.with_style("fluent-dark".into())
|
||||
.with_bundled_translations("lang"),
|
||||
)
|
||||
```
|
||||
|
||||
slint-build tracks the `.po` files, so edits rebuild. It fails ("No
|
||||
translations found") while `lang/` has no `.po` file yet, so enable it
|
||||
together with the first language.
|
||||
|
||||
At startup Slint picks the translation matching the system locale (exact
|
||||
match such as `pt_BR` first, then the language `pt`), English otherwise. A
|
||||
language setting in the app (stored in the settings, "System" by default)
|
||||
calls `slint::select_bundled_translation("de")` after the window has been
|
||||
created; `""` or `"en"` selects English. Changing it takes effect
|
||||
immediately for all `@tr` strings.
|
||||
|
||||
The desktop app (tsc-ui) and the Android app share the `.slint` files and
|
||||
therefore the translations. Texts outside Slint need their own mechanism:
|
||||
|
||||
- Android system texts (foreground service notification, permission
|
||||
rationale): Android string resources in `android/app/src/main/res/values-<lang>/`.
|
||||
- Desktop file and AppStream metainfo: translated with `itstool` / `msgfmt
|
||||
--desktop` / `msgfmt --xml` from `.po` files when there are translations
|
||||
for the app itself.
|
||||
|
||||
## Checks
|
||||
|
||||
- A pseudo-translation catches unmarked strings and truncation: create a
|
||||
test language (e.g. `lang/eo/`) with `msgen` from the template, replace
|
||||
the texts with longer accented versions, and select it with the language
|
||||
setting (or `LANG=eo.UTF-8` on Linux).
|
||||
- Test at least one language with longer words (German) and one with a
|
||||
different script (Russian) on every screen before a release (manual
|
||||
matrix row GE7).
|
||||
- Dates and numbers are formatted in Rust; use unambiguous formats
|
||||
(ISO dates, 24-hour times) until there is locale-aware formatting.
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
# Releasing
|
||||
|
||||
How a release is versioned, built, signed and checked. The product name and
|
||||
app id are still placeholders (see [packaging/README.md](../packaging/README.md));
|
||||
rename them before the first public release, since the app id cannot change
|
||||
afterwards on Flathub or Google Play.
|
||||
|
||||
## Versioning
|
||||
|
||||
- One version for the apps: `version` of `crates/tsc-ui` (desktop; the
|
||||
installer and the About page read it), `crates/tsc-android` and the
|
||||
Android app's `versionName`. Semantic versioning; before 1.0 a minor bump
|
||||
may break settings or the gateway protocol, and the changelog says so.
|
||||
- Android `versionCode` must grow with every upload:
|
||||
`major * 1000000 + minor * 1000 + patch` (0.2.3 is 2003).
|
||||
- The gateway `tsgw` (`crates/tsc-gateway`) is versioned on its own, since
|
||||
server admins update it separately. Its wire protocol is versioned in the
|
||||
WebSocket subprotocol (`tsgw.v1+json`); a breaking change needs `v2` and a
|
||||
period in which the gateway serves both.
|
||||
- Library crates are not published (`publish = false`) and keep their
|
||||
versions.
|
||||
- Tags: `v<version>` for the apps (`v0.2.0`), `tsgw-v<version>` for the
|
||||
gateway. Tags are annotated and signed (`git tag -s`).
|
||||
|
||||
## Changelog
|
||||
|
||||
`CHANGELOG.md` follows [Keep a Changelog](https://keepachangelog.com/). Every
|
||||
change a user or server admin notices adds a line under `Unreleased`
|
||||
(Added / Changed / Fixed / Removed / Security). At release the section gets
|
||||
the version and date, and its highlights also go into the `<releases>` entry
|
||||
of `packaging/linux/io.github.faumaray.TsClient.metainfo.xml` (shown by
|
||||
software centers and Flathub). Release notes also state the TeamSpeak server
|
||||
versions the release was tested against (TS3 and TS6 from
|
||||
`dev/docker-compose.yml`).
|
||||
|
||||
## Third-party notices
|
||||
|
||||
`THIRD_PARTY_NOTICES.md` lists the licenses of everything compiled into the
|
||||
apps. It is shown in the About page (`tsc_platform::notices::text()`) and
|
||||
shipped in every package. It is generated, never edited:
|
||||
|
||||
```sh
|
||||
cargo install cargo-about --locked --version 0.9.2 --features cli
|
||||
scripts/notices.sh # regenerate
|
||||
scripts/notices.sh --check # what CI runs
|
||||
```
|
||||
|
||||
- `about.toml`: accepted licenses (the same list as `deny.toml`), the
|
||||
targets we ship (Linux, Windows, Android), no build or dev dependencies,
|
||||
and clarifications for crates whose license files cargo-about does not
|
||||
find (Slint, the bundled libopus, AWS-LC, OpenH264). Clarifications pin
|
||||
file checksums; after a dependency update that changes such a file the
|
||||
script fails and the new text has to be checked and its checksum updated.
|
||||
- `about.hbs`: the Markdown template, with the notices that do not come from
|
||||
crates: the Slint attribution, OpenH264 (downloaded at runtime, not
|
||||
shipped), the vendored tsclientlib and libvpx.
|
||||
- The output does not depend on the host, so CI (`notices` job in
|
||||
`.github/workflows/ci.yml`) compares the committed file exactly and fails
|
||||
when `Cargo.lock` changed without a regeneration. The cargo-about version
|
||||
is pinned in the script and the job: a newer version may format
|
||||
differently, so update both together.
|
||||
|
||||
A new license has to be allowed in `deny.toml` (cargo-deny fails first) and
|
||||
in `about.toml`, and must be compatible with distributing the apps under
|
||||
MIT OR Apache-2.0 (no GPL/AGPL/LGPL code linked in; LGPL only as a
|
||||
dynamically loaded system library, after review).
|
||||
|
||||
## Signing
|
||||
|
||||
Signing keys and certificates never go into the repository. In CI they live
|
||||
in the secrets of a GitHub environment `release` that requires approval,
|
||||
are written to `$RUNNER_TEMP` in the job and deleted at its end.
|
||||
|
||||
### Windows (Authenticode)
|
||||
|
||||
Unsigned executables trigger SmartScreen warnings; signed ones build
|
||||
reputation with the publisher's certificate. Sign `tsc-desktop.exe` first,
|
||||
then build the installer with `/DSIGN=...`, which signs the installer and the
|
||||
uninstaller it writes (see [packaging/windows/README.md](../packaging/windows/README.md)).
|
||||
Always timestamp (`/tr ... /td SHA256`), so signatures stay valid after the
|
||||
certificate expires.
|
||||
|
||||
Options for the certificate:
|
||||
|
||||
- **Azure Trusted Signing**: Microsoft-managed certificates, no hardware
|
||||
token, billed monthly; needs an Azure subscription and identity
|
||||
validation of the publisher (check the current eligibility rules). Sign
|
||||
with `signtool` and the Trusted Signing dlib (NuGet package
|
||||
`Microsoft.Trusted.Signing.Client`):
|
||||
|
||||
```powershell
|
||||
# metadata.json: {"Endpoint": "https://<region>.codesigning.azure.net",
|
||||
# "CodeSigningAccountName": "<account>", "CertificateProfileName": "<profile>"}
|
||||
signtool sign /v /fd SHA256 /tr http://timestamp.acs.microsoft.com /td SHA256 `
|
||||
/dlib Azure.CodeSigning.Dlib.dll /dmdf metadata.json target\release\tsc-desktop.exe
|
||||
```
|
||||
|
||||
In GitHub Actions, `azure/trusted-signing-action` does the same with a
|
||||
service principal (client id, tenant id, secret as environment secrets).
|
||||
- An OV or EV code-signing certificate (on a hardware token or in a cloud
|
||||
HSM, as CAs require since 2023) with `signtool /f` or the HSM's CSP.
|
||||
- SignPath's free plan for open-source projects (signing happens in their
|
||||
service from a CI artifact).
|
||||
|
||||
Check the result with `signtool verify /pa /v <file>` for the executable,
|
||||
the installer and `uninstall.exe` after installing.
|
||||
|
||||
### Linux
|
||||
|
||||
- **Flathub** builds and signs the Flatpak itself (with Flathub's key) from
|
||||
a manifest in the `flathub/<app id>` repository. For the first submission
|
||||
open a pull request against `flathub/flathub` with the manifest, where the
|
||||
source is this repository at the release tag and commit (not `type: dir`)
|
||||
plus the generated `cargo-sources.json`. Before submitting: run
|
||||
`flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest`
|
||||
and `... repo`, `appstreamcli validate` on the metainfo, add screenshots
|
||||
and the release entry to the metainfo. Flathub reviews names and branding:
|
||||
the app must not look like an official TeamSpeak product.
|
||||
- For our own releases (GitHub): a tarball of `tsc-desktop` with the desktop
|
||||
file, metainfo, icon and notices, and optionally a Flatpak bundle
|
||||
(`flatpak build-bundle --gpg-sign=<key> ...`). Publish `SHA256SUMS` and
|
||||
sign it (`gpg --detach-sign` or minisign) with a key whose fingerprint is
|
||||
in the README.
|
||||
|
||||
### Android
|
||||
|
||||
APKs and app bundles are signed with a keystore kept outside the
|
||||
repository; losing it means existing installs can no longer be updated.
|
||||
|
||||
- Create it once:
|
||||
`keytool -genkeypair -v -keystore tsc-release.jks -alias tsc -keyalg RSA -keysize 4096 -validity 10000`,
|
||||
and back it up (two offline copies, password in a password manager).
|
||||
- The Gradle build reads the keystore path, alias and passwords from Gradle
|
||||
properties or environment variables (`~/.gradle/gradle.properties`, CI
|
||||
secrets), never from files in the repository. Without them it builds
|
||||
unsigned or debug-signed artifacts only.
|
||||
- CI: the keystore as a base64 secret, decoded to `$RUNNER_TEMP`, removed
|
||||
afterwards. Check with `apksigner verify --print-certs app-release.apk`.
|
||||
- Google Play: use Play App Signing; our keystore is then the upload key
|
||||
(it can be reset through Play support if lost). F-Droid builds and signs
|
||||
itself unless reproducible builds are set up.
|
||||
|
||||
## Checklist
|
||||
|
||||
Before tagging:
|
||||
|
||||
1. `main` is green in CI, including the smoke job (TS3 + TS6) and the
|
||||
browser interop job.
|
||||
2. `cargo deny --workspace check` is clean; the ignores in `deny.toml` are
|
||||
still needed and still justified.
|
||||
3. `scripts/notices.sh` has been run after the last dependency change (CI
|
||||
`notices` job green); new licenses in the diff were reviewed. The About
|
||||
page shows the AboutSlint widget (required by Slint's royalty-free
|
||||
license), the OpenH264 attribution and the notices.
|
||||
4. The [manual test matrix](testing/manual-matrix.md) has been run for this
|
||||
version, results committed; failures are fixed or listed as known issues.
|
||||
5. Translations: `.pot` regenerated and `.po` files merged
|
||||
([i18n.md](i18n.md)); string freeze announced a week before.
|
||||
6. Versions bumped (`crates/tsc-ui`, `crates/tsc-android`, Android
|
||||
`versionName` / `versionCode`, `tsc-gateway` if it changed),
|
||||
`Cargo.lock` updated, changelog and metainfo `<release>` written.
|
||||
|
||||
Release:
|
||||
|
||||
7. Tag `v<version>` (signed) on the release commit and push it.
|
||||
8. Build the artifacts from the tag: Windows executable and installer
|
||||
(signed), Linux tarball, Flatpak bundle, Android APK / AAB (signed); the
|
||||
gateway container image if it changed.
|
||||
9. Verify: signatures (`signtool verify`, `apksigner verify`), the installer
|
||||
and the Flatpak on a clean machine (matrix rows IN1-IN3), the version in
|
||||
the About page.
|
||||
10. `SHA256SUMS` (signed), a draft GitHub release with the changelog section,
|
||||
known issues and the tested server versions; publish it.
|
||||
11. Update the Flathub manifest (tag, commit, `cargo-sources.json`), Google
|
||||
Play / F-Droid.
|
||||
|
||||
After:
|
||||
|
||||
12. Add an empty `Unreleased` section to the changelog.
|
||||
@@ -0,0 +1,215 @@
|
||||
# Manual test matrix
|
||||
|
||||
What CI cannot check: other clients' WebRTC stacks, real desktops and
|
||||
portals, real audio hardware, Android power management and the installers.
|
||||
Run this matrix before every release (see [release.md](../release.md)) and
|
||||
after changes to the area in question.
|
||||
|
||||
## How to record results
|
||||
|
||||
- Fill in **Result**, **Date** (YYYY-MM-DD) and **Version** (from the About
|
||||
page; the commit hash for unreleased builds) in the tables below and
|
||||
commit the update with the release.
|
||||
- Result: `pass`, `fail` with a link to the issue, `partial` with a note, or
|
||||
`n/a` when the platform does not support the feature. Empty means not run.
|
||||
- Keep only the latest run per row; earlier runs are in the git history.
|
||||
- Note the desktop and OS versions in **Notes** the first time a row is run
|
||||
on a new release of them (e.g. "GNOME 48.2, Fedora 42").
|
||||
|
||||
Platforms:
|
||||
|
||||
| Name | Session |
|
||||
|---|---|
|
||||
| GNOME | GNOME Shell 48 or newer, Wayland (older GNOME has no GlobalShortcuts portal) |
|
||||
| KDE | KDE Plasma 6, Wayland |
|
||||
| X11 | Any X11 session (e.g. Xfce, or GNOME/KDE on Xorg) |
|
||||
| Win10 | Windows 10 22H2 |
|
||||
| Win11 | Windows 11 24H2 or newer |
|
||||
| Android | A phone with Android 12 or newer; note the model |
|
||||
|
||||
Servers: TeamSpeak 6 (streams need it; use the version pinned in
|
||||
`dev/docker-compose.yml` or newer) and TeamSpeak 3.13 for voice checks. The
|
||||
official client is the current TeamSpeak 6 client for the same OS unless
|
||||
noted.
|
||||
|
||||
## Streams with the official TeamSpeak 6 client
|
||||
|
||||
- **ST1** The official client watches our stream: we share a monitor at
|
||||
1080p30 with sound in our channel; the official client joins it. Pass:
|
||||
picture within 5 s, smooth motion (move a window around), sound in sync
|
||||
(play a video with speech), no freeze over 10 minutes, stop from either
|
||||
side ends it cleanly.
|
||||
- **ST2** We watch the official client's stream (screen with sound). Same
|
||||
pass criteria. Note the codec it sent (debug log or stats).
|
||||
- **ST3** Screen share with sound: system audio reaches viewers; voices of
|
||||
the call are not sent back to them (known gap on Linux PipeWire, see
|
||||
[media.md](../media.md): note what viewers hear).
|
||||
- **ST4** Portal restore token (Wayland): share, stop, share again. Pass: the
|
||||
second share starts without the picker; after revoking the permission in
|
||||
the desktop's settings the picker shows again.
|
||||
- **ST5** H.264: enable OpenH264 (download on first use, attribution text
|
||||
shown next to the switch), stream to the official client and watch its
|
||||
H.264 stream. Disable it again: H.264 is no longer offered.
|
||||
|
||||
| ID | Platform | Result | Date | Version | Notes |
|
||||
|---|---|---|---|---|---|
|
||||
| ST1 | GNOME | | | | |
|
||||
| ST1 | KDE | | | | |
|
||||
| ST1 | X11 | | | | |
|
||||
| ST1 | Win10 | | | | |
|
||||
| ST1 | Win11 | | | | |
|
||||
| ST2 | GNOME | | | | |
|
||||
| ST2 | KDE | | | | |
|
||||
| ST2 | X11 | | | | |
|
||||
| ST2 | Win10 | | | | |
|
||||
| ST2 | Win11 | | | | |
|
||||
| ST3 | GNOME | | | | |
|
||||
| ST3 | KDE | | | | |
|
||||
| ST3 | X11 | | | | |
|
||||
| ST3 | Win10 | | | | |
|
||||
| ST3 | Win11 | | | | |
|
||||
| ST4 | GNOME | | | | |
|
||||
| ST4 | KDE | | | | |
|
||||
| ST5 | GNOME or KDE | | | | |
|
||||
| ST5 | Win11 | | | | |
|
||||
|
||||
## Global push-to-talk
|
||||
|
||||
- **PT1** Bind push-to-talk (Wayland: the desktop's dialog appears; accept
|
||||
or change the key), focus another application (a browser, a game in
|
||||
fullscreen), hold the key: the talking indicator lights and others hear
|
||||
us; release: it stops within 100 ms. Repeat 20 times quickly: no stuck
|
||||
transmission. Hold the key and Alt+Tab away: release still ends it.
|
||||
- **PT2** Change the binding and restart the app: the new binding works; on
|
||||
Wayland the desktop keeps the binding without asking again.
|
||||
- **PT3** Windows: with an elevated window (e.g. Task Manager) focused, note
|
||||
whether push-to-talk works (a hook of a non-elevated app does not see
|
||||
those keys; document, do not fail).
|
||||
|
||||
| ID | Platform | Result | Date | Version | Notes |
|
||||
|---|---|---|---|---|---|
|
||||
| PT1 | GNOME | | | | |
|
||||
| PT1 | KDE | | | | |
|
||||
| PT1 | X11 | | | | |
|
||||
| PT1 | Win10 | | | | |
|
||||
| PT1 | Win11 | | | | |
|
||||
| PT1 | Flatpak on GNOME or KDE | | | | |
|
||||
| PT2 | GNOME | | | | |
|
||||
| PT2 | KDE | | | | |
|
||||
| PT2 | X11 | | | | |
|
||||
| PT2 | Win11 | | | | |
|
||||
| PT3 | Win11 | | | | |
|
||||
|
||||
## Audio
|
||||
|
||||
- **AU1** Echo cancellation in a real one-hour call: laptop or desk
|
||||
speakers (no headset) on our side, a second person on another client.
|
||||
Pass: the other side hears no echo of their own voice (also while both
|
||||
talk), our voice is not cut off, and the delay at the end of the hour is
|
||||
the same as at the start (clap test at 0, 30 and 60 minutes). Note CPU
|
||||
usage.
|
||||
- **AU2** Device hotplug during a call: unplug the USB headset in use: audio
|
||||
moves to the default device within a few seconds and an error or notice
|
||||
is shown; plug it back in: it moves back within 5 s. Repeat with a
|
||||
Bluetooth headset (connect, disconnect, switch between headset and
|
||||
high-quality profiles).
|
||||
- **AU3** Change the system default output and input while connected with
|
||||
"default" selected: the app follows.
|
||||
|
||||
| ID | Platform | Result | Date | Version | Notes |
|
||||
|---|---|---|---|---|---|
|
||||
| AU1 | GNOME or KDE | | | | |
|
||||
| AU1 | Win11 | | | | |
|
||||
| AU1 | Android | | | | |
|
||||
| AU2 | GNOME | | | | |
|
||||
| AU2 | KDE | | | | |
|
||||
| AU2 | X11 | | | | |
|
||||
| AU2 | Win10 | | | | |
|
||||
| AU2 | Win11 | | | | |
|
||||
| AU2 | Android | | | | |
|
||||
| AU3 | GNOME or KDE | | | | |
|
||||
| AU3 | Win11 | | | | |
|
||||
|
||||
## Android
|
||||
|
||||
- **AN1** Background voice: connect, lock the phone, 30 minutes with the
|
||||
screen off (unplugged, not on a charger). Pass: still connected, both
|
||||
directions audible the whole time, the foreground notification is shown
|
||||
and its mute / disconnect actions work. Note the battery used.
|
||||
- **AN2** Watch a stream: the official desktop client's and ours.
|
||||
- **AN3** Share the screen (MediaProjection) with sound to the official
|
||||
client and to our desktop app; stop from the notification.
|
||||
- **AN4** A phone call during a voice session: our audio pauses, the session
|
||||
resumes afterwards. Switch between Wi-Fi and mobile data: it reconnects.
|
||||
|
||||
| ID | Platform | Result | Date | Version | Notes |
|
||||
|---|---|---|---|---|---|
|
||||
| AN1 | Android | | | | |
|
||||
| AN2 | Android | | | | |
|
||||
| AN3 | Android | | | | |
|
||||
| AN4 | Android | | | | |
|
||||
|
||||
## Install and uninstall
|
||||
|
||||
- **IN1** Flatpak (bundle or Flathub): install, first run (microphone
|
||||
permission, portals, notifications, keyring), update over the previous
|
||||
version (data kept), `flatpak uninstall` (data kept) and
|
||||
`flatpak uninstall --delete-data` (`~/.var/app/<app id>` removed).
|
||||
- **IN2** Windows installer on a clean VM (no Visual C++ redistributable,
|
||||
no Rust toolchain): SmartScreen and UAC show the publisher of the
|
||||
signature, the app starts from the Start menu, an update over the
|
||||
previous version keeps the settings, uninstall from Settings > Apps
|
||||
removes the files, shortcut and registry key and keeps `%APPDATA%\tsc`;
|
||||
`uninstall.exe /S` works too.
|
||||
- **IN3** Android APK: install, update over the previous version (same
|
||||
signature, data kept), uninstall.
|
||||
|
||||
| ID | Platform | Result | Date | Version | Notes |
|
||||
|---|---|---|---|---|---|
|
||||
| IN1 | GNOME | | | | |
|
||||
| IN1 | KDE | | | | |
|
||||
| IN2 | Win10 | | | | |
|
||||
| IN2 | Win11 | | | | |
|
||||
| IN3 | Android | | | | |
|
||||
|
||||
## General
|
||||
|
||||
- **GE1** About page: the AboutSlint widget, the OpenH264 attribution and
|
||||
the full third-party notices (scrollable) are shown.
|
||||
- **GE2** Crash reports: with reports enabled, start the app with
|
||||
`TSC_TEST_CRASH=1`: it exits with a panic and, on the next start, offers
|
||||
the report (open folder, delete). With reports disabled nothing is
|
||||
written. Reports are in `~/.local/state/tsc/crash-reports` (Flatpak:
|
||||
`~/.var/app/<app id>/.local/state/tsc/crash-reports`) or
|
||||
`%LOCALAPPDATA%\tsc\crash-reports`.
|
||||
- **GE3** Saved passwords survive a restart (GNOME Keyring, KWallet, Windows
|
||||
Credential Manager, Android Keystore); without a keyring the app warns
|
||||
and keeps them for the session only.
|
||||
- **GE4** Notifications for pokes and private messages; clicking one brings
|
||||
the window up.
|
||||
- **GE5** Suspend and resume the machine while connected: the app
|
||||
reconnects.
|
||||
- **GE6** HiDPI and fractional scaling (150 %), two monitors with different
|
||||
scales: text is sharp, windows open on the right monitor.
|
||||
- **GE7** Another UI language (once translations exist): switch, restart,
|
||||
no untranslated or truncated strings on the main screens.
|
||||
|
||||
| ID | Platform | Result | Date | Version | Notes |
|
||||
|---|---|---|---|---|---|
|
||||
| GE1 | any desktop | | | | |
|
||||
| GE1 | Android | | | | |
|
||||
| GE2 | Linux | | | | |
|
||||
| GE2 | Win11 | | | | |
|
||||
| GE3 | GNOME | | | | |
|
||||
| GE3 | KDE | | | | |
|
||||
| GE3 | Win11 | | | | |
|
||||
| GE3 | Android | | | | |
|
||||
| GE4 | GNOME | | | | |
|
||||
| GE4 | KDE | | | | |
|
||||
| GE4 | Win11 | | | | |
|
||||
| GE5 | Linux | | | | |
|
||||
| GE5 | Win11 | | | | |
|
||||
| GE6 | GNOME | | | | |
|
||||
| GE6 | KDE | | | | |
|
||||
| GE6 | Win11 | | | | |
|
||||
| GE7 | any desktop | | | | |
|
||||
@@ -10,6 +10,11 @@ The product name is not decided yet: `TS Client` and the app id
|
||||
| `flatpak/io.github.faumaray.TsClient.yml` | Flatpak manifest |
|
||||
| `windows/` | NSIS installer and how to build and sign on Windows ([README](windows/README.md)) |
|
||||
|
||||
Every package also carries `THIRD_PARTY_NOTICES.md` (generated by
|
||||
`scripts/notices.sh`, see [docs/release.md](../docs/release.md)): Flatpak in
|
||||
`/app/share/licenses/<app id>/`, the Windows installer next to the executable,
|
||||
the CI artifacts in the archive. The app shows the same text in its About page.
|
||||
|
||||
## Flatpak
|
||||
|
||||
flatpak-builder builds offline, so the crates from `Cargo.lock` are listed as
|
||||
|
||||
@@ -44,6 +44,8 @@ modules:
|
||||
- install -Dm644 packaging/linux/io.github.faumaray.TsClient.desktop -t /app/share/applications/
|
||||
- install -Dm644 packaging/linux/io.github.faumaray.TsClient.metainfo.xml -t /app/share/metainfo/
|
||||
- install -Dm644 packaging/linux/io.github.faumaray.TsClient.svg -t /app/share/icons/hicolor/scalable/apps/
|
||||
# Also shown in the app's About page.
|
||||
- install -Dm644 THIRD_PARTY_NOTICES.md -t /app/share/licenses/io.github.faumaray.TsClient/
|
||||
sources:
|
||||
- type: dir
|
||||
path: ../..
|
||||
|
||||
@@ -61,6 +61,8 @@ VIAddVersionKey "LegalCopyright" "MIT OR Apache-2.0"
|
||||
Section "Install"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "/oname=${EXE}" "${BINARY}"
|
||||
; Also shown in the app's About page.
|
||||
File "/oname=THIRD_PARTY_NOTICES.md" "..\..\THIRD_PARTY_NOTICES.md"
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
CreateShortcut "$SMPROGRAMS\${APP_NAME}.lnk" "$INSTDIR\${EXE}"
|
||||
@@ -79,6 +81,7 @@ SectionEnd
|
||||
Section "Uninstall"
|
||||
; User data in %APPDATA%\tsc (identities, bookmarks, history) is kept.
|
||||
Delete "$INSTDIR\${EXE}"
|
||||
Delete "$INSTDIR\THIRD_PARTY_NOTICES.md"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
Delete "$SMPROGRAMS\${APP_NAME}.lnk"
|
||||
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerate THIRD_PARTY_NOTICES.md from Cargo.lock with cargo-about
|
||||
# (about.toml, about.hbs). The app shows the file in its About page
|
||||
# (tsc_platform::notices::text()), so it is committed; run this after changing
|
||||
# dependencies.
|
||||
#
|
||||
# Usage: scripts/notices.sh regenerate THIRD_PARTY_NOTICES.md
|
||||
# scripts/notices.sh --check fail if the committed file is stale (CI)
|
||||
#
|
||||
# Needs cargo-about $ABOUT_VERSION; the output depends on its version:
|
||||
# cargo install cargo-about --locked --version 0.9.2 --features cli
|
||||
# Fails on any warning, e.g. a license whose text was not found.
|
||||
set -euo pipefail
|
||||
|
||||
ABOUT_VERSION=0.9.2
|
||||
OUT=THIRD_PARTY_NOTICES.md
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
check=false
|
||||
case "${1:-}" in
|
||||
--check) check=true ;;
|
||||
"") ;;
|
||||
*) echo "usage: $0 [--check]" >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
version=$(cargo about --version 2>/dev/null | awk '{print $2}' || true)
|
||||
if [[ "$version" != "$ABOUT_VERSION" ]]; then
|
||||
echo "cargo-about $ABOUT_VERSION is required (found: ${version:-none}):" >&2
|
||||
echo " cargo install cargo-about --locked --version $ABOUT_VERSION --features cli" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
# Workspace members with default features, filtered by the targets in
|
||||
# about.toml, so the result does not depend on the host.
|
||||
if ! cargo about generate --workspace --locked --fail about.hbs -o "$tmp/$OUT" 2>"$tmp/log"; then
|
||||
cat "$tmp/log" >&2
|
||||
exit 1
|
||||
fi
|
||||
if grep -E "WARN|ERROR" "$tmp/log" >&2; then
|
||||
echo "cargo-about reported problems (above); fix about.toml" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if $check; then
|
||||
if ! diff -u "$OUT" "$tmp/$OUT" >"$tmp/diff"; then
|
||||
head -n 100 "$tmp/diff"
|
||||
echo "$OUT is stale: run scripts/notices.sh and commit the result" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "$OUT is up to date"
|
||||
else
|
||||
mv "$tmp/$OUT" "$OUT"
|
||||
echo "wrote $OUT ($(wc -c <"$OUT") bytes)"
|
||||
fi
|
||||
Reference in new issue
Block a user