Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat(settings): the Remote token is dots until the eye is pressed

Jareer86b8b92f924c
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index 14177e0c..079a8cbd 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -402,6 +402,7 @@
"Height": "Height",
"Hero": "Hero",
"Hide lane": "Hide lane",
+ "Hide the token": "Hide the token",
"High": "High",
"High-Contrast Mono": "High-Contrast Mono",
"High-energy pulsating stroboscopic flash.": "High-energy pulsating stroboscopic flash.",
@@ -749,6 +750,7 @@
"Show in folder": "Show in folder",
"Show lane": "Show lane",
"Show the log": "Show the log",
+ "Show the token": "Show the token",
"Showing the look over the picture. Double-click the card, or its plus, to lay it on the timeline": "Showing the look over the picture. Double-click the card, or its plus, to lay it on the timeline",
"Silent": "Silent",
"Silver": "Silver",
diff --git a/src/crates/concat/ui/dialogs/settings.slint b/src/crates/concat/ui/dialogs/settings.slint
index 4d260174..7b2fe677 100644
--- a/src/crates/concat/ui/dialogs/settings.slint
+++ b/src/crates/concat/ui/dialogs/settings.slint
@@ -473,6 +473,16 @@ export component SettingsDialog inherits Modal {
I18n.t("Rose"), I18n.t("Amber"), I18n.t("Mint"),
];
+ /// The Remote page's token is shown in clear rather than as dots.
+ /// Off each time the sheet opens: showing it is a decision for the
+ /// moment, not a setting.
+ property <bool> token-shown;
+ changed open => {
+ if (!root.open) {
+ root.token-shown = false;
+ }
+ }
+
open: root.data.open;
title: I18n.t("Settings");
glyph: Glyph.settings;
@@ -987,6 +997,10 @@ export component SettingsDialog inherits Modal {
title: I18n.t("Token");
hint: I18n.t("What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.");
+ // Dots until asked, the way a password field is: the
+ // token is what lets a connection in, and Settings is
+ // open on screens other people look at. The eye shows
+ // it for as long as the sheet is up.
HorizontalLayout {
spacing: 6px;
@@ -994,9 +1008,17 @@ export component SettingsDialog inherits Modal {
value: root.data.server-token;
placeholder: I18n.t("none");
technical: true;
+ secret: !root.token-shown;
edited(text) => { root.server-token-edited(text); }
}
+ Button {
+ square: true;
+ glyph: root.token-shown ? Glyph.eye-off : Glyph.eye;
+ label: root.token-shown ? I18n.t("Hide the token") : I18n.t("Show the token");
+ clicked => { root.token-shown = !root.token-shown; }
+ }
+
Button {
label: I18n.t("New token");
clicked => { root.server-token-generated(); }
diff --git a/src/crates/concat/ui/primitives/modal.slint b/src/crates/concat/ui/primitives/modal.slint
index a003095f..3c0e1abc 100644
--- a/src/crates/concat/ui/primitives/modal.slint
+++ b/src/crates/concat/ui/primitives/modal.slint
@@ -171,10 +171,14 @@ export component Button inherits Rectangle {
in property <bool> block;
/// 34px instead of 28px, for the action a sheet is built around
in property <bool> large;
+ /// A glyph alone on a square the height of the row, for a toggle that
+ /// sits beside a field and says what it does with its mark: the eye
+ /// that shows a token. The label, if one is given, is not drawn.
+ in property <bool> square;
callback clicked();
- property <length> gap: root.glyph == Glyph.none ? 0px : 6px;
+ property <length> gap: (root.glyph == Glyph.none || root.square) ? 0px : 6px;
property <length> mark: root.glyph == Glyph.none ? 0px : 14px;
property <bool> lit: touch.has-hover && root.enabled;
/// the red the danger tone hovers into — a dark wash, not a fill
@@ -188,7 +192,9 @@ export component Button inherits Rectangle {
// below sizes the label from this button's width, so reading back the
// result is a loop.
min-width: root.block ? 0px
+ : root.square ? (root.large ? 34px : 28px)
: text.preferred-width + root.mark + root.gap + (root.large ? 32px : 24px);
+ max-width: root.square ? (root.large ? 34px : 28px) : 100000px;
border-radius: Theme.r;
opacity: root.enabled ? 1.0 : 0.45;
border-width: root.ghost ? 0px : 1px;
@@ -222,7 +228,7 @@ export component Button inherits Rectangle {
}
text := Text {
- text: root.label;
+ text: root.square ? "" : root.label;
color: root.ink;
font-size: root.large ? Theme.fs-lg : Theme.fs;
font-weight: Theme.weight-title;
@@ -476,6 +482,10 @@ export component Field inherits Rectangle {
in property <string> placeholder;
/// numbers, paths and names read better in the technical face
in property <bool> technical;
+ /// Drawn as dots, the way a password field is: for a token that is
+ /// shown on a screen other people can see. What is typed and what
+ /// `edited` reports are the real characters either way.
+ in property <bool> secret;
/// The corners, a side at a time, so two fields can be joined into
/// one control with a square seam between them.
in property <length> radius-left: Theme.r;
@@ -536,6 +546,7 @@ export component Field inherits Rectangle {
// same reason, as SearchField in the inspector.
height: self.preferred-height;
text <=> root.draft;
+ input-type: root.secret ? InputType.password : InputType.text;
color: Theme.fg;
font-family: root.technical ? Theme.font-technical : Theme.font;
font-size: Theme.fs;