Settings shows the audio decoder; release builds get its version right (#251)

- Settings > About lists nobilis's audio decoder (libopus and its
  version), from the daemon's version answer.
- The daemon build scripts run cargo from inside nobilis/, so its
  .cargo/config.toml - which names the bundled libopus's version - applies.
- libopus_sys's build does not rerun for that setting, so a kept target
  directory (here, or CI's cache restored by prefix) would keep a bundled
  libopus that calls itself "unknown". After building, each script looks
  for that string in the daemon and rebuilds just libopus_sys if it is
  there. Seen working on the first run: the Windows daemon was stale and
  now reports libopus 1.5.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-04 15:34:31 -04:00
co-authored by Claude Opus 5.5
parent a0e9445991
commit 1782558f52
4 changed files with 32 additions and 3 deletions
+1 -1
Submodule nobilis updated: 9eeab7e5d2...8eca16e175
+10
View File
@@ -22,10 +22,20 @@ MANIFEST="$SRC_DIR/nobilis/Cargo.toml"
. "$SRC_DIR/scripts/find-cargo.sh"
echo "building the Windows daemon with $CARGO"
# From inside nobilis/, for its .cargo/config.toml - see build-daemon.sh.
cd "$SRC_DIR/nobilis"
# --locked: see build-daemon.sh.
"$CARGO" build --release --locked --target "$TARGET" --manifest-path "$MANIFEST"
BUILT="$SRC_DIR/nobilis/target/$TARGET/release/nobilis.exe"
# The Windows build always bundles libopus; see build-daemon.sh for why a kept
# target directory can leave it calling itself "unknown".
if [ -f "$BUILT" ] && grep -aq 'libopus unknown' "$BUILT"; then
echo "the bundled libopus does not know its version - building it again"
"$CARGO" clean --release --target "$TARGET" -p libopus_sys --manifest-path "$MANIFEST"
"$CARGO" build --release --locked --target "$TARGET" --manifest-path "$MANIFEST"
fi
WANTED="$SRC_DIR/nobilis/target/release/nobilis.exe"
# Not merely "did cargo exit 0": a build that fails after having produced an
+15
View File
@@ -9,6 +9,21 @@ SRC_DIR="$(cd "$(dirname "$0")/.." && pwd)"
. "$SRC_DIR/scripts/find-cargo.sh"
echo "building the daemon with $CARGO"
# From inside nobilis/: cargo reads .cargo/config.toml from the directory it
# runs in, not from the manifest's, and nobilis's names the version a bundled
# libopus reports (#251).
cd "$SRC_DIR/nobilis"
# --locked: build exactly what Cargo.lock names, and fail rather than quietly
# re-resolve and rewrite it when Cargo.toml and the lockfile disagree.
"$CARGO" build --release --locked --manifest-path "$SRC_DIR/nobilis/Cargo.toml"
# A bundled libopus built before .cargo/config.toml named its version still
# says "unknown", and its build script does not rerun for that setting - so a
# kept target directory (here, or CI's cache) would ship "unknown" for good.
# Only that crate is built again, and only when it happened. A daemon linked
# to the system's libopus does not contain the string at all.
if grep -aq 'libopus unknown' "$SRC_DIR/nobilis/target/release/nobilis"; then
echo "the bundled libopus does not know its version - building it again"
"$CARGO" clean --release -p libopus_sys --manifest-path "$SRC_DIR/nobilis/Cargo.toml"
"$CARGO" build --release --locked --manifest-path "$SRC_DIR/nobilis/Cargo.toml"
fi
@@ -1124,12 +1124,12 @@ function AboutSettings(): JSX.Element {
const store = useStore()
const linkUp = useChat((s) => s.linkUp)
const [status, setStatus] = useState<{ binaryPath: string; available: boolean } | null>(null)
const [daemon, setDaemon] = useState<{ version: string; commit: string } | null>(null)
const [daemon, setDaemon] = useState<{ version: string; commit: string; opus?: string } | null>(null)
useEffect(() => {
void window.moho.daemonStatus().then(setStatus)
void window.moho
.rpc<{ version: string; commit: string }>('version')
.rpc<{ version: string; commit: string; opus?: string }>('version')
.then(setDaemon)
// A daemon too old to answer cannot say - which is itself the useful
// answer, since it means the two are out of step.
@@ -1150,6 +1150,10 @@ function AboutSettings(): JSX.Element {
>
<BuildRow label="Version" value={daemon?.version ?? (linkUp ? 'not reported' : '\u2014')} />
<BuildRow label="Build" value={daemon?.commit ?? (linkUp ? 'older than this client' : '\u2014')} />
{/* The C library that decodes every Discord voice packet and
soundboard sound (#251): what a report about audio needs to name,
and what to compare against libopus's own advisories. */}
<BuildRow label="Audio decoder" value={daemon?.opus ?? (linkUp ? 'not reported' : '\u2014')} />
<div className="setting-row">
<div className="setting-text">
<div>Status</div>