Commit Graph

1613 Commits

Author SHA1 Message Date
shum 0706b2516e refactor(store): consolidate names migrations into one
Unshipped feature - merge the four incremental simplex_name migrations
(0603/0604/0606/0612) into a single M20260603_simplex_name. The combined
UP applies the ALTERs/indexes in the same order, so the resulting schema
is byte-identical (verified by SchemaDump on SQLite and pg_dump on Postgres).
2026-06-23 16:23:02 +00:00
shum 60258245eb chore: bump simplexmq pin to 6843b14c 2026-06-23 16:23:02 +00:00
shum e9656d0b18 Merge origin/master into sh/namespace
The names (simplex_name / RSLV) feature and master's badge feature both
extended the contact/group profile row layer. Resolution keeps both, with
simplex_name ordered last (chronological - it is the newer column):
- Profile/LocalProfile gain badge + simplex_name; simplex_name last in the
  data types, record builds, schema, and SQL row types/SELECTs/INSERTs
- SQL row types, SELECTs and INSERT/UPDATE lists carry both badge_* and
  simplex_name columns (simplex_name after badge)
- migration lists ordered by date (master 0601/0602 before names 0603+)
- SQLite chat_schema.sql regenerated; Postgres chat_schema.sql hand-merged

Verified: lib + test suite build; SchemaDump, Operators, Protocol and
direct/group profile round-trip tests pass.
2026-06-23 12:28:56 +00:00
shum e08367dc9b fix(store): single-line simplex_name WHERE to match CI sqlite (<=3.45) 2026-06-23 10:07:43 +00:00
spaced4ndy 0e09b38ea6 core: public groups - roster of privileged members (#7017) 2026-06-22 10:15:41 +00:00
Evgeny Poberezkin f64030f704 Merge branch 'stable' 2026-06-21 23:37:47 +01:00
Evgeny 6cde614e51 core: fix group link use after admin demotion (#7111)
* Fix group link use after admin demotion

* fix: group role change

* size limit

* fix

* allow delete

* do not remove link

* query plan

* relay test

* refactor

---------

Co-authored-by: Paul Bottinelli <paul.bottinelli@trailofbits.com>
Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
2026-06-21 23:36:15 +01:00
Evgeny c42c121a36 core: improve short link decompression (#7110)
* fix: bound short-link decompression

* core: improve short link decompression

---------

Co-authored-by: Paul Bottinelli <paul.bottinelli@trailofbits.com>
2026-06-21 13:03:57 +01:00
Evgeny Poberezkin 3c68ba4803 Merge branch 'stable' 2026-06-20 20:55:10 +01:00
Evgeny 8c4580ee00 core: block obfuscated simplex links if the group does not allow them (#7107)
* core: block obfuscated simplex links if the group does not allow them

* remove newlines

* remove renames

* name

* more efficient parser

* remove comment

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
2026-06-20 20:54:34 +01:00
Evgeny Poberezkin 90799ebbc5 docs: update query plans 2026-06-18 09:34:15 +01:00
Evgeny a6bc9da009 web: improve channel layout, fix subscriber count (#7092)
* web: improve channel layout

* limit link preview width

* fix

* update subscriber count in relays

* catch worker errors

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
2026-06-18 08:41:05 +01:00
spaced4ndy cfefafc337 core: file invitation size check (#7069)
* core: file invitation size check

* comment

* comment
2026-06-17 19:20:58 +01:00
Narasimha-sc 8504c0ce98 cli: remove help entries for removed commands (#7079)
* cli: remove help entries for commands removed long ago

/pq and /pq @<name> were removed in #4049 (PQ encryption for contacts
is now automatic); /get stats and /reset stats were removed in #4375
(legacy agent stats). All four were left documented in CLI help, so
typing them fails. Remove the stale entries.

* plans: justify removal of outdated CLI help entries

* plans: drop //get stats mention from CLI help plan
2026-06-17 19:18:32 +01:00
Evgeny Poberezkin e11cf1b82e Merge branch 'stable' 2026-06-17 19:13:51 +01:00
Evgeny 80538850f1 ui: show badges in more contexts (#7084)
* core: fix delivery cursor not advancing to maximum group member id for posgtgres (#7043)

* ui: show badge in user picker above message entry

* core: send badge with channel owner profile

---------

Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
2026-06-17 19:10:37 +01:00
spaced4ndy 09e9235c86 core: fix delivery cursor not advancing to maximum group member id for posgtgres (#7043) 2026-06-17 19:09:50 +01:00
Evgeny @ SimpleX Chat 8dd888295d website: add SimpleX Network News channel preview (#7087)
* website: add SimpleX Network News channel preview

* send relay domain/capability to channel owner on profile update

* add channel ID

* add top offset parameter

* allow overscroll

* better scroll

* improve

* fix promoted communities

* use path for channel renderer without host

* fix

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
2026-06-17 19:06:24 +01:00
Evgeny adb3fb8cb2 core: render web previews for channels (#7029)
* plan: web previews for channels

* types for recipient side to support channel web previews and domain names

* fix

* migrations

* update schema and api types

* update schema

* rename migrations

* core: render channel preview data

* core: render channel preview data in relays

* website: use cpp to inject JS functions

* JSC files

* remove directory.js

* channel preview renderer

* Revert "cli: fix redraw slowness (#6735)"

This reverts commit b801d77c74.

* sample channel page

* default avatar

* rename options

* better layout

* layout

* images

* some fixes

* tails

* markdown colors

* image sizes

* reactions

* fix reactions

* fewer avatars

* forward icon

* command to change group access parameters

* view public group access changes in CLI

* media metadata color

* ios: group web access ui

* update ui

* add init

* kotlin, labels

* update page

* update relay base URL

* fix

* ios update channel web page info

* update kotlin layout

* use cards

* update layout

* use domains for relay data, path is fixed

* update embed code

* fix bots api

* include only history items and senders

* update preview JS/HTML

* show different error if link is different

* remove stale json files

* better layout

* layout fixes

* improve layout

* improve layout

* update embed code

* web cta

* better layout

* buttons

* layout

* paddings

* desktop cta

* desktop cta

* cta layout

* fonts

* paddings

* paddings

* more paddings

* copy link

* read more

* hide avatar and placeholder when all messages are from channel

* color scheme

* fix color

* improve

* layout

* welcome message

* dark mode colors

* padding

* font size

* overscroll

* font

* logo on button

* better join

* buttons

* refactor

* another logo

* text

* desktop button

* button text

* center

* fix svg

* padding

* smaller gap

* render channel on any message changes etc

* fixes

* atomic file updates, escape attributes

* fix tests

* more tests

* more efficient rendering

* improve security

* sanitize links, include mentioned members

* schema

* fixes

* improve rendering

* fix showing correct subscribers count

* fix member names

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
2026-06-16 14:36:55 +01:00
Evgeny Poberezkin 37f7ed3126 Merge branch 'stable' 2026-06-16 07:40:58 +01:00
Evgeny ad23da63d0 core: supporter badges using anonymous BBS credentials (#7040)
* core: supporter badges using anonymous BBS credentials

* badges in profiles

* badge in profiles

* process badges

* update simplexmq

* update simplexmq

* change types

* fix migration

* migration

* update simplexmq

* fix bot API, schema

* fix postgresql build

* refactor

* postgresql schema

* correctly set badges in all cases

* badges ffi

* plan, bot types

* FFI

* FFI: export badge symbols

* add extra field

* refactor badge types to GADT

* configurable badge key

* add badge to profile, test

* ui: badge images

* generate badge key and sign badge

* badge sign in CLI

* fix commands, ui

* rename badges

* Binary

* image size, migration

* update badge images, add public key

* send badges in more cases

* update UI, tests

* bot types, schema

* postgres schema

* tone down badges

* revert formula

* refactor badges

* smaller badges

* badge position

* better badge position

* simpler

* position

* move position

* update simplexmq

* show badge after name

* badge layout

* fix badge

* debug badge height

* shift badge

* fix badge in member name

* bigger badge

* badge layout

* differentiate badge colors

* more avatars for the user's profiles

* refactor

* remove color filter

* alerts

* multiple keys, old expired

* use new BBS api

* update badge keys, bot api

* presentation header

* simplify

* parser

* update iOS images

* update public keys

* query plans

* update simplexmq

* refactor badge types

* simplexmq

* bot api types

* update simplexmq - commoncrypto flag

* update simplexmq

* pass commoncrypto flag to simplexmq in nix iOS build

* ios ui

* update core library, fixes

* badge layout

* badge size

* badge gap

* remove extensions

* simplify

* share badge in more events, reverify badge if verification failed

* larger files with badges

* allow sending larger files

* simpler

* update simplexmq

* better decoder for badge keys

* update simplexmq

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
Co-authored-by: shum <github.shum@liber.li>
2026-06-15 22:25:08 +01:00
shum 93d62c2aee feat(operators): warn when no server resolves names
Mirror USWNoChatRelays: validateUserServers emits USWNoNamesServers
when no enabled server of an enabled operator carries the SMP names
role. noNamesServersWarns is self-contained with local predicates,
matching the sibling noChatRelaysWarns; noServersErrs is untouched.
2026-06-13 09:29:26 +00:00
shum ebc7af3250 fix(store): match chat_schema.sql to sqlite 3.46+ indent
The schema-dump test renders the partial-index WHERE via the sqlite3
CLI; sqlite >=3.46 wraps a multi-condition WHERE onto two lines
("IS NOT NULL" + indented "AND ...") where 3.45 kept it on one. The
committed schema was generated with 3.45, so CI (newer sqlite) failed
the comparison on idx_contacts_simplex_name. Regenerated with the
newer formatter; only that one WHERE clause changes.
2026-06-13 08:41:16 +00:00
shum 69dee10bd7 refactor(names): agent resolution + one error type
Adopt the simplexmq names rework (PR #7045): name resolution is now
owned by the agent (resolveSimplexName picks a names-role server), so
the chat-side iteration is removed - delete ResolveError,
iterateResolvers, resolveOnUserServers, enabledSMPServersForUser and
resolveErrorToChatError.

One error type: resolver/agent failures flow through ChatErrorAgent;
remove the CEvtSimplexName* events, SimplexNameVerifyFailReason,
SimplexNameConflictEntity and CESimplexNameResolverUnavailable.
APIVerifySimplexName returns CRSimplexNameVerified (verified::Bool),
mirroring CRConnectionVerified. connectPlan handles the name target
directly; updateProfile WithConflict aliases collapsed into the plain
functions.

Add the per-operator "names" SMP server role (migration
20260612_smp_role_names, official operator on by default) feeding
ServerRoles.names -> UserServers.nameSrvs.

Bump simplexmq pin to ce69adfd and regenerate sha256map.nix.
2026-06-13 07:40:36 +00:00
shum 7836f71d7a core: align resolver docs/tests with RSLV errors 2026-06-11 15:11:55 +00:00
shum ae42ab130c core: filter RSLV servers by operator enablement 2026-06-11 15:11:55 +00:00
shum a580698584 core: iterate past RSLV-unsupported name servers 2026-06-11 15:11:55 +00:00
shum f0302ebf5a core: fix contact-by-connection query missing simplex_name_verified_at 2026-06-11 12:37:03 +00:00
shum 3b3b320e75 core: treat RSLV CMD UNKNOWN as no name-resolution support 2026-06-11 11:03:26 +00:00
shum 599bb49ebd deps: bump simplexmq for multi-link NameRecord; adapt consumers 2026-06-11 09:39:01 +00:00
spaced4ndy b9d1f0c0a3 core: fix delivery batching (#7065) 2026-06-09 16:58:17 +00:00
spaced4ndy 931881c860 core: validate user chat ownership for chat tag and TTL APIs (#7063) 2026-06-09 13:03:51 +00:00
spaced4ndy dd150e2d70 core: limit xftp file description (#7060) 2026-06-09 06:47:39 +00:00
shum 613eb421da Merge remote-tracking branch 'origin/master' into sh/namespace
# Conflicts:
#	src/Simplex/Chat/Library/Commands.hs
#	src/Simplex/Chat/Library/Subscriber.hs
#	src/Simplex/Chat/Store/Direct.hs
#	src/Simplex/Chat/Store/Groups.hs
#	src/Simplex/Chat/Store/Shared.hs
2026-06-08 16:06:27 +00:00
shum 5ce9e852a3 deps: bump simplexmq for HTTP resolver; adapt NameRecord consumers
simplexmq 92b3d049 reshaped NameRecord text fields from Maybe Text to
Text (empty string sentinel). Adapt firstNameLink to take Text directly
and treat T.null as "absent". dispatchResolvedRecord destructure
unchanged; passes the text values straight through. apiVerifySimplexName
switches from Just/Nothing pattern to a T.null guard with the same UX.
Test fixtures updated.
2026-06-08 11:49:07 +00:00
Evgeny Poberezkin 4d63d9e3a8 Merge branch 'stable' 2026-06-07 23:18:43 +01:00
Evgeny 95349430c5 core: support signature verification in p2p groups (forward compatibility) (#7058)
* core: support signature verification in p2p groups (forward compatibility)

* encoding

* mirror encoding

* comment

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
2026-06-07 12:01:40 +01:00
Evgeny Poberezkin adbffe2d1b Merge branch 'stable' 2026-06-06 21:18:42 +01:00
Evgeny 5b93cb0e3f core: store context to pass configuration parameters (#7057)
* core: store context to pass configuration parameters

* fix directory

* fix test

* comment

* order

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
2026-06-06 20:48:11 +01:00
shum d5bfa2e9d8 chat: bump simplexmq pin + document cross-table simplex_name discriminator
Pin bump 5ee014dd -> c9c2d19 picks up the 8 simplexmq commits since the
last bump (parseBare lowercase fix, forwarded-param cleanup, ServerTests
+ agent end-to-end tests, TldRegistries removal, SNRC ABI decoder,
NameRecord/NameOwner module extraction).

Adds a brief comment on clearConflictingContactProfileSimplexName_
explaining why the audit's flagged cross-table collision (between
contact_profiles.simplex_name and group_profiles.simplex_name) is
structurally impossible: SimplexNameInfo's strEncode prefixes contact
names with '@' and group names with '#', so the stored bytes never
overlap between the two tables.

Query-plan regen deferred (the test is non-deterministic in CI / dev
sandbox — see prior 6c990696c).
2026-06-06 09:17:55 +00:00
shum ebe90f7169 chat: APIVerifySimplexName command + CEvtSimplexNameUnverified warning
Addresses the TOFU vulnerability where peer-claimed simplex_name was
accepted unverified. Adds:

- contacts.simplex_name_verified_at + groups.simplex_name_verified_at
  (M20260606_simplex_name_verified)
- APIVerifySimplexName ChatRef command: RSLV-resolves the claimed name
  and compares the resolved link to the peer's stored connection link;
  on match writes verified_at and emits CEvtSimplexNameVerified;
  on mismatch emits CEvtSimplexNameVerifyFailed
- CEvtSimplexNameUnverified passive warning emitted on incoming XInfo /
  XGrpInfo when a name claim arrives without a current verification
- updateContactProfileWithConflict / updateGroupProfileWithConflict
  clear simplex_name_verified_at whenever the peer's claim transitions
  (any value change including Nothing<->Just): the prior verification
  was bound to the prior claim.

UI can surface the unverified indicator next to a contact / group's
name, and prompt the user to invoke the verify command. This shifts
the security model from "TOFU + last-writer-wins" to "TOFU + on-demand
RSLV verification".
2026-06-06 08:33:25 +00:00
shum 3104291609 chat: extract surfaceSimplexNameConflict helper
Six call sites duplicated the same forM_ ((,) <$> claim <*> displaced)
shape emitting CEvtSimplexNameConflict. Extract to a single helper so
future call sites don't drift on whether to emit, and so the conflict
event shape change (post-Task-3 SimplexNameConflictEntity split into
SNCEContact / SNCEGroup) propagates through one site.
2026-06-05 17:05:57 +00:00
shum b1d18100f4 chat: document connections.simplex_name as transient carrier
Audit flagged the column as "INSERTed but never UPDATEd". This is by
design per the prior plan's connect-via-plan flow: the column is a
transient carrier between connection-creation and contact-creation.
After the Contact row is created via XInfo handling, contacts.simplex_name
is the source of truth and the connections value is a historical snapshot.
Documents the intent so future readers don't reflag it.
2026-06-05 16:40:20 +00:00
shum c1235c01bb chat: document why groups simplex_name index has no soft-delete filter
The contacts simplex_name index filters on (deleted = 0); the groups
index has no analogous filter because the groups table has no `deleted`
column. Groups are hard-deleted by deleteGroup, so the asymmetry is
intentional. The remaining "removed member, row retained" edge case is
flagged in the lookup comment for follow-up.
2026-06-05 10:34:19 +00:00
shum 63a9d22148 chat: resolveOnUserServers iterates only on transport errors
Privacy: every miss previously broadcast the candidate name to every
enabled SMP server. Now only NETWORK / TIMEOUT failures fall through
to the next server; definite resolver answers (NAME / AUTH / CMD
PROHIBITED / other ERR) stop iteration.
2026-06-05 10:29:01 +00:00
shum 1cf96fc291 deps: bump simplexmq for NameRecord reshape; update consumers
simplexmq 5ee014dd reshaped NameRecord to align with the Python resolver
JSON: nrChannelLinks/nrContactLinks (lists of NameLink) became
nrSimplexChannel/nrSimplexContact (Maybe Text); nrDisplayName became
nrName; nrResolver was added; the NameLink wrapper type and nrIsTest/
nrExpiry/nrAdminAddress/nrAdminEmail fields were dropped.

Update dispatchResolvedRecord destructure and firstNameLink signature
to the new Maybe Text shape, and refresh the ResolveNameTests fixtures
and assertions accordingly.
2026-06-05 10:09:02 +00:00
shum 6c990696ca chat: regen query plans after simplex_name plumbing 2026-06-04 23:05:18 +00:00
shum 1f9b6e29de chat: RSLV-resolved NameRecord dispatched through prepared row
dispatchResolvedRecord now picks the first nrContactLinks (NTContact) or
nrChannelLinks (NTPublicGroup) entry from the resolved record, decodes it
as AConnShortLink, fetches the short-link data, and eagerly calls
createPreparedContact / createPreparedGroup with the simplex_name set.

Returning CPContactAddress (CAPKnown ct) / CPGroupLink (GLPKnown g ...)
mirrors the local-store-hit branch of connectPlanName: hit and miss
converge on the same plan shape, so the connectWithPlan caller cannot
distinguish where the prepared row came from. Threading uses the
existing Maybe SimplexNameInfo parameter added in c6f26150 for the
local-prepare path -- no new write path or transient carrier.

Pure helper firstNameLink is extracted and exported so the link-picker
contract is testable without a DB / agent. ResolveNameTests gains five
cases covering the per-type selection, the first-link policy, and the
empty-list to CESimplexNameNotFound collapse.
2026-06-04 18:49:57 +00:00
shum 0ec3b101b9 chat: connectPlanName falls back to RSLV when local lookup misses 2026-06-04 18:32:02 +00:00
shum 5fe584b522 chat: resolveOnUserServers iterates user SMP servers for RSLV 2026-06-04 18:13:35 +00:00