codehost 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/web/discovery.tsx +47 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [0.9.1](https://github.com/snomiao/codehost/compare/v0.9.0...v0.9.1) (2026-06-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **web:** stop rendering raw room token in the input ([abf7ea5](https://github.com/snomiao/codehost/commit/abf7ea5abd96f156f178f5f5c8ddb0e31f8fdd81))
|
|
7
|
+
|
|
1
8
|
# [0.9.0](https://github.com/snomiao/codehost/compare/v0.8.0...v0.9.0) (2026-06-08)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/web/discovery.tsx
CHANGED
|
@@ -103,7 +103,11 @@ export function Discovery() {
|
|
|
103
103
|
}
|
|
104
104
|
return localStorage.getItem(TOKEN_KEY) ?? "";
|
|
105
105
|
});
|
|
106
|
-
|
|
106
|
+
// The token is a bearer secret — never pre-fill the input with it (it would be
|
|
107
|
+
// left in plaintext in the DOM on every load). Start blank; once a token is
|
|
108
|
+
// saved we show a masked label instead, and only reveal the input on "Change".
|
|
109
|
+
const [draft, setDraft] = useState("");
|
|
110
|
+
const [editingToken, setEditingToken] = useState(false);
|
|
107
111
|
const [tokenError, setTokenError] = useState<string | null>(null);
|
|
108
112
|
const [connected, setConnected] = useState(false);
|
|
109
113
|
const [servers, setServers] = useState<PeerInfo[]>([]);
|
|
@@ -227,6 +231,8 @@ export function Discovery() {
|
|
|
227
231
|
setTokenError(null);
|
|
228
232
|
localStorage.setItem(TOKEN_KEY, t);
|
|
229
233
|
setToken(t);
|
|
234
|
+
setDraft("");
|
|
235
|
+
setEditingToken(false);
|
|
230
236
|
}
|
|
231
237
|
|
|
232
238
|
async function connectTo(server: PeerInfo, folder?: string) {
|
|
@@ -428,25 +434,46 @@ export function Discovery() {
|
|
|
428
434
|
{token ? "waiting for a live server" : "enter the room's token below"}.
|
|
429
435
|
</p>
|
|
430
436
|
)}
|
|
431
|
-
|
|
432
|
-
<
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
<p style={styles.tokenError}>{tokenError}</p>
|
|
437
|
+
{token && !editingToken ? (
|
|
438
|
+
<div style={styles.tokenForm}>
|
|
439
|
+
<label style={styles.label}>Token</label>
|
|
440
|
+
<span style={styles.tokenSaved}>saved · {roomLabel}</span>
|
|
441
|
+
<button
|
|
442
|
+
type="button"
|
|
443
|
+
style={styles.shareBtn}
|
|
444
|
+
onClick={() => {
|
|
445
|
+
setDraft("");
|
|
446
|
+
setTokenError(null);
|
|
447
|
+
setEditingToken(true);
|
|
448
|
+
}}
|
|
449
|
+
>
|
|
450
|
+
Change
|
|
451
|
+
</button>
|
|
452
|
+
</div>
|
|
448
453
|
) : (
|
|
449
|
-
|
|
454
|
+
<>
|
|
455
|
+
<form onSubmit={applyToken} style={styles.tokenForm}>
|
|
456
|
+
<label style={styles.label}>Token</label>
|
|
457
|
+
<input
|
|
458
|
+
value={draft}
|
|
459
|
+
onChange={(e) => {
|
|
460
|
+
setDraft(e.target.value);
|
|
461
|
+
if (tokenError) setTokenError(null);
|
|
462
|
+
}}
|
|
463
|
+
placeholder="your room token"
|
|
464
|
+
style={styles.input}
|
|
465
|
+
autoFocus={editingToken}
|
|
466
|
+
/>
|
|
467
|
+
<button type="submit" style={styles.button}>
|
|
468
|
+
Connect
|
|
469
|
+
</button>
|
|
470
|
+
</form>
|
|
471
|
+
{tokenError ? (
|
|
472
|
+
<p style={styles.tokenError}>{tokenError}</p>
|
|
473
|
+
) : (
|
|
474
|
+
<p style={styles.tokenHint}>Token requires {TOKEN_REQUIREMENTS}.</p>
|
|
475
|
+
)}
|
|
476
|
+
</>
|
|
450
477
|
)}
|
|
451
478
|
|
|
452
479
|
<div style={styles.listHead}>
|
|
@@ -544,6 +571,7 @@ const styles: Record<string, React.CSSProperties> = {
|
|
|
544
571
|
tokenHint: { margin: "0 0 20px", fontSize: 12, color: "#888" },
|
|
545
572
|
tokenError: { margin: "0 0 20px", fontSize: 12, color: "#f48771" },
|
|
546
573
|
label: { fontSize: 12, color: "#888" },
|
|
574
|
+
tokenSaved: { flex: 1, fontFamily: "monospace", fontSize: 13, color: "#4ec9b0" },
|
|
547
575
|
input: { flex: 1, background: "#252525", border: "1px solid #3d3d3d", color: "#eee", padding: "8px 10px", borderRadius: 6, fontSize: 13, outline: "none" },
|
|
548
576
|
button: { background: "#0e639c", border: "none", color: "#fff", padding: "8px 16px", borderRadius: 6, cursor: "pointer", fontSize: 13 },
|
|
549
577
|
listHead: { display: "flex", alignItems: "baseline", gap: 10, margin: "0 0 12px" },
|