Files
regent/meson.build
raucao ca7ba5d8d7 Show identity keys in one style, and verify NIP-05 before showing it
Every key in the app is now the same kind of thing: `plain::key` /
`.key-value` renders it in the monospace font at the size the label already
has, as a fixed `head…tail` cut, so a column of them lines up. Deliberately
not libadwaita's `.monospace`, which also switches to the code size and, on an
`AdwActionRow`, takes the field name with it. The identities list shows the
name over the key alone (it used to be "Profile · npub" on one line, where a
long profile name ate the key's tail), and the switcher keeps its own shorter
npub cut and renders it at `.caption`: a key is never body-sized there, and the
row's bold *name* stays the loudest thing in it.

The switcher's second line prefers a NIP-05 address — but only one the domain
has confirmed for exactly this key, because a kind-0's `nip05` is
self-declared and that line is where an identity is identified.
`store::nip05` parses the address strictly (it becomes an HTTPS request, so a
sloppy parse would be an SSRF), asks
`https://<domain>/.well-known/nostr.json?name=<local>` through the icons'
hardened fetch — now split into `fetch_https(url, Content)`, the app's single
HTTP path — and shows the address only while `nip05_ok == nip05`. A
re-declared or forged address is unverified again immediately, a slow answer
for a changed one is dropped, and a failed check costs a day.

Names are no longer invented: no "Identity 3" and no "Imported 1". The create
dialog starts empty, import carries a Name field that is prefilled from a
cached profile as soon as the pasted string decodes to a key, and an empty
field stores no label at all. A discovered profile name trumps the label for
display (`identity_label`), which is what happens for a key imported before
its profile was known — the label itself is never overwritten.
2026-11-29 16:33:53 +04:00

97 lines
3.1 KiB
Meson

project('regent', 'rust',
version: '0.1.0',
license: 'Unlicense',
meson_version: '>= 1.1',
)
gnome = import('gnome')
cargo = find_program('cargo')
blueprint_compiler = find_program('blueprint-compiler')
# A development/nightly build is a separate application identity, per the GNOME
# convention: the app id carries a `.Devel` suffix and *everything* derived from
# it follows — the desktop file, the AppStream id, the icon, the GSettings schema
# id and path, the GResource bundle name, the well-known D-Bus name and the XDG
# data/config/cache directories. That is what lets a nightly Regent run beside a
# stable one without clobbering its config or fighting over the D-Bus name.
#
# Select it with `-Dprofile=development`; the default builds the stable identity.
# The binary is named `regent-devel` too, so a `~/.local` nightly install does not
# overwrite the stable `regent` on PATH (see `build-aux/regent-deploy.sh`).
profile = get_option('profile')
devel = profile == 'development'
if devel
app_id = 'org.kosmos.raucao.Regent.Devel'
binary_name = 'regent-devel'
# The Rust side switches `APP_ID`/`RESOURCE_PATH` on this cargo feature; see
# src/main.rs. A feature (not an env var) so the shared cargo target directory
# cannot hand back a binary built for the other profile.
cargo_features = '--features devel'
else
app_id = 'org.kosmos.raucao.Regent'
binary_name = 'regent'
cargo_features = ''
endif
# The GSettings path is the app id with dots replaced by slashes. (The GResource
# prefix is separate and fixed in data/resources/resources.gresource.xml.)
app_path = '/' + app_id.replace('.', '/')
pkgdatadir = get_option('datadir') / app_id
subdir('data')
# Meson has no native cargo integration, so cargo is driven through a sh -c
# wrapper that also copies the binary to the location Meson expects. Every
# source file is listed as an input so edits trigger a rebuild.
cargo_build = custom_target(binary_name,
output: binary_name,
input: files(
'Cargo.toml',
'Cargo.lock',
'src/main.rs',
'src/application.rs',
'src/config.rs',
'src/headless.rs',
'src/portal.rs',
'src/runner.rs',
'src/runtime.rs',
'src/signer/approval.rs',
'src/signer/mod.rs',
'src/signer/policy.rs',
'src/state.rs',
'src/store/apps.rs',
'src/store/audit.rs',
'src/store/icons.rs',
'src/store/mod.rs',
'src/store/keys.rs',
'src/store/nip05.rs',
'src/store/profiles.rs',
'src/ui/about.rs',
'src/ui/activity_view.rs',
'src/ui/apps_view.rs',
'src/ui/approval.rs',
'src/ui/connect.rs',
'src/ui/content.rs',
'src/ui/kind.rs',
'src/ui/keys_view.rs',
'src/ui/mod.rs',
'src/ui/plain.rs',
'src/ui/preferences.rs',
'src/ui/qr.rs',
'src/ui/switcher.rs',
'src/ui/tray.rs',
'src/window.rs',
),
command: [
find_program('sh'), '-c',
'cargo build --release --locked @0@ --manifest-path "$1" --target-dir "$2" && cp "$2/release/regent" "$3"'.format(cargo_features),
'sh',
meson.current_source_dir() / 'Cargo.toml',
meson.current_build_dir() / 'cargo-target',
'@OUTPUT@',
],
build_by_default: true,
install: true,
install_dir: get_option('bindir'),
)