feat(client): protocol v2 wire layer, screen sharing, channel webhooks and secure voice

Verified against the real gateway via tests/gateway_interop.rs.
This commit is contained in:
Loki 2026-10-24 16:51:15 +02:00
parent 8460fb28fd
commit 3d7dd5413b
Signed by: boba
GPG key ID: 253067914055423B
65 changed files with 6048 additions and 1156 deletions

View file

@ -81,6 +81,7 @@ export component ChatPanel inherits Rectangle {
in-out property <bool> members-visible: true;
callback input-edited(string);
callback toggle-members();
callback open-webhooks();
callback send-message(string, string);
callback load-more(string);
callback react(string, string);
@ -99,6 +100,7 @@ export component ChatPanel inherits Rectangle {
Text { text: root.is-dm ? root.dm-partner-name : root.active-channel-name; color: Theme.text-primary; font-size: Math.max(11px, Theme.font-size * 1.0); font-weight: 600; overflow: elide; vertical-alignment: center; }
if root.e2ee-enabled : Text { text: @tr("End-to-end encrypted"); color: Theme.success; font-size: Math.max(11px, Theme.font-size * 0.6875); }
Rectangle { horizontal-stretch: 1; }
if !root.is-dm : ActionButton { text: @tr("Webhooks"); quiet: true; clicked => { root.open-webhooks(); } }
if !root.is-dm : ActionButton { text: @tr("Members"); active: root.members-visible; clicked => { root.toggle-members(); } }
}
}

View file

@ -1,4 +1,5 @@
export { ScreenShareWindow } from "screen-share.slint";
export { WebhookWindow, WebhookRow } from "webhooks.slint";
export { ScreenShareWindow, ScreenViewerWindow } from "screen-share.slint";
export { UnlockWindow } from "unlock.slint";
export { Theme } from "theme.slint";
import { Theme, ActionButton } from "theme.slint";
@ -128,6 +129,7 @@ export component MainWindow inherits Window {
callback friend-input-edited(string);
callback open-settings();
callback open-screen-share();
callback open-webhooks();
callback show-voice-view();
callback show-friends-view();
callback audio-settings-changed(int, int, float, int, float);
@ -231,6 +233,7 @@ export component MainWindow inherits Window {
members: root.members;
input-text <=> root.input-text;
members-visible: root.members-visible && root.width > 1100px;
open-webhooks => { root.open-webhooks(); }
toggle-members => { root.members-visible = !root.members-visible; }
input-edited(text) => { root.input-edited(text); }
is-dm: root.is-dm;

View file

@ -3,7 +3,7 @@ import { Theme, ActionButton } from "theme.slint";
export component ScreenShareWindow inherits Window {
title: @tr("Screen preview");
preferred-width: 820px; preferred-height: 740px; min-width: 640px; min-height: 650px;
preferred-width: 820px; preferred-height: 810px; min-width: 640px; min-height: 720px;
background: Theme.bg-base;
in-out property <image> preview;
in-out property <bool> has-frame;
@ -15,21 +15,33 @@ export component ScreenShareWindow inherits Window {
in-out property <int> source-index;
in-out property <int> audio-mode;
in-out property <float> audio-level;
in-out property <bool> can-broadcast;
in-out property <bool> publishing;
in-out property <bool> publication-starting;
in-out property <int> viewers;
in-out property <[string]> broadcasts;
in-out property <int> broadcast-index;
callback toggle-broadcast();
callback watch-broadcast();
callback refresh-audio();
callback choose-source();
callback stop-capture();
callback audio-mode-changed();
VerticalLayout {
padding: 28px; spacing: 14px;
spacing: 0;
Flickable {
content-width: self.width;
VerticalLayout {
padding: 24px; spacing: 12px;
Text { text: @tr("Choose what you share"); color: Theme.text-primary; font-size: 24px; font-weight: 600; }
Text { text: @tr("Video, application audio and your microphone stay separate."); color: Theme.text-secondary; wrap: word-wrap; }
Rectangle {
min-height: 270px; vertical-stretch: 1; background: Theme.bg-rail; border-radius: 10px;
min-height: 230px; vertical-stretch: 1; background: Theme.bg-rail; border-radius: 10px;
Image { visible: root.has-frame; source: root.preview; image-fit: contain; }
if !root.has-frame : Text { text: root.busy ? @tr("Choose a screen or window in the system dialog…") : @tr("Your preview appears here after you choose a source."); color: Theme.text-muted; wrap: word-wrap; horizontal-alignment: center; vertical-alignment: center; }
if root.running : Rectangle {
x: 12px; y: 12px; width: 132px; height: 28px; border-radius: 5px; background: Theme.bg-surface;
Text { text: @tr("LOCAL PREVIEW"); color: Theme.accent; font-size: 11px; horizontal-alignment: center; vertical-alignment: center; }
Text { text: root.publishing ? @tr("LIVE") : @tr("LOCAL PREVIEW"); color: Theme.accent; font-size: 11px; horizontal-alignment: center; vertical-alignment: center; }
}
}
Text { text: @tr("Share audio"); color: Theme.text-primary; font-weight: 600; }
@ -47,12 +59,49 @@ export component ScreenShareWindow inherits Window {
Text { text: @tr("Microphone uses your existing voice controls. This preview never enables or mixes it."); color: Theme.text-secondary; wrap: word-wrap; }
Rectangle {
height: note.preferred-height + 24px; background: Theme.bg-surface; border-radius: 8px;
note := Text { x: 12px; y: 12px; width: parent.width - 24px; text: root.capable ? @tr("Local capture is available. Broadcasting to other members is not available until the media transport is connected.") : @tr("Screen capture is not available in this build."); color: Theme.text-muted; wrap: word-wrap; }
note := Text { x: 12px; y: 12px; width: parent.width - 24px; text: root.capable ? @tr("Preview stays local until you start broadcasting. Only members of your voice channel can watch.") : @tr("Screen capture is not available in this build."); color: Theme.text-muted; wrap: word-wrap; }
}
if root.broadcasts.length > 0 : HorizontalLayout {
DeviceSelect { model: root.broadcasts; current-index <=> root.broadcast-index; horizontal-stretch: 1; }
ActionButton { text: @tr("Watch broadcast"); clicked => { root.watch-broadcast(); } }
}
if root.error != "" : Text { text: root.error; color: Theme.danger; wrap: word-wrap; }
}
}
Rectangle {
height: 72px; background: Theme.bg-surface;
HorizontalLayout {
Text { text: root.running && root.has-frame ? @tr("Preview active · not broadcasting") : @tr("Nothing is being broadcast"); color: Theme.text-muted; vertical-alignment: center; horizontal-stretch: 1; }
padding: 20px; spacing: 12px;
Text { text: root.publication-starting ? @tr("Starting broadcast…") : root.publishing ? @tr("Broadcasting · {n} viewer" | "Broadcasting · {n} viewers" % root.viewers) : root.running && root.has-frame ? @tr("Preview active · not broadcasting") : @tr("Nothing is being broadcast"); color: Theme.text-muted; vertical-alignment: center; horizontal-stretch: 1; }
if root.running && root.has-frame && root.can-broadcast : ActionButton { text: root.publication-starting ? @tr("Cancel broadcast") : root.publishing ? @tr("Stop broadcast") : @tr("Start broadcast"); active: root.publishing; clicked => { root.toggle-broadcast(); } }
if root.capable : ActionButton { text: root.running || root.busy ? @tr("Stop") : @tr("Choose screen or window"); clicked => { if root.running || root.busy { root.stop-capture(); } else { root.choose-source(); } } }
}
}
}
}
export component ScreenViewerWindow inherits Window {
title: @tr("Broadcast");
preferred-width: 1100px; preferred-height: 720px; min-width: 640px; min-height: 420px;
background: Theme.bg-rail;
in-out property <image> frame;
in-out property <bool> has-frame;
in-out property <bool> audio-enabled: true;
in-out property <string> publisher;
callback stop-viewing();
callback audio-changed();
VerticalLayout {
padding: 16px; spacing: 12px;
HorizontalLayout {
Text { text: root.publisher; color: Theme.text-primary; font-size: 16px; vertical-alignment: center; horizontal-stretch: 1; }
ActionButton { text: root.audio-enabled ? @tr("Mute broadcast") : @tr("Unmute broadcast"); active: !root.audio-enabled; clicked => { root.audio-enabled = !root.audio-enabled; root.audio-changed(); } }
ActionButton { text: @tr("Stop watching"); clicked => { root.stop-viewing(); } }
}
Rectangle {
background: #000000; vertical-stretch: 1; border-radius: 8px;
Image { source: root.frame; visible: root.has-frame; image-fit: contain; }
if !root.has-frame : Text { text: @tr("Connecting to broadcast…"); color: Theme.text-muted; horizontal-alignment: center; vertical-alignment: center; }
}
}
}

View file

@ -7,8 +7,9 @@ component ThemeChoice inherits Rectangle {
in property <color> preview-background;
in property <color> preview-sidebar;
in property <color> preview-ink;
in property <color> preview-accent: #bba583;
callback clicked();
height: 142px;
height: 160px;
border-radius: 9px;
border-width: keyboard.has-focus || root.selected ? 2px : 1px;
border-color: root.selected || keyboard.has-focus ? Theme.accent : Theme.border;
@ -17,13 +18,52 @@ component ThemeChoice inherits Rectangle {
accessible-label: root.label;
VerticalLayout {
padding: 8px; spacing: 10px;
Rectangle {
height: 86px; background: root.preview-background; border-radius: 5px; clip: true;
Rectangle { width: 23%; height: 100%; background: root.preview-sidebar; }
Rectangle { x: parent.width * 0.29; y: 15px; width: 41%; height: 6px; background: root.preview-ink; opacity: 0.8; border-radius: 2px; }
Rectangle { x: parent.width * 0.29; y: 29px; width: 59%; height: 4px; background: root.preview-ink; opacity: 0.28; border-radius: 2px; }
Rectangle { x: parent.width * 0.29; y: 40px; width: 45%; height: 4px; background: root.preview-ink; opacity: 0.28; border-radius: 2px; }
Rectangle { x: parent.width * 0.29; y: 61px; width: 60%; height: 13px; background: root.preview-sidebar; border-radius: 3px; }
mini := Rectangle {
height: 108px;
background: root.preview-background;
border-radius: 5px;
border-width: 1px;
border-color: root.preview-ink.with-alpha(0.1);
clip: true;
// A miniature client: server rail, channel list, conversation and composer.
rail := Rectangle {
x: 0px; y: 0px;
width: 17px; height: parent.height; background: root.preview-sidebar.darker(8%);
Rectangle { x: 4px; y: 8px; width: 9px; height: 9px; border-radius: 3px; background: root.preview-accent;
Image { source: @image-url("../assets/vnox-mark.svg"); width: 9px; height: 9px; image-fit: contain; }
}
Rectangle { x: 4px; y: 24px; width: 9px; height: 9px; border-radius: 4px; background: root.preview-ink.with-alpha(0.14); }
Rectangle { x: 4px; y: 38px; width: 9px; height: 9px; border-radius: 4px; background: root.preview-ink.with-alpha(0.08); }
Rectangle { x: 4px; y: parent.height - 13px; width: 8px; height: 8px; border-radius: 4px; background: root.preview-ink.with-alpha(0.3); }
}
side := Rectangle {
x: 17px; y: 0px; width: parent.width * 0.27; height: parent.height; background: root.preview-sidebar;
Text { x: 5px; y: 7px; text: "Vnox"; color: root.preview-ink; font-size: 7px; font-weight: 700; }
Rectangle { x: 3px; y: 24px; width: parent.width - 6px; height: 13px; border-radius: 2px; background: root.preview-accent.with-alpha(0.18);
Text { x: 4px; text: "#"; color: root.preview-accent; font-size: 9px; vertical-alignment: center; }
Rectangle { x: 14px; y: 5px; width: Math.max(parent.width - 21px, 3px); height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.65); }
}
Text { x: 7px; y: 42px; text: "#"; color: root.preview-ink.with-alpha(0.4); font-size: 8px; }
Text { x: 7px; y: 59px; text: "♪"; color: root.preview-ink.with-alpha(0.4); font-size: 8px; }
Rectangle { x: 7px; y: 80px; width: 4px; height: 4px; border-radius: 2px; background: root.preview-accent; }
Rectangle { x: 15px; y: 81px; width: Math.max(parent.width - 24px, 3px); height: 2px; background: root.preview-ink.with-alpha(0.3); }
}
thread := Rectangle {
x: side.x + side.width; y: 0px; width: parent.width - self.x; height: parent.height; background: transparent;
Text { x: 7px; y: 5px; text: "#"; color: root.preview-ink.with-alpha(0.65); font-size: 10px; }
Rectangle { x: 21px; y: 10px; width: parent.width * 0.29; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.65); }
Rectangle { y: 23px; width: parent.width; height: 1px; background: root.preview-ink.with-alpha(0.08); }
Rectangle { x: 7px; y: 33px; width: 10px; height: 10px; border-radius: 4px; background: root.preview-accent; }
Rectangle { x: 23px; y: 34px; width: parent.width * 0.35; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.75); }
Rectangle { x: 23px; y: 42px; width: parent.width - 32px; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.25); }
Rectangle { x: 7px; y: 56px; width: 10px; height: 10px; border-radius: 4px; background: root.preview-ink.with-alpha(0.22); }
Rectangle { x: 23px; y: 57px; width: parent.width * 0.25; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.65); }
Rectangle { x: 23px; y: 65px; width: parent.width * 0.4; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.25); }
Rectangle { x: 6px; y: parent.height - 23px; width: parent.width - 12px; height: 16px; border-radius: 4px; background: root.preview-sidebar;
Text { x: 4px; text: "+"; color: root.preview-ink.with-alpha(0.45); font-size: 10px; vertical-alignment: center; }
Rectangle { x: parent.width - 12px; y: 5px; width: 6px; height: 6px; border-radius: 2px; background: root.preview-accent; }
}
}
}
HorizontalLayout {
Text { text: root.label; color: Theme.text-primary; font-size: Math.max(Theme.font-size - 3px, 11px); font-weight: 500; overflow: elide; horizontal-stretch: 1; }
@ -72,7 +112,7 @@ export component AppearanceSettings inherits Rectangle {
ThemeChoice { label: @tr("Light"); selected: root.theme-mode == "light"; preview-background: #f5f4f2; preview-sidebar: #e6e4e0; preview-ink: #353330; clicked => { root.theme-selected("light"); } }
ThemeChoice { label: @tr("Dark"); selected: root.theme-mode == "dark"; preview-background: #272729; preview-sidebar: #202022; preview-ink: #e9e7e4; clicked => { root.theme-selected("dark"); } }
ThemeChoice { label: @tr("Extra dark"); selected: root.theme-mode == "black"; preview-background: #080808; preview-sidebar: #131313; preview-ink: #dedbd5; clicked => { root.theme-selected("black"); } }
ThemeChoice { label: @tr("Custom"); selected: root.theme-mode == "custom"; preview-background: Theme.bg-base; preview-sidebar: Theme.bg-surface; preview-ink: Theme.accent; clicked => { root.theme-selected("custom"); } }
ThemeChoice { label: @tr("Custom"); selected: root.theme-mode == "custom"; preview-background: Theme.bg-base; preview-sidebar: Theme.bg-surface; preview-ink: Theme.text-primary; preview-accent: Theme.accent; clicked => { root.theme-selected("custom"); } }
}
Rectangle { height: 29px; }
Rectangle { height: 1px; background: Theme.border; }

126
src/ui/slint/webhooks.slint Normal file
View file

@ -0,0 +1,126 @@
import { Theme, ActionButton } from "theme.slint";
import { ThemeInput, DeviceSelect } from "controls.slint";
export struct WebhookRow { id: string, name: string, detail: string, paused: bool }
export component WebhookWindow inherits Window {
title: @tr("Channel webhooks");
preferred-width: 820px; preferred-height: 700px; min-width: 680px; min-height: 620px;
background: Theme.bg-base;
in property <string> channel-name;
in property <[WebhookRow]> hooks;
in property <bool> allowed;
in property <bool> busy;
in property <string> error;
in property <string> secret;
in property <string> secret-name;
in property <string> secret-path;
in property <bool> secret-outgoing;
in property <string> confirmation-name;
in property <bool> confirming;
in property <bool> confirming-revoke;
in-out property <string> new-name;
in-out property <string> new-endpoint;
in-out property <int> new-kind;
callback refresh();
callback create();
callback rotate(string);
callback revoke(string);
callback confirm();
callback cancel-confirmation();
callback hide-secret();
callback dismiss();
VerticalLayout {
padding: 28px; spacing: 12px;
HorizontalLayout {
VerticalLayout {
spacing: 4px;
Text { text: @tr("Channel webhooks"); color: Theme.text-primary; font-size: Theme.font-size + 8px; font-weight: 600; }
Text { text: root.channel-name; color: Theme.text-muted; font-size: Theme.font-size; overflow: elide; }
}
if !root.busy && root.secret == "" && !root.confirming : ActionButton { text: @tr("Refresh"); clicked => { root.refresh(); } }
}
Text { text: @tr("Receive updates here, or send signed channel events to your own service."); color: Theme.text-secondary; wrap: word-wrap; }
Rectangle { height: 1px; background: Theme.border; }
if root.error != "" : Text { text: root.error; color: Theme.danger; wrap: word-wrap; }
if root.busy : Text { text: @tr("Waiting for the server…"); color: Theme.text-muted; }
if root.secret != "" : Rectangle {
height: secret-content.preferred-height + 28px;
background: Theme.bg-surface; border-radius: Theme.radius;
border-width: 1px; border-color: Theme.accent;
secret-content := VerticalLayout {
padding: 14px; spacing: 10px;
Text { text: @tr("Save this secret now"); color: Theme.text-primary; font-weight: 600; }
Text { text: root.secret-name; color: Theme.text-secondary; overflow: elide; }
Text { text: @tr("It is shown once. Closing this window or hiding it removes it from the client."); color: Theme.text-muted; wrap: word-wrap; }
credential := TextInput {
text: root.secret; read-only: true; wrap: word-wrap; height: 44px;
color: Theme.text-primary; font-family: "monospace"; font-size: Theme.font-size - 2px;
selection-background-color: Theme.selected;
accessible-label: @tr("Webhook secret");
}
if !root.secret-outgoing : Text { text: root.secret-path; color: Theme.text-secondary; wrap: word-wrap; }
Text { text: root.secret-outgoing ? @tr("Use this key to verify X-Vnox-Signature over the timestamp and raw request body.") : @tr("Use your server's HTTPS webhook endpoint. Generic integrations send this secret in Authorization: Bearer; GitHub uses it as the webhook secret."); color: Theme.text-muted; wrap: word-wrap; }
HorizontalLayout {
ActionButton { text: @tr("Copy and hide"); active: true; clicked => { credential.select-all(); credential.copy(); root.hide-secret(); } }
ActionButton { text: @tr("Hide secret"); quiet: true; clicked => { root.hide-secret(); } }
Rectangle { horizontal-stretch: 1; }
}
}
}
if root.confirming : Rectangle {
height: confirm-content.preferred-height + 28px; background: Theme.bg-surface; border-radius: Theme.radius;
confirm-content := VerticalLayout {
padding: 14px; spacing: 10px;
Text { text: root.confirming-revoke ? @tr("Revoke this webhook?") : @tr("Rotate this secret?"); color: Theme.text-primary; font-weight: 600; }
Text { text: root.confirmation-name; color: Theme.text-secondary; overflow: elide; }
Text { text: root.confirming-revoke ? @tr("New deliveries stop. Existing messages stay in the channel.") : @tr("The old secret stops working. Update the external integration with the new secret."); color: Theme.text-muted; wrap: word-wrap; }
HorizontalLayout {
ActionButton { text: root.confirming-revoke ? @tr("Revoke webhook") : @tr("Rotate secret"); danger: root.confirming-revoke; clicked => { root.confirm(); } }
ActionButton { text: @tr("Cancel"); quiet: true; clicked => { root.cancel-confirmation(); } }
Rectangle { horizontal-stretch: 1; }
}
}
}
list := Flickable {
min-height: 80px; vertical-stretch: 1; content-width: self.width;
VerticalLayout {
spacing: 0; alignment: start;
if root.allowed && !root.busy && root.hooks.length == 0 : Text { text: @tr("No webhooks yet. Add an integration below."); color: Theme.text-muted; wrap: word-wrap; }
for hook in root.hooks : Rectangle {
height: 76px; background: transparent;
HorizontalLayout {
padding-top: 10px; padding-bottom: 10px; spacing: 10px;
VerticalLayout {
spacing: 5px; horizontal-stretch: 1;
Text { text: hook.name; color: Theme.text-primary; font-weight: 600; overflow: elide; }
Text { text: hook.detail; color: hook.paused ? Theme.danger : Theme.text-muted; font-size: Theme.font-size - 3px; overflow: elide; }
}
if root.allowed && !root.busy && root.secret == "" && !root.confirming : ActionButton { text: @tr("Rotate"); clicked => { root.rotate(hook.id); } }
if root.allowed && !root.busy && root.secret == "" && !root.confirming : ActionButton { text: @tr("Revoke"); quiet: true; danger: true; clicked => { root.revoke(hook.id); } }
}
Rectangle { y: parent.height - 1px; height: 1px; background: Theme.border; }
}
}
}
if root.allowed && !root.busy && root.secret == "" && !root.confirming : VerticalLayout {
spacing: 10px;
Text { text: @tr("Add an integration"); color: Theme.text-primary; font-weight: 600; }
HorizontalLayout {
spacing: 10px;
ThemeInput { text <=> root.new-name; placeholder-text: @tr("Integration name"); horizontal-stretch: 1; }
DeviceSelect { width: 210px; model: [@tr("Incoming message"), @tr("GitHub updates"), @tr("Outgoing events")]; current-index <=> root.new-kind; }
}
if root.new-kind == 2 : ThemeInput { text <=> root.new-endpoint; placeholder-text: "https://example.org/vnox-events"; }
HorizontalLayout {
Text { text: root.new-kind == 2 ? @tr("Only public HTTPS destinations. Events: message.created.") : @tr("An integration can post only in this channel, using its own identity."); color: Theme.text-muted; wrap: word-wrap; horizontal-stretch: 1; }
ActionButton { text: @tr("Create webhook"); active: true; clicked => { root.create(); } }
}
}
if !root.allowed && !root.busy : Text { text: @tr("Only the server owner or members with Manage Webhooks can change integrations."); color: Theme.text-muted; wrap: word-wrap; }
HorizontalLayout {
Rectangle { horizontal-stretch: 1; }
ActionButton { text: @tr("Close"); quiet: true; clicked => { root.dismiss(); } }
}
}
}