Skip to content

Commit 7f67028

Browse files
committed
Show WebRTC source page URLs in the connection details
1 parent aad549b commit 7f67028

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

src/components/view/rtc/rtc-connection-card.tsx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { observer } from 'mobx-react';
55

66
import { UNKNOWN_SOURCE } from '../../../model/http/sources';
77
import { RTCConnection } from '../../../model/webrtc/rtc-connection';
8+
import { getSummaryColour } from '../../../model/events/categorization';
89

910
import {
1011
CollapsibleCard,
@@ -17,12 +18,13 @@ import {
1718
} from '../../common/collapsible-section';
1819
import {
1920
ContentLabel,
21+
ContentLabelBlock,
2022
ContentMonoValueInline,
2123
ContentValue
2224
} from '../../common/text-content';
2325
import { SourceIcon } from '../../common/source-icon';
2426
import { Pill } from '../../common/pill';
25-
import { getSummaryColour } from '../../../model/events/categorization';
27+
import { UrlBreakdown } from '../url-breakdown';
2628

2729
interface RTCConnectionCardProps {
2830
connection: RTCConnection;
@@ -116,19 +118,37 @@ export class RTCConnectionCard extends React.Component<RTCConnectionCardProps> {
116118
</CollapsibleSectionSummary>
117119
</CollapsibleSection>
118120

119-
{ connection.source !== UNKNOWN_SOURCE
120-
? <CollapsibleSection>
121+
{ connection.sourceURL && <>
122+
<ContentLabelBlock>Source page: </ContentLabelBlock>
123+
124+
<CollapsibleSection prefixTrigger={true}>
125+
<CollapsibleSectionSummary>
126+
<ContentMonoValueInline>
127+
{ connection.sourceURL.toString() }
128+
</ContentMonoValueInline>
129+
</CollapsibleSectionSummary>
130+
131+
<CollapsibleSectionBody>
132+
<UrlBreakdown url={connection.sourceURL} />
133+
</CollapsibleSectionBody>
134+
</CollapsibleSection>
135+
</> }
136+
137+
{ connection.source !== UNKNOWN_SOURCE && <>
138+
<ContentLabelBlock>Client: </ContentLabelBlock>
139+
140+
<CollapsibleSection prefixTrigger={true}>
121141
<CollapsibleSectionSummary>
122-
<ContentLabel>Client: </ContentLabel>
123-
<ContentValue>{ connection.source.summary }</ContentValue>
142+
<ContentMonoValueInline>
143+
{ connection.source.ua }
144+
</ContentMonoValueInline>
124145
</CollapsibleSectionSummary>
125146

126147
<CollapsibleSectionBody>
127148
<p>{ connection.source.description }</p>
128149
</CollapsibleSectionBody>
129150
</CollapsibleSection>
130-
: null
131-
}
151+
</> }
132152
</CollapsibleCard>;
133153
}
134154
}

src/model/webrtc/rtc-connection.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ export class RTCConnection extends HTKEventBase {
4545
return parseSource(this.connectionEvent.metadata.userAgent);
4646
}
4747

48+
@computed
49+
get sourceURL() {
50+
if (!this.connectionEvent.metadata.sourceURL) return undefined;
51+
52+
try {
53+
return new URL(this.connectionEvent.metadata.sourceURL);
54+
} catch (e) {
55+
return undefined;
56+
}
57+
}
58+
4859
@computed
4960
get clientURL() {
5061
return candidateToUrl(this.connectionEvent.selectedRemoteCandidate);

0 commit comments

Comments
 (0)