Merge pull request #9 from Faumaray/claude/great-allen-rw6re7
Login page, myTeamSpeak profile, stream fps, invisible gateway, relay as author, TS6 version, packaging, logs
This commit is contained in:
commit
656bc5f6dd
69 files changed
+2693
-1321
No files matched your search
@@ -9,8 +9,6 @@ on:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_BUILD_JOBS: "1"
|
||||
CARGO_INCREMENTAL: "0"
|
||||
RUST_BACKTRACE: "0"
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
name: System dependencies
|
||||
description: >
|
||||
Native libraries and tools the workspace builds against: apt packages on
|
||||
Linux; NASM and libvpx (vcpkg, cached) on Windows, exporting VPX_LIB_DIR,
|
||||
VPX_INCLUDE_DIR, VPX_VERSION and VPX_STATIC for libvpx-native-sys.
|
||||
Linux; NASM, libvpx and dav1d (vcpkg, cached) on Windows, exporting
|
||||
VPX_LIB_DIR, VPX_INCLUDE_DIR, VPX_VERSION and VPX_STATIC for
|
||||
libvpx-native-sys and SYSTEM_DEPS_DAV1D_* for dav1d-sys.
|
||||
|
||||
inputs:
|
||||
vpx-triplet:
|
||||
description: vcpkg triplet for libvpx on Windows (static library, dynamic CRT like Rust's default)
|
||||
description: vcpkg triplet for libvpx and dav1d on Windows (static libraries, dynamic CRT like Rust's default)
|
||||
default: x64-windows-static-md
|
||||
|
||||
runs:
|
||||
@@ -47,8 +48,8 @@ runs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}\vcpkg-archives
|
||||
key: vcpkg-libvpx-${{ inputs.vpx-triplet }}-${{ steps.vcpkg.outputs.commit }}
|
||||
restore-keys: vcpkg-libvpx-${{ inputs.vpx-triplet }}-
|
||||
key: vcpkg-libvpx-dav1d-${{ inputs.vpx-triplet }}-${{ steps.vcpkg.outputs.commit }}
|
||||
restore-keys: vcpkg-libvpx-dav1d-${{ inputs.vpx-triplet }}-
|
||||
|
||||
- name: libvpx
|
||||
if: runner.os == 'Windows'
|
||||
@@ -60,7 +61,7 @@ runs:
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$vcpkg = Join-Path $env:VCPKG_INSTALLATION_ROOT 'vcpkg.exe'
|
||||
New-Item -ItemType Directory -Force (Join-Path $env:RUNNER_TEMP 'vcpkg-archives') | Out-Null
|
||||
& $vcpkg install "libvpx:$env:TRIPLET"
|
||||
& $vcpkg install "libvpx:$env:TRIPLET" "dav1d:$env:TRIPLET"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
# "libvpx:x64-windows-static-md 1.15.2#1 The reference ..."
|
||||
@@ -85,3 +86,19 @@ runs:
|
||||
"VPX_VERSION=$version" >> $env:GITHUB_ENV
|
||||
"VPX_STATIC=1" >> $env:GITHUB_ENV
|
||||
Write-Host "libvpx $version from $libdir"
|
||||
|
||||
# dav1d-sys (AV1 decoding) through system-deps, without pkg-config:
|
||||
# the static library, linked as dav1d.lib.
|
||||
$davdir = Join-Path $root 'lib'
|
||||
if (-not (Test-Path (Join-Path $davdir 'dav1d.lib'))) {
|
||||
$lib = Get-ChildItem $davdir -Filter '*dav1d*.lib' | Select-Object -First 1
|
||||
if (-not $lib) { Get-ChildItem $davdir; throw "no dav1d library in $davdir" }
|
||||
$davdir = Join-Path $env:RUNNER_TEMP 'dav1d-lib'
|
||||
New-Item -ItemType Directory -Force $davdir | Out-Null
|
||||
Copy-Item $lib.FullName (Join-Path $davdir 'dav1d.lib')
|
||||
}
|
||||
"SYSTEM_DEPS_DAV1D_NO_PKG_CONFIG=1" >> $env:GITHUB_ENV
|
||||
"SYSTEM_DEPS_DAV1D_SEARCH_NATIVE=$davdir" >> $env:GITHUB_ENV
|
||||
"SYSTEM_DEPS_DAV1D_LIB=dav1d" >> $env:GITHUB_ENV
|
||||
"SYSTEM_DEPS_DAV1D_LINK=static" >> $env:GITHUB_ENV
|
||||
Write-Host "dav1d from $davdir"
|
||||
@@ -20,8 +20,6 @@ permissions:
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: "0"
|
||||
CARGO_BUILD_JOBS: "1"
|
||||
CARGO_INCREMENTAL: "0"
|
||||
|
||||
jobs:
|
||||
package-linux:
|
||||
@@ -37,10 +35,11 @@ jobs:
|
||||
key: release
|
||||
- name: Build
|
||||
run: cargo build --release --locked -p voelin-ui -p voelin-gateway
|
||||
# dpkg-shlibdeps works out the .deb's dependencies.
|
||||
# dpkg-shlibdeps works out the .deb's dependencies; patchelf points
|
||||
# the .tar.gz's binary at the libraries it carries.
|
||||
- name: Package (.tar.gz, .deb)
|
||||
run: |
|
||||
sudo apt-get install -y --no-install-recommends dpkg-dev
|
||||
sudo apt-get install -y --no-install-recommends dpkg-dev patchelf
|
||||
scripts/package.sh linux dist
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -72,6 +71,12 @@ jobs:
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
}
|
||||
"MAKENSIS=$($makensis.Replace('\', '/'))" >> $env:GITHUB_ENV
|
||||
# FFmpeg's LGPL DLLs, shipped next to voelin.exe.
|
||||
- name: FFmpeg
|
||||
shell: bash
|
||||
run: |
|
||||
scripts/fetch-ffmpeg-windows.sh "$RUNNER_TEMP/ffmpeg"
|
||||
echo "FFMPEG_DLL_DIR=$RUNNER_TEMP/ffmpeg" >> "$GITHUB_ENV"
|
||||
- name: Package (.zip, installer)
|
||||
shell: bash
|
||||
run: scripts/package.sh windows dist
|
||||
|
||||
@@ -6,6 +6,54 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- myTeamSpeak profile: Settings → My Account shows the account's avatar,
|
||||
description, registration date, previous sign-in, badges and signed-in
|
||||
devices from the account service; the avatar is also the sidebar's
|
||||
profile picture where a server has none for us.
|
||||
- Log files: each run logs to `<state>/voelin/logs/voelin.log`, the previous
|
||||
four runs are kept; `VOELIN_LOG` sets what is logged. Settings → Advanced
|
||||
opens the folder.
|
||||
- Linux `.tar.gz`: libvpx and libdav1d in `lib/`, and `bin/voelin-install-deps`
|
||||
for FFmpeg, VA-API drivers, PipeWire, the desktop portal and a keyring.
|
||||
- Windows packages ship FFmpeg's LGPL libraries, so hardware encoders and
|
||||
decoders work without installing FFmpeg.
|
||||
- AV1 decoding through dav1d in every desktop build.
|
||||
- 122 more signed client versions (`Versions.csv`).
|
||||
|
||||
### Changed
|
||||
|
||||
- New login page; it no longer opens when a session is saved (only when one
|
||||
has expired), and "Continue without an account" is remembered.
|
||||
- Selecting a server observes it through its gateway at once; the Observe
|
||||
button is gone. The server dialog asks only for the address, password,
|
||||
name and nickname: the gateway is found from the address.
|
||||
- Relayed messages appear in TeamSpeak under the author's own nickname
|
||||
(`Nick1` while the name is taken), not as `[Nick] text` from the relay.
|
||||
- The client reports itself as TeamSpeak 6 (`6.0.0-beta4.1` on Linux,
|
||||
`6.0.0-beta2` on Windows) instead of `3.?.?`; `--client-version generic`
|
||||
claims the old version.
|
||||
- Watching streams: VP8 decodes on one thread (FFmpeg's slice threads made
|
||||
multi-partition streams 40-80 % slower), pictures are converted for the
|
||||
window on their own thread into reused buffers, and libvpx and dav1d use
|
||||
fewer threads. A 1440p60 VP8 stream from a 6-8 core sender showed 35-49
|
||||
fps; FFmpeg decodes it at 95-101 fps on one thread against 54-60 on four.
|
||||
- Release builds no longer limit Cargo to one job.
|
||||
- The gateway is invisible: relayed messages look like everyone else's (no
|
||||
"via relay"), and a gateway that is away is tried again quietly instead
|
||||
of showing a WebSocket error; only what the user did and failed is
|
||||
told, in plain words. A server whose gateway is away no longer shows as
|
||||
connecting, so it can always be joined.
|
||||
- A server's published gateway replaces one stored before (found or typed
|
||||
into an older version), so a gateway that moved is followed.
|
||||
- zbus's warnings about desktop portal requests are left out of the logs.
|
||||
|
||||
### Fixed
|
||||
|
||||
- The account's avatar is downloaded from its own link; it was asked for
|
||||
as an upload link and refused with HTTP 403.
|
||||
|
||||
## [0.0.1-alpha] - 2026-10-04
|
||||
|
||||
The first alpha.
|
||||
|
||||
@@ -41,7 +41,7 @@ Done so far (milestones M0–M4 and the first part of M5 of [the plan](docs/arch
|
||||
reactions, topics, events, stream directory and administration; the media pipeline for streams
|
||||
(capture → VP8 + Opus → stream, stream → decoder)
|
||||
- `crates/voelin-ui` (`voelin`): Slint desktop app: servers, channel tree with talking indicators,
|
||||
chat tabs (own channel via voice, other channels via relay), connect / observe invisibly, mute, push-to-talk
|
||||
chat tabs (own channel via voice, other channels via relay), connect, observe invisibly (on selecting a server, through its gateway), mute, push-to-talk
|
||||
(in the window and as a global hotkey), audio settings with a level meter, per-client volume, and on
|
||||
TeamSpeak 6 streams: watch in a viewer, share the screen with sound. Desktop and phone layouts
|
||||
from one design system, dark and light themes, text size, emoji ([docs/ui.md](docs/ui.md))
|
||||
|
||||
+87
-770
@@ -182,12 +182,12 @@ the crate's authors are listed as its copyright holders.
|
||||
|
||||
| License | Crates |
|
||||
|---|---|
|
||||
| MIT License | 657 |
|
||||
| Apache License 2.0 | 34 |
|
||||
| MIT License | 661 |
|
||||
| Apache License 2.0 | 32 |
|
||||
| Unicode License v3 | 26 |
|
||||
| ISC License | 24 |
|
||||
| BSD 3-Clause "New" or "Revised" License | 22 |
|
||||
| LicenseRef-Slint-Royalty-free-2.0 | 12 |
|
||||
| ISC License | 8 |
|
||||
| BSD 2-Clause "Simplified" License | 3 |
|
||||
| zlib License | 3 |
|
||||
| Boost Software License 1.0 | 2 |
|
||||
@@ -405,284 +405,6 @@ Used by: flagset 0.4.7, hound 3.5.1
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor 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, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
Licenses for support code
|
||||
-------------------------
|
||||
|
||||
Parts of the TLS test suite are under the Go license. This code is not included
|
||||
in BoringSSL (i.e. libcrypto and libssl) when compiled, however, so
|
||||
distributing code linked against BoringSSL does not trigger this license:
|
||||
|
||||
Copyright (c) 2009 The Go 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 Inc. 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
|
||||
OWNER 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.
|
||||
|
||||
|
||||
BoringSSL uses the Chromium test infrastructure to run a continuous build,
|
||||
trybots etc. The scripts which manage this, and the script for generating build
|
||||
metadata, are under the Chromium license. Distributing code linked against
|
||||
BoringSSL does not trigger this license.
|
||||
|
||||
Copyright 2015 The Chromium 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 Inc. 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
|
||||
OWNER 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.
|
||||
|
||||
````
|
||||
|
||||
Used by: moka 0.12.16
|
||||
|
||||
````text
|
||||
@@ -1304,7 +1026,7 @@ Used by: cpal 0.18.2, imgref 1.12.3, self_cell 1.3.0, unicode-linebreak 0.1.5
|
||||
|
||||
````
|
||||
|
||||
Used by: gethostname 1.1.0, prost-derive 0.14.4, prost-types 0.14.4, prost 0.14.4, ring 0.17.14
|
||||
Used by: gethostname 1.1.0, prost-derive 0.14.4, prost-types 0.14.4, prost 0.14.4
|
||||
|
||||
````text
|
||||
Apache License
|
||||
@@ -2518,84 +2240,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
### ISC License
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
/* Copyright (c) 2014, Intel Corporation.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||
|
||||
#ifndef OPENSSL_HEADER_EC_ECP_NISTZ384_H
|
||||
#define OPENSSL_HEADER_EC_ECP_NISTZ384_H
|
||||
|
||||
#include "../../limbs/limbs.h"
|
||||
|
||||
#define P384_LIMBS (384u / LIMB_BITS)
|
||||
|
||||
typedef struct {
|
||||
Limb X[P384_LIMBS];
|
||||
Limb Y[P384_LIMBS];
|
||||
Limb Z[P384_LIMBS];
|
||||
} P384_POINT;
|
||||
|
||||
typedef struct {
|
||||
Limb X[P384_LIMBS];
|
||||
Limb Y[P384_LIMBS];
|
||||
} P384_POINT_AFFINE;
|
||||
|
||||
|
||||
#endif // OPENSSL_HEADER_EC_ECP_NISTZ384_H
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2015-2016 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
//! EdDSA Signatures.
|
||||
|
||||
use super::ops::ELEM_LEN;
|
||||
use crate::digest;
|
||||
|
||||
pub mod signing;
|
||||
pub mod verification;
|
||||
|
||||
/// The length of an Ed25519 public key.
|
||||
pub const ED25519_PUBLIC_KEY_LEN: usize = ELEM_LEN;
|
||||
|
||||
pub fn eddsa_digest(signature_r: &[u8], public_key: &[u8], msg: &[u8]) -> digest::Digest {
|
||||
let mut ctx = digest::Context::new(&digest::SHA512);
|
||||
ctx.update(signature_r);
|
||||
ctx.update(public_key);
|
||||
ctx.update(msg);
|
||||
ctx.finish()
|
||||
}
|
||||
|
||||
````
|
||||
|
||||
Used by: untrusted 0.7.1, untrusted 0.9.0
|
||||
|
||||
````text
|
||||
@@ -2615,397 +2259,6 @@ Used by: untrusted 0.7.1, untrusted 0.9.0
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2015-2022 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
use crate::limb::Limb;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[repr(transparent)]
|
||||
pub struct N0([Limb; 2]);
|
||||
|
||||
impl N0 {
|
||||
#[cfg(feature = "alloc")]
|
||||
pub(super) const LIMBS_USED: usize = 64 / crate::limb::LIMB_BITS;
|
||||
|
||||
#[inline]
|
||||
pub const fn precalculated(n0: u64) -> Self {
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
{
|
||||
Self([n0, 0])
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
{
|
||||
Self([n0 as Limb, (n0 >> crate::limb::LIMB_BITS) as Limb])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2015-2025 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
use crate::{bb, error};
|
||||
|
||||
#[deprecated(
|
||||
note = "To be removed. Internal function not intended for external use with no promises regarding side channels."
|
||||
)]
|
||||
pub fn verify_slices_are_equal(a: &[u8], b: &[u8]) -> Result<(), error::Unspecified> {
|
||||
bb::verify_slices_are_equal(a, b)
|
||||
}
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2016 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
//! Elliptic curve operations and schemes using Curve25519.
|
||||
|
||||
pub mod ed25519;
|
||||
|
||||
pub mod x25519;
|
||||
|
||||
mod ops;
|
||||
mod scalar;
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2016-2024 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
use crate::error::{KeyRejected, Unspecified};
|
||||
|
||||
impl From<untrusted::EndOfInput> for Unspecified {
|
||||
fn from(source: untrusted::EndOfInput) -> Self {
|
||||
super::erase(source)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<core::array::TryFromSliceError> for Unspecified {
|
||||
fn from(source: core::array::TryFromSliceError) -> Self {
|
||||
super::erase(source)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<KeyRejected> for Unspecified {
|
||||
fn from(source: KeyRejected) -> Self {
|
||||
super::erase(source)
|
||||
}
|
||||
}
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2018 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
//! Serialization and deserialization.
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod der;
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
mod writer;
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
pub(crate) mod der_writer;
|
||||
|
||||
pub(crate) mod positive;
|
||||
|
||||
pub use self::positive::Positive;
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
pub(crate) use self::writer::TooLongError;
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2019-2024 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
use super::BlockLen;
|
||||
|
||||
pub(super) use self::{
|
||||
sha2_32::{block_data_order_32, State32, SHA256_BLOCK_LEN},
|
||||
sha2_64::{block_data_order_64, State64, SHA512_BLOCK_LEN},
|
||||
};
|
||||
|
||||
pub(super) const CHAINING_WORDS: usize = 8;
|
||||
|
||||
#[cfg(any(
|
||||
all(target_arch = "aarch64", target_endian = "little"),
|
||||
all(target_arch = "arm", target_endian = "little"),
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[macro_use]
|
||||
mod ffi;
|
||||
|
||||
pub(super) mod fallback;
|
||||
mod sha2_32;
|
||||
mod sha2_64;
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2024 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
// TODO(MSRV 1.76): Replace with `core::ptr::from_mut`.
|
||||
#[allow(dead_code)]
|
||||
#[inline(always)]
|
||||
pub fn from_mut<T: ?Sized>(r: &mut T) -> *mut T {
|
||||
r
|
||||
}
|
||||
|
||||
// TODO(MSRV 1.76): Replace with `core::ptr::from_ref`.
|
||||
#[allow(dead_code)]
|
||||
#[inline(always)]
|
||||
pub const fn from_ref<T: ?Sized>(r: &T) -> *const T {
|
||||
r
|
||||
}
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2024 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
//! Integration tests for non-public APIs.
|
||||
|
||||
mod bits_tests;
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2024 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
pub use self::{
|
||||
array::Array,
|
||||
base::{IndexError, Overlapping},
|
||||
partial_block::PartialBlock,
|
||||
};
|
||||
|
||||
mod array;
|
||||
mod base;
|
||||
mod partial_block;
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2025 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#![cfg(all(target_arch = "aarch64", target_endian = "little"))]
|
||||
|
||||
pub(in super::super) mod mont;
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2025 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#![cfg(target_arch = "x86_64")]
|
||||
|
||||
pub(in super::super::super) mod mont;
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2025 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
mod storage;
|
||||
|
||||
pub(super) use self::storage::{AlignedStorage, LIMBS_PER_CHUNK};
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
// Copyright 2025 Brian Smith.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
pub(super) mod aarch64;
|
||||
pub(super) mod x86_64;
|
||||
|
||||
````
|
||||
|
||||
Used by: aws-lc-sys 0.45.0
|
||||
|
||||
````text
|
||||
@@ -3347,25 +2600,6 @@ THIS SOFTWARE.
|
||||
|
||||
````
|
||||
|
||||
Used by: ring 0.17.14
|
||||
|
||||
````text
|
||||
Copyright 2015-2025 Brian Smith.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
````
|
||||
|
||||
Used by: libloading 0.8.9
|
||||
|
||||
````text
|
||||
@@ -9677,6 +8911,33 @@ SOFTWARE.
|
||||
|
||||
````
|
||||
|
||||
Used by: av-data 0.4.4
|
||||
|
||||
````text
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Luca Barbato
|
||||
|
||||
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.
|
||||
|
||||
````
|
||||
|
||||
Used by: imagesize 0.15.0
|
||||
|
||||
````text
|
||||
@@ -9758,6 +9019,33 @@ SOFTWARE.
|
||||
|
||||
````
|
||||
|
||||
Used by: dav1d-sys 0.8.3, dav1d 0.11.1
|
||||
|
||||
````text
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Luca Barbato
|
||||
|
||||
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.
|
||||
|
||||
````
|
||||
|
||||
Used by: crc32fast 1.5.2
|
||||
|
||||
````text
|
||||
@@ -11606,6 +10894,35 @@ 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.
|
||||
|
||||
````
|
||||
|
||||
Used by: byte-slice-cast 1.2.3
|
||||
|
||||
````text
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Sebastian Dröge <sebastian@centricular.com>.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
````
|
||||
|
||||
Used by: derive-new 0.7.0
|
||||
|
||||
@@ -1414,4 +1414,126 @@ version,platform,hash
|
||||
3.?.? [Build: 5680278000],Linux,Hjd+N58Gv3ENhoKmGYy2bNRBsNNgm5kpiaQWxOj5HN2DXttG6REjymSwJtpJ8muC2gSwRuZi0R+8Laan5ts5CQ==
|
||||
3.?.? [Build: 5680278000],OS X,SttEnjoWE8jqIM6BOHSfiZP9DGjW0EP/ajU4bdKqgGMV4aYq/kzwVA9gxbmdIzV4lbaokvXBqrRjfBHrTVh8Cg==
|
||||
3.?.? [Build: 5680278000],Windows,DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg==
|
||||
3.?.? [Build: 5680278000] DEBUG,Windows,FaA10gndI44f19ZThYJX2OSM8ESrx9/vJ2uY+rON4enzzPsPR9kiPhsUXtMcC5szzTu6F/vLCiNNEhCr70CKCQ==
|
||||
3.?.? [Build: 5680278000] DEBUG,Windows,FaA10gndI44f19ZThYJX2OSM8ESrx9/vJ2uY+rON4enzzPsPR9kiPhsUXtMcC5szzTu6F/vLCiNNEhCr70CKCQ==
|
||||
3.6.0 [Build: 1668022263],Windows,jNUeF6ydYPJp6CpoA2Nm8FcmxPTwj8bFJmmzo/Ch2B9L2CU2rrgLJedcQM3NjAncESYYywUiFR0+BsljvaTNAQ==
|
||||
5.0.0-qa-74-5 [Build: 1680085518],Windows,/X5xXLBPrLClWkivAnMJCz+QIBmFk9fFie8sNg69OdN/xwBQrX6naf2IehfxLdd+BBWX/5TsDjuPJqJwhK1FBg==
|
||||
5.0.0-qa-74-7 [Build: 1681481733],Windows,4qdm8R3gNHlXDV9PS2CtV3Fe9SN7Mjgt82X+iZmqwMXk9B0g9vCyK62G7h2nr/qcqSopPXR4652xMsSQPYVvDQ==
|
||||
3.6.0 [Build: 1681728436],OS X,MZzEbAN51fl7FGiF51T32nHz5tySXH3te4EEZip5rImRNX1Ey3bBQkahN1PYhURNAQxAtIupczX5iGMmvKm4DA==
|
||||
5.0.0-qa-74-8 [Build: 1681821920],Windows,wBuvBhPgbvXmtEOavMpF/6X7xvHkd0PcrNmob7nSr5trxi5HFGjzvOZU19p56yzOStI077LvVJcQtjVha2uXCA==
|
||||
5.0.0-qa-74-10 [Build: 1682065994],Windows,fCODC/wSy5xu9VXPjK3MsRur4MqN/mSLcP/DdbQ2u/KNgQmpuQEsVelmbrf5AvJUQ9YhmXyx8aMvTnG9kHSnCQ==
|
||||
5.0.0-qa-dc-1 [Build: 1682080978],Windows,0p63hM9RbR65x093OWBlS9g0We6lNfYA+IWN99TZ23HXzWXuvfukMK6lIviHJkNSFWCBxhGQFmFi9lttH00vCA==
|
||||
5.0.0-qa-74-11 [Build: 1682337867],Windows,BhUfmE4EX5h9gjKKtfO1JQ61sIdzZfm1IcvA4FNU8BtmA2DSzUJ9uDWFrq60h7lh33wkktDCzlXL7j8PNQChCg==
|
||||
5.0.0-qa-74-13 [Build: 1682589154],Windows,4OMk6jcMvJc/P3zaojn8+laRQzG/vnmEkWEmTpQzIsTcPzKOu5irT82YpOtlp+BIxFDGb8onygu/turJjHLiDA==
|
||||
5.0.0-qa-74-14 [Build: 1682680770],Windows,bwZm9gRSoUSRTWCcc1N0ZuKs+xznjBKErt3myq9YlXzdC/jkn4miNoinG60Ynbsp1JkU8tAVKy4v8HUBLictAg==
|
||||
5.0.0-qa-74-15 [Build: 1683039954],Windows,MFemYXY5GGg2OYhdRzdhpkn9ujzOMMCZA8QGlPV1GUbhjjtjXuMw5+ydEzLwcgZYpFTod3N6CEz/b/aXwWeyCQ==
|
||||
3.6.0 [Build: 1683203743],Linux,ao52xPYBI8qe57kJJ6KQgQPr0J9w7BhGikkFMqs7pGpsrxLK9ghzOlbu5IZsdct3tNw88S2YB0oFmcCWlx+hCA==
|
||||
3.6.0 [Build: 1683203743],OS X,w/rKVPUul3im2KxVqvL8udZf/o0Yre+92bvACj8hU1x5aNtQkvodXo7CML+4mM6EgifiVCyI8kyo6BtbfeF7Ag==
|
||||
3.6.0 [Build: 1683203743],Windows,Ha73fVhy6+r06Zh3CCx8RVJ1HtHCaABNnTfFbjQPy0dm/e79JFIPZgeC5IvJBltwaiBic/9M+aKBrt+7sNxNDw==
|
||||
5.0.0-qa-74-17 [Build: 1683295507],Windows,hpDc2gHUCHv3HUA1nBray8U8Re/d9XvDUHZkefwMkgeL8L6KizWeo7vZzFguQLYpRPr20B4h0d/A8NAxYxfqAA==
|
||||
5.0.0-beta74 [Build: 1683627550],Linux,M5TTHH2J1erTQKBElj0dz4Lm9N4erZuHxZNjNlbJjDxRC8CYnziveIW0j8DY8NeQaSKHeCTXoL5pDakZtvAODQ==
|
||||
5.0.0-beta74 [Build: 1683627550],macOS,EmwreqEhVhmpGrjPKyNjwuEdWKF+uGTX0syXkq57+klgtcNw9lddPm9lodLTdB5spPGlsx0CJQySvEXlWyXNDg==
|
||||
5.0.0-beta74 [Build: 1683627550],Windows,pipm1uaijQDJKPZgRkhjyLsLG/W9KnjEDWNGvqUkUrSuqrUvfEG4OUsdTOReMb+FJp4xz82n3cwd4HExO5k3Dw==
|
||||
5.0.0-qa-tr-1 [Build: 1683731563],Windows,HmBOKipdW28prdI2FFdmBu/mMXui+zdC0G7769F3bW+nVRfNoVtvJhSUx7/UDeQ9ghHbUIW6q2lCxnQLzsIRCg==
|
||||
3.6.0 [Build: 1683804569],Linux,CqbjoDdeYd83t/u9YUtlQf4rDIf6yEnFInF6nq7GcO02tRXBQlppxHd/ziaTdlpwYrha00goKb2GGWwdrNhFAA==
|
||||
3.6.0 [Build: 1683804569],OS X,sT6ej/41Qk3T0LfXl3+VSm3J7Ck4M/OCTWIRundvOHBRodGLWJtddZuQu7IlXNr9mbJfklarQ4XyyXvXMdjvCw==
|
||||
3.6.0 [Build: 1683804569],Windows,PesaPHU3+aiZMUPzpq8UBKjck77jLw9N+hyZq6JjD4baqns5dmKj4sTfSL9/QROyOLqPICZ+fwkSy5iuuMQEAw==
|
||||
5.0.0-qa-75-1 [Build: 1684855710],Windows,LLfl5sHAfsdepvecADQI9/nx98H+jA/r9pe6fq5CqlRY+MCdVbOphiXy7zZerE5h4lIRqcJtEeAJVIXaNu+LDA==
|
||||
5.0.0-qa-75-2 [Build: 1685542148],Windows,Ir/0IAdrK5dDVDlh6gIRwGZe0DFR9vUNf313cLwHTN1EB9nyO2Bq5yoBjZuGYOdNgcbdgQCBzfKNd4ZpCxxSAg==
|
||||
3.6.0 [Build: 1685546268],OS X,i257nbRzdfvBvgW4IeFoCe8KnCDfoIvtNeORVFVPohKWfFajfoBNYTDa/2/jgHbd97Dzqd+hx8t2ZwPPwgR+Bg==
|
||||
5.0.0-beta75-rc1 [Build: 1685698093],Windows,Jkvyb0PGEmS3/lVfr2x7SFlSZMeopxo7JXBHx8m1pWeDL7XdjYoDPOaIJ6UD1hNxY/wv84fgAwt65Ip2AdP1Dw==
|
||||
5.0.0-beta75-rc2 [Build: 1686050172],Windows,BcULgPFoo2+QTsjD88VH5rONZcABm32fgd5jBNbdkxTaERND/CJI4ZBWS30s5WKN9bi3T6LKUOzcLyN6+gfNDQ==
|
||||
5.0.0-beta75-rc3 [Build: 1686126230],macOS,38gec16GTEPCeaVw5qM8tU58HWM0HZ20yROR1foT8TRHqsTvoED2gm07xb6KfSHN3//3k1ErMvuS4emNBohcBA==
|
||||
5.0.0-beta75-rc3 [Build: 1686126230],Windows,1Jj8VSZ8QQ2K5jFiRM2DB6Z12Yi1fFjJ3ng96W/S+zU2VzldrOsuvhO36BOjbWMCcEIWoc45sbHPm+utJtxeAw==
|
||||
3.6.0 [Build: 1686637110],Linux,8eM1WF1E9+8DeS+Zm6IcidGtuTC0+jtrLRkkiIk+GUA91bVOCyYgrUWNFVftZtFEM4qIOICJhLQopVTIwYJOCQ==
|
||||
3.6.0 [Build: 1686637110],Windows,r21r7w+EGu6F6aruzYiuzv2lP5bX8X4TP2xXBH5Wljz3x/VxOxndN84qA9sPn6QJZFQCtzq+iEb0wfFFM7mYCA==
|
||||
3.6.0 [Build: 1686731472],Linux,MKaey6yCAdQDBHl5ERY24N5bz9CsdypGJfpTC5mNPc0s3Z1zeb8c3g9/w/mlRD+qoK3xlCYt3f25oaFMZofMAA==
|
||||
3.6.0 [Build: 1686731472],Windows,KRYqAaQhnKh/NQ4LrOw8+nVA659NDn+IlOB8hhmKZolIOEDSiijCeDoTVf61t/0Z0y1OWlxABS4X7uWRzvhiDw==
|
||||
3.6.0 [Build: 1686736529],Linux,l1LIP8nreS+y33Hp7SmA6M7kJZZI1KbsN1/Rx9hAAL3Wd6PbEwhLIQHXBkfCI8MizWSAl7NDb+UOuNxAL9GoAg==
|
||||
3.6.0 [Build: 1686736529],OS X,EFU7gHd4QZhwmAojg0Tk/tL9dPiFTcWn40R/6YZCrlzX6t0FSPXiAj93OUf1du+qyy2ly4Lrox/M0u4wOhEDBg==
|
||||
3.6.0 [Build: 1686736529],Windows,kRHYyNCdM5rna2v27LyPerCeNd1s76h0KfpLSmLQk3Bzkrg/NCBzpj0WofE1cvbQ2Qm/41d/mUIMxIfXJ/+hCg==
|
||||
3.6.0 [Build: 1686744367],Linux,toUkg41DTfeCfWgqqxSeb8eDzri2PsjRNIcHsFxr0d7nLCTYGoSFfQjme84FjMYtvYloMVAk/gx5Nt+hWE+ZBg==
|
||||
3.6.0 [Build: 1686744367],Windows,VXx9yKF0ZaBMqlU285hPLxaCgH1N8OwKjU52A0EdulFmEeLYYQeJI/7139hno0Ph8kGT6nxoDRKtw0yn9woNAQ==
|
||||
3.6.0 [Build: 1686749764],Linux,TccRBHwn5LSA0lfpa2B42QmfCOiG+MqqyhlOqy5RcuRQNUGPD0e47lUz+Z/8+Gsdc1TPG4+vYlRl8+v2v+26Aw==
|
||||
3.6.0 [Build: 1686749764],OS X,g8H7Op8eCrn0wHutuD/SlmUcZPmkSlFUBhvZpSgm9kuQl4dapzKJq2anI5jDwRs/ooBm/wrIlSiWI6HXuOPZDA==
|
||||
3.6.0 [Build: 1686749764],Windows,gfzG6CfwNYeqrjT68s7ahPd24A/XS0P8LLAB7hrE54MnrlO12RiflD2w69VZ7EYlqnd9GAiVzdGJHCmCFWtlAQ==
|
||||
5.0.0-beta75-rc4 [Build: 1687777367],Linux,DCZXmwc6xocEuzvS+f+qyQLwN8FLdNqyDTAjdOfy1y8JeO8VmIlNwRFd7X0D0Q51kqPNPIB7Jbh4yiwySHjhDw==
|
||||
5.0.0-beta75-rc4 [Build: 1687777367],macOS,xgV8yX/XS3qVXshur/PbsquRIbPvz3w+hJL905nQQBwbniSGvKxAUcTJompBgECG989hf6nW+2GApbf8p70RBw==
|
||||
5.0.0-beta75-rc4 [Build: 1687777367],Windows,wIGrljvdCMZX3XJoe0rWTA/nNZuXVC6z8kUvDw1gi9YxyM6AxmsleqOzjZ3zY5Ii7cRU8slxNAh4ERLcHEPQDg==
|
||||
5.0.0-beta75-rc5 [Build: 1687944933],Windows,1fQu13pX9jdR5oJ4yaqasfoWrcySvwocstrOQOZLZjB+0nUtKMYW4Kp2DYHuIoTlvuWiiF7pYc7YK4bOUWdlAA==
|
||||
3.6.1 [Build: 1689766945],Linux,fjR+/+EsahBSG/qGjcTTUVIyn/w7W6h7uy9YUebYzRbtWIxxv69ZD4k7Y4Z1OS9+cuB/Nbtg05J2Upt2oK/qCg==
|
||||
3.6.1 [Build: 1689766945],Windows,+6Tcswj4E40ablTifyXIA3UDEY+359hxjEVx+Tb+xha08CiSwpzSpFndS8GCs8z0QICVKUZBwhVfGfePm00vDw==
|
||||
3.6.1 [Build: 1689949736],Linux,yM9tjby+KBrov9dyNLM1I1PZXDBK2fdwR8ylvKdZJc/DaL5GqnoBAGLkFmzOIl//u8VMbXspCDWb/PbvOS2gAg==
|
||||
3.6.1 [Build: 1689949736],Windows,30JdFX5zLrHx3uKsb55vpdlS6DO36bVRSOewzOlTV70LS4X0dVMZp64EzDZY8ZR2woAAjZ8ZR/rIKt4JlNnKDg==
|
||||
3.6.1 [Build: 1690193193],Linux,UAcE5h5FgPcdChWTtiO816HX8f2qdoDcDEw6crbJ96Yo7rp1Bt+qx/rkKK9bzlVWMhOd4fI7pr++1XaPkEBnAQ==
|
||||
3.6.1 [Build: 1690193193],OS X,P+KOw42V8K0nN5FbGItCaJzrDuWcRgfE3MRzrtbYAhRMTXHzRxvwLkoLM7+vKTW135NtWZlKbZuDAvxgwhSLBg==
|
||||
3.6.1 [Build: 1690193193],Windows,I5uwVK2CZa9aXblVQPUKGbjNYoE2eaUPujK8sVGWAUsPhmGySTvSkP70jrpX8pUgQdtHwUOl3gvrAH6+moNeDQ==
|
||||
5.0.0-beta75-rc7 [Build: 1690443874],Windows,dvpImL6c5RMVxPV/jNNG3DncR8QlQcqWKBQCDiE89KQpZ/q4kRJkAlje0Pgoqk8BT/2WQWaUixqctfOGNPxNBA==
|
||||
3.6.1 [Build: 1690811573],Windows,aWKpb0eAiI6FndcOBw+OixzripgCENMlM5gwKuRhdqtOdWAEYI5Luz8sGQ77yWC1RlQ1llxHcqhjNcJ8qMVcAw==
|
||||
3.6.1 [Build: 1690872913],Windows,+YmPaYUBL4F9+TgxyFhlT8qIi1Ym+So4NNMcuohla/u4kfJCGabZ1vDF4cIOAghIqWfO+bQ0OkORZrCBdpi2Cw==
|
||||
5.0.0-beta75-rc8 [Build: 1690875928],Windows,1xI3XWPzHxz5zD4OIZDvJteHXOHcxliqCGh/lifvzA6Gb+/GhkcPGj5RqmlIHPKHJFAozbB0UhvTuJcTU5HGDg==
|
||||
5.0.0-qa-75-4 [Build: 1690964581],Windows,3o5M5JegEvtXwGHMdhUSR+PbaXTIoinUI1GGgoXrGi2tYNUvaguiYYlsak4z8twpgzp68L0KaoA4nz4DyNX9Aw==
|
||||
3.6.2 [Build: 1690976575],Linux,iSJZ2tmUsUhCuB3G/7SCgM+JNZe3Jb/KSxFNr+0FDgg8r5t4JKGBD0SPl/cdDMqNqXmG9zEHi0XmuVl9lysoCg==
|
||||
3.6.2 [Build: 1690976575],OS X,0VegJZtWI25+RXM3J6jNfskqEgM8f4CyYrrz0IXuSK8azRQ3AMWH7YgSnrotoIX1q7aDhnTulk9eChKSPoKVCQ==
|
||||
3.6.2 [Build: 1690976575],Windows,OyuLO/1bVJtBsXLRWzfGVhNaQd7B9D4QTolZm14DM1uCbSXVvqX3Ssym3sLi/PcvOl+SAUlX6NwBPOsQdwOGDw==
|
||||
5.0.0-qa-75-8 [Build: 1691162334],macOS,jJLCUYbKDDtPB56YGtUSK+EjrY3LxoOAWVLHKIc/Li4UAFNL9iaq5gRvHF+cfJHyGg0keg2SEVr1+TfCEDG4Dw==
|
||||
5.0.0-qa-75-8 [Build: 1691162334],Windows,yLHN6dcol32mrRoi2ZMYDYsn9XPMncp79PwcCHxFC+8CuaxhOSq7/iXUPwhsdqvUQzyvstq1hCaG9/MLn8G/Dg==
|
||||
5.0.0-beta75-rc10 [Build: 1691405422],Windows,ETFP63u2QoQzmb1vHyRC+KxAAZKWq1PEpKfC6ep8A59zptnOtocEbc50wb55GpF7pVv2n5nJP6CV3iv2QauAAA==
|
||||
5.0.0-qa-75-9 [Build: 1691734909],Windows,t0guTMT1lZZI34At9X9kg0/ablk2LEtjePCLXNSCyTGeam3E4l+hjjaLZYx5gFLDX4tQEGqG4Dms96T+xRVTCg==
|
||||
5.0.0-qa-tr-2 [Build: 1691758984],Windows,YmsBwLBmFqrMhlCLGXUcn/qLvHJBrOeg1kRj+xDp7FltLJ6z4G5r6QdPt1sTaalD3TWE9If10i9mQFnP73nCDw==
|
||||
5.0.0-beta75-rc11 [Build: 1692269983],Windows,TraubtepmvLTzCkyZwDgJram2qrdpuPy1hWRhN0ZFwSAnXkBklJjBSMAUO22D/hTAfTeiQaUiFDJThf2aGSJBQ==
|
||||
5.0.0-beta75-rc12 [Build: 1692273792],Linux,UFodfOKNy4uOGnQdL35xlc5XoOkT2xVzn93w2+rshfBQKd63BqCqBcrMDL5We4UGnCdeF7oiUsraWm65qvfDDA==
|
||||
5.0.0-beta75-rc12 [Build: 1692273792],macOS,yRtBZtJrOetbT3IREKlZ7bYCLLDWtl88l6OvbRHsfI0MwgBuaLuZmgA7gAGaNDc4u427XpxD1U4WRRMJ4XXuCA==
|
||||
5.0.0-beta75-rc12 [Build: 1692273792],Windows,fX3auh0DNxFmMmmjKmxJ0bS5T+sI2OActVkppSthJOJ/W1so/WfdxtxavuJgpzFHQ7wqanaJYUajAY0uFnYEDA==
|
||||
5.0.0-qa-75-10 [Build: 1692281089],Windows,6Tn50hZBDK2v1gAfXvnfVsOvCYiZ5O7t9ae/PGIzTQPYJiK+83CCR9F+NrjaNwrwn8U4fHCm0DvF2qrk6FiEDA==
|
||||
5.0.0-qa-75-11 [Build: 1692344346],Windows,XUiXiYpVQ1lvhscQ0T0STLhzFxgUgPD5yRvHnHa+gl0z62xvSnUYMcaulZu+vu7N7Zx2XD0yXwDt1aAWjmSmAQ==
|
||||
5.0.0-qa-75-12 [Build: 1692942703],Windows,eg20cqWFjsdIv3fP37BPzSsEMAabdXgPwE/iZ0nu8JIUFCx+dDPmD+Yezf4f2cbe+w7MEkPoAMKS5cAOYbG9BQ==
|
||||
5.0.0-qa-tr-4 [Build: 1692956820],Windows,B8tNlJlgST8ITvDXO4m0mBmR+fOur02Dr0MbmYcE1LWOWJfQUk2A5Lyni65NEBdJIg6/D3ihc0US27Yd4sFWAA==
|
||||
5.0.0-qa-75-14 [Build: 1693548790],Linux,VFo+uqfuN636vfO2uplN7MxwjcGgZ7C7a8H78PSMBtPYU5KOh86FNgH3g4TefK5suVza384d9DpPK5sjZBVICA==
|
||||
5.0.0-qa-75-14 [Build: 1693548790],Windows,eBIeiZ9RjIlTT9AVkwXsiHsKrvSkGWfILDbts+A5xGDsIU8nFGl77uXjfNqjM6+Ud2Eb6lKk7NVQrmRWs/b7AQ==
|
||||
5.0.0-qa-tr-6 [Build: 1693832989],Linux,7S96m1KKKlB2+x4osdky+gdCUnWTlAaoiOQcsmmXPUxxyS/ypTY7tnYRmo2lj/Hx46aI7R0+Z4+vnHLIY9InCw==
|
||||
5.0.0-qa-tr-6 [Build: 1693832989],Windows,IOoZZnLdprCn572p0GRdOJftjQq12pYODanfyqFy9rG+sSQWmDs4Q7LX5aF/K6oRi1dj31I/BaBKxRhcs0ylAQ==
|
||||
5.0.0-qa-75-16 [Build: 1694525079],Windows,mnve3nHnNHCWJD/v1UucjHwYP5iiMcQYozzkQTxY4SlU3HozJb1Zkq9hhXpnaQHE37TODB+7B/fshVo/yWJIAA==
|
||||
5.0.0-qa-75-17 [Build: 1694593665],Windows,dQxRWH4A/RdhuwMQG2fWtbP8aRLJNs9eGrdSHBEd07MEVA29iyNx6J4Ab9pFvzw8rbxC/QsL20G1LGc0ilz7Dg==
|
||||
5.0.0-qa-75-18 [Build: 1694615531],Windows,qDBmGwpP/bskv03tvqCDvK4xXGVpyS7K6cvu06/yMk5rDd05Dba928UfMNh0/Wub/Xy9MfI5gVdA3kSuXJrnDA==
|
||||
5.0.0-qa-75-19 [Build: 1694699313],Windows,KtR3EavFC3d5PBcKFWt7Gd27B6fAG0k4EevugDzjYs2BCg+PFgeZ1DPAQCw8/k0SzewR7i9x/ZedhPC7pvYmDA==
|
||||
3.6.2 [Build: 1695203293],Linux,p4iF1jZ3ZOz9MEkKSZ2bvnFtm9WmUcQy9mAP//erFE4PF1sB6K1CSANrr+3X4B0aZR0u+K2pjnv8kiKsWKQCBQ==
|
||||
3.6.2 [Build: 1695203293],OS X,SOCkLcsxINIGVc+3OQ5Vrmv2BVNNFA9LX5Jj9tqbIiYv2HU6Z5E8AL5+v5G2LDN0F+U55+uW43ezUoYAr1WuBA==
|
||||
3.6.2 [Build: 1695203293],Windows,4BdaZpdgUSMCuIs8qcloJPNxNlJ4o7QKnxMCRO60mSOTtJZyKjOrGLAmeAEtLIJjcjmdSpycMbQOIV92K2vXAw==
|
||||
5.0.0-beta75-rc13 [Build: 1695397203],macOS,gwgeaGifMO1IIGcPJBbHUklR0m11N+XeuvflfT5CFUh0RE3zbzmV0ehUtg5udX9BU9XxcLh5LsiMQtmUobmUCQ==
|
||||
5.0.0-beta75-rc13 [Build: 1695397203],Windows,dSkrQtjUjxOQmAdQUbi7Z6oQFKPqi6/nsKVpovncQ4hDjQqVsUfoS2NO/XHO+iCwH0De3zrPgPQju3bRiYdzBA==
|
||||
5.0.0-beta75-rc14 [Build: 1696088917],Windows,GoQG+71nd6b9QUv7vECPDAXGcKEWwrW/YbPaQVNhdFwonbKegBPYKUel8rxuGzqR/uJp3EqXEGV0JyQBVXiEBg==
|
||||
5.0.0-beta75-rc14 [Build: 1696489500],Windows,6rCkYTY/IQav+zwrXfu9wFEmeuFcNxuHKBdW5aiblX5a0KpF9wzn0qwwKgjZcrzQiH5+r9tmsoB36KSwdxX1Dg==
|
||||
5.0.0-beta75 [Build: 1696607978],Linux,zk+WtkzXgRWAFIA59ad066AbGsom9QfQW6JpskztbEh4Gri5BlsQ/HKy2xUfQX+7x+A1ukt27BU/6msK7B5bAA==
|
||||
5.0.0-beta75 [Build: 1696607978],macOS,W9THGtchSxG8Q9DmjC72Ah5wcWVH9/+ZxTH3TZKH3E3NsyjaRwMdjgPvfYVaOb3qYq8Se/HxkYqBbyxSJZFBBg==
|
||||
5.0.0-beta75 [Build: 1696607978],Windows,0LhX3/Ss9GxjzXzyW6sNvaIGtivWocu9CDH3k0tOqkm8rjiwwQFTu3dCtGEzgBw89QrCXEcKOmZkbgLpechOAg==
|
||||
5.0.0-beta76-rc1 [Build: 1697033899],macOS,ZjuTP89K3fFgfAHkzg9vbhR+EkSOnkozd1pTXB2MH//jTj9tfyEPwDlzK1TaCV+JKoAsM5WlSmyx//a72S7mDQ==
|
||||
5.0.0-beta76-rc1 [Build: 1697033899],Windows,CLEscmKTzIkTC9VAQAQ1hIN6eOlSaOjuaWE8EqYThv0aunDzxWRBG9MCNQmdLJ8JgtIM6Ng412x46TOoGAmJBg==
|
||||
5.0.0-beta76-rc5 [Build: 1697802195],macOS,0aSd/h3YrLvyhywBXtNf2h1ZfSLkHW3jr33EoIsuL6oBepMSvi0nZI3Gx8j4gmLDXtwxE9+wFqrm2vc5VfYjCQ==
|
||||
5.0.0-beta76-rc5 [Build: 1697802195],Windows,5JXHvuwisq+an9hsgGgA6FW00ENcH5khuMQ1SFyaKgKdByDdvPA7/XbPtxRvUvSUh5brGL4m3CldEQ88ga1mCw==
|
||||
5.0.0-beta76 [Build: 1698243642],Linux,xXggpgd8+q2Ozk/of+0ciH2v/jp1K83EorMbbiI/J6ywpzQVocFyqQUpOjD6Xoh6K2AV2heFQF/cKoJ0aHwABA==
|
||||
5.0.0-beta76 [Build: 1698243642],macOS,Buhg/MoJF/pPldGEsesBUpTj+ClIp4xFXX/n+BcOgIS98D/kdO8pTWbk42f+wx24ALEJRwWZCYunaLFXF0iJDA==
|
||||
5.0.0-beta76 [Build: 1698243642],Windows,zV72PUBNtH7bblwdldd6t/o8hprjepbfR7CbzQCehaYUTID5y/W4IW7e/Qt4v9ip55mycWzADgiqCndMlOVNDA==
|
||||
5.0.0-qa-77-1 [Build: 1698316110],macOS,ESRePbVvFOl0wUJKoSsFAMV34isnFNfzvUQW6yDoMqa8GNGNPdRw10TxUA+ypTzu4H3A8VEiKgEEm2pdwj/5CA==
|
||||
5.0.0-beta77 [Build: 1699457285],Windows,id8cERxgKG68YRDcSYCceqekamIZlBmAE/IfwYkpu+a8RC0Gkyyhtn4ZU80ppUfES3GFsGVSSwJ/eci1g+pCBg==
|
||||
5.0.0-beta77-rc1 [Build: 1700224895],Linux,T101xCL/zRr+iwZJHURKd4DUDTrQSSJ3QsADpMH/Ed8wqXPTqneP6hQk04tKEB39aJCJTDW9W0FT7Pf7vCKLBA==
|
||||
5.0.0-beta77-rc1 [Build: 1700224895],macOS,0y/hKU/yqkqgUqtn6KXbuRtqQa4DlYQ50Rziwg9k4wAUgAnCm1hts7AvUHrGv5415cJX9czxUAFdIEApPR06CA==
|
||||
5.0.0-beta77-rc2 [Build: 1700761919],Linux,oFMyO1h6nZOmA0sM9DP+6fy69t+o1drV3inNG+kaH7pZGYqgUg9r/Xu8jGaD2EqZ+Vc7JnO8Zl9Y5n3+HPNkAQ==
|
||||
5.0.0-beta77-rc2 [Build: 1700761919],Windows,VOTBvsWNSc5MNXDWd/M3JpCB8WzvUlj7+V7EVtUy9cZ8LaK8TyJjIip16YJnVDod73wMW8npyt4oaDrqkzL6Bg==
|
||||
3.6.3 [Build: 1701166057],Windows,ML3yE6pV0QGyhc8o7k1bgqDSj+5gZIQFMjBNhWJ6L0FtJwniBq8l1wivx3DzgVVCvyRbzfg8MsdV/rjl5sHNCw==
|
||||
5.0.0-beta77-rc3 [Build: 1701707182],Linux,bS/lxwnq0KSoNl0WggENJ/tuYm+QJF67gSqXykWGAik40iFmM1g7kYOkI5GoBsOxgWJBJB5L4dOjlAyA91BbCw==
|
||||
5.0.0-beta77 [Build: 1702382332],Linux,sJx9Ss46tDLfsJ6y73csGOXnSIRsSeUFrpHFQ2il/jjM7xWAbp8F8Cnyix/CaNwy7DfZKtgMRcPc8YP0a1r3AA==
|
||||
5.0.0-beta77 [Build: 1702382332],macOS,E2rqU9M9HvWnqZbki0+blgLmDWneDZZP9TW89lDDuDoQ7GaqXizzNfvr9XJBm8dJwToLfpR9/9kmLhZpHkK3Dg==
|
||||
5.0.0-beta77 [Build: 1702382332],Windows,Ee6DzP16MUXpdKWjiSY0NGb4thN22/Ks0hwNcaMrWoaadgkM6c5477X0IbGFWVjzTWfjFTEad5noYLUPDWSgCQ==
|
||||
5.0.0-qa-lm-29 [Build: 1719554519],Windows,mSNqoUO2xaP31n8wrHwuAHHYrgov4ZQmq5OrgvOF0jsEQvTy11Z29j02q3nUA+k9TrXyG12CMYVUWfe8ltneBg==
|
||||
5.0.0-qa-puzzle-2-1 [Build: 1723116226],Windows,7Qx8GeSIEvRNZ4D3aNbX0AO67Awj92afgNCgkJ7L0YdcaD0c1HFs0c2Ms6CArTiD8pB/Nxw7QgCsKcpBln1PCg==
|
||||
5.0.0-beta78-pre-1 [Build: 1724839559],Windows,fy7cW8uGyr7lA/5eqsNztXA2nS0PbFZQgIo2HNMbNPycLWJLA8DNZGafBgsfchx9EF5piNtMsJAs9JSy1Pp8DA==
|
||||
5.0.0-qa-78-18 [Build: 1724924030],Windows,/86Ug4O5Huvf1fHooxLOqIxOIp2wyyR821wOcXkDkbXawEbsp1K7GcVqPH/cyLbfKO6x4LeCILqsrV4no3pMCg==
|
||||
5.0.0-qa-78-19 [Build: 1724930118],Windows,m2z53BpS7ocld0/TuasTKe1vXvGB6ZFR9mhdAt5I4j3QZpFlCy3NeObvQEHu+a+4Dr8yFBusdQ6vR8Jf23uyCQ==
|
||||
5.0.0-beta78-pre-2 [Build: 1725011227],Windows,v6UJ+WoJ/TYQe2MqDfoXcMLPTb2L8KrN03x2WHSdsJY17yn6ofLpMtNuBLa84by+sNi1/b8htf0HdV+6TLKEDg==
|
||||
5.0.0-qa-78-20 [Build: 1725620142],Windows,hxdPF5JpyHwDb36xlKAls6wgmhGh1OvIeo4PlqVX8a9zzP0NvGVR1O2BUdo7ixFsKqrzeHoHJ7KoVxenvGpLCw==
|
||||
5.0.0-qa-78-21 [Build: 1726235323],Windows,OiQZT9J/s6kIOX6UUDEB5tu3DrKYz6S7Lay/BaXY6teJcbkIuhBr1MREgmkg8Z+yIEHpIqrV73sUqHD2vk+lAg==
|
||||
5.0.0-qa-78-22 [Build: 1726816276],Windows,dfh0I4RAn1OSy6GrlSmStLBZWutnmUEg7D4tWvzC668p3FBsm7az/CexueslYeoXKgFj871k4F/CyDCgKtCUBA==
|
||||
5.0.0-qa-78-23 [Build: 1727272684],Windows,OkGqYGggz96MOy29Q7kkNi1sWbGkS6B0K//l7E8oixEdS6xdLgW6GmxwcI6DxvwBjVICg0TdO+VhGpRC9RnUCQ==
|
||||
5.0.0-beta78-pre-5 [Build: 1728287639],Windows,r9IEzCKmd1M5JszuUU02xy1qFkxKAPAHa45mzxakCqibCdzdL5+T6L+OepdbB6xOKSQ+uAyAFJOd6FHX4vJ7BA==
|
||||
6.0.0-beta2 [Build: 1737468425],Windows,b5mySiqYAd4Lv5TZNflW+G5Gk8y7Woo9YnJfHRjmzhUyMdGfF1O7fSGJzmx2Hpe/PKaY2aDuKKD6lSxbLYlKCw==
|
||||
6.0.0-beta4.1 [Build: 1779880475],Linux,7A/XVk3u5VSltgVlDzJCNmN+LUzztoaqCbzmaC7s3EENoN6TpEKh2Fz/N4zPVYM/pllU3Ij5K0h6UsSJHj2FCw==
|
||||
|
@@ -16,9 +16,9 @@ audio-device = ["voelin-audio/device"]
|
||||
# voelin-media backends are enabled (e.g. MediaCodec and a registered capture
|
||||
# source on Android).
|
||||
media = ["dep:voelin-media"]
|
||||
# `media` with voelin-media's desktop backends: libvpx, OpenH264 loaded at
|
||||
# runtime, X11 and PipeWire on Linux. Not for Android (libvpx does not
|
||||
# cross-compile there).
|
||||
# `media` with voelin-media's desktop backends: libvpx, dav1d, OpenH264 and
|
||||
# FFmpeg loaded at runtime, X11 and PipeWire on Linux. Not for Android
|
||||
# (libvpx does not cross-compile there).
|
||||
media-desktop = ["media", "voelin-media/default"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -39,9 +39,11 @@
|
||||
//! streams look for streams that started before we joined, next to the
|
||||
//! server's `requeststreaminfo`.
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::info;
|
||||
use tracing::{debug, info, warn};
|
||||
use voelin_gateway_proto::client::Login;
|
||||
pub use voelin_gateway_proto::client::{ClientError, GatewayClient, Push};
|
||||
use voelin_gateway_proto::{
|
||||
@@ -68,6 +70,10 @@ pub(crate) enum GatewayEvent {
|
||||
Presence(Box<Presence>),
|
||||
/// A push other than presence.
|
||||
Push(Box<Push>),
|
||||
/// The gateway could not be reached, or the connection was lost; the
|
||||
/// next attempt follows by itself.
|
||||
Retrying(String),
|
||||
/// Stopped, or the gateway refused the login (the reason).
|
||||
Disconnected(Option<String>),
|
||||
}
|
||||
|
||||
@@ -87,11 +93,133 @@ pub(crate) async fn run(
|
||||
mut commands: mpsc::UnboundedReceiver<GatewayCmd>,
|
||||
events: mpsc::UnboundedSender<GatewayEvent>,
|
||||
) {
|
||||
let reason =
|
||||
run_inner(&url, &identity, &mut commands, &events).await.err().map(|e| e.to_string());
|
||||
// A gateway that is away (down, restarting, a network change) is tried
|
||||
// again until the session stops observing; only a refused login ends it.
|
||||
let mut chats = Chats::default();
|
||||
let mut failures = 0;
|
||||
let mut last_reason = String::new();
|
||||
let reason = loop {
|
||||
match attempt(&url, &identity, &mut commands, &events, &mut chats, &mut failures).await {
|
||||
Ended::Stopped => break None,
|
||||
Ended::Refused(reason) => break Some(reason),
|
||||
Ended::Lost(reason) => {
|
||||
failures += 1;
|
||||
let delay = retry_delay(failures);
|
||||
// Once per cause, not every minute of a long absence.
|
||||
if reason != last_reason {
|
||||
warn!(%url, error = %reason, retry_in_s = delay.as_secs(), "gateway unreachable");
|
||||
} else {
|
||||
debug!(%url, error = %reason, retry_in_s = delay.as_secs(), "gateway still unreachable");
|
||||
}
|
||||
last_reason.clone_from(&reason);
|
||||
let _ = events.send(GatewayEvent::Retrying(reason));
|
||||
if !chats.wait(delay, &mut commands).await {
|
||||
break None;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
let _ = events.send(GatewayEvent::Disconnected(reason));
|
||||
}
|
||||
|
||||
/// How one connection to the gateway ended.
|
||||
enum Ended {
|
||||
/// The session stopped observing.
|
||||
Stopped,
|
||||
/// The gateway refused the login: trying again would not help.
|
||||
Refused(String),
|
||||
/// Not reached, or lost: try again.
|
||||
Lost(String),
|
||||
}
|
||||
|
||||
/// The wait before the next attempt after `failures` failed ones in a row.
|
||||
fn retry_delay(failures: u32) -> Duration {
|
||||
const SECONDS: [u64; 5] = [2, 5, 15, 30, 60];
|
||||
let index = (failures.max(1) as usize - 1).min(SECONDS.len() - 1);
|
||||
Duration::from_secs(SECONDS[index])
|
||||
}
|
||||
|
||||
/// Messages written while the gateway is away, at most this many, go out
|
||||
/// when it is back.
|
||||
const MAX_UNSENT: usize = 64;
|
||||
|
||||
/// What a new connection restores: the chats open at the gateway, and
|
||||
/// messages written while it was away.
|
||||
#[derive(Default)]
|
||||
struct Chats {
|
||||
open: Vec<ChatTarget>,
|
||||
unsent: Vec<(ChatTarget, String)>,
|
||||
}
|
||||
|
||||
impl Chats {
|
||||
/// Note a chat command; it goes out when connected.
|
||||
fn note(&mut self, cmd: GatewayCmd) {
|
||||
match cmd {
|
||||
GatewayCmd::OpenChat(target) => {
|
||||
if !self.open.contains(&target) {
|
||||
self.open.push(target);
|
||||
}
|
||||
}
|
||||
GatewayCmd::CloseChat(target) => self.open.retain(|open| *open != target),
|
||||
GatewayCmd::SendChat(target, text) => {
|
||||
if self.unsent.len() < MAX_UNSENT {
|
||||
self.unsent.push((target, text));
|
||||
}
|
||||
}
|
||||
GatewayCmd::Stop => {}
|
||||
}
|
||||
}
|
||||
|
||||
/// Carry out a chat command on a connected gateway.
|
||||
fn apply(&mut self, client: &GatewayClient, cmd: GatewayCmd) -> Result<(), ClientError> {
|
||||
match cmd {
|
||||
GatewayCmd::OpenChat(target) => {
|
||||
if !self.open.contains(&target) {
|
||||
self.open.push(target.clone());
|
||||
}
|
||||
client.send(ClientMsg::OpenChat { target })
|
||||
}
|
||||
GatewayCmd::CloseChat(target) => {
|
||||
self.open.retain(|open| *open != target);
|
||||
client.send(ClientMsg::CloseChat { target })
|
||||
}
|
||||
GatewayCmd::SendChat(target, text) => client.send(ClientMsg::SendChat { target, text }),
|
||||
GatewayCmd::Stop => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Open the chats again on a new connection and send what waited.
|
||||
fn restore(&mut self, client: &GatewayClient) -> Result<(), ClientError> {
|
||||
for target in &self.open {
|
||||
client.send(ClientMsg::OpenChat { target: target.clone() })?;
|
||||
}
|
||||
for (target, text) in std::mem::take(&mut self.unsent) {
|
||||
client.send(ClientMsg::SendChat { target, text })?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Wait `delay` before the next attempt, noting the commands that come
|
||||
/// meanwhile; false when the session stops observing.
|
||||
async fn wait(
|
||||
&mut self,
|
||||
delay: Duration,
|
||||
commands: &mut mpsc::UnboundedReceiver<GatewayCmd>,
|
||||
) -> bool {
|
||||
let sleep = tokio::time::sleep(delay);
|
||||
tokio::pin!(sleep);
|
||||
loop {
|
||||
tokio::select! {
|
||||
() = &mut sleep => return true,
|
||||
cmd = commands.recv() => match cmd {
|
||||
None | Some(GatewayCmd::Stop) => return false,
|
||||
Some(cmd) => self.note(cmd),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Features whose pushes for open chats need [`ClientMsg::Enable`].
|
||||
const CHAT_EXTENSIONS: [&str; 4] = [
|
||||
voelin_gateway_proto::feature::HISTORY,
|
||||
@@ -100,22 +228,38 @@ const CHAT_EXTENSIONS: [&str; 4] = [
|
||||
voelin_gateway_proto::feature::TOPICS,
|
||||
];
|
||||
|
||||
async fn run_inner(
|
||||
/// One connection: log in, then relay until it ends.
|
||||
async fn attempt(
|
||||
url: &str,
|
||||
identity: &tsclientlib::Identity,
|
||||
commands: &mut mpsc::UnboundedReceiver<GatewayCmd>,
|
||||
events: &mpsc::UnboundedSender<GatewayEvent>,
|
||||
) -> anyhow::Result<()> {
|
||||
chats: &mut Chats,
|
||||
failures: &mut u32,
|
||||
) -> Ended {
|
||||
let (client, mut pushes) = match connect(url, identity).await {
|
||||
Ok(connected) => connected,
|
||||
Err(ClientError::Gateway { code, message }) => {
|
||||
let _ = events
|
||||
.send(GatewayEvent::Push(Box::new(Push::Error { code, message: message.clone() })));
|
||||
anyhow::bail!("gateway refused login: {message}");
|
||||
warn!(%url, ?code, %message, "gateway refused the login");
|
||||
return Ended::Refused(format!("gateway refused login: {code:?}: {message}"));
|
||||
}
|
||||
Err(e) => return Err(e.into()),
|
||||
Err(e) => return Ended::Lost(e.to_string()),
|
||||
};
|
||||
info!(server_name = %client.info().server_name, capabilities = ?client.capabilities(), "gateway connected");
|
||||
*failures = 0;
|
||||
info!(%url, server_name = %client.info().server_name, capabilities = ?client.capabilities(), "gateway connected");
|
||||
match relay(&client, &mut pushes, commands, events, chats).await {
|
||||
Ok(ended) => ended,
|
||||
Err(e) => Ended::Lost(e.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
async fn relay(
|
||||
client: &GatewayClient,
|
||||
pushes: &mut mpsc::UnboundedReceiver<Push>,
|
||||
commands: &mut mpsc::UnboundedReceiver<GatewayCmd>,
|
||||
events: &mpsc::UnboundedSender<GatewayEvent>,
|
||||
chats: &mut Chats,
|
||||
) -> Result<Ended, ClientError> {
|
||||
// Messages with their gateway ids, pins, reactions and topics of open
|
||||
// chats (older gateways answer `unknown_type` as a push; ignored).
|
||||
if CHAT_EXTENSIONS.iter().any(|f| client.has(f)) {
|
||||
@@ -123,13 +267,16 @@ async fn run_inner(
|
||||
}
|
||||
let _ = events.send(GatewayEvent::Connected(client.clone()));
|
||||
client.subscribe_presence()?;
|
||||
chats.restore(client)?;
|
||||
let mut presence = Presence::default();
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
push = pushes.recv() => match push {
|
||||
None | Some(Push::Disconnected(None)) => return Ok(()),
|
||||
Some(Push::Disconnected(Some(reason))) => anyhow::bail!(reason),
|
||||
None | Some(Push::Disconnected(None)) => {
|
||||
return Ok(Ended::Lost("the gateway closed the connection".into()));
|
||||
}
|
||||
Some(Push::Disconnected(Some(reason))) => return Ok(Ended::Lost(reason)),
|
||||
Some(Push::PresenceSnapshot(snapshot)) => {
|
||||
presence = Presence::from_snapshot(snapshot);
|
||||
let _ = events.send(GatewayEvent::Presence(Box::new(presence.clone())));
|
||||
@@ -140,24 +287,17 @@ async fn run_inner(
|
||||
}
|
||||
// Answers to requests sent without waiting.
|
||||
Some(Push::Other(_) | Push::Error { code: ErrorCode::UnknownType, .. }) => {}
|
||||
// The gateway forgot the login (restarted): log in again.
|
||||
Some(Push::Error { code: ErrorCode::NotAuthenticated, message }) => {
|
||||
let _ = events.send(GatewayEvent::Push(Box::new(Push::Error {
|
||||
code: ErrorCode::NotAuthenticated,
|
||||
message: message.clone(),
|
||||
})));
|
||||
anyhow::bail!("gateway session lost: {message}");
|
||||
return Ok(Ended::Lost(format!("gateway session lost: {message}")));
|
||||
}
|
||||
Some(push) => {
|
||||
let _ = events.send(GatewayEvent::Push(Box::new(push)));
|
||||
}
|
||||
},
|
||||
cmd = commands.recv() => match cmd {
|
||||
None | Some(GatewayCmd::Stop) => return Ok(()),
|
||||
Some(GatewayCmd::OpenChat(target)) => client.send(ClientMsg::OpenChat { target })?,
|
||||
Some(GatewayCmd::CloseChat(target)) => client.send(ClientMsg::CloseChat { target })?,
|
||||
Some(GatewayCmd::SendChat(target, text)) => {
|
||||
client.send(ClientMsg::SendChat { target, text })?;
|
||||
}
|
||||
None | Some(GatewayCmd::Stop) => return Ok(Ended::Stopped),
|
||||
Some(cmd) => chats.apply(client, cmd)?,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ use std::time::Duration;
|
||||
use tokio::time::Instant;
|
||||
|
||||
use tokio::sync::{broadcast, mpsc, watch};
|
||||
use tracing::debug;
|
||||
use tracing::{debug, warn};
|
||||
use tsclientlib::ClientId;
|
||||
use voelin_audio::AudioSettings;
|
||||
use voelin_gateway_proto::{HistoryEntry, StreamEntry, StreamSpec, feature};
|
||||
use voelin_gateway_proto::{ErrorCode, HistoryEntry, StreamEntry, StreamSpec, feature};
|
||||
use voelin_model::{ChatMessage, ChatTarget, GroupInfo, Presence, ServerDetails};
|
||||
use voelin_stream::ClientState;
|
||||
|
||||
@@ -1736,6 +1736,15 @@ impl Session {
|
||||
self.publish_presence();
|
||||
}
|
||||
GatewayEvent::Push(push) => self.gateway_push(*push),
|
||||
// Away for now (logged where it happened): observing resumes
|
||||
// when it is back. Users never hear of the gateway.
|
||||
GatewayEvent::Retrying(reason) => {
|
||||
self.gateway_gone(Some(reason));
|
||||
self.gateway_presence = None;
|
||||
self.state.observe = ObserveState::Connecting;
|
||||
self.emit_state();
|
||||
self.publish_presence();
|
||||
}
|
||||
GatewayEvent::Disconnected(reason) => {
|
||||
self.gateway = None;
|
||||
self.gateway_gone(reason.clone());
|
||||
@@ -1743,7 +1752,7 @@ impl Session {
|
||||
self.state.observe = ObserveState::Off;
|
||||
self.emit_state();
|
||||
if let Some(reason) = reason {
|
||||
self.error(format!("gateway: {reason}"));
|
||||
warn!(%reason, "not observing through the gateway");
|
||||
}
|
||||
self.publish_presence();
|
||||
}
|
||||
@@ -1814,7 +1823,18 @@ impl Session {
|
||||
Push::Capabilities(capabilities) => {
|
||||
self.gateway_update(GatewayUpdate::Capabilities { capabilities });
|
||||
}
|
||||
Push::Error { code, message } => self.error(format!("gateway: {code:?}: {message}")),
|
||||
Push::Error { code, message } => {
|
||||
warn!(?code, %message, "gateway error");
|
||||
// What answers the user's own doing; the rest is the
|
||||
// gateway's business.
|
||||
let told = match code {
|
||||
ErrorCode::Forbidden => "Not allowed on this server.",
|
||||
ErrorCode::RateLimited => "Too many messages; try again in a moment.",
|
||||
ErrorCode::QuotaExceeded => "This server's limit is reached.",
|
||||
_ => return,
|
||||
};
|
||||
self.error(told);
|
||||
}
|
||||
Push::PresenceSnapshot(_)
|
||||
| Push::PresenceDelta(_)
|
||||
| Push::Other(_)
|
||||
@@ -1833,7 +1853,8 @@ impl Session {
|
||||
self.publish_presence();
|
||||
}
|
||||
QueryEvent::Chat(msg) => self.chat(msg, MessageSource::Query, None),
|
||||
QueryEvent::Error(message) => self.error(format!("query: {message}")),
|
||||
// The relay's business, not the user's (as the gateway's).
|
||||
QueryEvent::Error(message) => warn!(%message, "query relay"),
|
||||
QueryEvent::Disconnected => {
|
||||
self.query = None;
|
||||
self.query_presence = None;
|
||||
|
||||
@@ -12,6 +12,8 @@ const VERSIONS_CSV: &str = include_str!("../../proto/tsproto-structs/declaration
|
||||
|
||||
/// The signed generic version of every platform, tsclientlib's default.
|
||||
const GENERIC_VERSION: &str = "3.?.? [Build: 5680278000]";
|
||||
/// The client generation claimed where a signed build of it exists.
|
||||
const CLIENT_GENERATION: &str = "6.";
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct KnownVersion {
|
||||
@@ -52,12 +54,17 @@ pub fn known_versions() -> Vec<KnownVersion> {
|
||||
|
||||
/// Resolve a `--client-version` argument.
|
||||
///
|
||||
/// Accepts `default` (the core native-platform default), an index into [`known_versions`],
|
||||
/// or `<platform>@<version>` with the exact strings from `voelinctl versions`.
|
||||
/// Accepts `default` (the core native-platform default), `generic` (the
|
||||
/// generic `3.?.?` version of the native platform, as before 6.x builds were
|
||||
/// claimed), an index into [`known_versions`], or `<platform>@<version>` with
|
||||
/// the exact strings from `voelinctl versions`.
|
||||
pub fn resolve(spec: &str) -> Result<Option<Version>> {
|
||||
if spec == "default" {
|
||||
return Ok(None);
|
||||
}
|
||||
if spec == "generic" {
|
||||
return generic_version(std::env::consts::OS).map(Some);
|
||||
}
|
||||
let versions = known_versions();
|
||||
if let Ok(i) = spec.parse::<usize>() {
|
||||
let Some(v) = versions.get(i) else {
|
||||
@@ -74,10 +81,13 @@ pub fn resolve(spec: &str) -> Result<Option<Version>> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The signed compatibility tuple for the native operating system.
|
||||
/// The signed compatibility tuple for the native operating system: the
|
||||
/// newest TeamSpeak 6 client build signed for it, so servers and other
|
||||
/// clients see a 6.x client (its build is recent enough for any server's
|
||||
/// minimum client version); where none is signed for the platform, the
|
||||
/// generic version, whose build passes every minimum.
|
||||
///
|
||||
/// The generic version retains the library's minimum-version compatibility.
|
||||
/// Its version, platform and signature must stay together: the signature does
|
||||
/// Version, platform and signature must stay together: the signature does
|
||||
/// not authorize renaming the client or changing its platform.
|
||||
///
|
||||
/// Unsupported operating systems return an error rather than claiming another
|
||||
@@ -87,6 +97,31 @@ pub fn native_version() -> Result<Version> {
|
||||
}
|
||||
|
||||
fn compatibility_version(os: &str) -> Result<Version> {
|
||||
// TeamSpeak 5 and 6 call macOS "macOS", TeamSpeak 3 "OS X".
|
||||
let platforms: &[&str] = match os {
|
||||
"linux" => &["Linux"],
|
||||
"windows" => &["Windows"],
|
||||
"macos" => &["macOS", "OS X"],
|
||||
"android" => &["Android"],
|
||||
"ios" => &["iOS"],
|
||||
_ => bail!("no signed compatibility version for operating system {os:?}"),
|
||||
};
|
||||
let versions = known_versions();
|
||||
let newest = versions
|
||||
.iter()
|
||||
.filter(|v| platforms.contains(&v.platform.as_str()))
|
||||
.filter(|v| v.version.starts_with(CLIENT_GENERATION))
|
||||
.filter_map(|v| Some((build(&v.version)?, v)))
|
||||
.max_by_key(|(build, _)| *build)
|
||||
.map(|(_, v)| v);
|
||||
match newest {
|
||||
Some(version) => version.to_version(),
|
||||
None => generic_version(os),
|
||||
}
|
||||
}
|
||||
|
||||
/// The generic version of the operating system's platform.
|
||||
fn generic_version(os: &str) -> Result<Version> {
|
||||
let platform = match os {
|
||||
"linux" => "Linux",
|
||||
"windows" => "Windows",
|
||||
@@ -95,15 +130,18 @@ fn compatibility_version(os: &str) -> Result<Version> {
|
||||
"ios" => "iOS",
|
||||
_ => bail!("no signed compatibility version for operating system {os:?}"),
|
||||
};
|
||||
// The library's generic version: its build passes servers' minimum client
|
||||
// version, which a real (older) build such as 3.6.0 may not.
|
||||
known_versions()
|
||||
.into_iter()
|
||||
.find(|version| version.platform == platform && version.version == GENERIC_VERSION)
|
||||
.find(|v| v.platform == platform && v.version == GENERIC_VERSION)
|
||||
.with_context(|| format!("missing signed compatibility version for {platform}"))?
|
||||
.to_version()
|
||||
}
|
||||
|
||||
/// The build number of a version string (`6.0.0 [Build: 1737468425]`).
|
||||
fn build(version: &str) -> Option<u64> {
|
||||
version.split_once("[Build: ")?.1.strip_suffix(']')?.parse().ok()
|
||||
}
|
||||
|
||||
/// Truthful product identity, separate from the signed compatibility tuple.
|
||||
pub fn client_metadata() -> String {
|
||||
serde_json::json!({
|
||||
@@ -121,16 +159,19 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn native_platform_preserves_complete_signed_tuple() {
|
||||
for (os, platform) in [
|
||||
("linux", "Linux"),
|
||||
("windows", "Windows"),
|
||||
("macos", "OS X"),
|
||||
("android", "Android"),
|
||||
("ios", "iOS"),
|
||||
for (os, platform, version) in [
|
||||
// The newest TeamSpeak 6 build signed for the platform.
|
||||
("linux", "Linux", "6.0.0-beta4.1 [Build: 1779880475]"),
|
||||
("windows", "Windows", "6.0.0-beta2 [Build: 1737468425]"),
|
||||
// None signed: the generic version.
|
||||
("macos", "OS X", GENERIC_VERSION),
|
||||
("android", "Android", GENERIC_VERSION),
|
||||
("ios", "iOS", GENERIC_VERSION),
|
||||
] {
|
||||
let expected = version;
|
||||
let version = compatibility_version(os).unwrap();
|
||||
assert_eq!(version.get_platform(), platform);
|
||||
assert_eq!(version.get_version_string(), "3.?.? [Build: 5680278000]");
|
||||
assert_eq!(version.get_version_string(), expected);
|
||||
assert_eq!(version.get_signature().len(), 64);
|
||||
let known = known_versions()
|
||||
.into_iter()
|
||||
@@ -156,6 +197,14 @@ mod tests {
|
||||
assert_eq!(metadata["platform"], std::env::consts::OS);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_build_numbers() {
|
||||
assert_eq!(build("6.0.0-beta2 [Build: 1737468425]"), Some(1_737_468_425));
|
||||
assert_eq!(build(GENERIC_VERSION), Some(5_680_278_000));
|
||||
assert_eq!(build("3.0.0 [Build: x]"), None);
|
||||
assert_eq!(build("6.0.0"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_all_rows() {
|
||||
let versions = known_versions();
|
||||
@@ -169,6 +218,10 @@ mod tests {
|
||||
#[test]
|
||||
fn resolves_specs() {
|
||||
assert!(resolve("default").unwrap().is_none());
|
||||
if let Ok(generic) = generic_version(std::env::consts::OS) {
|
||||
assert_eq!(resolve("generic").unwrap(), Some(generic.clone()));
|
||||
assert_eq!(generic.get_version_string(), GENERIC_VERSION);
|
||||
}
|
||||
let by_index = resolve("0").unwrap().unwrap();
|
||||
let first = &known_versions()[0];
|
||||
let by_name = resolve(&format!("{}@{}", first.platform, first.version)).unwrap().unwrap();
|
||||
|
||||
@@ -127,7 +127,12 @@ struct FakeGateway {
|
||||
|
||||
impl FakeGateway {
|
||||
async fn start() -> Self {
|
||||
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
Self::start_on(0).await
|
||||
}
|
||||
|
||||
/// A gateway at `port` of the loopback address (0: any free port).
|
||||
async fn start_on(port: u16) -> Self {
|
||||
let listener = TcpListener::bind(("127.0.0.1", port)).await.unwrap();
|
||||
let url = format!("ws://{}/v1", listener.local_addr().unwrap());
|
||||
let state: Arc<Mutex<State>> = Arc::default();
|
||||
let st = state.clone();
|
||||
@@ -707,3 +712,57 @@ async fn store_history_off_keeps_the_database_empty() {
|
||||
drop((engine, history));
|
||||
let _ = std::fs::remove_dir_all(path.parent().unwrap());
|
||||
}
|
||||
|
||||
/// A gateway that is away is tried again by itself and quietly: no error for
|
||||
/// the user, "connecting" meanwhile, then observing once it is there, with
|
||||
/// the open chats opened again.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn an_unreachable_gateway_is_tried_again_quietly() {
|
||||
// Nothing listens there yet: the connection is refused.
|
||||
let port = std::net::TcpListener::bind("127.0.0.1:0").unwrap().local_addr().unwrap().port();
|
||||
let path = temp_db("retry");
|
||||
let engine = Engine::start_with(Settings::in_memory(), History::open(&path).unwrap());
|
||||
let mut rx = engine.subscribe();
|
||||
engine.send(Command::OpenChat { session: 3, target: LOBBY });
|
||||
engine.send(Command::ObserveGateway {
|
||||
session: 3,
|
||||
url: format!("ws://127.0.0.1:{port}/v1"),
|
||||
identity: Box::new(tsclientlib::Identity::create()),
|
||||
});
|
||||
// The first attempt fails (the next one is 2 s later): still connecting,
|
||||
// and the user is told nothing.
|
||||
let mut connecting = false;
|
||||
let quiet = timeout(Duration::from_millis(1500), async {
|
||||
loop {
|
||||
match rx.recv().await {
|
||||
Ok(Event::Error { message, .. }) => panic!("the user was told: {message}"),
|
||||
Ok(Event::State { session: 3, state }) => {
|
||||
// (Off before observing starts.)
|
||||
assert!(!connecting || state.observe != ObserveState::Off, "gave up");
|
||||
connecting |= state.observe == ObserveState::Connecting;
|
||||
}
|
||||
Ok(_) | Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => {}
|
||||
Err(e) => panic!("{e}"),
|
||||
}
|
||||
}
|
||||
});
|
||||
assert!(quiet.await.is_err(), "the event stream ended");
|
||||
assert!(connecting, "never started observing");
|
||||
// The gateway comes up: observing, and the open chat is opened again.
|
||||
let gw = FakeGateway::start_on(port).await;
|
||||
wait(&mut rx, "observing", |e| match e {
|
||||
Event::Error { message, .. } => panic!("the user was told: {message}"),
|
||||
Event::State { session: 3, state } if state.observe == ObserveState::Observing => Some(()),
|
||||
_ => None,
|
||||
})
|
||||
.await;
|
||||
timeout(Duration::from_secs(5), async {
|
||||
while !gw.requests().contains(&"open_chat".to_owned()) {
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
}
|
||||
})
|
||||
.await
|
||||
.unwrap_or_else(|_| panic!("the chat was not opened again: {:?}", gw.requests()));
|
||||
drop(engine);
|
||||
let _ = std::fs::remove_dir_all(path.parent().unwrap());
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
# Build: docker build -f crates/voelin-gateway/Dockerfile -t tsgw .
|
||||
# Run: docker run -v ./tsgw.toml:/etc/tsgw/tsgw.toml -p 7788:7788 tsgw
|
||||
FROM rust:1.94-bookworm AS build
|
||||
ENV CARGO_BUILD_JOBS=1 CARGO_INCREMENTAL=0
|
||||
WORKDIR /src
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends cmake libasound2-dev && rm -rf /var/lib/apt/lists/*
|
||||
COPY . .
|
||||
|
||||
@@ -160,7 +160,7 @@ pub static KEYS: &[KeyDef] = &[
|
||||
"relay.format",
|
||||
Kind::Str,
|
||||
"\"[{nick}] {text}\"",
|
||||
"How posts appear in TeamSpeak; {nick} and {text} are replaced",
|
||||
"How posts appear when the relay cannot take the user's nickname; {nick} and {text} are replaced",
|
||||
),
|
||||
key(
|
||||
"relay.idle_teardown_secs",
|
||||
|
||||
@@ -19,8 +19,8 @@ use voelin_gateway_proto::{
|
||||
Action, ActivityEntry, ErrorCode, EventInfo, HistoryEntry, PinInfo, StreamEntry, TopicInfo,
|
||||
UniqueIds, UserRef, feature, identity_level, verify_auth,
|
||||
};
|
||||
use voelin_model::{ChannelId, ChatMessage, ChatTarget, Presence, ServerFlavor, relay_text};
|
||||
use voelin_observer::{Observer, ObserverConfig, RelayConfig, RelayPool};
|
||||
use voelin_model::{ChannelId, ChatMessage, ChatTarget, Presence, ServerFlavor};
|
||||
use voelin_observer::{Observer, ObserverConfig, RelayConfig, RelayPool, post_as};
|
||||
use voelin_query::{Command, Connect, QueryClient};
|
||||
|
||||
use crate::config::{Bootstrap, Layers, Runtime};
|
||||
@@ -206,6 +206,8 @@ pub struct Hub {
|
||||
/// Serializes rebuilding the relay pool.
|
||||
relay_rebuild: tokio::sync::Mutex<()>,
|
||||
lookup: QueryClient,
|
||||
/// One server-chat post at a time: each borrows the poster's nickname.
|
||||
lookup_posting: tokio::sync::Mutex<()>,
|
||||
perms: PermResolver,
|
||||
groups: GroupResolver,
|
||||
pub db: Db,
|
||||
@@ -268,6 +270,7 @@ impl Hub {
|
||||
relays: RwLock::new(relays),
|
||||
relay_rebuild: Default::default(),
|
||||
lookup,
|
||||
lookup_posting: Default::default(),
|
||||
perms,
|
||||
groups: GroupResolver::default(),
|
||||
db,
|
||||
@@ -751,16 +754,20 @@ impl Hub {
|
||||
}
|
||||
None => text.to_string(),
|
||||
};
|
||||
let full = relay_text(&rt.relay.format, &user.nickname, &relayed);
|
||||
// Posts go out under the user's nickname; `relay.format` only when the
|
||||
// session cannot take it.
|
||||
match target {
|
||||
ChatTarget::Server => {
|
||||
for part in voelin_model::split_message(&full, 1024) {
|
||||
self.lookup
|
||||
.send(
|
||||
&Command::new("sendtextmessage").arg("targetmode", 3).arg("msg", part),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
let _posting = self.lookup_posting.lock().await;
|
||||
post_as(
|
||||
&self.lookup,
|
||||
&lookup_nickname(&rt.relay.nickname),
|
||||
&user.nickname,
|
||||
&relayed,
|
||||
&rt.relay.format,
|
||||
|part| Command::new("sendtextmessage").arg("targetmode", 3).arg("msg", part),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
ChatTarget::Channel(cid) => {
|
||||
if !self.readers.lock().unwrap().contains_key(cid) {
|
||||
@@ -768,8 +775,7 @@ impl Hub {
|
||||
self.add_reader(*cid).await?;
|
||||
self.remove_reader(*cid);
|
||||
}
|
||||
// The pool's format is `{text}`: `full` is already formatted.
|
||||
self.relays().send(*cid, &user.nickname, &full).await?;
|
||||
self.relays().post(*cid, &user.nickname, &relayed, &rt.relay.format).await?;
|
||||
}
|
||||
ChatTarget::Private(_) => unreachable!("checked by require_post"),
|
||||
}
|
||||
@@ -797,14 +803,17 @@ impl Hub {
|
||||
fn new_relay_pool(connect: &Connect, nickname: &str) -> RelayPool {
|
||||
let mut config = RelayConfig::new(connect.clone());
|
||||
config.nickname = nickname.to_string();
|
||||
// Posts are formatted by the hub, with the current settings.
|
||||
config.format = "{text}".into();
|
||||
RelayPool::new(config)
|
||||
}
|
||||
|
||||
/// The lookup session's own name, given `relay.nickname`.
|
||||
fn lookup_nickname(nickname: &str) -> String {
|
||||
format!("{nickname} Gateway")
|
||||
}
|
||||
|
||||
async fn set_lookup_nickname(lookup: &QueryClient, nickname: &str) {
|
||||
let _ = lookup
|
||||
.send(&Command::new("clientupdate").arg("client_nickname", format!("{nickname} Gateway")))
|
||||
.send(&Command::new("clientupdate").arg("client_nickname", lookup_nickname(nickname)))
|
||||
.await;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,12 @@ pub struct State {
|
||||
pub server_groups: HashMap<u64, Vec<u64>>,
|
||||
/// (target mode, channel of the posting connection, text)
|
||||
pub posted: Vec<(u8, u64, String)>,
|
||||
/// The nickname of the posting connection, for each of `posted`.
|
||||
pub posters: Vec<String>,
|
||||
/// Nicknames set with clientupdate.
|
||||
pub nicknames: Vec<String>,
|
||||
/// The current nickname of each query connection.
|
||||
names: HashMap<u16, String>,
|
||||
/// Connections that registered for server events (the observer).
|
||||
observers: Vec<mpsc::UnboundedSender<String>>,
|
||||
/// Relay connections by channel.
|
||||
@@ -120,6 +124,12 @@ impl FakeServer {
|
||||
self.state.lock().unwrap().posted.clone()
|
||||
}
|
||||
|
||||
/// What was posted as `(nickname of the poster, text)`.
|
||||
pub fn posted_by(&self) -> Vec<(String, String)> {
|
||||
let s = self.state.lock().unwrap();
|
||||
s.posters.iter().cloned().zip(s.posted.iter().map(|p| p.2.clone())).collect()
|
||||
}
|
||||
|
||||
async fn connection(self, stream: tokio::net::TcpStream) {
|
||||
let (r, mut w) = stream.into_split();
|
||||
let mut lines = BufReader::new(r).lines();
|
||||
@@ -192,6 +202,12 @@ impl FakeServer {
|
||||
"whoami" => data(vec![format!("client_id={clid} client_channel_id={channel}")]),
|
||||
"clientupdate" => {
|
||||
if let Some(nick) = arg("client_nickname") {
|
||||
let in_use = s.online.iter().any(|c| c.nickname == nick)
|
||||
|| s.names.iter().any(|(id, n)| *id != clid && *n == nick);
|
||||
if in_use {
|
||||
return "error id=513 msg=nickname\\sis\\salready\\sin\\suse\n\r".into();
|
||||
}
|
||||
s.names.insert(clid, nick.clone());
|
||||
s.nicknames.push(nick);
|
||||
}
|
||||
ok
|
||||
@@ -262,6 +278,8 @@ impl FakeServer {
|
||||
"sendtextmessage" => {
|
||||
let mode = num("targetmode") as u8;
|
||||
s.posted.push((mode, *channel, arg("msg").unwrap_or_default()));
|
||||
let poster = s.names.get(&clid).cloned().unwrap_or_default();
|
||||
s.posters.push(poster);
|
||||
ok
|
||||
}
|
||||
_ => ok,
|
||||
|
||||
@@ -173,7 +173,11 @@ async fn chat_pins_reactions_topics() {
|
||||
unreachable!()
|
||||
};
|
||||
assert_eq!((id, message.text.as_str()), (hello.id, "hello"));
|
||||
assert!(fx.fake.posted().contains(&(2, 1, "[Bob] hello".into())));
|
||||
// Under Bob's name: "Bob1", as Bob is online with voice as "Bob". The
|
||||
// relay takes its own name back after the post.
|
||||
assert!(fx.fake.posted().contains(&(2, 1, "hello".into())));
|
||||
assert!(fx.fake.posted_by().contains(&("Bob1".into(), "hello".into())));
|
||||
assert_eq!(fx.fake.state.lock().unwrap().nicknames.last().unwrap(), "Chat Relay 1");
|
||||
|
||||
// Pins: moderators only by default; Alice is an admin.
|
||||
assert_eq!(code(b.pin(hello.id).await), ErrorCode::Forbidden);
|
||||
@@ -213,7 +217,7 @@ async fn chat_pins_reactions_topics() {
|
||||
assert_eq!(t.id, topic.id);
|
||||
let in_topic = b.post(LOBBY, "saturday?".into(), Some(topic.id)).await.unwrap();
|
||||
assert_eq!(in_topic.topic_id, Some(topic.id));
|
||||
assert!(fx.fake.posted().contains(&(2, 1, "[Bob] [#Plans] saturday?".into())));
|
||||
assert!(fx.fake.posted_by().contains(&("Bob1".into(), "[#Plans] saturday?".into())));
|
||||
expect(
|
||||
&mut c_rx,
|
||||
"prefixed chat event",
|
||||
@@ -456,7 +460,7 @@ async fn admin_settings_apply_live() {
|
||||
|
||||
// Feature switches reach connected clients at once.
|
||||
let first = b.post(LOBBY, "one".into(), None).await.unwrap();
|
||||
assert!(fx.fake.posted().contains(&(2, 1, "<Bob> one".into())));
|
||||
assert!(fx.fake.posted_by().contains(&("Bob1".into(), "one".into())));
|
||||
let entry = a.config_set("features.pins".into(), json!(false)).await.unwrap();
|
||||
assert_eq!(entry.source, voelin_gateway_proto::ConfigSource::Db);
|
||||
expect(
|
||||
@@ -506,10 +510,22 @@ async fn admin_settings_apply_live() {
|
||||
// 0: no limit.
|
||||
a.config_set("limits.posts_per_window".into(), json!(0)).await.unwrap();
|
||||
|
||||
// Relay settings apply without a restart.
|
||||
// Relay settings apply without a restart. The format is for posts the
|
||||
// relay cannot make under Bob's name: every variant of it is taken.
|
||||
for (clid, nick) in [(21, "Bob1"), (22, "Bob2"), (23, "Bob3")] {
|
||||
fx.fake.add_online(Online {
|
||||
clid,
|
||||
cid: 2,
|
||||
uid: format!("other-{nick}"),
|
||||
nickname: nick.into(),
|
||||
server_groups: Vec::new(),
|
||||
streaming: false,
|
||||
});
|
||||
}
|
||||
a.config_set("relay.format".into(), json!("{nick}: {text}")).await.unwrap();
|
||||
b.post(LOBBY, "two".into(), None).await.unwrap();
|
||||
assert!(fx.fake.posted().contains(&(2, 1, "Bob: two".into())));
|
||||
assert!(fx.fake.posted_by().contains(&("Chat Relay 1".into(), "Bob: two".into())));
|
||||
a.config_set("relay.nickname".into(), json!("Bridge")).await.unwrap();
|
||||
for _ in 0..100 {
|
||||
if fx.fake.state.lock().unwrap().nicknames.iter().any(|n| n == "Bridge 1") {
|
||||
|
||||
@@ -42,6 +42,8 @@ token_ttl_hours = 720
|
||||
|
||||
[relay]
|
||||
nickname = "Chat Relay"
|
||||
# Posts go out under the user's nickname; this form only when the relay
|
||||
# cannot take it.
|
||||
format = "[{nick}] {text}"
|
||||
idle_teardown_secs = 120
|
||||
# Each relay is one query connection; stay below the server's per-IP limit.
|
||||
|
||||
@@ -9,7 +9,8 @@ repository.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["vpx", "openh264", "openh264-download", "ffmpeg", "x11", "pipewire", "wlroots", "segment"]
|
||||
# Every codec backend: desktop builds have all encoders and decoders.
|
||||
default = ["vpx", "openh264", "openh264-download", "ffmpeg", "av1", "x11", "pipewire", "wlroots", "segment"]
|
||||
# VP8 and VP9 through the system libvpx (pkg-config `vpx`).
|
||||
vpx = ["dep:libvpx-native-sys"]
|
||||
# H.264 through Cisco's prebuilt OpenH264 library, loaded at runtime. The
|
||||
@@ -21,7 +22,9 @@ openh264-download = ["openh264", "dep:reqwest", "dep:bzip2", "dep:sha2"]
|
||||
# VA-API, NVENC, Quick Sync, AMF, Media Foundation, VideoToolbox, x264,
|
||||
# SVT-AV1, ... whatever the installed FFmpeg has (see docs/media.md).
|
||||
ffmpeg = ["dep:libloading", "dep:rustix"]
|
||||
# AV1 decoding through the system libdav1d (pkg-config `dav1d` >= 1.3).
|
||||
# AV1 decoding through libdav1d (pkg-config `dav1d` >= 1.3; on Windows
|
||||
# vcpkg's or our MinGW build, see .github/actions/system-deps and
|
||||
# docker/windows.Dockerfile).
|
||||
av1 = ["dep:dav1d"]
|
||||
# X11 screen capture (Linux).
|
||||
x11 = ["dep:x11rb", "dep:memmap2", "dep:rustix"]
|
||||
|
||||
@@ -21,9 +21,7 @@ impl Dav1dDecoder {
|
||||
pub fn new() -> Result<Self> {
|
||||
let mut settings = Settings::new();
|
||||
settings.set_max_frame_delay(1);
|
||||
settings.set_n_threads(
|
||||
std::thread::available_parallelism().map_or(1, |n| n.get().min(4) as u32),
|
||||
);
|
||||
settings.set_n_threads(crate::codec::dav1d_threads() as u32);
|
||||
let decoder = dav1d::Decoder::with_settings(&settings).map_err(|e| {
|
||||
Error::CodecUnavailable { codec: Codec::Av1, reason: format!("dav1d: {e}") }
|
||||
})?;
|
||||
|
||||
@@ -25,6 +25,15 @@ use std::sync::Arc;
|
||||
use crate::frame::VideoFrame;
|
||||
use crate::{Error, Result};
|
||||
|
||||
/// dav1d's threads with a frame delay of one (ours and FFmpeg's `libdav1d`):
|
||||
/// a quarter of the cores, 1 to 4. They wait on each other where cores are
|
||||
/// few (on 4 cores, 1080p: 211 fps on one thread, 155-166 on 3 or 4) and
|
||||
/// help where there are many (32 cores, 1440p: 412 fps on 8).
|
||||
#[cfg_attr(not(any(feature = "av1", feature = "ffmpeg")), allow(dead_code))]
|
||||
pub(crate) fn dav1d_threads() -> usize {
|
||||
std::thread::available_parallelism().map_or(1, |n| (n.get() / 4).clamp(1, 4))
|
||||
}
|
||||
|
||||
#[cfg(feature = "av1")]
|
||||
pub mod av1;
|
||||
#[cfg(feature = "openh264")]
|
||||
@@ -1051,7 +1060,17 @@ mod tests {
|
||||
assert!(codecs.new_decoder(Codec::H265).is_err());
|
||||
#[cfg(feature = "vpx")]
|
||||
{
|
||||
assert_eq!(codecs.decoders()[..2], [Codec::Vp9, Codec::Vp8]);
|
||||
// AV1 (dav1d, feature `av1`) comes first where it is built in.
|
||||
let vpx: Vec<_> = codecs
|
||||
.decoders()
|
||||
.into_iter()
|
||||
.filter(|c| matches!(c, Codec::Vp8 | Codec::Vp9))
|
||||
.collect();
|
||||
assert_eq!(vpx, [Codec::Vp9, Codec::Vp8]);
|
||||
assert_eq!(
|
||||
codecs.decoders()[0],
|
||||
if cfg!(feature = "av1") { Codec::Av1 } else { Codec::Vp9 }
|
||||
);
|
||||
assert_eq!(codecs.encoder_codecs()[0], Codec::Vp8);
|
||||
assert_eq!(codecs.pick_encoder(&[Codec::H264, Codec::Vp9]), Some(Codec::Vp9));
|
||||
assert_eq!(codecs.pick_encoder(&[Codec::Vp8, Codec::Vp9]), Some(Codec::Vp8));
|
||||
|
||||
@@ -302,7 +302,11 @@ impl VpxDecoder {
|
||||
pub fn new(codec: Codec) -> Result<Self> {
|
||||
let vp9 = is_vp9(codec)?;
|
||||
check(codec, false)?;
|
||||
let threads = std::thread::available_parallelism().map_or(1, |n| n.get().min(4) as u32);
|
||||
// libvpx's decoder threads spin waiting for each other: on 4 threads
|
||||
// with another core busy, our 4- and 8-partition 1440p streams
|
||||
// decoded at 23 and 11 fps, on 2 at 143 and 129.
|
||||
let cores = std::thread::available_parallelism().map_or(1, |n| n.get());
|
||||
let threads = (cores / 2).clamp(1, 2) as u32;
|
||||
let decoder =
|
||||
raw::Decoder::new(vp9, threads).map_err(|message| Error::Decoder { codec, message })?;
|
||||
Ok(Self { codec, decoder })
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
//! Every decoder is set up for live video: slice threads only (frame
|
||||
//! threads hold one frame per thread before the first picture comes out),
|
||||
//! dav1d with a frame delay of one, so each frame's picture comes out of
|
||||
//! the call that decoded it.
|
||||
//! the call that decoded it. VP8 decodes on one thread: its slice threads
|
||||
//! split frames by token partitions and wait on each other ([`decoder_threads`]).
|
||||
//!
|
||||
//! [`probe`] runs every decoder once per process (in parallel) on a short
|
||||
//! clip of its codec: three frames of a test picture encoded by this crate's
|
||||
@@ -196,9 +197,18 @@ fn hw_device(ffmpeg: &Ffmpeg, kind: &'static str) -> std::result::Result<Ptr, St
|
||||
}
|
||||
|
||||
/// Threads of a software decoder: slice (or dav1d's tile and row) threads,
|
||||
/// which add no delay.
|
||||
fn decoder_threads() -> usize {
|
||||
std::thread::available_parallelism().map_or(1, |n| n.get().min(8))
|
||||
/// which add no delay. Except for VP8, whose slice threads work on the
|
||||
/// frame's token partitions and wait on each other: a stream of 4 or 8
|
||||
/// partitions (ours, from a sender with 6 cores or more) decoded 40-80 %
|
||||
/// slower on 4 threads than on one, too slow for 1440p at 60 fps. dav1d
|
||||
/// ([`crate::codec::dav1d_threads`]) gets a quarter of the cores.
|
||||
fn decoder_threads(codec: Codec, decoder: &str) -> usize {
|
||||
let cores = std::thread::available_parallelism().map_or(1, |n| n.get());
|
||||
match (codec, decoder) {
|
||||
(Codec::Vp8, _) => 1,
|
||||
(_, "libdav1d") => crate::codec::dav1d_threads(),
|
||||
_ => cores.min(8),
|
||||
}
|
||||
}
|
||||
|
||||
/// A decoder of one [`DecoderSpec`]; see the [module docs](self).
|
||||
@@ -258,7 +268,8 @@ impl FfmpegDecoder {
|
||||
// private options object (NULL if the decoder has none).
|
||||
let private = unsafe { (api.av_opt_child_next)(this.ctx, std::ptr::null_mut()) };
|
||||
// A hardware decoder's work is on the GPU.
|
||||
let threads = if spec.is_hardware() { 1 } else { decoder_threads() };
|
||||
let threads =
|
||||
if spec.is_hardware() { 1 } else { decoder_threads(spec.codec, spec.decoder) };
|
||||
this.set(this.ctx, "threads", &threads.to_string());
|
||||
this.set(this.ctx, "thread_type", "slice");
|
||||
if spec.decoder == "libdav1d"
|
||||
|
||||
@@ -14,4 +14,4 @@ mod relay;
|
||||
|
||||
pub use convert::{channel_from_row, client_from_row, delta_from_notification, is_text_message};
|
||||
pub use observer::{Observer, ObserverConfig, ObserverEvent};
|
||||
pub use relay::{RelayConfig, RelayEvent, RelayPool};
|
||||
pub use relay::{RelayConfig, RelayEvent, RelayPool, post_as};
|
||||
@@ -3,7 +3,7 @@
|
||||
//! TeamSpeak only delivers channel chat to clients in that channel, and a
|
||||
//! client can only post to its own channel. A relay session is an invisible
|
||||
//! query client moved into the channel; it forwards what is said there and
|
||||
//! posts messages on behalf of users as `[Nick] text`.
|
||||
//! posts messages on behalf of users under their own nickname ([`post_as`]).
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
@@ -23,13 +23,17 @@ const ERR_ALREADY_MEMBER: u32 = 770;
|
||||
|
||||
/// TeamSpeak's limit for one text message.
|
||||
const MAX_MESSAGE_BYTES: usize = 1024;
|
||||
/// TeamSpeak's limits for a nickname, in characters.
|
||||
const MIN_NICKNAME_CHARS: usize = 3;
|
||||
const MAX_NICKNAME_CHARS: usize = 30;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RelayConfig {
|
||||
pub connect: Connect,
|
||||
/// Base nickname; the channel id is appended because nicknames are unique.
|
||||
pub nickname: String,
|
||||
/// How posts appear, with `{nick}` and `{text}` placeholders.
|
||||
/// How posts appear when the relay cannot take the author's nickname
|
||||
/// ([`post_as`]), with `{nick}` and `{text}` placeholders.
|
||||
pub format: String,
|
||||
}
|
||||
|
||||
@@ -49,6 +53,10 @@ pub enum RelayEvent {
|
||||
|
||||
struct Session {
|
||||
client: QueryClient,
|
||||
/// The relay's own nickname, taken back after each post.
|
||||
nickname: String,
|
||||
/// One post at a time: each borrows the author's nickname.
|
||||
posting: Arc<Mutex<()>>,
|
||||
task: JoinHandle<()>,
|
||||
}
|
||||
|
||||
@@ -92,7 +100,7 @@ impl RelayPool {
|
||||
return Err(voelin_query::Error::Unsupported("relays need a transport with events"));
|
||||
};
|
||||
let own_id = client.own_client_id().await?;
|
||||
set_nickname(&client, &format!("{} {channel}", self.config.nickname)).await;
|
||||
let nickname = set_nickname(&client, &format!("{} {channel}", self.config.nickname)).await;
|
||||
match client.send(&Command::new("clientmove").arg("clid", own_id).arg("cid", channel)).await
|
||||
{
|
||||
// Query clients start in the default channel.
|
||||
@@ -104,7 +112,7 @@ impl RelayPool {
|
||||
client.send(&Command::new("servernotifyregister").arg("event", "textchannel")).await?;
|
||||
info!(channel, own_id, "relay opened");
|
||||
let task = tokio::spawn(forward(channel, own_id, notifications, self.events.clone()));
|
||||
sessions.insert(channel, Session { client, task });
|
||||
sessions.insert(channel, Session { client, nickname, posting: Default::default(), task });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -126,48 +134,118 @@ impl RelayPool {
|
||||
}
|
||||
}
|
||||
|
||||
/// Post `text` in `channel` on behalf of `nick`, opening a relay if needed.
|
||||
/// Post `text` in `channel` as `nick` wrote it ([`post_as`]), opening a
|
||||
/// relay if needed.
|
||||
pub async fn send(
|
||||
&self,
|
||||
channel: ChannelId,
|
||||
nick: &str,
|
||||
text: &str,
|
||||
) -> voelin_query::Result<()> {
|
||||
self.post(channel, nick, text, &self.config.format).await
|
||||
}
|
||||
|
||||
/// [`RelayPool::send`] with another fallback `format` than the pool's.
|
||||
pub async fn post(
|
||||
&self,
|
||||
channel: ChannelId,
|
||||
nick: &str,
|
||||
text: &str,
|
||||
format: &str,
|
||||
) -> voelin_query::Result<()> {
|
||||
self.open(channel).await?;
|
||||
let client = match self.sessions.lock().await.get(&channel) {
|
||||
Some(s) => s.client.clone(),
|
||||
let (client, nickname, posting) = match self.sessions.lock().await.get(&channel) {
|
||||
Some(s) => (s.client.clone(), s.nickname.clone(), s.posting.clone()),
|
||||
None => return Err(voelin_query::Error::Closed),
|
||||
};
|
||||
let full = relay_text(&self.config.format, nick, text);
|
||||
for part in split_message(&full, MAX_MESSAGE_BYTES) {
|
||||
client
|
||||
.send(
|
||||
&Command::new("sendtextmessage")
|
||||
.arg("targetmode", 2)
|
||||
.arg("target", channel)
|
||||
.arg("msg", part),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
Ok(())
|
||||
let _posting = posting.lock().await;
|
||||
post_as(&client, &nickname, nick, text, format, |part| {
|
||||
Command::new("sendtextmessage")
|
||||
.arg("targetmode", 2)
|
||||
.arg("target", channel)
|
||||
.arg("msg", part)
|
||||
})
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
/// Post `text` through the query session `client` as if `nick` wrote it: the
|
||||
/// session takes the nickname for the post (or `nick1`, `nick2`, … while
|
||||
/// someone has it, as TeamSpeak names a second client of the same name) and
|
||||
/// goes back to `own_nickname` afterwards, so it never keeps someone's name.
|
||||
/// When it cannot take any (too short, refused), the post goes out under the
|
||||
/// session's own name as `format` (`{nick}`, `{text}`). `command` makes the
|
||||
/// `sendtextmessage` for one part of the text.
|
||||
///
|
||||
/// Callers serialize posts through one session: each borrows a nickname.
|
||||
pub async fn post_as(
|
||||
client: &QueryClient,
|
||||
own_nickname: &str,
|
||||
nick: &str,
|
||||
text: &str,
|
||||
format: &str,
|
||||
command: impl Fn(String) -> Command,
|
||||
) -> voelin_query::Result<()> {
|
||||
let taken = take_nickname(client, nick).await;
|
||||
let full = if taken { text.to_owned() } else { relay_text(format, nick, text) };
|
||||
let mut result = Ok(());
|
||||
for part in split_message(&full, MAX_MESSAGE_BYTES) {
|
||||
result = client.send(&command(part)).await.map(drop);
|
||||
if result.is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if taken && !own_nickname.is_empty() {
|
||||
set_nickname(client, own_nickname).await;
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/// Name the session `nick` or a numbered variant; whether it did.
|
||||
async fn take_nickname(client: &QueryClient, nick: &str) -> bool {
|
||||
for nickname in author_nicknames(nick) {
|
||||
match client.send(&Command::new("clientupdate").arg("client_nickname", &nickname)).await {
|
||||
Ok(_) => return true,
|
||||
Err(voelin_query::Error::Query(e)) if e.id == ERR_NICKNAME_IN_USE => continue,
|
||||
Err(e) => {
|
||||
debug!(%e, "could not take the author's nickname");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
/// The names a post by `nick` may go out under, in order: the nickname
|
||||
/// itself, then `nick1` to `nick3`, each within TeamSpeak's length limits.
|
||||
fn author_nicknames(nick: &str) -> Vec<String> {
|
||||
let nick = nick.trim();
|
||||
if nick.chars().count() < MIN_NICKNAME_CHARS {
|
||||
return Vec::new();
|
||||
}
|
||||
let fit = |suffix: &str| {
|
||||
let head: String = nick.chars().take(MAX_NICKNAME_CHARS - suffix.len()).collect();
|
||||
format!("{}{suffix}", head.trim_end())
|
||||
};
|
||||
std::iter::once(fit("")).chain((1..=3).map(|n| fit(&n.to_string()))).collect()
|
||||
}
|
||||
|
||||
/// Nicknames are unique per server; try a few numbered variants. The name is
|
||||
/// cosmetic, so failing keeps the server-assigned one.
|
||||
async fn set_nickname(client: &QueryClient, base: &str) {
|
||||
/// cosmetic, so failing keeps the server-assigned one. The name it got.
|
||||
async fn set_nickname(client: &QueryClient, base: &str) -> String {
|
||||
for attempt in 1..=5 {
|
||||
let nickname = if attempt == 1 { base.to_string() } else { format!("{base} ({attempt})") };
|
||||
match client.send(&Command::new("clientupdate").arg("client_nickname", &nickname)).await {
|
||||
Ok(_) => return,
|
||||
Ok(_) => return nickname,
|
||||
Err(voelin_query::Error::Query(e)) if e.id == ERR_NICKNAME_IN_USE => continue,
|
||||
Err(e) => {
|
||||
warn!(%e, %nickname, "could not set relay nickname");
|
||||
return;
|
||||
return base.to_owned();
|
||||
}
|
||||
}
|
||||
}
|
||||
warn!(base, "all relay nicknames in use");
|
||||
base.to_owned()
|
||||
}
|
||||
|
||||
async fn forward(
|
||||
@@ -193,3 +271,22 @@ async fn forward(
|
||||
}
|
||||
let _ = events.send(RelayEvent::Closed { channel, reason: "connection closed".into() });
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn posts_go_out_under_the_authors_name_then_numbered_variants() {
|
||||
assert_eq!(author_nicknames(" Alice "), ["Alice", "Alice1", "Alice2", "Alice3"]);
|
||||
// Too short for TeamSpeak: the relay's own name and the format.
|
||||
assert!(author_nicknames("Al").is_empty());
|
||||
let long = "x".repeat(40);
|
||||
let names = author_nicknames(&long);
|
||||
assert_eq!(names[0], "x".repeat(30));
|
||||
assert_eq!(names[1], format!("{}1", "x".repeat(29)));
|
||||
assert!(names.iter().all(|n| n.chars().count() <= MAX_NICKNAME_CHARS));
|
||||
// Characters, not bytes.
|
||||
assert_eq!(author_nicknames(&"é".repeat(31))[0].chars().count(), 30);
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,13 @@
|
||||
//! - [`notify`]: desktop notifications
|
||||
//! - [`paths`]: data, config, cache and state directories
|
||||
//! - [`crash`]: opt-in local crash reports (panic hook)
|
||||
//! - [`logs`]: the log file, with the previous runs' kept
|
||||
//! - [`notices`]: third-party notices for the About page
|
||||
|
||||
pub mod crash;
|
||||
pub mod files;
|
||||
pub mod hotkey;
|
||||
pub mod logs;
|
||||
pub mod notices;
|
||||
pub mod notify;
|
||||
pub mod paths;
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
//! The app's log file: `<state>/logs/voelin.log` for this run, the previous
|
||||
//! runs' as `voelin.1.log` (the last one) to `voelin.4.log`. A run that writes
|
||||
//! more than [`MAX_BYTES`] starts a fresh file (the full one moves to
|
||||
//! `voelin.1.log`), so the logs never fill the disk.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! let log = voelin_platform::logs::LogFile::open(voelin_platform::logs::default_dir())?;
|
||||
//! // tracing_subscriber::fmt::layer().with_ansi(false).with_writer(move || log.clone())
|
||||
//! # Ok::<(), std::io::Error>(())
|
||||
//! ```
|
||||
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{self, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex, OnceLock, PoisonError};
|
||||
|
||||
use crate::paths;
|
||||
|
||||
/// The log directory's name under the state directory.
|
||||
pub const DIR_NAME: &str = "logs";
|
||||
/// Files kept: this run's and the previous runs'.
|
||||
pub const KEEP: usize = 5;
|
||||
/// One file's limit.
|
||||
pub const MAX_BYTES: u64 = 20 << 20;
|
||||
|
||||
const NAME: &str = "voelin";
|
||||
|
||||
/// The file this process writes, once [`LogFile::open`] succeeded.
|
||||
static CURRENT: OnceLock<PathBuf> = OnceLock::new();
|
||||
|
||||
/// `<state>/logs`.
|
||||
pub fn default_dir() -> PathBuf {
|
||||
paths::state_dir().join(DIR_NAME)
|
||||
}
|
||||
|
||||
/// The log file of this run, if there is one.
|
||||
pub fn current() -> Option<&'static Path> {
|
||||
CURRENT.get().map(PathBuf::as_path)
|
||||
}
|
||||
|
||||
/// A log file to write to from any thread; clones write to the same file.
|
||||
#[derive(Clone)]
|
||||
pub struct LogFile(Arc<Mutex<Inner>>);
|
||||
|
||||
struct Inner {
|
||||
dir: PathBuf,
|
||||
file: File,
|
||||
written: u64,
|
||||
keep: usize,
|
||||
max: u64,
|
||||
}
|
||||
|
||||
impl LogFile {
|
||||
/// Start this run's file in `dir`, moving the previous runs' along.
|
||||
pub fn open(dir: impl Into<PathBuf>) -> io::Result<Self> {
|
||||
Self::open_with(dir.into(), KEEP, MAX_BYTES)
|
||||
}
|
||||
|
||||
fn open_with(dir: PathBuf, keep: usize, max: u64) -> io::Result<Self> {
|
||||
std::fs::create_dir_all(&dir)?;
|
||||
let file = start(&dir, keep)?;
|
||||
let _ = CURRENT.set(dir.join(file_name(0)));
|
||||
Ok(Self(Arc::new(Mutex::new(Inner { dir, file, written: 0, keep, max }))))
|
||||
}
|
||||
|
||||
/// The file being written.
|
||||
pub fn path(&self) -> PathBuf {
|
||||
self.lock().dir.join(file_name(0))
|
||||
}
|
||||
|
||||
fn lock(&self) -> std::sync::MutexGuard<'_, Inner> {
|
||||
self.0.lock().unwrap_or_else(PoisonError::into_inner)
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for LogFile {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let mut inner = self.lock();
|
||||
if inner.written > 0 && inner.written + buf.len() as u64 > inner.max {
|
||||
inner.file = start(&inner.dir, inner.keep)?;
|
||||
inner.written = 0;
|
||||
}
|
||||
let n = inner.file.write(buf)?;
|
||||
inner.written += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
self.lock().file.flush()
|
||||
}
|
||||
}
|
||||
|
||||
/// `voelin.log`, `voelin.1.log`, …
|
||||
fn file_name(n: usize) -> String {
|
||||
if n == 0 { format!("{NAME}.log") } else { format!("{NAME}.{n}.log") }
|
||||
}
|
||||
|
||||
/// Move the files one along (the oldest goes) and open a new current one.
|
||||
fn start(dir: &Path, keep: usize) -> io::Result<File> {
|
||||
let keep = keep.max(1);
|
||||
let _ = std::fs::remove_file(dir.join(file_name(keep - 1)));
|
||||
for n in (0..keep - 1).rev() {
|
||||
let from = dir.join(file_name(n));
|
||||
if from.exists() {
|
||||
let _ = std::fs::rename(&from, dir.join(file_name(n + 1)));
|
||||
}
|
||||
}
|
||||
OpenOptions::new().create(true).write(true).truncate(true).open(dir.join(file_name(0)))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn temp_dir(name: &str) -> PathBuf {
|
||||
let dir = std::env::temp_dir().join(format!(
|
||||
"voelin-logs-{name}-{}-{:?}",
|
||||
std::process::id(),
|
||||
std::thread::current().id()
|
||||
));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
dir
|
||||
}
|
||||
|
||||
fn read(dir: &Path, n: usize) -> Option<String> {
|
||||
std::fs::read_to_string(dir.join(file_name(n))).ok()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_run_gets_a_file_and_the_oldest_go() {
|
||||
let dir = temp_dir("runs");
|
||||
for run in 0..4 {
|
||||
let mut log = LogFile::open_with(dir.clone(), 3, MAX_BYTES).unwrap();
|
||||
writeln!(log, "run {run}").unwrap();
|
||||
}
|
||||
assert_eq!(read(&dir, 0).as_deref(), Some("run 3\n"));
|
||||
assert_eq!(read(&dir, 1).as_deref(), Some("run 2\n"));
|
||||
assert_eq!(read(&dir, 2).as_deref(), Some("run 1\n"));
|
||||
assert_eq!(read(&dir, 3), None, "only three files are kept");
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_full_file_starts_over() {
|
||||
let dir = temp_dir("full");
|
||||
let log = LogFile::open_with(dir.clone(), 3, 10).unwrap();
|
||||
let mut writer = log.clone();
|
||||
writer.write_all(b"12345678\n").unwrap();
|
||||
// Clones share the file and its size.
|
||||
log.clone().write_all(b"abcdef\n").unwrap();
|
||||
assert_eq!(read(&dir, 0).as_deref(), Some("abcdef\n"));
|
||||
assert_eq!(read(&dir, 1).as_deref(), Some("12345678\n"));
|
||||
assert_eq!(log.path(), dir.join("voelin.log"));
|
||||
// A line longer than the limit still goes out whole.
|
||||
writer.write_all(b"a line longer than ten bytes\n").unwrap();
|
||||
assert_eq!(read(&dir, 0).as_deref(), Some("a line longer than ten bytes\n"));
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -470,6 +470,8 @@ pub(crate) struct App {
|
||||
pub demo: bool,
|
||||
/// `VOELIN_DEMO_UI`: sample servers, channels and chat (dev.rs).
|
||||
pub demo_ui: bool,
|
||||
/// Servers whose gateway was looked up in this run (`discover_gateway`).
|
||||
pub gateways_looked_up: HashSet<i64>,
|
||||
/// `VOELIN_AUTOSHARE=test-pattern`: share the test pattern once streams work.
|
||||
pub autoshare: bool,
|
||||
/// `VOELIN_OPEN=client`: open the volume dialog of the first other client.
|
||||
@@ -662,7 +664,7 @@ pub fn run(options: RunOptions) -> Result<()> {
|
||||
#[cfg(not(target_os = "android"))]
|
||||
runtime: runtime.clone(),
|
||||
#[cfg(not(target_os = "android"))]
|
||||
myts: Default::default(),
|
||||
myts: crate::myts::Account::new(dir.join("account")),
|
||||
ui: ui.as_weak(),
|
||||
store,
|
||||
// The sample data of VOELIN_DEMO_UI never reaches the system keyring.
|
||||
@@ -699,6 +701,7 @@ pub fn run(options: RunOptions) -> Result<()> {
|
||||
stream_volume: 100.0,
|
||||
demo: switches.demo_stream,
|
||||
demo_ui: switches.demo_ui,
|
||||
gateways_looked_up: HashSet::new(),
|
||||
autoshare: switches.autoshare,
|
||||
open_client_pending: switches.open_client,
|
||||
notices_loaded: false,
|
||||
|
||||
@@ -23,9 +23,6 @@ pub(super) fn wire(ui: &MainWindow) {
|
||||
bridge.on_disconnect_voice(|| {
|
||||
with_app(|app| app.command(|session| Command::DisconnectVoice { session }));
|
||||
});
|
||||
bridge.on_toggle_observe(|| {
|
||||
with_app(|app| app.toggle_observe());
|
||||
});
|
||||
bridge.on_join_channel(|cid| {
|
||||
with_app(|app| {
|
||||
app.command(|session| Command::MoveToChannel {
|
||||
|
||||
@@ -16,7 +16,7 @@ use voelin_core::{
|
||||
Command, DownloadTo, GatewayRequest, GatewayUpdate, HistoryMessage, HistorySource,
|
||||
TransferState,
|
||||
};
|
||||
use voelin_gateway_proto::{TopicInfo, feature};
|
||||
use voelin_gateway_proto::{ErrorCode, TopicInfo, feature};
|
||||
use voelin_model::{ChatMessage, ChatTarget};
|
||||
|
||||
use crate::app::{App, Bridge, ChatLine, ChatTab, FileItem, Msg, PinItem, SessionView, Tab};
|
||||
@@ -546,8 +546,11 @@ impl App {
|
||||
}
|
||||
tab.topic_messages.sort_by_key(|m| (m.message.message.ts_ms, m.message.id));
|
||||
}
|
||||
GatewayUpdate::Failed { request, message, .. } => {
|
||||
self.set_status(format!("{request}: {message}"));
|
||||
GatewayUpdate::Failed { request, code, message } => {
|
||||
tracing::warn!(%request, ?code, %message, "gateway request failed");
|
||||
if let Some(text) = failure_text(&request, code, &message) {
|
||||
self.set_status(text);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// The stream directory: how many watch each stream.
|
||||
@@ -809,6 +812,40 @@ impl App {
|
||||
}
|
||||
|
||||
/// A directory entry's stream id and viewer count, when it has both.
|
||||
/// What a failed gateway request tells the user. What the app asked for by
|
||||
/// itself (history, lists, subscriptions) fails quietly; what the user did
|
||||
/// says so in plain words, never the gateway's; the gateway's own
|
||||
/// administration page shows its message as it is.
|
||||
fn failure_text(request: &str, code: Option<ErrorCode>, message: &str) -> Option<String> {
|
||||
if request.starts_with("config_") || request.starts_with("perm_") {
|
||||
return Some(format!("{request}: {message}"));
|
||||
}
|
||||
let done_by_user = matches!(
|
||||
request,
|
||||
"post"
|
||||
| "pin" | "unpin"
|
||||
| "react" | "unreact"
|
||||
| "create_topic"
|
||||
| "update_topic"
|
||||
| "create_event"
|
||||
| "update_event"
|
||||
| "delete_event"
|
||||
| "rsvp"
|
||||
);
|
||||
if !done_by_user {
|
||||
return None;
|
||||
}
|
||||
let text = match code {
|
||||
Some(ErrorCode::Forbidden) => "Not allowed on this server.",
|
||||
Some(ErrorCode::RateLimited) => "Too many requests; try again in a moment.",
|
||||
Some(ErrorCode::QuotaExceeded) => "This server's limit is reached.",
|
||||
Some(ErrorCode::NotFound) => "That is no longer there.",
|
||||
Some(ErrorCode::FeatureDisabled) => "This server does not offer that.",
|
||||
_ => "That did not work; try again later.",
|
||||
};
|
||||
Some(text.to_owned())
|
||||
}
|
||||
|
||||
fn viewers_of(entry: &voelin_gateway_proto::StreamEntry) -> Option<(String, u32)> {
|
||||
Some((entry.stream_id.clone()?, entry.viewers?))
|
||||
}
|
||||
@@ -836,4 +873,25 @@ mod tests {
|
||||
assert_eq!(ago(now - 3 * 3_600_000), "3 hours ago");
|
||||
assert_eq!(ago(now - 36 * 3_600_000), "yesterday");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failures_say_what_the_user_did_never_the_gateway() {
|
||||
let lost = "websocket: IO error: Connection refused (os error 111)";
|
||||
// The app's own requests fail quietly.
|
||||
for request in ["history", "sync", "pins", "events", "subscribe_streams"] {
|
||||
assert_eq!(failure_text(request, None, lost), None, "{request}");
|
||||
}
|
||||
// The user's own, in plain words.
|
||||
assert_eq!(
|
||||
failure_text("pin", Some(ErrorCode::Forbidden), "no b_pin").as_deref(),
|
||||
Some("Not allowed on this server.")
|
||||
);
|
||||
let text = failure_text("post", None, lost).unwrap();
|
||||
assert!(!text.contains("websocket") && !text.to_lowercase().contains("gateway"), "{text}");
|
||||
// The gateway's administration page shows its message.
|
||||
assert_eq!(
|
||||
failure_text("config_set", Some(ErrorCode::BadRequest), "bad value").as_deref(),
|
||||
Some("config_set: bad value")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,11 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running {
|
||||
with_app(|app| app.connect_voice());
|
||||
}
|
||||
Some("observe") => {
|
||||
with_app(|app| app.toggle_observe());
|
||||
with_app(|app| {
|
||||
if let Some(id) = app.current {
|
||||
app.observe(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -180,6 +184,18 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running {
|
||||
account.uuid = "00000000-0000-0000-0000-000000000001".into();
|
||||
account.myts_id = "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB".into();
|
||||
account.identity_status = 1;
|
||||
account.initials = "AE".into();
|
||||
account.description = "Usually in the Raid channel after 8.".into();
|
||||
account.member_since = "2019-03-14".into();
|
||||
account.last_login = "2026-10-03".into();
|
||||
let strings = |items: &[&str]| {
|
||||
slint::ModelRc::new(slint::VecModel::from(
|
||||
items.iter().map(|s| slint::SharedString::from(*s)).collect::<Vec<_>>(),
|
||||
))
|
||||
};
|
||||
account.badges = strings(&["TeamSpeak 6 Beta", "Early supporter"]);
|
||||
account.devices =
|
||||
strings(&["Voelin · EU · 2026-10-03", "TeamSpeak · EU · 2026-09-28"]);
|
||||
nav.invoke_open_settings(SettingsSection::Account);
|
||||
}
|
||||
account.otp_required = arg == "otp";
|
||||
|
||||
@@ -176,6 +176,11 @@ pub fn picture(key: &str, bytes: &[u8]) -> Image {
|
||||
CACHE.with(|c| c.borrow_mut().get_or_load(&cache_key, || decode(bytes))).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Forget the decoded picture kept by `key` (a changed account avatar).
|
||||
pub fn forget_picture(key: &str) {
|
||||
CACHE.with(|c| c.borrow_mut().remove(&format!("picture:{key}")));
|
||||
}
|
||||
|
||||
/// A Twemoji by key; an empty image if there is none.
|
||||
pub fn emoji(key: &str) -> Image {
|
||||
if key.is_empty() {
|
||||
|
||||
@@ -5,14 +5,41 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use anyhow::Result;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use tracing_subscriber::{EnvFilter, Layer, fmt, prelude::*};
|
||||
use voelin_platform::logs;
|
||||
|
||||
/// What the log file gets without `VOELIN_LOG`: our crates' information,
|
||||
/// everyone's warnings. zbus's warnings are left out: it warns when a desktop
|
||||
/// portal's request or session object is gone before it reads the object's
|
||||
/// properties, which is harmless; its errors stay.
|
||||
const FILE_FILTER: &str = "warn,zbus=error,voelin=info,voelin_ui=info,voelin_core=info,voelin_media=info,\
|
||||
voelin_stream=info,voelin_audio=info,voelin_store=info,voelin_myts=info,voelin_observer=info,\
|
||||
voelin_query=info,voelin_gateway_proto=info,voelin_platform=info,tsclientlib=info";
|
||||
|
||||
fn main() -> Result<()> {
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("warn")),
|
||||
// The terminal (RUST_LOG, warnings by default) and the log file in the
|
||||
// state directory (VOELIN_LOG, `FILE_FILTER` by default): release builds
|
||||
// on Windows have no terminal.
|
||||
let file = logs::LogFile::open(logs::default_dir());
|
||||
let console = fmt::layer().with_writer(std::io::stderr).with_filter(
|
||||
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("warn,zbus=error")),
|
||||
);
|
||||
let to_file = file.as_ref().ok().map(|log| {
|
||||
let log = log.clone();
|
||||
fmt::layer().with_ansi(false).with_writer(move || log.clone()).with_filter(
|
||||
EnvFilter::try_from_env("VOELIN_LOG").unwrap_or_else(|_| EnvFilter::new(FILE_FILTER)),
|
||||
)
|
||||
.init();
|
||||
});
|
||||
tracing_subscriber::registry().with(console).with(to_file).init();
|
||||
match &file {
|
||||
Ok(log) => tracing::info!(
|
||||
version = env!("CARGO_PKG_VERSION"),
|
||||
os = std::env::consts::OS,
|
||||
log = %log.path().display(),
|
||||
"Voelin starting"
|
||||
),
|
||||
Err(error) => tracing::warn!(%error, "no log file this time"),
|
||||
}
|
||||
let options = voelin_ui::RunOptions {
|
||||
setting_overrides: setting_overrides(std::env::args().skip(1)),
|
||||
..Default::default()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
//! Desktop account state. Only the UI thread mutates state or persists credentials.
|
||||
use serde::{Deserialize, Serialize};
|
||||
use slint::ComponentHandle;
|
||||
use slint::{ComponentHandle, ModelRc, SharedString, VecModel};
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use voelin_myts::{Client, Login, ServerIdentity, SessionToken};
|
||||
use voelin_myts::{Client, Login, Profile, ServerIdentity, SessionToken};
|
||||
use voelin_store::Secrets;
|
||||
|
||||
use crate::app::{App, Bridge, MytsForm, later};
|
||||
@@ -25,13 +26,81 @@ struct Saved {
|
||||
// Private account identity belongs in the same secret-store transaction.
|
||||
#[serde(default)]
|
||||
identity: Option<ServerIdentity>,
|
||||
/// What the account service tells about the account, shown at once on
|
||||
/// the next start.
|
||||
#[serde(default)]
|
||||
profile: SavedProfile,
|
||||
}
|
||||
|
||||
/// The profile of [`voelin_myts::Profile`] worth keeping between runs.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
struct SavedProfile {
|
||||
description: String,
|
||||
/// Unix seconds; 0: not known.
|
||||
registered: i64,
|
||||
last_login: i64,
|
||||
badges: Vec<String>,
|
||||
/// "Name · region · date" per signed-in device.
|
||||
devices: Vec<String>,
|
||||
/// The avatar file shown, as the service names it; the picture is
|
||||
/// [`AVATAR_FILE`] in the account directory.
|
||||
avatar: String,
|
||||
}
|
||||
|
||||
/// The account's avatar picture, in the account directory.
|
||||
const AVATAR_FILE: &str = "avatar";
|
||||
|
||||
/// A date (Unix seconds) as the profile shows it; empty when not known.
|
||||
fn date(seconds: i64) -> String {
|
||||
chrono::DateTime::from_timestamp(seconds, 0)
|
||||
.filter(|_| seconds > 0)
|
||||
.map(|d| d.with_timezone(&chrono::Local).format("%Y-%m-%d").to_string())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
impl SavedProfile {
|
||||
/// Take what the service told; empty fields keep what was known.
|
||||
fn update(&mut self, profile: &Profile) {
|
||||
if !profile.description.is_empty() {
|
||||
self.description = profile.description.clone();
|
||||
}
|
||||
if profile.registered > 0 {
|
||||
self.registered = profile.registered;
|
||||
}
|
||||
if profile.last_login > 0 {
|
||||
self.last_login = profile.last_login;
|
||||
}
|
||||
if !profile.badges.is_empty() {
|
||||
self.badges = profile.badges.iter().map(|b| b.name.clone()).collect();
|
||||
}
|
||||
if !profile.devices.is_empty() {
|
||||
self.devices = profile
|
||||
.devices
|
||||
.iter()
|
||||
.map(|d| {
|
||||
[d.name.as_str(), d.region.as_str(), &date(d.last_login)]
|
||||
.into_iter()
|
||||
.filter(|part| !part.is_empty())
|
||||
.collect::<Vec<_>>()
|
||||
.join(" · ")
|
||||
})
|
||||
.collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct Account {
|
||||
/// Where the avatar picture is kept (`<data>/account`); none in tests.
|
||||
dir: Option<PathBuf>,
|
||||
/// The avatar, decoded.
|
||||
avatar: slint::Image,
|
||||
saved: Option<Saved>,
|
||||
signed_in: bool,
|
||||
busy: bool,
|
||||
/// The saved session is being checked (not a password sign-in).
|
||||
checking: bool,
|
||||
otp_required: bool,
|
||||
status: i32,
|
||||
persistence_status: i32,
|
||||
@@ -44,10 +113,56 @@ pub(crate) struct Account {
|
||||
}
|
||||
|
||||
impl Account {
|
||||
pub(crate) fn new(dir: PathBuf) -> Self {
|
||||
Self { dir: Some(dir), ..Default::default() }
|
||||
}
|
||||
|
||||
fn avatar_path(&self) -> Option<PathBuf> {
|
||||
self.dir.as_ref().map(|dir| dir.join(AVATAR_FILE))
|
||||
}
|
||||
|
||||
/// The kept picture, shown while the session is checked.
|
||||
fn load_avatar(&mut self) {
|
||||
let bytes = self.avatar_path().and_then(|path| std::fs::read(path).ok());
|
||||
self.avatar = bytes.map(|b| crate::images::picture("myts-avatar", &b)).unwrap_or_default();
|
||||
}
|
||||
|
||||
/// A new picture from the service: kept on disk and shown.
|
||||
fn set_avatar(&mut self, name: String, bytes: &[u8]) {
|
||||
crate::images::forget_picture("myts-avatar");
|
||||
self.avatar = crate::images::picture("myts-avatar", bytes);
|
||||
if self.avatar.size().width == 0 {
|
||||
return;
|
||||
}
|
||||
if let Some(path) = self.avatar_path() {
|
||||
let written = path
|
||||
.parent()
|
||||
.map_or(Ok(()), std::fs::create_dir_all)
|
||||
.and_then(|()| std::fs::write(&path, bytes));
|
||||
if let Err(error) = written {
|
||||
tracing::warn!(%error, "could not keep the account's avatar");
|
||||
}
|
||||
}
|
||||
if let Some(saved) = self.saved.as_mut() {
|
||||
saved.profile.avatar = name;
|
||||
}
|
||||
}
|
||||
|
||||
fn forget_avatar(&mut self) {
|
||||
self.avatar = slint::Image::default();
|
||||
crate::images::forget_picture("myts-avatar");
|
||||
if let Some(path) = self.avatar_path() {
|
||||
let _ = std::fs::remove_file(path);
|
||||
}
|
||||
}
|
||||
|
||||
fn load(&mut self, secrets: &dyn Secrets) {
|
||||
match read_saved(secrets) {
|
||||
Ok(saved) => {
|
||||
self.saved = saved;
|
||||
if self.saved.is_some() {
|
||||
self.load_avatar();
|
||||
}
|
||||
self.can_forget = false;
|
||||
self.status = 0;
|
||||
self.persistence_status = 0;
|
||||
@@ -80,7 +195,17 @@ impl Account {
|
||||
.renewal
|
||||
.map(|renewal| (renewal.token, renewal.device_id, renewal.otp_token))
|
||||
.unwrap_or_default();
|
||||
// Another account's picture is not this one's.
|
||||
let same_account =
|
||||
self.saved.as_ref().is_some_and(|s| !s.uuid.is_empty() && s.uuid == login.uuid);
|
||||
let mut profile =
|
||||
if same_account { self.saved.take().unwrap().profile } else { SavedProfile::default() };
|
||||
if !same_account {
|
||||
self.forget_avatar();
|
||||
}
|
||||
profile.update(&login.profile);
|
||||
let saved = Saved {
|
||||
profile,
|
||||
session: login.token.into_inner(),
|
||||
email,
|
||||
username: login.username,
|
||||
@@ -108,12 +233,44 @@ impl Account {
|
||||
self.status = 9;
|
||||
}
|
||||
}
|
||||
/// Store what the account service told (`Client::profile`).
|
||||
fn take_profile(&mut self, secrets: &dyn Secrets, profile: &Profile) {
|
||||
let Some(saved) = self.saved.as_mut() else { return };
|
||||
if !profile.username.is_empty() {
|
||||
saved.username = profile.username.clone();
|
||||
}
|
||||
saved.profile.update(profile);
|
||||
if self.persistence_status == 0 && !save(secrets, saved) {
|
||||
self.persistence_status = 5;
|
||||
}
|
||||
}
|
||||
|
||||
fn form(&self) -> MytsForm {
|
||||
let identity = self.identity();
|
||||
let profile = self.saved.as_ref().map(|s| s.profile.clone()).unwrap_or_default();
|
||||
let name = self
|
||||
.saved
|
||||
.as_ref()
|
||||
.map(|s| if s.username.is_empty() { s.email.as_str() } else { s.username.as_str() })
|
||||
.unwrap_or_default();
|
||||
let strings = |items: Vec<String>| -> ModelRc<SharedString> {
|
||||
ModelRc::new(VecModel::from(
|
||||
items.into_iter().map(SharedString::from).collect::<Vec<_>>(),
|
||||
))
|
||||
};
|
||||
MytsForm {
|
||||
available: true,
|
||||
prompt: self.prompt,
|
||||
signed_in: self.signed_in,
|
||||
// A saved session being checked: its profile shows, not the form.
|
||||
restoring: !self.signed_in && self.busy && self.checking && self.saved.is_some(),
|
||||
avatar: self.avatar.clone(),
|
||||
initials: crate::vm::avatar::initials(name).into(),
|
||||
description: profile.description.into(),
|
||||
member_since: date(profile.registered).into(),
|
||||
last_login: date(profile.last_login).into(),
|
||||
badges: strings(profile.badges),
|
||||
devices: strings(profile.devices),
|
||||
email: self.saved.as_ref().map(|s| s.email.as_str()).unwrap_or_default().into(),
|
||||
username: self.saved.as_ref().map(|s| s.username.as_str()).unwrap_or_default().into(),
|
||||
uuid: self.saved.as_ref().map(|s| s.uuid.as_str()).unwrap_or_default().into(),
|
||||
@@ -143,6 +300,7 @@ impl Account {
|
||||
}
|
||||
self.generation += 1;
|
||||
self.busy = true;
|
||||
self.checking = false;
|
||||
self.status = 0;
|
||||
Some(self.generation)
|
||||
}
|
||||
@@ -152,12 +310,14 @@ impl Account {
|
||||
return false;
|
||||
}
|
||||
self.busy = false;
|
||||
self.checking = false;
|
||||
true
|
||||
}
|
||||
|
||||
fn forget(&mut self, secrets: &dyn Secrets) -> bool {
|
||||
self.generation += 1;
|
||||
self.busy = false;
|
||||
self.checking = false;
|
||||
self.signed_in = false;
|
||||
self.prompt = true;
|
||||
self.saved = None;
|
||||
@@ -166,6 +326,7 @@ impl Account {
|
||||
let cleared = secrets.delete(KEY).is_ok();
|
||||
self.persistence_status = if cleared { 0 } else { 8 };
|
||||
self.can_forget = !cleared;
|
||||
self.forget_avatar();
|
||||
cleared
|
||||
}
|
||||
}
|
||||
@@ -238,15 +399,68 @@ impl App {
|
||||
self.refresh_myts();
|
||||
return;
|
||||
}
|
||||
self.myts.prompt = true;
|
||||
self.myts.load(self.secrets.as_ref());
|
||||
// Signed in before: no login page. The saved session is checked in
|
||||
// the background, and only one that has expired asks again. Without
|
||||
// one, the page shows unless "Continue without an account" was
|
||||
// chosen before.
|
||||
self.myts.prompt = self.myts.saved.is_none() && !self.settings.skip_account_prompt;
|
||||
self.myts_retry();
|
||||
}
|
||||
|
||||
pub(crate) fn myts_dismiss(&mut self) {
|
||||
self.myts.prompt = false;
|
||||
if !self.demo_ui && !self.settings.skip_account_prompt {
|
||||
self.settings.skip_account_prompt = true;
|
||||
self.store_settings();
|
||||
}
|
||||
self.refresh_myts();
|
||||
}
|
||||
|
||||
/// Ask the account service for the profile and avatar of the signed-in
|
||||
/// account; what comes back is stored and shown.
|
||||
fn refresh_myts_profile(&self) {
|
||||
let Some(token) =
|
||||
self.myts.saved.as_ref().and_then(|s| SessionToken::new(s.session.clone()).ok())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let shown = self.myts.saved.as_ref().map(|s| s.profile.avatar.clone()).unwrap_or_default();
|
||||
let has_picture = self.myts.avatar.size().width > 0;
|
||||
let generation = self.myts.generation;
|
||||
self.runtime.spawn(async move {
|
||||
let client = match Client::new() {
|
||||
Ok(client) => client,
|
||||
Err(error) => return tracing::debug!(%error, "no account client"),
|
||||
};
|
||||
let profile = match client.profile(&token).await {
|
||||
Ok(profile) => profile,
|
||||
Err(error) => return tracing::info!(%error, "account profile not refreshed"),
|
||||
};
|
||||
let avatar = profile.avatars.first().cloned();
|
||||
later(move |app| {
|
||||
if app.myts.generation == generation && app.myts.signed_in {
|
||||
app.myts.take_profile(app.secrets.as_ref(), &profile);
|
||||
app.refresh_myts();
|
||||
}
|
||||
});
|
||||
// The picture only when it changed (or was never fetched).
|
||||
let Some(name) = avatar.filter(|name| *name != shown || !has_picture) else { return };
|
||||
match client.avatar(&name).await {
|
||||
Ok(bytes) => later(move |app| {
|
||||
if app.myts.generation == generation && app.myts.signed_in {
|
||||
app.myts.set_avatar(name, &bytes);
|
||||
if let Some(saved) = app.myts.saved.as_ref() {
|
||||
let _ = save(app.secrets.as_ref(), saved);
|
||||
}
|
||||
app.refresh_myts();
|
||||
}
|
||||
}),
|
||||
Err(error) => tracing::info!(%error, "account avatar not fetched"),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn myts_portal(&mut self, action: i32) {
|
||||
let Some(url) = portal_url(action).filter(|_| !self.myts.busy) else {
|
||||
return;
|
||||
@@ -269,6 +483,7 @@ impl App {
|
||||
};
|
||||
let token = SessionToken::new(saved.session.clone()).expect("validated stored token");
|
||||
let generation = self.myts.begin().expect("startup is idle");
|
||||
self.myts.checking = true;
|
||||
self.refresh_myts();
|
||||
self.runtime.spawn(async move {
|
||||
// Password login does not provide the separate auth token required
|
||||
@@ -280,7 +495,10 @@ impl App {
|
||||
}
|
||||
let was_signed_in = app.myts.signed_in;
|
||||
match result {
|
||||
Ok(()) => app.myts.restored(),
|
||||
Ok(()) => {
|
||||
app.myts.restored();
|
||||
app.refresh_myts_profile();
|
||||
}
|
||||
Err(error) => {
|
||||
app.myts.otp_required =
|
||||
error.is_otp_required() || error.status_code() == Some(209);
|
||||
@@ -288,6 +506,8 @@ impl App {
|
||||
if error.is_invalid_session() {
|
||||
app.myts.signed_in = false;
|
||||
app.myts.status = 15;
|
||||
// Expired: ask to sign in again.
|
||||
app.myts.prompt = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,6 +551,11 @@ impl App {
|
||||
Ok(login) => {
|
||||
app.myts.accept(app.secrets.as_ref(), login, email.trim().to_owned());
|
||||
app.publish_myts_identity();
|
||||
if app.settings.skip_account_prompt {
|
||||
app.settings.skip_account_prompt = false;
|
||||
app.store_settings();
|
||||
}
|
||||
app.refresh_myts_profile();
|
||||
}
|
||||
Err(error) => {
|
||||
app.myts.otp_required =
|
||||
@@ -398,6 +623,7 @@ impl App {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use slint::Model;
|
||||
use voelin_store::MemorySecrets;
|
||||
|
||||
fn login(name: &str) -> Login {
|
||||
@@ -406,6 +632,11 @@ mod tests {
|
||||
uuid: format!("{name}-uuid"),
|
||||
username: name.into(),
|
||||
identity: Ok(server_identity()),
|
||||
profile: Profile {
|
||||
description: format!("{name}'s profile"),
|
||||
avatars: vec![format!("{name}.png")],
|
||||
..Default::default()
|
||||
},
|
||||
renewal: Some(voelin_myts::Renewal {
|
||||
token: format!("{name}-renewal"),
|
||||
otp_token: format!("{name}-otp"),
|
||||
@@ -598,6 +829,59 @@ mod tests {
|
||||
assert_eq!(account.status, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_saved_session_being_checked_shows_its_profile_not_the_form() {
|
||||
let secrets = MemorySecrets::default();
|
||||
let mut account = Account::default();
|
||||
account.accept(&secrets, login("Alice"), "alice@example.test".into());
|
||||
assert_eq!(account.form().description, "Alice's profile");
|
||||
let mut restarted = Account { prompt: true, ..Default::default() };
|
||||
restarted.load(&secrets);
|
||||
restarted.begin().unwrap();
|
||||
restarted.checking = true;
|
||||
let form = restarted.form();
|
||||
assert!(form.restoring && !form.signed_in);
|
||||
assert_eq!((form.username.as_str(), form.initials.as_str()), ("Alice", "AL"));
|
||||
// A password sign-in over an expired saved session shows the form.
|
||||
restarted.finish(restarted.generation);
|
||||
restarted.begin().unwrap();
|
||||
assert!(!restarted.form().restoring);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_service_profile_is_kept_and_another_account_starts_empty() {
|
||||
let secrets = MemorySecrets::default();
|
||||
let mut account = Account::default();
|
||||
account.accept(&secrets, login("Alice"), "alice@example.test".into());
|
||||
let profile = Profile {
|
||||
username: "Alice B".into(),
|
||||
registered: 1_600_000_000,
|
||||
badges: vec![voelin_myts::Badge { name: "Early".into(), ..Default::default() }],
|
||||
devices: vec![voelin_myts::Device {
|
||||
name: "Voelin".into(),
|
||||
region: "EU".into(),
|
||||
last_login: 0,
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
account.take_profile(&secrets, &profile);
|
||||
let saved = read_saved(&secrets).unwrap().unwrap();
|
||||
assert_eq!(saved.username, "Alice B");
|
||||
assert_eq!(saved.profile.registered, 1_600_000_000);
|
||||
assert_eq!(saved.profile.badges, ["Early"]);
|
||||
assert_eq!(saved.profile.devices, ["Voelin · EU"]);
|
||||
assert_eq!(saved.profile.description, "Alice's profile", "kept: not in this reply");
|
||||
let form = account.form();
|
||||
assert_eq!(form.member_since, date(1_600_000_000));
|
||||
assert_eq!(form.badges.row_count(), 1);
|
||||
// The same account signing in again keeps it, another one does not.
|
||||
account.accept(&secrets, login("Alice"), "alice@example.test".into());
|
||||
assert_eq!(account.saved.as_ref().unwrap().profile.registered, 1_600_000_000);
|
||||
account.accept(&secrets, login("Bob"), "bob@example.test".into());
|
||||
let bob = &account.saved.as_ref().unwrap().profile;
|
||||
assert_eq!((bob.registered, bob.description.as_str()), (0, "Bob's profile"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn form_exposes_signed_out_busy_otp_and_signed_in_states_without_tokens() {
|
||||
let mut account = Account::default();
|
||||
@@ -639,6 +923,7 @@ mod tests {
|
||||
otp_token: "otp renewal".into(),
|
||||
uuid: "account-uuid".into(),
|
||||
identity: Some(server_identity()),
|
||||
profile: SavedProfile { description: "Hi".into(), ..Default::default() },
|
||||
};
|
||||
assert!(save(&secrets, &saved));
|
||||
let loaded = read_saved(&secrets).unwrap().unwrap();
|
||||
|
||||
+87
-108
@@ -2,10 +2,10 @@
|
||||
//! server card and the channel tree.
|
||||
|
||||
use slint::{ComponentHandle, SharedString};
|
||||
use tracing::warn;
|
||||
use tracing::{info, warn};
|
||||
use voelin_core::identity::LaunchImport;
|
||||
use voelin_core::{Command, ObserveState, Source, VoiceOptions, VoiceState};
|
||||
use voelin_store::{Bookmark, QueryConfig, QueryTransport};
|
||||
use voelin_store::{Bookmark, QueryTransport};
|
||||
|
||||
use crate::app::{App, BookmarkForm, Bridge, SessionView, later};
|
||||
use crate::vm;
|
||||
@@ -35,7 +35,9 @@ pub(crate) fn imported_status(report: &LaunchImport) -> Option<String> {
|
||||
/// like the identity, the default channel or the client version, stays; a
|
||||
/// new server has none of it). Only the address is needed: the name is the
|
||||
/// address until the server tells its own (`adopt_server_name`), the
|
||||
/// nickname `default_nickname`, the gateway is looked up later.
|
||||
/// nickname `default_nickname`, the gateway is looked up in DNS
|
||||
/// (`discover_gateway`). A new address drops the gateway and the query
|
||||
/// login found or set for the old one.
|
||||
fn bookmark_from_form(
|
||||
old: Option<&Bookmark>,
|
||||
form: &BookmarkForm,
|
||||
@@ -46,6 +48,8 @@ fn bookmark_from_form(
|
||||
bookmark.address = form.address.trim().to_string();
|
||||
if old.is_some_and(|old| old.address != bookmark.address) {
|
||||
bookmark.cached_server_icon = None;
|
||||
bookmark.gateway_url = None;
|
||||
bookmark.query = None;
|
||||
}
|
||||
bookmark.name = match form.name.trim() {
|
||||
"" => bookmark.address.clone(),
|
||||
@@ -55,35 +59,6 @@ fn bookmark_from_form(
|
||||
"" => default_nickname(),
|
||||
nickname => nickname.to_string(),
|
||||
};
|
||||
bookmark.gateway_url = Some(form.gateway_url.trim().to_string()).filter(|u| !u.is_empty());
|
||||
bookmark.query = match form.query_transport.as_str() {
|
||||
"none" | "" => None,
|
||||
t => {
|
||||
let (host, port) = form
|
||||
.query_addr
|
||||
.rsplit_once(':')
|
||||
.map_or((form.query_addr.to_string(), None), |(h, p)| {
|
||||
(h.to_string(), p.parse().ok())
|
||||
});
|
||||
let transport = match t {
|
||||
"raw" => QueryTransport::Raw,
|
||||
"http" => QueryTransport::Http,
|
||||
_ => QueryTransport::Ssh,
|
||||
};
|
||||
let default_port = match transport {
|
||||
QueryTransport::Raw => 10011,
|
||||
QueryTransport::Ssh => 10022,
|
||||
QueryTransport::Http => 10080,
|
||||
};
|
||||
Some(QueryConfig {
|
||||
transport,
|
||||
host,
|
||||
port: port.unwrap_or(default_port),
|
||||
user: form.query_user.to_string(),
|
||||
server_port: bookmark.query.as_ref().and_then(|q| q.server_port),
|
||||
})
|
||||
}
|
||||
};
|
||||
bookmark
|
||||
}
|
||||
|
||||
@@ -159,12 +134,16 @@ impl App {
|
||||
.unwrap_or_else(|| "Voelin user".to_owned())
|
||||
}
|
||||
|
||||
/// Look up the gateway of a server that has none in DNS
|
||||
/// ([`voelin_core::discover`]); one found is kept as if typed.
|
||||
pub(crate) fn discover_gateway(&self, id: i64) {
|
||||
let Some(b) = self.bookmark(id).filter(|b| b.gateway_url.is_none() && !self.demo_ui) else {
|
||||
/// Look up the gateway of a server ([`voelin_core::discover`]), once a
|
||||
/// run: one found is kept as if typed, and takes the place of a stored
|
||||
/// one that is no longer what the server publishes (a gateway that
|
||||
/// moved, or one typed into an older version, which showed the field).
|
||||
/// Nothing found keeps what is stored.
|
||||
pub(crate) fn discover_gateway(&mut self, id: i64) {
|
||||
if self.demo_ui || !self.gateways_looked_up.insert(id) {
|
||||
return;
|
||||
};
|
||||
}
|
||||
let Some(b) = self.bookmark(id) else { return };
|
||||
let address = b.address.clone();
|
||||
self.engine.runtime().spawn(async move {
|
||||
if let Some(url) = voelin_core::discover::gateway(&address).await {
|
||||
@@ -174,23 +153,32 @@ impl App {
|
||||
}
|
||||
|
||||
/// A gateway was found for the server at `address`; it is kept unless
|
||||
/// the server changed meanwhile.
|
||||
/// the server changed meanwhile, and the server is observed through it
|
||||
/// if it is the one shown. Users never hear of it (logged only).
|
||||
fn gateway_found(&mut self, id: i64, address: &str, url: String) {
|
||||
let Some(b) = self
|
||||
.bookmarks
|
||||
.iter_mut()
|
||||
.find(|b| b.id == id && b.address == address && b.gateway_url.is_none())
|
||||
else {
|
||||
let Some(b) = self.bookmarks.iter_mut().find(|b| b.id == id && b.address == address) else {
|
||||
return;
|
||||
};
|
||||
b.gateway_url = Some(url.clone());
|
||||
let name = b.name.clone();
|
||||
if b.gateway_url.as_deref() == Some(url.as_str()) {
|
||||
return;
|
||||
}
|
||||
let previous = b.gateway_url.replace(url.clone());
|
||||
if let Err(e) = self.store.update_bookmark(b) {
|
||||
warn!(%e, "could not keep the gateway found");
|
||||
return;
|
||||
}
|
||||
self.set_status(format!("Found the gateway of {name}: {url}"));
|
||||
info!(server = %b.address, %url, ?previous, "gateway found");
|
||||
self.refresh_toolbar();
|
||||
// Observed through the old one: through this one now.
|
||||
if previous.is_some() {
|
||||
self.engine.send(Command::StopObserving { session: id as u64 });
|
||||
if let Some(view) = self.sessions.get_mut(&id) {
|
||||
view.state.observe = ObserveState::Off;
|
||||
}
|
||||
}
|
||||
if self.current == Some(id) {
|
||||
self.observe(id);
|
||||
}
|
||||
}
|
||||
|
||||
/// The server told its name: a server still named by its address takes
|
||||
@@ -210,13 +198,19 @@ impl App {
|
||||
self.refresh_toolbar();
|
||||
}
|
||||
|
||||
pub(crate) fn toggle_observe(&mut self) {
|
||||
let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return };
|
||||
/// Observe the server invisibly, unless it is already: through its
|
||||
/// gateway, else its own query login. Without either the gateway is
|
||||
/// looked up first, and observing starts when it is found
|
||||
/// (`gateway_found`).
|
||||
pub(crate) fn observe(&mut self, id: i64) {
|
||||
let Some(b) = self.bookmark(id).cloned() else { return };
|
||||
if self.demo_ui {
|
||||
return;
|
||||
}
|
||||
let session = b.id as u64;
|
||||
let observing =
|
||||
self.sessions.get(&b.id).is_some_and(|v| v.state.observe != ObserveState::Off);
|
||||
if observing {
|
||||
self.engine.send(Command::StopObserving { session });
|
||||
return;
|
||||
}
|
||||
if let Some(url) = &b.gateway_url {
|
||||
@@ -225,6 +219,8 @@ impl App {
|
||||
url: url.clone(),
|
||||
identity: Box::new(self.identity_for(Some(b.id))),
|
||||
});
|
||||
// Still the one the server publishes?
|
||||
self.discover_gateway(b.id);
|
||||
} else if let Some(q) = &b.query {
|
||||
let secret = self.secrets.get(&b.query_password_key()).ok().flatten();
|
||||
let transport = match q.transport {
|
||||
@@ -242,13 +238,18 @@ impl App {
|
||||
line: Default::default(),
|
||||
};
|
||||
self.engine.send(Command::ObserveQuery { session, connect: Box::new(connect) });
|
||||
} else {
|
||||
self.discover_gateway(b.id);
|
||||
return;
|
||||
}
|
||||
self.set_status("Observing invisibly…");
|
||||
}
|
||||
|
||||
/// Show a server, and observe it.
|
||||
pub(crate) fn select_server(&mut self, id: i64) {
|
||||
self.current = Some(id);
|
||||
self.refresh_all();
|
||||
self.observe(id);
|
||||
}
|
||||
|
||||
pub(crate) fn bookmark_form(&self, id: i64) -> BookmarkForm {
|
||||
@@ -256,26 +257,12 @@ impl App {
|
||||
return BookmarkForm {
|
||||
id: -1,
|
||||
nickname: self.default_nickname().into(),
|
||||
query_transport: "none".into(),
|
||||
query_user: "serveradmin".into(),
|
||||
..Default::default()
|
||||
};
|
||||
};
|
||||
let secret = |key: String| -> SharedString {
|
||||
self.secrets.get(&key).ok().flatten().unwrap_or_default().into()
|
||||
};
|
||||
let (transport, addr, user) = match &b.query {
|
||||
Some(q) => (
|
||||
match q.transport {
|
||||
QueryTransport::Raw => "raw",
|
||||
QueryTransport::Ssh => "ssh",
|
||||
QueryTransport::Http => "http",
|
||||
},
|
||||
format!("{}:{}", q.host, q.port),
|
||||
q.user.clone(),
|
||||
),
|
||||
None => ("none", String::new(), "serveradmin".to_string()),
|
||||
};
|
||||
BookmarkForm {
|
||||
id: b.id as i32,
|
||||
// Named by its address: empty, so a new address names it again.
|
||||
@@ -283,17 +270,12 @@ impl App {
|
||||
address: b.address.clone().into(),
|
||||
nickname: b.nickname.clone().into(),
|
||||
server_password: secret(b.server_password_key()),
|
||||
gateway_url: b.gateway_url.clone().unwrap_or_default().into(),
|
||||
query_transport: transport.into(),
|
||||
query_addr: addr.into(),
|
||||
query_user: user.into(),
|
||||
query_password: secret(b.query_password_key()),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn save_bookmark(&mut self, form: BookmarkForm) {
|
||||
let mut bookmark =
|
||||
bookmark_from_form(self.bookmark(form.id as i64), &form, || self.default_nickname());
|
||||
let old = self.bookmark(form.id as i64).cloned();
|
||||
let mut bookmark = bookmark_from_form(old.as_ref(), &form, || self.default_nickname());
|
||||
let result = if bookmark.id < 0 {
|
||||
self.store.add_bookmark(&bookmark).map(|id| bookmark.id = id)
|
||||
} else {
|
||||
@@ -303,23 +285,29 @@ impl App {
|
||||
self.set_status(format!("Could not save: {e}"));
|
||||
return;
|
||||
}
|
||||
for (key, value) in [
|
||||
(bookmark.server_password_key(), &form.server_password),
|
||||
(bookmark.query_password_key(), &form.query_password),
|
||||
] {
|
||||
let result = if value.is_empty() {
|
||||
self.secrets.delete(&key)
|
||||
} else {
|
||||
self.secrets.set(&key, value)
|
||||
};
|
||||
if let Err(e) = result {
|
||||
warn!(%e, "could not store secret");
|
||||
let key = bookmark.server_password_key();
|
||||
let result = if form.server_password.is_empty() {
|
||||
self.secrets.delete(&key)
|
||||
} else {
|
||||
self.secrets.set(&key, &form.server_password)
|
||||
};
|
||||
if let Err(e) = result {
|
||||
warn!(%e, "could not store secret");
|
||||
}
|
||||
// Another server: what was observed is the old one's, and its
|
||||
// gateway is looked up anew.
|
||||
if let Some(old) = old.filter(|old| old.address != bookmark.address) {
|
||||
if old.query.is_some() {
|
||||
let _ = self.secrets.delete(&old.query_password_key());
|
||||
}
|
||||
self.gateways_looked_up.remove(&bookmark.id);
|
||||
self.engine.send(Command::StopObserving { session: bookmark.id as u64 });
|
||||
if let Some(view) = self.sessions.get_mut(&bookmark.id) {
|
||||
view.state.observe = ObserveState::Off;
|
||||
}
|
||||
}
|
||||
self.current = Some(bookmark.id);
|
||||
self.bookmarks = self.store.bookmarks().unwrap_or_default();
|
||||
self.refresh_all();
|
||||
self.discover_gateway(bookmark.id);
|
||||
self.select_server(bookmark.id);
|
||||
}
|
||||
|
||||
pub(crate) fn delete_bookmark(&mut self, id: i64) {
|
||||
@@ -330,6 +318,7 @@ impl App {
|
||||
}
|
||||
let _ = self.store.delete_bookmark(id);
|
||||
self.sessions.remove(&id);
|
||||
self.gateways_looked_up.remove(&id);
|
||||
self.bookmarks = self.store.bookmarks().unwrap_or_default();
|
||||
self.current = self.bookmarks.first().map(|b| b.id);
|
||||
self.refresh_all();
|
||||
@@ -436,9 +425,6 @@ impl App {
|
||||
bridge.set_voice_connected(state.voice == VoiceState::Connected);
|
||||
bridge.set_voice_connecting(state.voice == VoiceState::Connecting);
|
||||
bridge.set_observing(state.observe != ObserveState::Off);
|
||||
bridge.set_can_observe(
|
||||
bookmark.is_some_and(|b| b.gateway_url.is_some() || b.query.is_some()),
|
||||
);
|
||||
bridge.set_input_muted(state.input_muted);
|
||||
bridge.set_output_muted(state.output_muted);
|
||||
bridge.set_transmitting(state.transmitting);
|
||||
@@ -558,6 +544,7 @@ mod tests {
|
||||
use voelin_core::identity::Found;
|
||||
|
||||
use super::*;
|
||||
use voelin_store::QueryConfig;
|
||||
|
||||
#[test]
|
||||
fn edited_server_rejects_queued_icons_and_failed_reconnect_keeps_them_hidden() {
|
||||
@@ -600,12 +587,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn the_address_alone_makes_a_server() {
|
||||
let form = BookmarkForm {
|
||||
id: -1,
|
||||
address: " ts.example.test ".into(),
|
||||
query_transport: "none".into(),
|
||||
..Default::default()
|
||||
};
|
||||
let form =
|
||||
BookmarkForm { id: -1, address: " ts.example.test ".into(), ..Default::default() };
|
||||
let b = bookmark_from_form(None, &form, || "Nick".into());
|
||||
assert_eq!((b.address.as_str(), b.name.as_str()), ("ts.example.test", "ts.example.test"));
|
||||
assert_eq!(b.nickname, "Nick");
|
||||
@@ -632,31 +615,27 @@ mod tests {
|
||||
id: 1234,
|
||||
}),
|
||||
};
|
||||
let form = BookmarkForm {
|
||||
// Same address: the gateway found and the query login stay.
|
||||
let same = BookmarkForm {
|
||||
id: 7,
|
||||
name: "Mine".into(),
|
||||
address: "new.example.test:9988".into(),
|
||||
address: "old.example.test".into(),
|
||||
nickname: "Other".into(),
|
||||
// Cleared: looked up again.
|
||||
gateway_url: "".into(),
|
||||
query_transport: "raw".into(),
|
||||
query_addr: "q.example.test".into(),
|
||||
query_user: "serveradmin".into(),
|
||||
..Default::default()
|
||||
};
|
||||
let b = bookmark_from_form(Some(&old), &form, || unreachable!("a nickname was given"));
|
||||
let b = bookmark_from_form(Some(&old), &same, || unreachable!("a nickname was given"));
|
||||
assert_eq!((b.id, b.name.as_str(), b.nickname.as_str()), (7, "Mine", "Other"));
|
||||
assert_eq!(b.gateway_url, old.gateway_url);
|
||||
assert_eq!(b.query, old.query);
|
||||
assert_eq!(b.cached_server_icon, old.cached_server_icon);
|
||||
// Another address: looked up again, for the new server.
|
||||
let form = BookmarkForm { address: "new.example.test:9988".into(), ..same };
|
||||
let b = bookmark_from_form(Some(&old), &form, || unreachable!("a nickname was given"));
|
||||
assert_eq!(b.address, "new.example.test:9988");
|
||||
assert!(b.cached_server_icon.is_none());
|
||||
assert_eq!((b.identity, b.default_channel), (Some(2), Some("Lobby/Sub".into())));
|
||||
assert_eq!(b.client_version.as_deref(), Some("linux"));
|
||||
assert_eq!(b.gateway_url, None);
|
||||
let q = b.query.unwrap();
|
||||
assert_eq!(
|
||||
(q.transport, q.host.as_str(), q.port),
|
||||
(QueryTransport::Raw, "q.example.test", 10011)
|
||||
);
|
||||
assert_eq!(q.server_port, Some(9988));
|
||||
assert_eq!((b.gateway_url, b.query), (None, None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -268,6 +268,9 @@ pub struct UiSettings {
|
||||
pub share: ShareDefaults,
|
||||
/// Write crash reports to disk (opt-in; never uploaded).
|
||||
pub crash_reports: bool,
|
||||
/// "Continue without an account" was chosen on the login page: it does
|
||||
/// not show at start any more (signing in clears it).
|
||||
pub skip_account_prompt: bool,
|
||||
}
|
||||
|
||||
impl Default for UiSettings {
|
||||
@@ -279,6 +282,7 @@ impl Default for UiSettings {
|
||||
portal_restore_token: None,
|
||||
share: ShareDefaults::default(),
|
||||
crash_reports: false,
|
||||
skip_account_prompt: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,8 +333,11 @@ impl App {
|
||||
fetch_images: p.get(&CACHE_FETCH_IMAGES),
|
||||
progress_ms: p.get(&FILES_PROGRESS_MS).to_string().into(),
|
||||
preview_kb: p.get(&UI_IMAGE_PREVIEW_KB).to_string().into(),
|
||||
logs: "Logs go to the terminal the app was started from (standard error); RUST_LOG=voelin_core=debug,voelin_ui=debug shows more.".into(),
|
||||
crash_dir: voelin_platform::crash::dir().map(|d| d.display().to_string()).unwrap_or_default().into(),
|
||||
logs: log_text().into(),
|
||||
crash_dir: voelin_platform::crash::dir()
|
||||
.map(|d| d.display().to_string())
|
||||
.unwrap_or_default()
|
||||
.into(),
|
||||
});
|
||||
self.refresh_account();
|
||||
}
|
||||
@@ -722,8 +725,14 @@ impl App {
|
||||
self.refresh_pages();
|
||||
}
|
||||
|
||||
/// The folder with the log files.
|
||||
pub(crate) fn open_logs(&mut self) {
|
||||
self.open_crash_folder();
|
||||
let dir = voelin_platform::logs::current().and_then(std::path::Path::parent);
|
||||
let result = dir.ok_or_else(|| "no log file".to_owned());
|
||||
if let Err(e) = result.and_then(|dir| crate::app::open_path(dir).map_err(|e| e.to_string()))
|
||||
{
|
||||
self.set_status(format!("Cannot open the log folder: {e}"));
|
||||
}
|
||||
}
|
||||
|
||||
// Integrations.
|
||||
@@ -1356,6 +1365,20 @@ fn codec_of(i: i32) -> CodecChoice {
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the logs go, for the Advanced page.
|
||||
fn log_text() -> String {
|
||||
match voelin_platform::logs::current() {
|
||||
Some(path) => format!(
|
||||
"This run logs to {} (the previous runs' next to it, the last as voelin.1.log). \
|
||||
VOELIN_LOG=voelin_core=debug,voelin_ui=debug logs more; warnings also go to the terminal.",
|
||||
path.display()
|
||||
),
|
||||
None => "Logs go to the terminal the app was started from (standard error); \
|
||||
RUST_LOG=voelin_core=debug,voelin_ui=debug shows more."
|
||||
.into(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
//! into Slint images when we watch, and the optional OpenH264 library
|
||||
//! (desktop; Android decodes H.264 with the device's MediaCodec).
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::path::Path;
|
||||
#[cfg(not(target_os = "android"))]
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, Condvar, Mutex, PoisonError};
|
||||
|
||||
use slint::{Image, Rgba8Pixel, SharedPixelBuffer};
|
||||
use tokio::runtime::Handle;
|
||||
@@ -357,17 +358,116 @@ impl Video {
|
||||
}
|
||||
|
||||
/// Converts decoded frames into Slint pixel buffers, keeping the newest.
|
||||
///
|
||||
/// The decoder only hands its newest frame over: a converter thread turns
|
||||
/// it into RGBA, so decoding never waits for the conversion (at 1440p it
|
||||
/// took a third of a 60 fps frame's time on the decode thread, and a
|
||||
/// decoder that falls behind drops its queue and waits for a keyframe),
|
||||
/// and frames the window could not show anyway are never converted. The
|
||||
/// converter reuses the buffers of earlier pictures, which the window has
|
||||
/// let go of by then, instead of a new zeroed buffer per frame. Without a
|
||||
/// thread, frames are converted on the decoder's.
|
||||
fn deliver(
|
||||
pictures: Arc<Latest<Picture>>,
|
||||
wake: impl Fn() + Send + Sync + 'static,
|
||||
) -> impl FnMut(Arc<VideoFrame>) + Send + 'static {
|
||||
move |frame: Arc<VideoFrame>| {
|
||||
let mut buffer = Picture::new(frame.width, frame.height);
|
||||
let stride = frame.width as usize * 4;
|
||||
if let Err(e) = convert::to_rgba(&frame, buffer.make_mut_bytes(), stride) {
|
||||
let slot = Arc::new(FrameSlot::default());
|
||||
let wake = Arc::new(wake);
|
||||
let thread = {
|
||||
let (slot, pictures, wake) = (slot.clone(), pictures.clone(), wake.clone());
|
||||
std::thread::Builder::new().name("voelin-picture".into()).spawn(move || {
|
||||
let mut buffers = Buffers::default();
|
||||
while let Some(frame) = slot.wait() {
|
||||
buffers.show(&frame, &pictures, &*wake);
|
||||
}
|
||||
})
|
||||
};
|
||||
let mut inline = match thread {
|
||||
Ok(_) => None,
|
||||
Err(e) => {
|
||||
warn!("no picture thread, converting on the decoder's: {e}");
|
||||
Some(Buffers::default())
|
||||
}
|
||||
};
|
||||
let handoff = Handoff(slot);
|
||||
move |frame: Arc<VideoFrame>| match &mut inline {
|
||||
Some(buffers) => buffers.show(&frame, &pictures, &*wake),
|
||||
None => handoff.0.put(frame),
|
||||
}
|
||||
}
|
||||
|
||||
/// The newest decoded frame, waiting for the converter thread.
|
||||
#[derive(Default)]
|
||||
struct FrameSlot {
|
||||
/// The frame, and whether the decoder is gone.
|
||||
state: Mutex<(Option<Arc<VideoFrame>>, bool)>,
|
||||
ready: Condvar,
|
||||
}
|
||||
|
||||
impl FrameSlot {
|
||||
/// Replace the waiting frame (an older one is never converted).
|
||||
fn put(&self, frame: Arc<VideoFrame>) {
|
||||
self.state.lock().unwrap_or_else(PoisonError::into_inner).0 = Some(frame);
|
||||
self.ready.notify_one();
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.state.lock().unwrap_or_else(PoisonError::into_inner).1 = true;
|
||||
self.ready.notify_one();
|
||||
}
|
||||
|
||||
/// The next frame; `None` once the decoder is gone.
|
||||
fn wait(&self) -> Option<Arc<VideoFrame>> {
|
||||
let mut state = self.state.lock().unwrap_or_else(PoisonError::into_inner);
|
||||
loop {
|
||||
if state.1 {
|
||||
return None;
|
||||
}
|
||||
if let Some(frame) = state.0.take() {
|
||||
return Some(frame);
|
||||
}
|
||||
state = self.ready.wait(state).unwrap_or_else(PoisonError::into_inner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The decoder's side of a [`FrameSlot`]: dropped with the decoder's
|
||||
/// callback, it ends the converter thread.
|
||||
struct Handoff(Arc<FrameSlot>);
|
||||
|
||||
impl Drop for Handoff {
|
||||
fn drop(&mut self) {
|
||||
self.0.close();
|
||||
}
|
||||
}
|
||||
|
||||
/// Pictures between a buffer's use and its reuse: the window shows one and
|
||||
/// may still be drawing the one before.
|
||||
const REUSE_AFTER: usize = 3;
|
||||
|
||||
/// The pixel buffers of the last pictures, reused when they come round.
|
||||
#[derive(Default)]
|
||||
struct Buffers {
|
||||
recent: VecDeque<Picture>,
|
||||
}
|
||||
|
||||
impl Buffers {
|
||||
fn show(&mut self, frame: &VideoFrame, pictures: &Latest<Picture>, wake: &dyn Fn()) {
|
||||
let (width, height) = (frame.width, frame.height);
|
||||
if self.recent.front().is_some_and(|b| (b.width(), b.height()) != (width, height)) {
|
||||
self.recent.clear();
|
||||
}
|
||||
let mut buffer = if self.recent.len() >= REUSE_AFTER {
|
||||
self.recent.pop_front().expect("a buffer")
|
||||
} else {
|
||||
Picture::new(width, height)
|
||||
};
|
||||
// A buffer the window still holds copies itself here first.
|
||||
if let Err(e) = convert::to_rgba(frame, buffer.make_mut_bytes(), width as usize * 4) {
|
||||
warn!("cannot show a picture: {e}");
|
||||
return;
|
||||
}
|
||||
self.recent.push_back(buffer.clone());
|
||||
if pictures.put(buffer) {
|
||||
wake();
|
||||
}
|
||||
@@ -544,6 +644,51 @@ impl Decoder {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
/// The converter thread shows the newest frame, wakes the window once
|
||||
/// per picture it waits for, and ends with the decoder's callback.
|
||||
#[test]
|
||||
fn frames_reach_the_window_through_the_converter() {
|
||||
let pictures = Arc::new(Latest::new());
|
||||
let wakes = Arc::new(AtomicUsize::new(0));
|
||||
let counted = wakes.clone();
|
||||
let mut on_frame = deliver(pictures.clone(), move || {
|
||||
counted.fetch_add(1, Ordering::SeqCst);
|
||||
});
|
||||
on_frame(Arc::new(VideoFrame::black_i420(8, 6)));
|
||||
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);
|
||||
let picture = loop {
|
||||
if let Some(picture) = pictures.take() {
|
||||
break picture;
|
||||
}
|
||||
assert!(std::time::Instant::now() < deadline, "no picture");
|
||||
std::thread::sleep(std::time::Duration::from_millis(5));
|
||||
};
|
||||
assert_eq!((picture.width(), picture.height()), (8, 6));
|
||||
assert_eq!(wakes.load(Ordering::SeqCst), 1);
|
||||
drop(on_frame);
|
||||
}
|
||||
|
||||
/// Buffers come round again after [`REUSE_AFTER`] pictures; a new size
|
||||
/// starts over.
|
||||
#[test]
|
||||
fn picture_buffers_are_reused() {
|
||||
let pictures = Latest::new();
|
||||
let mut buffers = Buffers::default();
|
||||
let frame = VideoFrame::black_i420(4, 4);
|
||||
for _ in 0..REUSE_AFTER + 2 {
|
||||
buffers.show(&frame, &pictures, &|| {});
|
||||
pictures.take();
|
||||
}
|
||||
assert_eq!(buffers.recent.len(), REUSE_AFTER);
|
||||
buffers.show(&VideoFrame::black_i420(2, 2), &pictures, &|| {});
|
||||
assert_eq!(buffers.recent.len(), 1);
|
||||
let picture = pictures.take().unwrap();
|
||||
assert_eq!((picture.width(), picture.height()), (2, 2));
|
||||
// Black, opaque.
|
||||
assert_eq!(picture.as_bytes()[3], 255);
|
||||
}
|
||||
|
||||
/// "Choose via system dialog" never passes the restore token, so the
|
||||
/// portal always asks; with a token the last choice gets its own row.
|
||||
|
||||
@@ -18,17 +18,12 @@ const GROUP_MS: i64 = 5 * 60 * 1000;
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct Previous {
|
||||
pub author: String,
|
||||
pub relayed: bool,
|
||||
pub ts_ms: i64,
|
||||
}
|
||||
|
||||
impl Previous {
|
||||
pub fn of(message: &ChatMessage) -> Self {
|
||||
Self {
|
||||
author: message.author_name.clone(),
|
||||
relayed: message.via_relay,
|
||||
ts_ms: message.ts_ms,
|
||||
}
|
||||
Self { author: message.author_name.clone(), ts_ms: message.ts_ms }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,9 +169,7 @@ fn line_of(
|
||||
files: &[FileRef],
|
||||
) -> ChatLine {
|
||||
let continued = previous.is_some_and(|p| {
|
||||
p.author == message.author_name
|
||||
&& p.relayed == message.via_relay
|
||||
&& (0..GROUP_MS).contains(&(message.ts_ms - p.ts_ms))
|
||||
p.author == message.author_name && (0..GROUP_MS).contains(&(message.ts_ms - p.ts_ms))
|
||||
});
|
||||
let text =
|
||||
if files.is_empty() { message.text.clone() } else { without_links(&message.text, files) };
|
||||
@@ -210,7 +203,6 @@ fn line_of(
|
||||
author: message.author_name.clone().into(),
|
||||
text: text.clone().into(),
|
||||
time: time_of(message.ts_ms).into(),
|
||||
relayed: message.via_relay,
|
||||
runs: runs.as_deref().map(runs_model).unwrap_or_default(),
|
||||
rich: runs.is_some(),
|
||||
jumbo,
|
||||
|
||||
@@ -12,11 +12,13 @@ pub fn cached_icon(bookmark: &Bookmark, cache: &voelin_core::Cache) -> slint::Im
|
||||
avatar::image(bookmark.server_icon_id().and_then(|id| cache.icon(id)).as_ref())
|
||||
}
|
||||
|
||||
/// "offline", "connecting", "observing" or "connected".
|
||||
/// "offline", "connecting", "observing" or "connected". "connecting" is
|
||||
/// voice only: observing that is not there yet (a gateway that is away and
|
||||
/// tried again) is "offline", as users never hear of the gateway.
|
||||
pub fn status(state: &SessionState) -> &'static str {
|
||||
match (state.voice, state.observe) {
|
||||
(VoiceState::Connected, _) => "connected",
|
||||
(VoiceState::Connecting, _) | (_, ObserveState::Connecting) => "connecting",
|
||||
(VoiceState::Connecting, _) => "connecting",
|
||||
(_, ObserveState::Observing) => "observing",
|
||||
_ => "offline",
|
||||
}
|
||||
@@ -152,6 +154,8 @@ mod tests {
|
||||
fn states() {
|
||||
let mut s = SessionState::default();
|
||||
assert_eq!(status(&s), "offline");
|
||||
s.observe = ObserveState::Connecting;
|
||||
assert_eq!(status(&s), "offline");
|
||||
s.observe = ObserveState::Observing;
|
||||
assert_eq!(status(&s), "observing");
|
||||
s.voice = VoiceState::Connecting;
|
||||
|
||||
@@ -189,7 +189,6 @@ export struct ChatLine {
|
||||
author: string,
|
||||
text: string,
|
||||
time: string,
|
||||
relayed: bool,
|
||||
// The text split into runs; only filled when it has emoji (`rich`).
|
||||
runs: [TextRun],
|
||||
rich: bool,
|
||||
@@ -240,11 +239,6 @@ export struct BookmarkForm {
|
||||
address: string,
|
||||
nickname: string,
|
||||
server-password: string,
|
||||
gateway-url: string,
|
||||
query-transport: string,
|
||||
query-addr: string,
|
||||
query-user: string,
|
||||
query-password: string,
|
||||
}
|
||||
|
||||
// A stream on the server, ours first: a stream can be watched from any
|
||||
@@ -774,8 +768,20 @@ export struct MytsForm {
|
||||
identity-status: int,
|
||||
available: bool,
|
||||
signed_in: bool,
|
||||
// A saved session is being checked: its profile shows meanwhile.
|
||||
restoring: bool,
|
||||
email: string,
|
||||
username: string,
|
||||
// From the account service: the avatar, the initials without one, the
|
||||
// description, dates as YYYY-MM-DD ("" when not known), badge names and
|
||||
// the signed-in devices ("name · region · date").
|
||||
avatar: image,
|
||||
initials: string,
|
||||
description: string,
|
||||
member-since: string,
|
||||
last-login: string,
|
||||
badges: [string],
|
||||
devices: [string],
|
||||
status: int,
|
||||
persistence-status: int,
|
||||
busy: bool,
|
||||
@@ -853,8 +859,9 @@ export global Bridge {
|
||||
in property <int> own-channel-banner-mode;
|
||||
in property <bool> voice-connected;
|
||||
in property <bool> voice-connecting;
|
||||
// Presence without joining (gateway or query), started when the server
|
||||
// is selected.
|
||||
in property <bool> observing;
|
||||
in property <bool> can-observe;
|
||||
in property <bool> input-muted;
|
||||
in property <bool> output-muted;
|
||||
in property <bool> transmitting;
|
||||
@@ -945,7 +952,6 @@ export global Bridge {
|
||||
callback search(string);
|
||||
callback connect-voice();
|
||||
callback disconnect-voice();
|
||||
callback toggle-observe();
|
||||
callback join-channel(int);
|
||||
callback open-channel-chat(int);
|
||||
callback toggle-collapse(int);
|
||||
@@ -1109,7 +1115,7 @@ export global Bridge {
|
||||
callback settings-section(int);
|
||||
in property <AccountForm> account;
|
||||
in property <MytsForm> myts;
|
||||
in property <string> primary-name: myts.signed-in ? (myts.username != "" ? myts.username : myts.email) : nickname != "" ? nickname : app-name;
|
||||
in property <string> primary-name: myts.signed-in || myts.restoring ? (myts.username != "" ? myts.username : myts.email) : nickname != "" ? nickname : app-name;
|
||||
callback myts-dismiss();
|
||||
callback myts-retry();
|
||||
callback myts-portal(int);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
// Shared account form for first launch and Settings → My Account.
|
||||
// The myTeamSpeak account: the login page at start (not shown while a saved
|
||||
// session exists) and the card in Settings → My Account. Both use the same
|
||||
// sign-in form; signed in, the card shows the account's profile.
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge } from "../bridge.slint";
|
||||
import { Button, TextField, Field, Card, ScrollView } from "../components/index.slint";
|
||||
import { Nav } from "../nav.slint";
|
||||
import { Icon, Spinner, Button, ButtonKind, IconButton, TextField, Field, Card, Divider, Banner, Avatar, Status, Chip, ScrollView } from "../components/index.slint";
|
||||
|
||||
component Note inherits Text {
|
||||
// Keep wrapped account copy in the card’s layout bounds.
|
||||
@@ -12,9 +15,66 @@ component Note inherits Text {
|
||||
wrap: word-wrap;
|
||||
}
|
||||
|
||||
component LoginForm inherits VerticalLayout {
|
||||
// What happened last, for `MytsForm.status`.
|
||||
global AccountText {
|
||||
pure public function status(code: int) -> string {
|
||||
return code == 2 ? @tr("Saved session could not be validated. Your saved credentials were retained; sign in again or clear them.") :
|
||||
code == 3 ? @tr("Enter your password again and the one-time code.") :
|
||||
code == 4 ? @tr("Sign-in failed. Check your credentials and connection; the experimental service may be unavailable.") :
|
||||
code == 7 ? @tr("Signed out.") :
|
||||
code == 9 ? @tr("Signed out and saved credentials cleared. Remote session revocation failed.") :
|
||||
code == 10 ? @tr("Could not open your browser. Visit myteamspeak.com to manage your account.") :
|
||||
code == 11 ? @tr("Account website opened in your browser. When finished, return here and sign in again to apply changes.") :
|
||||
code == 13 ? @tr("Your email address has not been verified. Activate your account using the link in your email, or request a new activation email.") :
|
||||
code == 14 ? @tr("The one-time code was not accepted. Enter your password and a new code.") :
|
||||
code == 15 ? @tr("Your saved session has expired. Sign in again.") :
|
||||
code == 16 ? @tr("Email or password was not accepted. Check your details and try again.") :
|
||||
code == 17 ? @tr("Too many requests. Wait a while before trying again.") : "";
|
||||
}
|
||||
|
||||
// Information rather than a problem.
|
||||
pure public function is-info(code: int) -> bool {
|
||||
return code == 7 || code == 11;
|
||||
}
|
||||
|
||||
pure public function persistence(code: int) -> string {
|
||||
return code == 1 ? @tr("Saved account credentials could not be read. Unlock the keyring or clear the saved session.") :
|
||||
code == 5 ? @tr("Account credentials could not be saved. This session will not be restored after restarting.") :
|
||||
code == 6 ? @tr("Account credentials could not be saved, and older credentials could not be removed. Unlock your keyring and clear the saved session.") :
|
||||
code == 8 ? @tr("Signed out locally, but saved credentials could not be removed. Unlock your keyring and clear the saved session again.") : "";
|
||||
}
|
||||
}
|
||||
|
||||
// The last result as a banner, and the keyring's problems.
|
||||
component AccountNotices inherits VerticalLayout {
|
||||
spacing: Theme.space-3;
|
||||
property <string> status: AccountText.status(Bridge.myts.status);
|
||||
property <string> persistence: AccountText.persistence(Bridge.myts.persistence-status);
|
||||
if root.status != "": Banner {
|
||||
text: root.status;
|
||||
icon: AccountText.is-info(Bridge.myts.status) ? Icons.info : Icons.triangle-alert;
|
||||
tone: AccountText.is-info(Bridge.myts.status) ? Theme.info : Theme.warning;
|
||||
}
|
||||
if Bridge.myts.status == 13: Button {
|
||||
text: @tr("Resend activation email in browser");
|
||||
icon: Icons.mail;
|
||||
small: true;
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(3); }
|
||||
}
|
||||
if root.persistence != "": Banner {
|
||||
text: root.persistence;
|
||||
icon: Icons.key-round;
|
||||
tone: Theme.danger;
|
||||
}
|
||||
}
|
||||
|
||||
// Email, password (and the one-time code when asked for), Sign in, and
|
||||
// the website's registration and password recovery.
|
||||
component LoginForm inherits VerticalLayout {
|
||||
spacing: Theme.space-4;
|
||||
property <string> otp-text;
|
||||
property <bool> show-password;
|
||||
function submit() {
|
||||
// The one-time code is asked for, never required to submit: another
|
||||
// account needs none, and without it a 2FA account is asked again.
|
||||
@@ -22,185 +82,516 @@ component LoginForm inherits VerticalLayout {
|
||||
Bridge.myts-login(email.text, password.text, otp-text);
|
||||
password.clear();
|
||||
otp-text = "";
|
||||
show-password = false;
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: @tr("Email");
|
||||
email := TextField {
|
||||
text: Bridge.myts.email;
|
||||
placeholder: @tr("Email");
|
||||
placeholder: @tr("you@example.com");
|
||||
label: @tr("Email");
|
||||
icon: Icons.mail;
|
||||
enabled: !Bridge.myts.busy;
|
||||
accepted(_) => { root.submit(); }
|
||||
accepted(_) => { password.focus(); }
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: @tr("Password");
|
||||
password := TextField {
|
||||
placeholder: @tr("Password");
|
||||
input-type: InputType.password;
|
||||
enabled: !Bridge.myts.busy;
|
||||
accepted(_) => { root.submit(); }
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
password := TextField {
|
||||
placeholder: @tr("Password");
|
||||
label: @tr("Password");
|
||||
icon: Icons.lock;
|
||||
input-type: root.show-password ? InputType.text : InputType.password;
|
||||
enabled: !Bridge.myts.busy;
|
||||
accepted(_) => { root.submit(); }
|
||||
}
|
||||
IconButton {
|
||||
icon: root.show-password ? Icons.eye-off : Icons.eye;
|
||||
label: root.show-password ? @tr("Hide password") : @tr("Show password");
|
||||
checked: root.show-password;
|
||||
clicked => { root.show-password = !root.show-password; }
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.myts.otp-required: Field {
|
||||
label: @tr("One-time code");
|
||||
hint: @tr("The code from your authenticator app.");
|
||||
TextField {
|
||||
text <=> root.otp-text;
|
||||
placeholder: @tr("One-time code");
|
||||
input-type: InputType.password;
|
||||
placeholder: "123456";
|
||||
label: @tr("One-time code");
|
||||
icon: Icons.key-round;
|
||||
input-type: InputType.number;
|
||||
enabled: !Bridge.myts.busy;
|
||||
accepted(_) => { root.submit(); }
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: @tr("Sign in");
|
||||
kind: ButtonKind.primary;
|
||||
icon: Icons.log-in;
|
||||
text: Bridge.myts.busy ? @tr("Signing in…") : @tr("Sign in");
|
||||
enabled: !Bridge.myts.busy && email.text != "" && password.text != "";
|
||||
clicked => { root.submit(); }
|
||||
}
|
||||
Button {
|
||||
text: @tr("Create account in browser");
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(0); }
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Button {
|
||||
kind: ButtonKind.ghost;
|
||||
small: true;
|
||||
text: @tr("Forgot password?");
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(1); }
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
Button {
|
||||
kind: ButtonKind.ghost;
|
||||
small: true;
|
||||
icon: Icons.user-plus;
|
||||
text: @tr("Create an account");
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(0); }
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: @tr("Forgot password?");
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(1); }
|
||||
}
|
||||
Note { text: @tr("Registration and password recovery open the official myTeamSpeak website. Return here to sign in when finished."); }
|
||||
}
|
||||
|
||||
export component AccountCard inherits Card {
|
||||
title: @tr("myTeamSpeak");
|
||||
icon: Icons.user;
|
||||
property <string> account-status: Bridge.myts.status == 2 ? @tr("Saved session could not be validated. Your saved credentials were retained; sign in again or clear them.") :
|
||||
Bridge.myts.status == 3 ? @tr("Enter your password again and the one-time code.") :
|
||||
Bridge.myts.status == 4 ? @tr("Sign-in failed. Check your credentials and connection; the experimental service may be unavailable.") :
|
||||
Bridge.myts.status == 7 ? @tr("Signed out.") :
|
||||
Bridge.myts.status == 9 ? @tr("Signed out and saved credentials cleared. Remote session revocation failed.") :
|
||||
Bridge.myts.status == 10 ? @tr("Could not open your browser. Visit myteamspeak.com to manage your account.") :
|
||||
Bridge.myts.status == 11 ? @tr("Account website opened in your browser. When finished, return here and sign in again to apply changes.") :
|
||||
Bridge.myts.status == 13 ? @tr("Your email address has not been verified. Activate your account using the link in your email, or request a new activation email.") :
|
||||
Bridge.myts.status == 14 ? @tr("The one-time code was not accepted. Enter your password and a new code.") :
|
||||
Bridge.myts.status == 15 ? @tr("Your saved session has expired. Sign in again.") :
|
||||
Bridge.myts.status == 16 ? @tr("Email or password was not accepted. Check your details and try again.") :
|
||||
Bridge.myts.status == 17 ? @tr("Too many requests. Wait a while before trying again.") : "";
|
||||
if !Bridge.myts.available: Note { text: @tr("Account sign-in is available on desktop."); }
|
||||
if Bridge.myts.available && !Bridge.myts.signed-in: LoginForm { }
|
||||
if Bridge.myts.signed-in: VerticalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Note { text: @tr("Primary account"); }
|
||||
// A labelled line of the profile: an icon, a label and its value.
|
||||
component ProfileRow inherits HorizontalLayout {
|
||||
in property <image> icon;
|
||||
in property <string> label;
|
||||
in property <string> value;
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: root.icon;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.text-muted;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: root.label;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
Text {
|
||||
text: root.value;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-alignment: right;
|
||||
vertical-alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
|
||||
// Avatar, name, email and what state the account is in.
|
||||
component ProfileHeader inherits HorizontalLayout {
|
||||
in property <length> avatar-size: 72px;
|
||||
spacing: Theme.space-5;
|
||||
Avatar {
|
||||
size: root.avatar-size;
|
||||
image: Bridge.myts.avatar;
|
||||
initials: Bridge.myts.initials;
|
||||
tint: Theme.accent;
|
||||
label: Bridge.primary-name;
|
||||
status: Bridge.myts.signed-in ? Status.online : Status.idle;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: Theme.space-2;
|
||||
horizontal-stretch: 1;
|
||||
Text {
|
||||
text: Bridge.primary-name;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-lg;
|
||||
font-size: Theme.font-2xl;
|
||||
font-weight: Theme.weight-semibold;
|
||||
wrap: word-wrap;
|
||||
overflow: elide;
|
||||
}
|
||||
Note { text: Bridge.myts.email; }
|
||||
if Bridge.myts.uuid != "": Field {
|
||||
if Bridge.myts.email != "": Text {
|
||||
text: Bridge.myts.email;
|
||||
color: Theme.text-secondary;
|
||||
overflow: elide;
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
if Bridge.myts.restoring: Chip {
|
||||
text: @tr("Checking session…");
|
||||
icon: Icons.loader;
|
||||
}
|
||||
if Bridge.myts.signed-in: Chip {
|
||||
text: @tr("Signed in");
|
||||
icon: Icons.circle-check;
|
||||
tint: Theme.success;
|
||||
fill: Theme.success-soft;
|
||||
}
|
||||
if Bridge.myts.signed-in && Bridge.myts.identity-status == 1: Chip {
|
||||
text: @tr("myTS ID active");
|
||||
icon: Icons.shield-check;
|
||||
tint: Theme.accent-text;
|
||||
fill: Theme.accent-soft;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// What the account service tells: description, dates, badges, devices.
|
||||
component ProfileDetails inherits VerticalLayout {
|
||||
spacing: Theme.space-3;
|
||||
if Bridge.myts.description != "": Text {
|
||||
text: Bridge.myts.description;
|
||||
color: Theme.text;
|
||||
font-italic: true;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
if Bridge.myts.member-since != "": ProfileRow {
|
||||
icon: Icons.calendar;
|
||||
label: @tr("Member since");
|
||||
value: Bridge.myts.member-since;
|
||||
}
|
||||
if Bridge.myts.last-login != "": ProfileRow {
|
||||
icon: Icons.clock;
|
||||
label: @tr("Previous sign-in");
|
||||
value: Bridge.myts.last-login;
|
||||
}
|
||||
if Bridge.myts.badges.length > 0: VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: @tr("Badges");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
font-weight: Theme.weight-medium;
|
||||
}
|
||||
for badge in Bridge.myts.badges: HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: Icons.star;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.gold;
|
||||
}
|
||||
Text {
|
||||
text: badge;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.myts.devices.length > 0: VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: @tr("Signed-in devices");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
font-weight: Theme.weight-medium;
|
||||
}
|
||||
for device in Bridge.myts.devices: HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: Icons.monitor;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.text-muted;
|
||||
}
|
||||
Text {
|
||||
text: device;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The signed-in account (or the saved one being checked).
|
||||
component AccountProfile inherits VerticalLayout {
|
||||
spacing: Theme.space-5;
|
||||
ProfileHeader { }
|
||||
ProfileDetails { }
|
||||
Divider { }
|
||||
if Bridge.myts.uuid != "": Field {
|
||||
label: @tr("Account ID");
|
||||
TextField {
|
||||
text: Bridge.myts.uuid;
|
||||
read-only: true;
|
||||
label: @tr("Account ID");
|
||||
TextField {
|
||||
text: Bridge.myts.uuid;
|
||||
read-only: true;
|
||||
label: @tr("Account ID");
|
||||
}
|
||||
icon: Icons.id-card;
|
||||
}
|
||||
if Bridge.myts.myts-id != "": Field {
|
||||
}
|
||||
if Bridge.myts.myts-id != "": Field {
|
||||
label: @tr("myTS ID");
|
||||
TextField {
|
||||
text: Bridge.myts.myts-id;
|
||||
read-only: true;
|
||||
label: @tr("myTS ID");
|
||||
TextField {
|
||||
text: Bridge.myts.myts-id;
|
||||
read-only: true;
|
||||
label: @tr("myTS ID");
|
||||
}
|
||||
icon: Icons.shield-check;
|
||||
}
|
||||
if Bridge.myts.identity-status == 1: Note {
|
||||
text: @tr("Your account identity is available for authentication on voice servers.");
|
||||
}
|
||||
if Bridge.myts.identity-status == 2: Note {
|
||||
text: @tr("Sign out and sign in with your password to enable your myTS ID on voice servers.");
|
||||
}
|
||||
if Bridge.myts.identity-status == 3: Note {
|
||||
text: @tr("Signed in, but the account identity could not be unlocked. Voice servers will not receive your myTS ID. Try signing in again; older account encryption may be unsupported.");
|
||||
}
|
||||
Note { text: @tr("This is your main app profile. Server identities and server nicknames are managed separately."); }
|
||||
Note { text: @tr("Account management opens the official website. Check which account is signed in there. Sign in again here after making changes."); }
|
||||
Button {
|
||||
text: @tr("Manage account in browser");
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(2); }
|
||||
}
|
||||
for action in [
|
||||
{ text: @tr("Change username"), portal: 4 },
|
||||
{ text: @tr("Change email"), portal: 5 },
|
||||
{ text: @tr("Change password"), portal: 6 },
|
||||
{ text: @tr("Two-factor authentication"), portal: 7 },
|
||||
{ text: @tr("Manage account deletion"), portal: 8 },
|
||||
{ text: @tr("Export account data"), portal: 9 },
|
||||
]: Button {
|
||||
text: action.text;
|
||||
}
|
||||
if Bridge.myts.signed-in && Bridge.myts.identity-status == 1: Note {
|
||||
text: @tr("Your account identity is available for authentication on voice servers.");
|
||||
}
|
||||
if Bridge.myts.signed-in && Bridge.myts.identity-status == 2: Note {
|
||||
text: @tr("Sign out and sign in with your password to enable your myTS ID on voice servers.");
|
||||
}
|
||||
if Bridge.myts.signed-in && Bridge.myts.identity-status == 3: Note {
|
||||
text: @tr("Signed in, but the account identity could not be unlocked. Voice servers will not receive your myTS ID. Try signing in again; older account encryption may be unsupported.");
|
||||
}
|
||||
Note { text: @tr("This is your main app profile. Server identities and server nicknames are managed separately."); }
|
||||
}
|
||||
|
||||
// Changes are made on the official website.
|
||||
component AccountManagement inherits VerticalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Text {
|
||||
text: @tr("Manage your account");
|
||||
color: Theme.text;
|
||||
font-weight: Theme.weight-semibold;
|
||||
}
|
||||
Note { text: @tr("Account management opens the official website. Check which account is signed in there. Sign in again here after making changes."); }
|
||||
Button {
|
||||
icon: Icons.external-link;
|
||||
text: @tr("Manage account in browser");
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(2); }
|
||||
}
|
||||
for row in [
|
||||
[{ text: @tr("Change username"), icon: Icons.user, portal: 4 }, { text: @tr("Change email"), icon: Icons.mail, portal: 5 }],
|
||||
[{ text: @tr("Change password"), icon: Icons.lock, portal: 6 }, { text: @tr("Two-factor authentication"), icon: Icons.key-round, portal: 7 }],
|
||||
[{ text: @tr("Export account data"), icon: Icons.download, portal: 9 }, { text: @tr("Manage account deletion"), icon: Icons.trash-2, portal: 8 }],
|
||||
]: HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
for action in row: Button {
|
||||
horizontal-stretch: 1;
|
||||
kind: ButtonKind.ghost;
|
||||
small: true;
|
||||
centered: false;
|
||||
icon: action.icon;
|
||||
text: action.text;
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(action.portal); }
|
||||
}
|
||||
}
|
||||
if Bridge.myts.busy: Note { text: @tr("Contacting account service…"); }
|
||||
if root.account-status != "": Note { text: root.account-status; }
|
||||
if Bridge.myts.persistence-status == 1: Note {
|
||||
text: @tr("Saved account credentials could not be read. Unlock the keyring or clear the saved session.");
|
||||
}
|
||||
|
||||
// Retry a saved session, sign out or clear what is stored.
|
||||
component SessionActions inherits HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
alignment: start;
|
||||
if Bridge.myts.busy: Spinner {
|
||||
size: 18px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if Bridge.myts.persistence-status == 5: Note {
|
||||
text: @tr("Account credentials could not be saved. This session will not be restored after restarting.");
|
||||
}
|
||||
if Bridge.myts.persistence-status == 6: Note {
|
||||
text: @tr("Account credentials could not be saved, and older credentials could not be removed. Unlock your keyring and clear the saved session.");
|
||||
}
|
||||
if Bridge.myts.persistence-status == 8: Note {
|
||||
text: @tr("Signed out locally, but saved credentials could not be removed. Unlock your keyring and clear the saved session again.");
|
||||
}
|
||||
if Bridge.myts.status == 13: Button {
|
||||
text: @tr("Resend activation email in browser");
|
||||
enabled: !Bridge.myts.busy;
|
||||
clicked => { Bridge.myts-portal(3); }
|
||||
if Bridge.myts.busy: Text {
|
||||
text: Bridge.myts.restoring ? @tr("Checking your saved session…") : @tr("Contacting account service…");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
if Bridge.myts.can-forget && !Bridge.myts.busy: Button {
|
||||
icon: Icons.refresh-cw;
|
||||
small: true;
|
||||
text: Bridge.myts.signed-in ? @tr("Check session") : @tr("Retry saved session");
|
||||
clicked => { Bridge.myts-retry(); }
|
||||
}
|
||||
if Bridge.myts.can-forget || Bridge.myts.busy: Button {
|
||||
kind: Bridge.myts.signed-in ? ButtonKind.secondary : ButtonKind.danger;
|
||||
icon: Icons.log-out;
|
||||
small: true;
|
||||
text: Bridge.myts.busy ? @tr("Cancel and clear session") : Bridge.myts.signed-in ? @tr("Sign out") : @tr("Clear saved session");
|
||||
clicked => { Bridge.myts-logout(); }
|
||||
}
|
||||
}
|
||||
|
||||
export component LoginPage inherits ScrollView {
|
||||
// Settings → My Account.
|
||||
export component AccountCard inherits Card {
|
||||
title: @tr("myTeamSpeak");
|
||||
icon: Icons.user;
|
||||
subtitle: Bridge.myts.signed-in ? @tr("Your account") : Bridge.myts.restoring ? @tr("Checking your saved session") : @tr("Sign in to make your account your main profile");
|
||||
if !Bridge.myts.available: Note { text: @tr("Account sign-in is available on desktop."); }
|
||||
if Bridge.myts.signed-in || Bridge.myts.restoring: AccountProfile { }
|
||||
if Bridge.myts.available && !Bridge.myts.signed-in && !Bridge.myts.restoring: LoginForm { }
|
||||
if AccountText.status(Bridge.myts.status) != "" || AccountText.persistence(Bridge.myts.persistence-status) != "": AccountNotices { }
|
||||
if Bridge.myts.busy || Bridge.myts.can-forget: SessionActions { }
|
||||
if Bridge.myts.signed-in: Divider { }
|
||||
if Bridge.myts.signed-in: AccountManagement { }
|
||||
}
|
||||
|
||||
// The artwork beside the form: the night landscape, what an account gives.
|
||||
component LoginHero inherits Rectangle {
|
||||
clip: true;
|
||||
border-radius: Theme.radius-xl;
|
||||
background: @linear-gradient(150deg, #0e1d5c 0%, #1c1470 45%, #3a1f86 75%, #0b2a6b 100%);
|
||||
property <float> ratio: art.source.width * 1.0 / max(1, art.source.height);
|
||||
art := Image {
|
||||
// The tall night landscape (the home sidebar's), covering the
|
||||
// panel from the bottom.
|
||||
source: Icons.art-sidebar;
|
||||
width: max(root.width, root.height * root.ratio);
|
||||
height: self.width / root.ratio;
|
||||
x: root.width - self.width;
|
||||
y: root.height - self.height;
|
||||
image-fit: fill;
|
||||
accessible-role: AccessibleRole.none;
|
||||
}
|
||||
Rectangle {
|
||||
background: @linear-gradient(180deg, #060c2cd8 0%, #060c2c30 100%);
|
||||
}
|
||||
VerticalLayout {
|
||||
width: root.visible-width;
|
||||
padding: Theme.space-4;
|
||||
spacing: Theme.space-5;
|
||||
padding: Theme.space-8;
|
||||
spacing: Theme.space-6;
|
||||
alignment: start;
|
||||
HorizontalLayout {
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
VerticalLayout {
|
||||
max-width: 480px;
|
||||
spacing: Theme.space-4;
|
||||
alignment: start;
|
||||
Image {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
source: Icons.logo;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.app-name;
|
||||
color: #ffffff;
|
||||
font-size: Theme.font-3xl;
|
||||
font-weight: Theme.weight-bold;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: @tr("Your TeamSpeak account, everywhere you talk.");
|
||||
color: #ffffff;
|
||||
font-size: Theme.font-2xl;
|
||||
font-weight: Theme.weight-semibold;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
for feature in [
|
||||
{ icon: Icons.user-check, text: @tr("Your myTeamSpeak name and avatar become your profile.") },
|
||||
{ icon: Icons.shield-check, text: @tr("Voice servers recognise you by your myTS ID.") },
|
||||
{ icon: Icons.star, text: @tr("Your badges and devices at a glance.") },
|
||||
]: HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
Rectangle {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: Theme.radius-md;
|
||||
background: #ffffff1f;
|
||||
Icon {
|
||||
source: feature.icon;
|
||||
tint: #ffffff;
|
||||
x: (parent.width - self.width) / 2;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: feature.text;
|
||||
color: #e4e9ff;
|
||||
vertical-alignment: center;
|
||||
wrap: word-wrap;
|
||||
horizontal-stretch: 1;
|
||||
spacing: Theme.space-4;
|
||||
Text {
|
||||
text: @tr("Welcome to {}", Bridge.app-name);
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-xl;
|
||||
font-weight: Theme.weight-semibold;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
Note { text: @tr("Sign in to make your myTeamSpeak account your main profile."); }
|
||||
AccountCard { }
|
||||
Button {
|
||||
text: @tr("Continue without an account");
|
||||
clicked => { Bridge.myts-dismiss(); }
|
||||
}
|
||||
Note { text: @tr("You can connect to servers without an account and sign in later in Settings → My Account."); }
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// First launch without a saved session: sign in or go on without.
|
||||
export component LoginPage inherits Rectangle {
|
||||
background: Theme.backdrop;
|
||||
// The window's width (`Nav.narrow`), not this page's: the artwork's
|
||||
// width is part of the page's own layout.
|
||||
property <bool> wide: !Nav.narrow;
|
||||
// Only rows with something in them (an empty one still takes spacing).
|
||||
property <bool> notices: AccountText.status(Bridge.myts.status) != "" || AccountText.persistence(Bridge.myts.persistence-status) != "";
|
||||
property <bool> actions: Bridge.myts.busy || Bridge.myts.can-forget;
|
||||
HorizontalLayout {
|
||||
padding: root.wide ? Theme.space-6 : 0px;
|
||||
spacing: Theme.space-6;
|
||||
// Half the window at most, by stretch (a width from the page's own
|
||||
// width would loop through its layout).
|
||||
if root.wide: LoginHero {
|
||||
horizontal-stretch: 1;
|
||||
min-width: 320px;
|
||||
max-width: 600px;
|
||||
}
|
||||
scroll := ScrollView {
|
||||
horizontal-stretch: 1;
|
||||
VerticalLayout {
|
||||
width: scroll.visible-width;
|
||||
min-height: scroll.visible-height;
|
||||
padding: Theme.space-6;
|
||||
alignment: center;
|
||||
HorizontalLayout {
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
VerticalLayout {
|
||||
max-width: 440px;
|
||||
horizontal-stretch: 1;
|
||||
spacing: Theme.space-5;
|
||||
if !root.wide: HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
alignment: start;
|
||||
Image {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
source: Icons.logo;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.app-name;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-2xl;
|
||||
font-weight: Theme.weight-bold;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: @tr("Sign in");
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-3xl;
|
||||
font-weight: Theme.weight-bold;
|
||||
}
|
||||
Note { text: @tr("Use your myTeamSpeak account to make it your main profile in {}.", Bridge.app-name); }
|
||||
}
|
||||
Rectangle {
|
||||
border-radius: Theme.radius-xl;
|
||||
background: Theme.surface;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border;
|
||||
VerticalLayout {
|
||||
padding: Theme.space-7;
|
||||
spacing: Theme.space-5;
|
||||
if !Bridge.myts.available: Note { text: @tr("Account sign-in is available on desktop."); }
|
||||
if Bridge.myts.available: LoginForm { }
|
||||
if root.notices: AccountNotices { }
|
||||
if root.actions: SessionActions { }
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Divider { y: (parent.height - self.height) / 2; }
|
||||
Text {
|
||||
text: @tr("or");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-stretch: 0;
|
||||
}
|
||||
Divider { y: (parent.height - self.height) / 2; }
|
||||
}
|
||||
Button {
|
||||
icon: Icons.arrow-right;
|
||||
text: @tr("Continue without an account");
|
||||
clicked => { Bridge.myts-dismiss(); }
|
||||
}
|
||||
Note {
|
||||
text: @tr("Servers work without an account. You can sign in later in Settings → My Account; this page will not ask again.");
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// The server's sidebar: the server card, connect and observe, and the
|
||||
// channel tree with its clients.
|
||||
// The server's sidebar: the server card, connect, and the channel tree
|
||||
// with its clients. Selecting a server observes it invisibly (through its
|
||||
// gateway) on its own, so there is no button for it.
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
@@ -82,14 +83,11 @@ export component ServerHeader inherits Rectangle {
|
||||
menu := PopupMenu {
|
||||
entries: [
|
||||
{ text: @tr("Edit server"), icon: Icons.pencil, enabled: Bridge.current-server >= 0 },
|
||||
{ text: Bridge.observing ? @tr("Stop observing") : @tr("Observe invisibly"), icon: Icons.eye, enabled: Bridge.can-observe },
|
||||
{ text: @tr("Add server"), icon: Icons.plus, enabled: true, separator: true },
|
||||
];
|
||||
activated(i) => {
|
||||
if i == 0 {
|
||||
Nav.edit-server(Bridge.current-server);
|
||||
} else if i == 1 {
|
||||
Bridge.toggle-observe();
|
||||
} else {
|
||||
Nav.add-server();
|
||||
}
|
||||
@@ -97,7 +95,7 @@ export component ServerHeader inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Connect and observe while not connected.
|
||||
// Connect while not connected.
|
||||
export component ConnectActions inherits HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Button {
|
||||
@@ -108,13 +106,6 @@ export component ConnectActions inherits HorizontalLayout {
|
||||
enabled: Bridge.current-server >= 0 && !Bridge.voice-connecting;
|
||||
clicked => { Bridge.connect-voice(); }
|
||||
}
|
||||
Button {
|
||||
icon: Bridge.observing ? Icons.eye-off : Icons.eye;
|
||||
text: Bridge.observing ? @tr("Stop observing") : @tr("Observe");
|
||||
enabled: Bridge.can-observe;
|
||||
checked: Bridge.observing;
|
||||
clicked => { Bridge.toggle-observe(); }
|
||||
}
|
||||
}
|
||||
|
||||
// A server-provided icon in its own colours.
|
||||
@@ -352,7 +343,7 @@ export component ChannelTree inherits VerticalLayout {
|
||||
small: true;
|
||||
}
|
||||
if Bridge.tree.length == 0: Text {
|
||||
text: Bridge.current-server < 0 ? @tr("No server yet.") : @tr("Connect or observe to see the channels.");
|
||||
text: Bridge.current-server < 0 ? @tr("No server yet.") : Bridge.observing ? @tr("Loading the channels…") : @tr("Connect to see the channels.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
|
||||
@@ -337,7 +337,7 @@ export component MessageRow inherits Rectangle {
|
||||
alignment: start;
|
||||
Text {
|
||||
text: line.author;
|
||||
color: line.relayed ? Theme.accent-text : Theme.name-text;
|
||||
color: Theme.name-text;
|
||||
font-size: Theme.font-lg;
|
||||
font-weight: Theme.weight-medium;
|
||||
vertical-alignment: center;
|
||||
@@ -348,12 +348,6 @@ export component MessageRow inherits Rectangle {
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
if line.relayed: Chip {
|
||||
text: @tr("via relay");
|
||||
icon: Icons.radio;
|
||||
tint: Theme.accent-text;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if line.pinned: Chip {
|
||||
text: @tr("pinned");
|
||||
icon: Icons.pin;
|
||||
|
||||
@@ -26,11 +26,13 @@ export component BookmarkDialog inherits Modal {
|
||||
// The fields beyond address and password: shown when editing.
|
||||
property <bool> advanced: form.id >= 0;
|
||||
title: join ? @tr("Join a server") : form.id < 0 ? @tr("Add server") : @tr("Edit server");
|
||||
// The rest includes the gateway (presence and chat without joining),
|
||||
// found from the address: DNS SRV records, else its well-known URL.
|
||||
subtitle: @tr("Only the address is needed; Voelin finds the rest.");
|
||||
icon: Icons.server;
|
||||
card-width: 560px;
|
||||
// Fits the address and password (two lines more on a phone).
|
||||
card-height: advanced ? 720px : Nav.narrow ? 360px : 330px;
|
||||
card-height: advanced ? 500px : Nav.narrow ? 360px : 330px;
|
||||
dismissed => { done(); }
|
||||
ScrollView {
|
||||
vertical-stretch: 1;
|
||||
@@ -57,7 +59,7 @@ export component BookmarkDialog inherits Modal {
|
||||
clicked => { root.advanced = !root.advanced; }
|
||||
}
|
||||
Text {
|
||||
text: @tr("Name, nickname, gateway, ServerQuery");
|
||||
text: @tr("Name, nickname");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
@@ -77,44 +79,6 @@ export component BookmarkDialog inherits Modal {
|
||||
hint: @tr("Empty: the nickname of your identity.");
|
||||
TextField { text <=> form.nickname; label: @tr("Nickname"); icon: Icons.user; }
|
||||
}
|
||||
Text {
|
||||
text: @tr("Invisible presence and chat without joining");
|
||||
font-weight: Theme.weight-semibold;
|
||||
color: Theme.text;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
Field {
|
||||
label: @tr("Gateway URL");
|
||||
hint: @tr("Empty: looked up in DNS, as published by the server's admin.");
|
||||
TextField { text <=> form.gateway-url; placeholder: @tr("Found automatically"); label: @tr("Gateway URL"); }
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
Field {
|
||||
label: @tr("Query transport");
|
||||
Select {
|
||||
model: ["none", "ssh", "raw", "http"];
|
||||
current-value <=> form.query-transport;
|
||||
current-index: form.query-transport == "ssh" ? 1 : form.query-transport == "raw" ? 2 : form.query-transport == "http" ? 3 : 0;
|
||||
label: @tr("Query transport");
|
||||
}
|
||||
}
|
||||
Field {
|
||||
label: @tr("Query address");
|
||||
TextField { text <=> form.query-addr; placeholder: "ts.example.org:10022"; label: @tr("Query address"); }
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
Field {
|
||||
label: @tr("Query login");
|
||||
TextField { text <=> form.query-user; label: @tr("Query login"); }
|
||||
}
|
||||
Field {
|
||||
label: @tr("Query password");
|
||||
TextField { text <=> form.query-password; input-type: InputType.password; label: @tr("Query password"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ export component EventsPage inherits VerticalLayout {
|
||||
}
|
||||
}
|
||||
if !Bridge.has-events: Banner {
|
||||
text: @tr("This server's gateway does not keep events (or there is no gateway).");
|
||||
text: @tr("This server does not keep events.");
|
||||
icon: Icons.info;
|
||||
tone: Theme.info;
|
||||
}
|
||||
|
||||
@@ -1024,7 +1024,7 @@ export component HomePage inherits Rectangle {
|
||||
action-clicked => { root.more-live(); }
|
||||
}
|
||||
if Bridge.live-rooms.length == 0: Text {
|
||||
text: @tr("No one is live on your servers right now. Streams of TeamSpeak 6 servers and those a gateway lists show up here.");
|
||||
text: @tr("No one is live on your servers right now. Streams on your servers show up here.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
|
||||
@@ -407,7 +407,7 @@ export component MembersPanel inherits VerticalLayout {
|
||||
padding-left: Theme.space-5;
|
||||
padding-right: Theme.space-5;
|
||||
Text {
|
||||
text: @tr("Connect or observe to see who is here.");
|
||||
text: Bridge.observing ? @tr("Loading who is here…") : @tr("Connect to see who is here.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
wrap: word-wrap;
|
||||
|
||||
@@ -882,7 +882,7 @@ export component IntegrationsSection inherits VerticalLayout {
|
||||
icon: Icons.plug;
|
||||
subtitle: @tr("A gateway gives a server invisible presence, chat without joining, history, pins, reactions, topics, events and the stream directory.");
|
||||
if Bridge.gateways.length == 0: Hint {
|
||||
text: @tr("None of your servers has a gateway. Add its URL to a server's bookmark (Edit server).");
|
||||
text: @tr("None of your servers has a gateway. Voelin finds one by the server's address when the server's admin publishes it.");
|
||||
}
|
||||
for gw in Bridge.gateways: VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
@@ -1262,6 +1262,23 @@ export component AdvancedSection inherits VerticalLayout {
|
||||
Hint {
|
||||
text: Bridge.advanced.logs;
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Text {
|
||||
text: @tr("Log files");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
Button {
|
||||
small: true;
|
||||
icon: Icons.folder-open;
|
||||
text: @tr("Open");
|
||||
clicked => { Bridge.open-logs(); }
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Text {
|
||||
@@ -1277,7 +1294,7 @@ export component AdvancedSection inherits VerticalLayout {
|
||||
icon: Icons.folder-open;
|
||||
text: @tr("Open");
|
||||
enabled: Bridge.advanced.crash-dir != "";
|
||||
clicked => { Bridge.open-logs(); }
|
||||
clicked => { Bridge.open-crash-folder(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -943,7 +943,7 @@ component ChatRow inherits Rectangle {
|
||||
alignment: start;
|
||||
Text {
|
||||
text: line.author;
|
||||
color: line.relayed ? Theme.accent-text : Theme.name-text;
|
||||
color: Theme.name-text;
|
||||
font-size: Theme.font-body;
|
||||
font-weight: Theme.weight-medium;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,8 @@ export component UserCard inherits Rectangle {
|
||||
Avatar {
|
||||
size: 38px;
|
||||
initials: Bridge.myts.signed-in || Bridge.nickname != "" ? "" : "?";
|
||||
image: Bridge.own-avatar;
|
||||
// The server's avatar for us, else the account's.
|
||||
image: Bridge.own-avatar.width > 0 ? Bridge.own-avatar : Bridge.myts.avatar;
|
||||
tint: Theme.accent;
|
||||
label: Bridge.primary-name;
|
||||
// Green ring while our voice goes out.
|
||||
@@ -190,7 +191,7 @@ export component UserCard inherits Rectangle {
|
||||
source: Icons.user;
|
||||
size: 20px;
|
||||
tint: #ffffff;
|
||||
visible: (Bridge.myts.signed-in || Bridge.nickname != "") && Bridge.own-avatar.width == 0;
|
||||
visible: (Bridge.myts.signed-in || Bridge.nickname != "") && Bridge.own-avatar.width == 0 && Bridge.myts.avatar.width == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
# unsigned.
|
||||
|
||||
FROM ubuntu:24.04 AS toolchain
|
||||
# Serial builds keep the generated Slint UI within the CI memory budget.
|
||||
ENV CARGO_BUILD_JOBS=1 CARGO_INCREMENTAL=0
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
# JDK 17 (Gradle, the Android Gradle plugin), CMake + Ninja (the bundled libopus).
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
@@ -11,13 +11,11 @@
|
||||
# live in cache mounts, so rebuilds are incremental.
|
||||
|
||||
FROM ubuntu:24.04 AS toolchain
|
||||
# Serial builds keep the generated Slint UI within the CI memory budget.
|
||||
ENV CARGO_BUILD_JOBS=1 CARGO_INCREMENTAL=0
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
# The same libraries as CI (.github/actions/system-deps), plus dpkg-dev for
|
||||
# the .deb's dependencies.
|
||||
# the .deb's dependencies and patchelf for the .tar.gz's bundled libraries.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential ca-certificates cmake curl dpkg-dev pkg-config \
|
||||
build-essential ca-certificates cmake curl dpkg-dev patchelf pkg-config \
|
||||
libasound2-dev libfontconfig1-dev libxkbcommon-dev \
|
||||
libvpx-dev libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
# on Windows 10 and 11. Unsigned, like CI's (signing: docs/release.md).
|
||||
|
||||
FROM ubuntu:24.04 AS toolchain
|
||||
# Serial builds keep the generated Slint UI within the CI memory budget.
|
||||
ENV CARGO_BUILD_JOBS=1 CARGO_INCREMENTAL=0
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
# mingw-w64 (C compiler and linker), NASM (aws-lc and libvpx assembly), CMake
|
||||
# (the bundled libopus, aws-lc), NSIS (the installer), zip.
|
||||
# mingw-w64 (C compiler and linker), NASM (aws-lc, libvpx and dav1d
|
||||
# assembly), CMake (the bundled libopus, aws-lc), Meson and Ninja (dav1d),
|
||||
# NSIS (the installer), zip and unzip.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential ca-certificates cmake curl git mingw-w64 nasm nsis perl pkg-config zip \
|
||||
build-essential ca-certificates cmake curl git meson mingw-w64 nasm ninja-build nsis perl \
|
||||
pkg-config unzip zip \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix \
|
||||
&& update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
|
||||
@@ -53,18 +53,49 @@ RUN git clone --quiet --depth 1 --branch "v$LIBVPX_VERSION" \
|
||||
&& make -j"$(nproc)" && make install \
|
||||
&& rm -rf /tmp/libvpx
|
||||
|
||||
# dav1d (AV1 decoding) as a static mingw library (CI's Windows jobs take it
|
||||
# from vcpkg), from upstream's git at a pinned commit.
|
||||
FROM toolchain AS dav1d
|
||||
ARG DAV1D_VERSION=1.5.4
|
||||
ARG DAV1D_COMMIT=54706fc6bc0cdecab7e9593974a4039cc038fca7
|
||||
RUN git clone --quiet --depth 1 --branch "$DAV1D_VERSION" \
|
||||
https://code.videolan.org/videolan/dav1d.git /tmp/dav1d \
|
||||
&& test "$(git -C /tmp/dav1d rev-parse HEAD)" = "$DAV1D_COMMIT" \
|
||||
&& printf '%s\n' \
|
||||
"[binaries]" \
|
||||
"c = 'x86_64-w64-mingw32-gcc'" \
|
||||
"ar = 'x86_64-w64-mingw32-ar'" \
|
||||
"strip = 'x86_64-w64-mingw32-strip'" \
|
||||
"windres = 'x86_64-w64-mingw32-windres'" \
|
||||
"[host_machine]" \
|
||||
"system = 'windows'" \
|
||||
"cpu_family = 'x86_64'" \
|
||||
"cpu = 'x86_64'" \
|
||||
"endian = 'little'" >/tmp/mingw.ini \
|
||||
&& meson setup /tmp/dav1d/build /tmp/dav1d --cross-file /tmp/mingw.ini \
|
||||
--prefix=/opt/dav1d --libdir=lib --buildtype=release -Ddefault_library=static \
|
||||
-Denable_tools=false -Denable_tests=false -Denable_examples=false \
|
||||
&& ninja -C /tmp/dav1d/build install \
|
||||
&& rm -rf /tmp/dav1d
|
||||
|
||||
FROM toolchain AS build
|
||||
COPY --from=libvpx /opt/libvpx /opt/libvpx
|
||||
COPY --from=dav1d /opt/dav1d /opt/dav1d
|
||||
ARG LIBVPX_VERSION=1.15.2
|
||||
# libvpx-native-sys: the library above, linked statically.
|
||||
# libvpx-native-sys: the library above, linked statically; dav1d-sys
|
||||
# through system-deps, without pkg-config.
|
||||
ENV VPX_LIB_DIR=/opt/libvpx/lib VPX_INCLUDE_DIR=/opt/libvpx/include \
|
||||
VPX_VERSION=$LIBVPX_VERSION VPX_STATIC=1
|
||||
VPX_VERSION=$LIBVPX_VERSION VPX_STATIC=1 \
|
||||
SYSTEM_DEPS_DAV1D_NO_PKG_CONFIG=1 SYSTEM_DEPS_DAV1D_SEARCH_NATIVE=/opt/dav1d/lib \
|
||||
SYSTEM_DEPS_DAV1D_LIB=dav1d SYSTEM_DEPS_DAV1D_LINK=static
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
# FFmpeg's LGPL DLLs go into the packages (scripts/fetch-ffmpeg-windows.sh).
|
||||
RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,id=voelin-target-windows,target=/src/target \
|
||||
cargo build --release --locked --target x86_64-pc-windows-gnu -p voelin-ui \
|
||||
&& WINDOWS_TARGET=x86_64-pc-windows-gnu scripts/package.sh windows /out
|
||||
&& scripts/fetch-ffmpeg-windows.sh /tmp/ffmpeg \
|
||||
&& FFMPEG_DLL_DIR=/tmp/ffmpeg WINDOWS_TARGET=x86_64-pc-windows-gnu scripts/package.sh windows /out
|
||||
|
||||
FROM scratch AS artifacts
|
||||
COPY --from=build /out /
|
||||
@@ -41,7 +41,7 @@ the admin grants them to the guest query group.
|
||||
| Feature | Mechanism |
|
||||
|---|---|
|
||||
| Server chat | Voice connection: `targetmode=3`. Without one: gateway or own query session (`servernotifyregister event=textserver`) |
|
||||
| Channel chat without joining | Relay pool (`voelin-observer`): invisible query sessions sit in channels and relay both ways; posts appear as `[Nick] text` |
|
||||
| Channel chat without joining | Relay pool (`voelin-observer`): invisible query sessions sit in channels and relay both ways; posts appear under the author's nickname |
|
||||
| Chat history | Every message a session sees is stored on the device (`voelin-store`); a gateway's stored history fills in what the device missed (sync by revision, paging by time) |
|
||||
| Pins, reactions, topics, events, stream directory, activity | Gateway features (`tsgw`), driven through `Command::Gateway` / `Event::Gateway` |
|
||||
| Voice | tsproto UDP transport, Opus (`opus2`), echo cancellation / noise suppression (sonora), own jitter buffer, cpal / AAudio |
|
||||
@@ -367,7 +367,7 @@ cannot decode and then shows nothing, so for codecs "accepted" is not
|
||||
| Opus | 48 kHz stereo, 128 kbit/s music mode, 20 ms, in-band FEC on (5 %), DTX off; SDP `minptime=10;useinbandfec=1` | fmtp differences do not refuse a codec (str0m scores the match), and every Opus decoder takes every mode | already so, no ladder needed. Our answers lack `stereo=1`, so libwebrtc streamers send us mono; our playback is mono anyway |
|
||||
| WHIP output | the studio's one codec + Opus; one host candidate | the service refuses → the output fails with its answer | not changed: a second codec would need a second encode; no STUN/TURN yet ([studio.md](studio.md)) |
|
||||
| Gateway protocol | subprotocol `tsgw.v1+json`; features by `capabilities` | a gateway without a feature: the client hides it; unknown fields are ignored, unknown message types answered `unknown_type` | already so; a `v2` would be offered first as a second subprotocol once it exists |
|
||||
| TeamSpeak client version | the configured signed version, else the vendored default (`Windows_3_X_X__1`); the legacy UDP protocol on TS3 and TS6 | a server that refuses the version ends the connection with its error | not done: no server here refuses the default; retrying with the newest signed version (`Versions.csv`, only `voelinctl` reads it) needs that refusal recognised first. TS6's protobuf transport is not implemented |
|
||||
| TeamSpeak client version | the configured signed version (a bookmark's `client_version`, `voelinctl --client-version`; `generic` claims the old `3.?.?` tuple), else the newest TeamSpeak 6 build signed for the native platform in `Versions.csv` (Linux 6.0.0-beta4.1, Windows 6.0.0-beta2), else the platform's generic `3.?.?` tuple; the legacy UDP protocol on TS3 and TS6 | a server that refuses the version ends the connection with its error | not done: no server here refuses the default; retrying with the newest signed version (`Versions.csv`, only `voelinctl` reads it) needs that refusal recognised first. TS6's protobuf transport is not implemented |
|
||||
| Capture buffers | DMA-BUF in the sink's tiled modifiers → LINEAR DMA-BUF → shared memory | the compositor fixates the format; a LINEAR mapping slower than 1 ns per pixel over 30 frames renegotiates to shared memory; a failed GPU conversion or an encoder that needs frames in memory declines DMA-BUFs | already so |
|
||||
| Capture backend | Android's provider → the ScreenCast portal (Wayland) → X11 (`DISPLAY`) → Windows Graphics Capture; or the backend set | the backend that cannot start fails the share with its reason; a cancelled portal dialog is not a failure | not changed: falling back from the portal to X11 on Wayland would capture XWayland only (black for Wayland windows); wlroots screencopy is the candidate for compositors without a portal |
|
||||
| Encoder backend | the preference: hardware (VA-API, NVENC, Quick Sync, AMF, VideoToolbox, Media Foundation, MediaCodec) → libvpx VP8 → x264, OpenH264 → libvpx VP9 → SVT-AV1, libaom; a named backend first | at start-up each backend's self-test (one keyframe) leaves out what fails, with the reason; at runtime an encoder that fails logs and tries again with the next frame | start-up already so; switching backends after runtime failures not done |
|
||||
|
||||
+11
-7
@@ -12,13 +12,13 @@ in no package (`cargo run -p voelinctl`).
|
||||
|
||||
| Platform | Files | Install |
|
||||
|---|---|---|
|
||||
| Linux x86_64 | `voelin-<version>-linux-x86_64.tar.gz` | unpack; `bin/voelin` plus desktop file and icon (prefix layout: `tar -xzf … --strip-components=1 -C ~/.local`) |
|
||||
| | `voelin_<version>_amd64.deb` | `sudo apt install ./voelin_<version>_amd64.deb` (Ubuntu 24.04+, Debian 13+) |
|
||||
| Linux x86_64 | `voelin-<version>-linux-x86_64.tar.gz` | unpack; `bin/voelin` plus desktop file and icon (prefix layout: `tar -xzf … --strip-components=1 -C ~/.local`), libvpx and libdav1d in `lib/`; `bin/voelin-install-deps` installs what comes from the system (FFmpeg, VA-API drivers, PipeWire, the desktop portal, a keyring) with apt, dnf, pacman or zypper |
|
||||
| | `voelin_<version>_amd64.deb` | `sudo apt install ./voelin_<version>_amd64.deb` (Ubuntu 24.04+, Debian 13+); apt installs the libraries it links and, by default, the recommended FFmpeg, VA-API, PipeWire, portal and keyring packages |
|
||||
| | `voelin.flatpak` (release workflow only) | `flatpak install --user voelin.flatpak` |
|
||||
| Linux server | `tsgw_<version>_amd64.deb` | `sudo apt install ./tsgw_<version>_amd64.deb`, then configure and start it ([gateway-admin.md](gateway-admin.md#install)) |
|
||||
| | `tsgw-<version>-linux-x86_64.tar.gz` | unpack; `bin/tsgw`, the systemd unit and the example config |
|
||||
| | `tsgw-image.tar.gz` (release workflow only) | `docker load -i tsgw-image.tar.gz` |
|
||||
| Windows x86_64 | `voelin-<version>-windows-x86_64.zip` | unpack; `voelin.exe` |
|
||||
| Windows x86_64 | `voelin-<version>-windows-x86_64.zip` | unpack; `voelin.exe` with FFmpeg's LGPL DLLs next to it (libvpx and dav1d are linked in) |
|
||||
| | `voelin-<version>-setup.exe` | run it (per-machine install, uninstaller in Settings → Apps) |
|
||||
| Android | `voelin-<version>-android-debug.apk` | `adb install …` or open it on the phone (arm64-v8a and x86_64) |
|
||||
| | `voelin-<version>-android-release.apk` | only with signing configured ([release.md](release.md#android-apk-signing)) |
|
||||
@@ -57,7 +57,9 @@ gh run list --workflow release.yml --limit 3
|
||||
gh run download <run id> --dir dist
|
||||
```
|
||||
|
||||
The Windows packages use the MSVC toolchain and libvpx from vcpkg. The
|
||||
The Windows packages use the MSVC toolchain, libvpx and dav1d from vcpkg, and
|
||||
FFmpeg's LGPL shared build from BtbN/FFmpeg-Builds
|
||||
(`scripts/fetch-ffmpeg-windows.sh`, checked against the release's checksums). The
|
||||
Android job builds a signed release APK only when the repository has the
|
||||
signing secrets (`ANDROID_KEYSTORE_BASE64`, `VOELIN_SIGNING_STORE_PASSWORD`,
|
||||
`VOELIN_SIGNING_KEY_ALIAS`, `VOELIN_SIGNING_KEY_PASSWORD`).
|
||||
@@ -85,7 +87,7 @@ BuildKit cache mounts (`docker builder prune` frees them).
|
||||
| Dockerfile | Builds | Notes |
|
||||
|---|---|---|
|
||||
| `docker/linux.Dockerfile` | the app's and the gateway's `.tar.gz` and `.deb` on Ubuntu 24.04 | the binaries need glibc 2.39+ and the libraries the `.deb` lists |
|
||||
| `docker/windows.Dockerfile` | `.zip` and the NSIS installer | cross-compiled for `x86_64-pc-windows-gnu` with mingw-w64 and a static libvpx; works on Windows 10 and 11 |
|
||||
| `docker/windows.Dockerfile` | `.zip` and the NSIS installer | cross-compiled for `x86_64-pc-windows-gnu` with mingw-w64 and static libvpx and dav1d, FFmpeg's LGPL DLLs alongside; works on Windows 10 and 11 |
|
||||
| `docker/android.Dockerfile` | debug APK | SDK, NDK and cargo-ndk as in CI; `--build-arg ABIS=arm64-v8a,x86_64,armeabi-v7a` picks the ABIs |
|
||||
|
||||
Options go after the platform, straight to `docker build`:
|
||||
@@ -108,11 +110,13 @@ the proxy is on localhost. If the proxy inspects TLS, set
|
||||
## Locally without Docker
|
||||
|
||||
- **Linux:** the packages from the table above need
|
||||
`sudo apt install libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev cmake dpkg-dev`,
|
||||
`sudo apt install libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev cmake dpkg-dev patchelf`,
|
||||
then `cargo build --release --locked -p voelin-ui -p voelin-gateway`
|
||||
and `scripts/package.sh linux`.
|
||||
- **Windows:** [packaging/windows/README.md](../packaging/windows/README.md)
|
||||
(MSVC, vcpkg libvpx, NSIS), then `bash scripts/package.sh windows` from Git Bash.
|
||||
(MSVC, vcpkg libvpx and dav1d, NSIS), then
|
||||
`bash scripts/fetch-ffmpeg-windows.sh ffmpeg && FFMPEG_DLL_DIR=ffmpeg bash scripts/package.sh windows`
|
||||
from Git Bash.
|
||||
- **Android:** [android.md](android.md) (SDK, NDK, cargo-ndk), then
|
||||
`cd android && ./gradlew assembleDebug` and `scripts/package.sh android`.
|
||||
- **Flatpak:** [packaging/README.md](../packaging/README.md#flatpak).
|
||||
|
||||
+9
-7
@@ -8,11 +8,12 @@ builds run by themselves, on `v*` tags, and they run none of these checks.
|
||||
Both GitHub and Gitea provide release packaging; see [release.md](release.md)
|
||||
and [building.md](building.md).
|
||||
|
||||
Cargo builds use one job in CI so the generated UI library and its test
|
||||
target do not compile concurrently. The release profile uses ThinLTO and
|
||||
Cargo builds use one job in CI (`ci.yml`) so the generated UI library and
|
||||
its test target do not compile concurrently. The release workflows, their
|
||||
Docker images and the Flatpak build use Cargo's defaults (one job per CPU,
|
||||
no incremental builds in release mode). The release profile uses ThinLTO and
|
||||
16 codegen units instead of fat LTO and one unit, reducing peak compiler
|
||||
memory while retaining optimised builds and panic unwinding. Flatpak sets
|
||||
the Cargo job limit inside its build sandbox as well. This trades some
|
||||
memory while retaining optimised builds and panic unwinding. This trades some
|
||||
whole-program optimisation for lower build-memory requirements; release
|
||||
runtime performance has not been benchmarked for this change.
|
||||
|
||||
@@ -147,9 +148,10 @@ ENDLESS_TASK_TIMEOUT = 9h
|
||||
```
|
||||
|
||||
Keep sufficient RAM/swap and free disk for all package builds and their
|
||||
Docker caches. Builds run sequentially and limit Cargo to one job. The
|
||||
workflow never prunes shared Docker state or creates host swap. The token
|
||||
and optional Android signing secrets are documented in
|
||||
Docker caches. The package builds run one after another, each with as many
|
||||
Cargo jobs as the host has CPUs. The workflow never prunes shared Docker
|
||||
state or creates host swap. The token and optional Android signing secrets
|
||||
are documented in
|
||||
[Gitea releases](release.md#gitea-releases).
|
||||
|
||||
The Gitea release job builds packages only: it runs no formatting, Clippy,
|
||||
|
||||
+32
-16
@@ -15,7 +15,7 @@ appear in the channel as `[#topic] text`).
|
||||
| Feature | How |
|
||||
|---|---|
|
||||
| Presence | One query session watches the server; each user sees the channels their `i_channel_subscribe_power` allows, without query clients |
|
||||
| Channel chat | A relay query session is moved into each channel someone opened; it forwards what is said and posts users' messages as `[Nick] text` |
|
||||
| Channel chat | A relay query session is moved into each channel someone opened; it forwards what is said and posts users' messages under their own nickname, as if they wrote them |
|
||||
| Server chat | Read by the watcher, posted by the gateway's lookup session |
|
||||
| History | Relayed messages are stored (SQLite) with stable ids; pages by id or time in both directions, without a size limit unless you set one; `sync` returns what changed since a revision |
|
||||
| Pins | Pinned messages per chat, kept even when older messages are pruned |
|
||||
@@ -26,7 +26,13 @@ appear in the channel as `[#topic] text`).
|
||||
| Activity feed | Streams started and stopped, events scheduled, starting or cancelled, topics started, messages pinned |
|
||||
|
||||
The nickname in relayed posts is the one the server has on record for the
|
||||
user's identity (from `clientdbinfo`), not something the user can choose.
|
||||
user's identity (from `clientdbinfo`), not something the user can choose. For
|
||||
each post the relay (or, for server chat, the lookup session) takes that
|
||||
nickname, sends the message and takes its own name back; while someone on the
|
||||
server has the nickname it uses `Nick1` to `Nick3`, as TeamSpeak names a second
|
||||
client of the same name. Only when it can take none of them (a nickname under
|
||||
three characters, the server refusing the change) does the post go out under
|
||||
the relay's own name, as `relay.format` (`[Nick] text`).
|
||||
Each feature can be turned off (`features.*`); pins, reactions and topics
|
||||
need `history.enabled`.
|
||||
|
||||
@@ -80,20 +86,25 @@ Every login, post and settings change is written to the audit table.
|
||||
5. Install tsgw ([below](#install)), copy the example config to
|
||||
`/etc/tsgw/tsgw.toml` and set the query address and credentials
|
||||
(`TSGW_QUERY_PASSWORD` or `password_file`).
|
||||
6. Run it behind TLS (Caddy, nginx) and publish it in DNS
|
||||
([below](#letting-voelin-find-the-gateway)), so users only add the
|
||||
server's address; or give them the `wss://…/v1` URL.
|
||||
6. Run it behind TLS (Caddy, nginx) and publish it in DNS, or let it
|
||||
answer on its default port next to the server
|
||||
([below](#letting-voelin-find-the-gateway)): users only add the
|
||||
server's address and never see the gateway.
|
||||
|
||||
## Letting Voelin find the gateway
|
||||
|
||||
When a user adds a server by its address (`ts.example.org`), Voelin looks
|
||||
for its gateway the way TeamSpeak looks for the voice server (SRV
|
||||
`_ts3._udp`, then TSDNS), and uses what it finds as if the user had typed
|
||||
the URL (the field stays editable under *Advanced*). It asks at the
|
||||
server's host name and then at each parent domain down to the registered
|
||||
domain, the most specific name first; for `ts.example.org` that is
|
||||
`ts.example.org`, then `example.org`. It looks again when the server is
|
||||
saved with an empty gateway URL and when it connects with voice.
|
||||
`_ts3._udp`, then TSDNS), and observes the server through it as soon as the
|
||||
user selects the server (users do not type gateway URLs or query logins).
|
||||
It asks at the server's host name and then at each parent domain down to the
|
||||
registered domain, the most specific name first; for `ts.example.org` that
|
||||
is `ts.example.org`, then `example.org`. It looks once per run when the
|
||||
server is selected or connects with voice, and again when its address
|
||||
changes: what is published takes the place of what was found before (a
|
||||
lookup that finds nothing keeps it). A gateway that cannot be reached is
|
||||
tried again by itself (after 2, 5, 15, 30, then every 60 seconds); users
|
||||
see nothing of it, the log file has the URL and the error.
|
||||
|
||||
**DNS records** (preferred). An SRV record names the gateway's host and
|
||||
port, the service name says whether it speaks TLS:
|
||||
@@ -119,6 +130,11 @@ _tsgw._tcp.ts.example.org. 3600 IN SRV 0 0 7788 ts.example.org.
|
||||
; -> ws://ts.example.org:7788/v1, only for ts.example.org
|
||||
```
|
||||
|
||||
The record's service name must match what listens on the port: tsgw
|
||||
itself speaks plain WebSocket, so its own port (7788) is published as
|
||||
`_tsgw`; a `_tsgws` record there makes Voelin start TLS with it, which
|
||||
fails. Publish `_tsgws` only for a port with TLS in front.
|
||||
|
||||
One domain with several servers and several gateways: publish one record
|
||||
per server host (`_tsgws._tcp.ts1.example.org`, `_tsgws._tcp.ts2.example.org`);
|
||||
a record at the domain itself applies to every host below it that has none
|
||||
@@ -138,7 +154,7 @@ Discovery is as trustworthy as DNS and the network, like TSDNS: prefer a
|
||||
use one from a public CA (Caddy's automatic Let's Encrypt certificates
|
||||
work); the Android app cannot reach `wss://` gateways yet (it has no
|
||||
system store to read). A user logs in with
|
||||
their own identity, and only when they choose to observe the server.
|
||||
their own identity, when they select the server in Voelin.
|
||||
|
||||
## Install
|
||||
|
||||
@@ -187,9 +203,9 @@ docker run -v $PWD/tsgw.toml:/etc/tsgw/tsgw.toml -e TSGW_QUERY_PASSWORD=… -p 7
|
||||
Query clients are not hidden by the server; official clients hide them from
|
||||
users whose `i_client_serverquery_view_power` is below the query client's
|
||||
needed view power (100 by default). Server Admins, and third-party clients
|
||||
that ignore the rule, see the gateway's sessions. Relayed channels show the
|
||||
relay's posts under its own nickname (`Chat Relay <cid>`), so people in the
|
||||
channel can tell the messages come through the gateway.
|
||||
that ignore the rule, see the gateway's sessions. Relayed posts show the
|
||||
user's nickname, like a message the user wrote in TeamSpeak; whoever can see
|
||||
query clients sees that it came from a query session.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -241,7 +257,7 @@ you set here.
|
||||
| `auth.min_security_level` | `0` | On top of the server's own requirement |
|
||||
| `auth.token_ttl_hours` | `720` | Lifetime of login tokens |
|
||||
| `relay.nickname` | `"Chat Relay"` | Relay sessions are named `<nickname> <cid>`, the lookup session `<nickname> Gateway` |
|
||||
| `relay.format` | `"[{nick}] {text}"` | How posts appear in TeamSpeak |
|
||||
| `relay.format` | `"[{nick}] {text}"` | How posts appear when the relay cannot take the user's nickname |
|
||||
| `relay.idle_teardown_secs` | `120` | Close a relay this long after its last reader left |
|
||||
| `relay.max_channel_relays` | `6` | Concurrent relays (0: no limit) |
|
||||
| `relay.pinned_channels` | `[]` | Always relayed, so their history is complete |
|
||||
|
||||
+15
-7
@@ -384,7 +384,7 @@ off), the automatic order after it.
|
||||
|---|---|---|---|---|
|
||||
| libvpx | `vpx` (default) | VP8, VP9 | VP8, VP9 | system libvpx (1.14 tested), dynamically linked; bindings from `libvpx-native-sys` (pre-generated, no bindgen) |
|
||||
| OpenH264 | `openh264` (default) | H.264 Constrained High / Baseline | H.264 | Cisco's prebuilt binary, loaded at runtime |
|
||||
| dav1d | `av1` | – | AV1 | system libdav1d >= 1.3 (1.4.1 tested) |
|
||||
| dav1d | `av1` (default) | – | AV1 | system libdav1d >= 1.3 (1.4.1 tested); static from vcpkg (MSVC) and built in `docker/windows.Dockerfile` (MinGW) on Windows |
|
||||
| FFmpeg | `ffmpeg` (default; off on Android) | H.264, HEVC, AV1, VP9, VP8 in hardware; H.264 (x264, OpenH264), AV1 (SVT-AV1, libaom, rav1e) in software | AV1, HEVC, VP9, H.264, VP8 in hardware (VA-API, NVDEC, D3D11VA, DXVA2, VideoToolbox) and in software (dav1d, libaom, FFmpeg's own) | the system's (or `VOELIN_FFMPEG_DIR`'s) libavcodec / libavutil, any major version, loaded at runtime; see below |
|
||||
| MediaCodec (Android) | – | H.264, VP8, VP9 | VP8, VP9, H.264, AV1 | the device's default codec per type through the NDK (`ndk` crate); an encoder factory named `mediacodec` |
|
||||
|
||||
@@ -397,8 +397,10 @@ every build has).
|
||||
### FFmpeg encoders, loaded at runtime
|
||||
|
||||
`crate::ffmpeg` (feature `ffmpeg`) uses whatever FFmpeg is installed; it is
|
||||
never linked or shipped. Without it, or when a backend fails its self-test,
|
||||
the software encoders above are used as before.
|
||||
never linked. The Windows packages ship FFmpeg's LGPL DLLs next to
|
||||
`voelin.exe`; on Linux the packages depend on (or install, see
|
||||
`voelin-install-deps`) the distribution's. Without it, or when a backend
|
||||
fails its self-test, the software encoders above are used as before.
|
||||
|
||||
- Finding it: `VOELIN_FFMPEG_DIR` (only that directory; its libavutil and
|
||||
libswresample are loaded first so libavcodec's dependencies resolve
|
||||
@@ -652,7 +654,11 @@ on (`Video::set_decoder_preference`); a running watch keeps its decoder.
|
||||
thread before the first comes out), `threads` up to 8 in software and 1
|
||||
in hardware, dav1d's `max_frame_delay` 1 (`framethreads` 1 before FFmpeg
|
||||
5.0). Every frame's picture comes out of the call that decoded it, except
|
||||
what B-frames reorder.
|
||||
what B-frames reorder. VP8 decodes on one thread and dav1d on a quarter
|
||||
of the cores (1 to 4):
|
||||
FFmpeg's VP8 slice threads work on the token partitions and wait on each
|
||||
other, so our 4- and 8-partition streams decoded 40-80 % slower on four
|
||||
threads than on one ([research/stream-fps.md](research/stream-fps.md)).
|
||||
- The self-test (`ffmpeg::decoder::probe()`, once per process, every decoder
|
||||
on a thread of its own, at the same time as the encoders' probe in
|
||||
`Codecs::new()`): each decoder decodes a three-frame clip of its codec
|
||||
@@ -1329,8 +1335,10 @@ voelin-media, str0m, x11rb-protocol, pipewire, wayland-client, ...) with
|
||||
|
||||
Linux (Debian/Ubuntu packages): `libvpx-dev` (feature `vpx`),
|
||||
`libpipewire-0.3-dev libspa-0.2-dev libclang-dev` (feature `pipewire`; the
|
||||
PipeWire bindings run bindgen), `pkg-config`, and `libdav1d-dev` for
|
||||
`--features av1`. X11 capture is pure Rust (x11rb) and needs no packages.
|
||||
PipeWire bindings run bindgen), `pkg-config`, and `libdav1d-dev` (feature
|
||||
`av1`, on by default like every other codec backend: desktop builds always
|
||||
have every encoder and decoder voelin-media has). X11 capture is pure Rust
|
||||
(x11rb) and needs no packages.
|
||||
Tests of X11 capture need an X server: `xvfb`, run with `xvfb-run -a cargo
|
||||
test -p voelin-media` (skipped without `DISPLAY`). FFmpeg needs nothing at
|
||||
build time (feature `ffmpeg` only adds `libloading`); its tests run with the
|
||||
@@ -1364,7 +1372,7 @@ has not run on Windows yet.
|
||||
| `zune-jpeg`, `zune-core` | MIT OR Apache-2.0 OR Zlib | the studio's MJPEG cameras (`pipewire`) |
|
||||
| `tract-onnx`; PP-HumanSeg (ONNX model) | MIT OR Apache-2.0; Apache-2.0 | the studio's person segmentation (`segment`); the model is bundled |
|
||||
| `windows-capture`, `wasapi`, `windows` | MIT (`windows`: MIT OR Apache-2.0) | Windows only |
|
||||
| FFmpeg (libavcodec, libavutil, libavformat) | LGPL-2.1+ (GPL-2+ in builds with x264 and other GPL parts) | the user's installed libraries, loaded at runtime; never linked or shipped |
|
||||
| FFmpeg (libavcodec, libavutil, libavformat) | LGPL-2.1+ (GPL-2+ in builds with x264 and other GPL parts) | loaded at runtime, never linked: on Linux the distribution's libraries (the `.deb` recommends them, the `.tar.gz` has `voelin-install-deps`, the Flatpak runtime has its own); the Windows packages ship BtbN's LGPL shared build next to `voelin.exe` with its license and source pointer (`scripts/fetch-ffmpeg-windows.sh`) |
|
||||
| libva | MIT | the user's `libva.so.2` (the one FFmpeg's VA-API support uses), loaded at runtime for the GPU colour conversion; never linked or shipped |
|
||||
| `libloading` | ISC | opens FFmpeg (and OpenH264, through the `openh264` crate) |
|
||||
| `bzip2` / `libbz2-rs-sys` | MIT OR Apache-2.0 / bzip2-1.0.6 | unpacks the OpenH264 download; `bzip2-1.0.6` is allowed in `deny.toml` |
|
||||
|
||||
@@ -84,11 +84,43 @@ are stored together as a single `myts/session` item through the app's secret
|
||||
store, never in plaintext settings. Replacing one item prevents a partial write
|
||||
from mixing credentials from different accounts. The bundle also stores the
|
||||
account UUID, username and email, with backward-compatible defaults for older
|
||||
bundles. Startup validates a saved session before showing its profile as signed
|
||||
in. A valid session closes the login page; errors leave retry and manual sign-in
|
||||
available. Transport failures retain saved credentials. A locked keyring can be
|
||||
retried without restarting. Continue without an account dismisses the prompt
|
||||
for the current run and leaves server features available.
|
||||
bundles. With a saved session the login page does not open at all: startup
|
||||
validates the session in the background (Settings → My Account shows the saved
|
||||
profile as "Checking session…" meanwhile) and only an expired session brings
|
||||
the page back. Errors leave retry and manual sign-in available. Transport
|
||||
failures retain saved credentials. A locked keyring can be retried without
|
||||
restarting. Continue without an account dismisses the page and is remembered
|
||||
(`ui.skip_account_prompt`), so it does not ask at the next start; signing in
|
||||
clears that.
|
||||
|
||||
### Profile and avatar
|
||||
|
||||
After a sign-in or a validated saved session the app asks the user service,
|
||||
`https://clientapi.myteamspeak.com/user` (the route string is in the TS6
|
||||
client next to `/authentication` and `/session`), for `getAccountData` with the
|
||||
basic info, avatars, description, badges and authenticated devices, and shows
|
||||
them in Settings → My Account (and the avatar in the sidebar's profile when
|
||||
the server has none for us). An avatar's file name (the "online" one first)
|
||||
is its download link: it is fetched as it is with a plain GET, HTTPS only, at
|
||||
most 4 MiB, and kept in `<data>/account/avatar` for the next start; it is
|
||||
fetched again only when the name changes. The login response's own avatar
|
||||
file names and description are used until then. What is kept goes into the
|
||||
same secret-store bundle as the session (`profile`), never the token into a
|
||||
URL.
|
||||
|
||||
`requestAvatarSignedUrl` is not a download call: it signs *upload* links.
|
||||
In the TS6 6.0.0-beta4.1 Linux client, `Account_Manager_Impl::
|
||||
request_avatar_signed_urls`'s reply goes only to `upload_avatar`, whose
|
||||
upload (`Cloud_Sync_Impl::upload_avatar_to_intermediate_bucket`) is an
|
||||
`http_v2::Http_Client::put`, followed by `requestUploadAvatar`. The client's
|
||||
own avatar comes from `MyTeamSpeak::Account::request_own_myts_avatar`
|
||||
(0x1ae1a50): it parses the stored `AvatarData` and hands each map entry's
|
||||
state and name, unchanged, to `Avatar_Cache::request_avatar_from_urls`
|
||||
(0x12d6e20), which passes the name as the URL to `Http_Client::get` with an
|
||||
empty header list (0x12d78c1). An early Voelin fetched the signed link with
|
||||
a GET instead and was refused with HTTP 403 by the live service; a refused
|
||||
download is now logged as "avatar download returned HTTP …", apart from
|
||||
the account service's errors.
|
||||
|
||||
Sign-out returns to login, clears local account material and attempts remote
|
||||
session deletion; storage or remote errors are reported. A late completion
|
||||
@@ -131,7 +163,7 @@ The main account is shared by all voice connections. Each new connection signs
|
||||
its own challenge. Account changes cancel an unfinished handshake; connected
|
||||
clients send `updatemytsid`, and logout sends an empty myTS ID. Rejected or
|
||||
unanswered account updates disconnect rather than retaining a previous account
|
||||
association. Cloud avatar retrieval is outside this branch.
|
||||
association.
|
||||
|
||||
Static TS3 evidence in the binary identified above: proof helper `0x1018580`,
|
||||
`clientinit` invocation `0x1020c3b`, live update `0x1049659`, scalar signing
|
||||
@@ -163,7 +195,11 @@ sizes using synthetic account data.
|
||||
### Client reporting
|
||||
|
||||
The voice engine chooses an unchanged signed compatibility tuple for the
|
||||
actual operating system. A bookmark's explicit compatibility-version override
|
||||
actual operating system: the newest TeamSpeak 6 client build signed for it
|
||||
(`6.0.0-beta4.1 [Build: 1779880475]` on Linux, captured from the official
|
||||
Linux client's `clientinit`; `6.0.0-beta2` on Windows, from upstream
|
||||
tsdeclarations), else the generic `3.?.? [Build: 5680278000]`. Every row of
|
||||
`Versions.csv` verifies against TeamSpeak's version-signing key. A bookmark's explicit compatibility-version override
|
||||
is honored and validated. `client_meta_data` identifies `Voelin`, its package
|
||||
version and native OS. The CLI uses the same catalogue and native default.
|
||||
TeamSpeak signs compatibility versions: replacing the signed version with an
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# Why watched streams played at a low frame rate
|
||||
|
||||
Watching a TeamSpeak 6 stream (someone's screen share in the viewer) showed
|
||||
fewer frames than were sent, with freezes until the next keyframe. This
|
||||
note records what was measured, what changed, and what is left.
|
||||
|
||||
## Measurements
|
||||
|
||||
On a 4-core 2.1 GHz VM (one core busy with another build for part of the
|
||||
runs), with the app's own code: a 2560x1440 stream at 60 fps and about
|
||||
25 Mbit/s, encoded by `VpxEncoder` from synthetic content (moving gradients,
|
||||
a scrolling text-like area), fed to the viewer's decode loop in real time
|
||||
with the same queue rules as `decode_loop`.
|
||||
|
||||
| Stream (VP8 token partitions) | Decode per picture | Shown | Freezes in 10 s |
|
||||
|---|---|---|---|
|
||||
| 4 or 8 (a sender with 6 cores or more) | 18-21 ms | 35-49 of 60 fps | 2-3 queue drops, 34-167 frames skipped waiting for a keyframe |
|
||||
| 1 or 2 | 10.0-10.5 ms | 60 of 60 fps | none |
|
||||
|
||||
FFmpeg's command line on the same streams: `vp8` on 1 thread 95-101 fps, on
|
||||
4 slice threads (what the viewer used) 54-60 fps; libvpx on 4 threads 23 and
|
||||
11 fps on the 4- and 8-partition streams, on 2 threads 143 and 129. On clean
|
||||
1080p test clips, 4 partitions decode at 290 fps on one thread and 47-74 fps
|
||||
on 3-4 slice threads.
|
||||
|
||||
Handing a picture to the window (`video.rs`, a new zeroed `SharedPixelBuffer`
|
||||
and the I420 to RGBA conversion, on the decode thread):
|
||||
|
||||
| Size | New buffer + convert | Reused buffer + convert |
|
||||
|---|---|---|
|
||||
| 1920x1080 | 3.0-3.6 ms | 0.6-0.8 ms |
|
||||
| 2560x1440 | 5.1 ms | 1.0 ms |
|
||||
| 3840x2160 | 12.4-12.8 ms | 2.4-2.5 ms |
|
||||
|
||||
## Causes and what changed
|
||||
|
||||
1. **FFmpeg's VP8 decoder on slice threads** (the main cause). Every software
|
||||
decoder got all cores (up to 8) as slice threads. VP8's slice threads work
|
||||
on the frame's token partitions, and Voelin's VP8 senders use 4 (6-8
|
||||
cores) or 8 (9 or more) partitions, so the threads wait on each other and
|
||||
one 1440p picture took 18-21 ms: the decoder could not keep 60 fps, fell
|
||||
30 frames behind, dropped its queue and skipped everything until the next
|
||||
keyframe. FFmpeg's `vp8` comes before libvpx in the ladder, and Windows
|
||||
(and AMD under VA-API) have no VP8 hardware decoder, so most viewers took
|
||||
this path. **Now** VP8 decodes on one thread (`ffmpeg::decoder::decoder_threads`).
|
||||
2. **The picture's conversion on the decode thread.** Every decoded picture
|
||||
was converted to RGBA on the decode thread, into a new zeroed buffer, even
|
||||
when the window would only show the newest. **Now** the decoder hands its
|
||||
newest frame to a converter thread (`video.rs`, `deliver`), which converts
|
||||
only what can be shown, into buffers reused three pictures later (a buffer
|
||||
the window still holds copies itself first).
|
||||
3. **libvpx's decoder threads** spin waiting for each other and collapse when
|
||||
another core is busy (the fallback without FFmpeg, e.g. Windows without its
|
||||
FFmpeg libraries). **Now** at most 2 threads (`codec/vpx.rs`).
|
||||
4. **dav1d** with a frame delay of one is slower on 3-4 threads (155-166 fps)
|
||||
than on one (211 fps) on this 4-core machine, while 8 threads on a
|
||||
32-core one gave 412 fps at 1440p. **Now** a quarter of the cores, 1 to 4
|
||||
(`codec::dav1d_threads`, for our dav1d and FFmpeg's `libdav1d`).
|
||||
|
||||
## Left as they are
|
||||
|
||||
- **The sender.** The software VP8 encoder took 18-29 ms per 1440p frame on
|
||||
this machine, so a similar sender tops out at 35-55 fps; frames beyond that
|
||||
are dropped before encoding. The automatic bitrate is 0.12 bits per pixel
|
||||
per frame (27 Mbit/s at 1440p60); about 0.07 would suit screen content and
|
||||
decode faster. Showing the sender's encode rate next to the viewer's decode
|
||||
rate would tell the two apart.
|
||||
- **H.264 with one slice per frame** (the official client's AMF streams):
|
||||
slice threads give nothing (about 180 fps either way); frame threads give
|
||||
336-423 fps but add a frame of delay per thread, and the decoder self-test
|
||||
expects a picture from every frame at once.
|
||||
- **The window's texture upload.** The image has no cache key, so the
|
||||
renderer uploads a new full-size texture per frame (not measured, no GPU
|
||||
here).
|
||||
- **Lossy links.** str0m waits up to 30 complete frames for a lost packet
|
||||
before the frame is handed over as non-contiguous, and VP8/VP9/AV1 then
|
||||
wait for a keyframe (asked for at most every 500 ms).
|
||||
|
||||
The measuring harnesses were throwaway programs around `voelin-media`'s
|
||||
`VpxEncoder` and decoders and FFmpeg's command line; they are not part of the
|
||||
repository.
|
||||
+31
-16
@@ -192,12 +192,20 @@ Settings sections (`settings:<section>`):
|
||||
Settings controls read and write `voelin_core::settings` and apply at once;
|
||||
numbers are typed freely next to the presets.
|
||||
|
||||
Desktop startup shows the shared myTeamSpeak login page until a saved session
|
||||
is validated, a login succeeds, or the user chooses Continue without an account.
|
||||
The signed-in username/email becomes the primary app profile in the desktop
|
||||
user card and mobile You page; it does not replace server identities or bookmark
|
||||
nicknames. Settings → My Account reuses the form, supports retry/OTP/sign-out,
|
||||
and opens official browser flows for registration, activation, recovery and
|
||||
Desktop startup shows the myTeamSpeak login page (`LoginPage` in
|
||||
`screens/account.slint`: the artwork and what an account gives beside the
|
||||
form on wide windows, the form alone on narrow ones; email, password with a
|
||||
show button, the one-time code when asked, Sign in, password recovery and
|
||||
registration on the website) only when no session is saved and Continue
|
||||
without an account was never chosen (`ui.skip_account_prompt`). A saved
|
||||
session is checked in the background; only an expired one brings the page
|
||||
back. The signed-in username/email and the account's avatar become the
|
||||
primary app profile in the desktop user card and mobile You page; they do
|
||||
not replace server identities or bookmark nicknames. Settings → My Account
|
||||
shows the profile from the account service (avatar, name, email,
|
||||
description, member since, previous sign-in, badges, signed-in devices, the
|
||||
account and myTS ids) or the sign-in form, supports retry/OTP/sign-out, and
|
||||
opens official browser flows for registration, activation, recovery and
|
||||
account management. Account and renewal material live only in the keyring;
|
||||
passwords and one-time codes are cleared after submission. Expired sessions
|
||||
require fresh sign-in because password login supplies no renewal auth token.
|
||||
@@ -276,16 +284,23 @@ with the sample studio's sources, live at once with sample viewers.
|
||||
The add-server dialog (`BookmarkDialog` in `screens/dialogs.slint`, logic in
|
||||
`servers.rs`) asks for the address (host, host:port, IP or server
|
||||
nickname; the resolver finds the port through SRV records and TSDNS) and
|
||||
an optional server password. *Advanced* (open when editing) has the rest,
|
||||
and empty fields there are filled in: the name is the address until the
|
||||
first connection, then the server's own name (`adopt_server_name`); the
|
||||
nickname is the default identity's (one imported from TeamSpeak keeps its
|
||||
nickname there), else the system user's, else "Voelin user"; the identity is the default one,
|
||||
there is no default channel; the gateway is looked up in DNS when the
|
||||
server is saved without one and when it connects
|
||||
([gateway-admin.md](gateway-admin.md#letting-voelin-find-the-gateway)),
|
||||
and one found is stored as if typed. `bookmark` and `bookmark:edit` open
|
||||
it (below).
|
||||
an optional server password. *Advanced* (open when editing) has the name
|
||||
and the nickname, and empty fields there are filled in: the name is the
|
||||
address until the first connection, then the server's own name
|
||||
(`adopt_server_name`); the nickname is the default identity's (one imported
|
||||
from TeamSpeak keeps its nickname there), else the system user's, else
|
||||
"Voelin user"; the identity is the default one, there is no default channel.
|
||||
There are no gateway or ServerQuery fields: the gateway is looked up from
|
||||
the address (DNS SRV records, else the gateway's `/.well-known/tsgw`) when
|
||||
the server is saved, selected or connected
|
||||
([gateway-admin.md](gateway-admin.md#letting-voelin-find-the-gateway)), one
|
||||
found is stored, and a new address looks again. `bookmark` and
|
||||
`bookmark:edit` open it (below).
|
||||
|
||||
Selecting a server observes it invisibly through its gateway (or a query
|
||||
login an older version stored), so its channels, members and chats show
|
||||
without joining; there is no Observe button. Without a gateway, observing
|
||||
starts once one is found.
|
||||
|
||||
Settings → Profiles (`ProfilesSection` in `screens/settings-pages.slint`;
|
||||
`settings_pages.rs`, and `identities.rs` for the default and the import
|
||||
|
||||
@@ -37,9 +37,6 @@ build-options:
|
||||
env:
|
||||
CARGO_HOME: /run/build/voelin/cargo
|
||||
CARGO_NET_OFFLINE: "true"
|
||||
# flatpak-builder does not inherit Cargo settings from the outer job.
|
||||
CARGO_BUILD_JOBS: "1"
|
||||
CARGO_INCREMENTAL: "0"
|
||||
LIBCLANG_PATH: /usr/lib/sdk/llvm20/lib
|
||||
|
||||
modules:
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# Install what Voelin loads at run time from the system, for the .tar.gz
|
||||
# (the .deb and the Flatpak get them on their own): FFmpeg (hardware and
|
||||
# extra encoders and decoders), VA-API drivers, PipeWire and the desktop
|
||||
# portal (screen sharing, push-to-talk on Wayland), the Secret Service
|
||||
# (saved passwords). libvpx and libdav1d come with the archive (lib/).
|
||||
#
|
||||
# voelin-install-deps [--dry-run]
|
||||
#
|
||||
# Uses apt, dnf, pacman or zypper through sudo (unless run as root).
|
||||
set -eu
|
||||
|
||||
dry=
|
||||
[ "${1:-}" = "--dry-run" ] && dry=echo
|
||||
sudo=
|
||||
[ "$(id -u)" -eq 0 ] || sudo=sudo
|
||||
|
||||
run() {
|
||||
echo "+ $*"
|
||||
[ -n "$dry" ] || $sudo "$@"
|
||||
}
|
||||
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
# ffmpeg pulls in the libav* libraries of the release.
|
||||
run apt-get update
|
||||
run apt-get install -y ffmpeg libva2 libva-drm2 mesa-va-drivers pipewire xdg-desktop-portal \
|
||||
gnome-keyring libegl1 libxkbcommon-x11-0
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
# Fedora's ffmpeg-free; RPM Fusion's ffmpeg adds H.264/HEVC encoders.
|
||||
run dnf install -y ffmpeg-free libva mesa-va-drivers pipewire xdg-desktop-portal gnome-keyring \
|
||||
libxkbcommon-x11
|
||||
elif command -v pacman >/dev/null 2>&1; then
|
||||
run pacman -S --needed --noconfirm ffmpeg libva mesa pipewire xdg-desktop-portal gnome-keyring \
|
||||
libxkbcommon-x11
|
||||
elif command -v zypper >/dev/null 2>&1; then
|
||||
run zypper --non-interactive install ffmpeg libva2 Mesa-dri pipewire xdg-desktop-portal \
|
||||
gnome-keyring libxkbcommon-x11-0
|
||||
else
|
||||
echo "No apt, dnf, pacman or zypper: install FFmpeg (libavcodec), VA-API drivers," >&2
|
||||
echo "PipeWire, xdg-desktop-portal and a Secret Service keyring with your package manager." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -11,22 +11,36 @@ is for servers and packaged for Linux only.
|
||||
## Build
|
||||
|
||||
Needs the MSVC build tools, CMake (bundled libopus), NASM (assembly of
|
||||
`aws-lc-sys`, used by the WebRTC stack) and libvpx (video, `voelin-media`):
|
||||
`aws-lc-sys`, used by the WebRTC stack), libvpx (VP8/VP9) and dav1d (AV1
|
||||
decoding), both for `voelin-media`:
|
||||
|
||||
```powershell
|
||||
winget install NASM.NASM Kitware.CMake NSIS.NSIS
|
||||
vcpkg install libvpx:x64-windows-static-md
|
||||
vcpkg install libvpx:x64-windows-static-md dav1d:x64-windows-static-md
|
||||
|
||||
$vpx = "$env:VCPKG_ROOT\installed\x64-windows-static-md"
|
||||
$env:VPX_LIB_DIR = "$vpx\lib"
|
||||
$env:VPX_INCLUDE_DIR = "$vpx\include"
|
||||
$env:VPX_VERSION = "1.15.2" # what `vcpkg list libvpx` shows
|
||||
$env:VPX_STATIC = "1"
|
||||
# dav1d-sys through system-deps, without pkg-config.
|
||||
$env:SYSTEM_DEPS_DAV1D_NO_PKG_CONFIG = "1"
|
||||
$env:SYSTEM_DEPS_DAV1D_SEARCH_NATIVE = "$vpx\lib"
|
||||
$env:SYSTEM_DEPS_DAV1D_LIB = "dav1d"
|
||||
$env:SYSTEM_DEPS_DAV1D_LINK = "static"
|
||||
|
||||
cargo build --release --locked -p voelin-ui
|
||||
makensis /DVERSION=0.1.0 packaging\windows\installer.nsi
|
||||
bash scripts/fetch-ffmpeg-windows.sh ffmpeg
|
||||
makensis /DVERSION=0.1.0 /DFFMPEG=..\..\ffmpeg packaging\windows\installer.nsi
|
||||
```
|
||||
|
||||
FFmpeg (hardware encoders and decoders, H.265, more AV1 decoders) is not
|
||||
linked: the app loads `avcodec-*.dll` and `avutil-*.dll` from its own
|
||||
directory, then `PATH`. The packages carry BtbN's LGPL build of FFmpeg 8.1
|
||||
(`scripts/fetch-ffmpeg-windows.sh`, with `FFMPEG-LICENSE.txt` and
|
||||
`FFMPEG-README.txt` naming the build and its source); replacing the DLLs
|
||||
with another build of the same major versions works.
|
||||
|
||||
This gives `target\release\voelin.exe` and
|
||||
`packaging\windows\voelin-0.1.0-setup.exe`. The installer puts the app in
|
||||
`Program Files\Voelin`, adds a Start menu shortcut and an uninstaller; user
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
; for the numeric file version (default: VERSION)
|
||||
; BINARY the executable (default ..\..\target\release\voelin.exe)
|
||||
; OUTDIR where the installer goes (default: next to this file)
|
||||
; FFMPEG a directory with FFmpeg's DLLs and FFMPEG-*.txt
|
||||
; (scripts/fetch-ffmpeg-windows.sh), installed next to the app
|
||||
; SIGN a signing command; "%1" is replaced by the file to sign, e.g.
|
||||
; /DSIGN="signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /a %1"
|
||||
;
|
||||
@@ -67,6 +69,11 @@ Section "Install"
|
||||
File "/oname=${EXE}" "${BINARY}"
|
||||
; Also shown in the app's About page.
|
||||
File "/oname=THIRD_PARTY_NOTICES.md" "..\..\THIRD_PARTY_NOTICES.md"
|
||||
!ifdef FFMPEG
|
||||
; FFmpeg's DLLs, loaded from the app's directory, and their license.
|
||||
File "${FFMPEG}\*.dll"
|
||||
File "${FFMPEG}\FFMPEG-*.txt"
|
||||
!endif
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
CreateShortcut "$SMPROGRAMS\${APP_NAME}.lnk" "$INSTDIR\${EXE}"
|
||||
@@ -86,6 +93,9 @@ Section "Uninstall"
|
||||
; User data in %APPDATA%\voelin (identities, bookmarks, history) is kept.
|
||||
Delete "$INSTDIR\${EXE}"
|
||||
Delete "$INSTDIR\THIRD_PARTY_NOTICES.md"
|
||||
Delete "$INSTDIR\av*.dll"
|
||||
Delete "$INSTDIR\sw*.dll"
|
||||
Delete "$INSTDIR\FFMPEG-*.txt"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
Delete "$SMPROGRAMS\${APP_NAME}.lnk"
|
||||
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
# FFmpeg's shared libraries for the Windows packages: BtbN's LGPL build
|
||||
# (no GPL parts: no x264, x265), whose DLLs the app loads at run time from
|
||||
# its own directory (crates/voelin-media/src/ffmpeg/sys.rs). Without them a
|
||||
# Windows install has no FFmpeg, so no hardware encoders and decoders.
|
||||
#
|
||||
# scripts/fetch-ffmpeg-windows.sh <out-dir>
|
||||
#
|
||||
# Puts avcodec, avformat, avutil, swresample and swscale DLLs, FFmpeg's
|
||||
# LICENSE.txt as FFMPEG-LICENSE.txt and FFMPEG-README.txt (version, source)
|
||||
# into <out-dir>; scripts/package.sh windows ships them with FFMPEG_DLL_DIR.
|
||||
# The archive is checked against the release's checksums.
|
||||
#
|
||||
# Environment:
|
||||
# FFMPEG_BRANCH FFmpeg release branch (default 8.1: libavcodec 62, which
|
||||
# voelin-media's loader and struct layouts support)
|
||||
# FFMPEG_TAG BtbN release tag (default latest, rebuilt daily; set an
|
||||
# autobuild-YYYY-MM-DD-HH-MM tag to pin a build)
|
||||
set -euo pipefail
|
||||
|
||||
out=${1:?usage: $0 <out-dir>}
|
||||
branch=${FFMPEG_BRANCH:-8.1}
|
||||
tag=${FFMPEG_TAG:-latest}
|
||||
name=ffmpeg-n$branch-latest-win64-lgpl-shared-$branch
|
||||
base=https://github.com/BtbN/FFmpeg-Builds/releases/download/$tag
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
curl -sSfL --retry 4 -o "$tmp/$name.zip" "$base/$name.zip"
|
||||
curl -sSfL --retry 4 -o "$tmp/checksums.sha256" "$base/checksums.sha256"
|
||||
expected=$(awk -v file="$name.zip" '$2 == file { print $1 }' "$tmp/checksums.sha256")
|
||||
[[ -n $expected ]] || { echo "$name.zip is not in the release's checksums" >&2; exit 1; }
|
||||
actual=$(sha256sum "$tmp/$name.zip" | cut -d' ' -f1)
|
||||
[[ $actual == "$expected" ]] || { echo "checksum mismatch for $name.zip" >&2; exit 1; }
|
||||
|
||||
mkdir -p "$out"
|
||||
# unzip, else 7-Zip or Python (Windows runners' Git Bash may lack unzip).
|
||||
if command -v unzip >/dev/null; then
|
||||
(cd "$tmp" && unzip -q "$name.zip")
|
||||
elif command -v 7z >/dev/null; then
|
||||
(cd "$tmp" && 7z x -bso0 "$name.zip")
|
||||
else
|
||||
(cd "$tmp" && "$(command -v python3 || command -v python)" -m zipfile -e "$name.zip" .)
|
||||
fi
|
||||
dlls=()
|
||||
for lib in avcodec avformat avutil swresample swscale; do
|
||||
found=("$tmp/$name/bin/$lib"-*.dll)
|
||||
[[ -e ${found[0]} ]] || { echo "no $lib DLL in $name.zip" >&2; exit 1; }
|
||||
cp "${found[@]}" "$out/"
|
||||
dlls+=("$(basename "${found[0]}")")
|
||||
done
|
||||
cp "$tmp/$name/LICENSE.txt" "$out/FFMPEG-LICENSE.txt"
|
||||
cat >"$out/FFMPEG-README.txt" <<EOF
|
||||
FFmpeg $branch (LGPL-2.1-or-later), shared libraries: ${dlls[*]}
|
||||
|
||||
Built by https://github.com/BtbN/FFmpeg-Builds ($name.zip, release $tag,
|
||||
SHA-256 $actual). FFmpeg's source: https://ffmpeg.org/download.html and
|
||||
https://git.ffmpeg.org/ffmpeg.git (branch release/$branch); the build scripts
|
||||
and the exact versions of every library in the build are in the
|
||||
FFmpeg-Builds repository. Voelin loads these DLLs at run time; replace them
|
||||
with your own build of the same major versions to use another FFmpeg.
|
||||
EOF
|
||||
printf '%s\n' "${dlls[@]/#/$out/}"
|
||||
+41
-4
@@ -21,6 +21,13 @@
|
||||
# x86_64-pc-windows-gnu (default: none, target/release)
|
||||
# MAKENSIS the NSIS compiler (default: makensis on PATH, then the
|
||||
# default install location on Windows)
|
||||
# FFMPEG_DLL_DIR FFmpeg's DLLs for the Windows packages, from
|
||||
# scripts/fetch-ffmpeg-windows.sh (default: none; the
|
||||
# packages then have no FFmpeg)
|
||||
#
|
||||
# The Linux .tar.gz carries libvpx and libdav1d (lib/, found through the
|
||||
# binary's RUNPATH, set with patchelf) and bin/voelin-install-deps for what
|
||||
# the system provides; the .deb depends on and recommends the system's.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
@@ -83,6 +90,25 @@ make_deb() {
|
||||
files+=("${pkg}_${ver}_$deb_arch.deb")
|
||||
}
|
||||
|
||||
# Libraries of <exe> whose sonames differ between distributions (libvpx 7
|
||||
# to 11, libdav1d 6 and 7), copied into <dir>; <exe> then finds them there
|
||||
# (RUNPATH $ORIGIN/../lib) and the system's other libraries as usual.
|
||||
bundle_libs() {
|
||||
local exe=$1 dir=$2 lib path
|
||||
if ! command -v patchelf >/dev/null; then
|
||||
echo "patchelf not found: the .tar.gz uses the system's libvpx and libdav1d" >&2
|
||||
return
|
||||
fi
|
||||
mkdir -p "$dir"
|
||||
while read -r lib path; do
|
||||
case $lib in
|
||||
libvpx.so.* | libdav1d.so.*) install -m644 "$path" "$dir/$lib" ;;
|
||||
esac
|
||||
done < <(ldd "$exe" | awk '$2 == "=>" && $3 ~ /^\// { print $1, $3 }')
|
||||
# shellcheck disable=SC2016 # $ORIGIN is for the dynamic linker.
|
||||
patchelf --set-rpath '$ORIGIN/../lib' "$exe"
|
||||
}
|
||||
|
||||
package_linux() {
|
||||
local bin=$target_dir/release arch name stage root gw_version
|
||||
arch=$(uname -m)
|
||||
@@ -92,11 +118,12 @@ package_linux() {
|
||||
# `tar -xzf … --strip-components=1 -C ~/.local`.
|
||||
name=voelin-$version-linux-$arch
|
||||
stage=$tmp/$name
|
||||
install -Dm755 "$bin/voelin" -t "$stage/bin"
|
||||
install -Dm755 "$bin/voelin" packaging/linux/voelin-install-deps -t "$stage/bin"
|
||||
install -Dm644 packaging/linux/$app_id.desktop -t "$stage/share/applications"
|
||||
install -Dm644 packaging/linux/$app_id.metainfo.xml -t "$stage/share/metainfo"
|
||||
install -Dm644 packaging/linux/$app_id.svg -t "$stage/share/icons/hicolor/scalable/apps"
|
||||
install -Dm644 THIRD_PARTY_NOTICES.md -t "$stage/share/doc/voelin"
|
||||
bundle_libs "$stage/bin/voelin" "$stage/lib"
|
||||
tar -C "$tmp" -czf "$out/$name.tar.gz" "$name"
|
||||
files+=("$name.tar.gz")
|
||||
|
||||
@@ -118,8 +145,10 @@ package_linux() {
|
||||
install -Dm644 packaging/linux/$app_id.svg -t "$root/usr/share/icons/hicolor/scalable/apps"
|
||||
install -Dm644 THIRD_PARTY_NOTICES.md -t "$root/usr/share/doc/voelin"
|
||||
# libxkbcommon, Wayland/X11 and EGL are loaded at run time (dlopen), so
|
||||
# dpkg-shlibdeps cannot see them.
|
||||
deb_extra="Recommends: libwayland-client0, libwayland-cursor0, libxkbcommon-x11-0, libx11-xcb1, libxcursor1, libxi6, libxrandr2, libegl1" \
|
||||
# dpkg-shlibdeps cannot see them; neither FFmpeg (hardware and extra
|
||||
# encoders and decoders) and libva (GPU colour conversion), nor what
|
||||
# screen sharing, Wayland hotkeys and saved passwords talk to.
|
||||
deb_extra="Recommends: libwayland-client0, libwayland-cursor0, libxkbcommon-x11-0, libx11-xcb1, libxcursor1, libxi6, libxrandr2, libegl1, libavcodec61 | libavcodec60 | libavcodec59 | libavcodec-extra, libavformat61 | libavformat60 | libavformat59, libva2, libva-drm2, mesa-va-drivers | va-driver-all | intel-media-va-driver, pipewire, xdg-desktop-portal, gnome-keyring | kwalletmanager | keepassxc" \
|
||||
make_deb voelin "$version" libxkbcommon0 \
|
||||
"Voelin, a TeamSpeak 3 and 6 client" \
|
||||
"Desktop client for TeamSpeak 3 and TeamSpeak 6 servers: voice, chat," \
|
||||
@@ -149,6 +178,14 @@ package_windows() {
|
||||
stage=$tmp/$name
|
||||
mkdir -p "$stage"
|
||||
cp "$bin/voelin.exe" THIRD_PARTY_NOTICES.md "$stage/"
|
||||
# FFmpeg's DLLs next to voelin.exe, where the app looks for them first.
|
||||
local ffmpeg=()
|
||||
if [[ -n ${FFMPEG_DLL_DIR:-} ]]; then
|
||||
cp "$FFMPEG_DLL_DIR"/*.dll "$FFMPEG_DLL_DIR"/FFMPEG-*.txt "$stage/"
|
||||
ffmpeg=(-DFFMPEG="$(native_path "$(cd "$FFMPEG_DLL_DIR" && pwd)")")
|
||||
else
|
||||
echo "FFMPEG_DLL_DIR not set: the Windows packages have no FFmpeg" >&2
|
||||
fi
|
||||
if command -v zip >/dev/null; then
|
||||
(cd "$tmp" && zip -qr "$out/$name.zip" "$name")
|
||||
elif command -v 7z >/dev/null; then
|
||||
@@ -169,7 +206,7 @@ package_windows() {
|
||||
fi
|
||||
# Absolute paths: makensis changes into the script's directory.
|
||||
"$makensis" -V2 -DVERSION="$version" -DVERSION_NUMERIC="${version%%-*}" \
|
||||
-DOUTDIR="$(native_path "$out")" \
|
||||
-DOUTDIR="$(native_path "$out")" "${ffmpeg[@]}" \
|
||||
-DBINARY="$(native_path "$(cd "$bin" && pwd)/voelin.exe")" packaging/windows/installer.nsi
|
||||
files+=("voelin-$version-setup.exe")
|
||||
}
|
||||
|
||||
@@ -134,7 +134,8 @@ pub struct ConnectArgs {
|
||||
/// Identity file. Without it a temporary identity is generated.
|
||||
#[arg(long, env = "VOELINCTL_IDENTITY")]
|
||||
identity: Option<PathBuf>,
|
||||
/// Signed client version: `default`, an index or `<platform>@<version>` from `voelinctl versions`.
|
||||
/// Signed client version: `default` (the newest signed 6.x build of this OS), `generic`
|
||||
/// (3.?.?), an index or `<platform>@<version>` from `voelinctl versions`.
|
||||
#[arg(long, default_value = "default")]
|
||||
client_version: String,
|
||||
/// Server password.
|
||||
|
||||
Reference in new issue
Block a user