Links to a post or thread that open in the web and the desktop app #289
Labels
No labels
area/ci
area/desktop
area/packaging
area/protocol
area/reading
area/ui
area/web
area/writing
kind/bug
kind/feature
kind/infra
kind/request
needs/user
parked
perf
security
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
littlefox/neokom#289
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Approved by the user for 0.7 on 2026-10-22 (D-063). They asked specifically how links can work in both the web and the desktop app.
Goal: "Kopiera länk" on a post or thread gives a link that opens that post in NeoKOM, for anyone who can read it, in the browser or in the desktop app.
What a link names
LysKOM text numbers are only unique within one server, so a link always carries the server. Protocol A has a name for this: the server's
canonical-nameaux item [31], "the official domain name of the server, optionally followed by a colon and the port number … globally unique among all LysKOM servers". The Message-ID standard in Protocol A uses it the same way. If a server hasn't set it, we use the host (and port, if not 4894) that the desktop app connected to, or the web deployment's own server.Core:
<server>/text/<N>, e.g.kom.lysator.liu.se/text/12345. The same pattern works for/conf/Nand/person/N, sincemarkup::Refalready has all three kinds.A link always names a post. A link to a thread is a link to its root. The post opens in its thread (the chat view from #283, or the classic view), scrolled to the post and highlighted briefly. Opening a link doesn't mark anything read; the existing read-when-seen rule applies (#180).
Three ways to write it
https://neokom.lysator.liu.se/#kom.lysator.liu.se/text/12345<text 12345: Ämne>lyskom://kom.lysator.liu.se/text/12345Why the target goes after
#:How each client opens a link
Web
hashchange, parse the target.Desktop
lyskom://links pasted into Ctrl+K, and clicked inside posts. Those open in the app instead of the browser.Both
<text N>references and NeoKOM links pasted into the composer become<text N: subject>, so Emacs users get a working link too.Errors
Steps
kom_client::link: parse and format all three forms; readcanonical-namefrom server info at login. Unit tests, and fuzz the parser.Copy and open, both builds: "Kopiera länk" in a post's ··· menu and in the thread header; opening from Ctrl+K and from links in posts; the composer rewrite; the error and other-server messages.
Web: read the hash, keep the target through login, handle hashchange.
Desktop
lyskom://:MimeType=x-scheme-handler/lyskomandExec=neokom %uinneokom.desktop, checked in all four packages;neokom <url>on the command line;$XDG_RUNTIME_DIRand exits, so you don't get two logins.This is the largest step and can go last.
Tests
<text N>.neokom lyskom://…under Xvfb in desktop-smoke, with a second launch handing over to the first.Before starting
canonical-name.Probe (logged out, one get-info call, D-007): kom.lysator.liu.se sets canonical-name — aux item 31 on the server info, "kom.lysator.liu.se". So links name the server as kom.lysator.liu.se. Starting with step 1 (kom_client::link).
Verified, merged in #304; main green (run #557).
kom_client::link: unit tests for parsing and formatting web links,lyskom://and<text N>, including random input (it never panics).e2e/tests/share-links.spec.ts, all three profiles: "Kopiera länk" in a post's menu copies the web link; opening that link logged out keeps it through the login and then opens the post in its thread, highlighted and not marked read; ahashchangeopens another; a link for another server says so rather than open the same number here; a link pasted into the composer becomes<text N: Ämne>.neokom.desktopregistersx-scheme-handler/lyskom; the desktop smoke test (CI'sdesktopjob) checks that a second launch with a link hands it to the running app, which comes to the front.canonical-name(aux 31):kom.lysator.liu.sesets it (logged-out probe); the devserver seed setsdev.neokom.test.