tangled
alpha
login
or
join now
stream.place
/
streamplace
77
fork
atom
Live video on the AT Protocol
77
fork
atom
overview
issues
1
pulls
pipelines
multistreaming: redact urls on frontend
Eli Mallon
2 months ago
c2993f70
14a5fc5e
+30
-6
2 changed files
expand all
collapse all
unified
split
js
app
components
live-dashboard
bento-grid.tsx
settings
multistream-manager.tsx
+4
-1
js/app/components/live-dashboard/bento-grid.tsx
···
195
195
]}
196
196
>
197
197
<View
198
198
-
style={[borders.top.width.thin, borders.top.color.neutral[700]]}
198
198
+
style={[
199
199
+
borders.bottom.width.thin,
200
200
+
borders.bottom.color.neutral[700],
201
201
+
]}
199
202
>
200
203
<MultistreamStatus />
201
204
</View>
+26
-5
js/app/components/settings/multistream-manager.tsx
···
26
26
record: PlaceStreamMultistreamTarget.Record;
27
27
}
28
28
29
29
+
const redactMultistreamTargetURL = (url: string) => {
30
30
+
try {
31
31
+
const u = new URL(url);
32
32
+
return `${u.protocol}//${u.host}/redacted`;
33
33
+
} catch (error) {
34
34
+
return "parsing failed";
35
35
+
}
36
36
+
};
37
37
+
29
38
const multistreamTitle = (
30
39
target: MultistreamTargetViewHydrated | undefined,
31
40
t: TFunction,
···
363
372
return (
364
373
<SettingsListItem
365
374
title={multistreamTitle(target, t)}
366
366
-
url={target.record.url}
375
375
+
url={redactMultistreamTargetURL(target.record.url)}
367
376
active={target.record.active}
368
377
isDeleting={isDeleting}
369
378
isToggling={isToggling}
···
405
414
);
406
415
407
416
const [errors, setErrors] = useState<Record<string, string>>({});
417
417
+
const [changedTargetUrl, setChangedTargetUrl] = useState(false);
408
418
409
419
// Update form data when webhook prop changes (for editing)
410
420
useEffect(() => {
411
421
setErrors({});
422
422
+
setChangedTargetUrl(false);
412
423
if (target) {
413
424
setFormData({
414
425
$type: "place.stream.multistream.target",
···
448
459
}
449
460
};
450
461
462
462
+
let displayUrl = formData.url;
463
463
+
if (target && !changedTargetUrl) {
464
464
+
displayUrl = "";
465
465
+
}
466
466
+
451
467
return (
452
468
<Dialog
453
469
open={isVisible}
···
483
499
{t("rtmp-target-url")} *
484
500
</Text>
485
501
<Input
486
486
-
value={formData.url}
487
487
-
onChangeText={(text) =>
502
502
+
value={displayUrl}
503
503
+
onChangeText={(text) => {
504
504
+
setChangedTargetUrl(true);
488
505
setFormData((prev) => ({
489
506
...prev,
490
507
url: text.trim().replaceAll(/\n/g, ""),
491
491
-
}))
508
508
+
}));
509
509
+
}}
510
510
+
placeholder={
511
511
+
target
512
512
+
? redactMultistreamTargetURL(target.record.url)
513
513
+
: "rtmps://example.com:443/live/foo"
492
514
}
493
493
-
placeholder="rtmps://example.com:443/live/foo"
494
515
multiline
495
516
/>
496
517
<Text style={[text.red[600], mt[1], { fontSize: 12 }]}>