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
chat: fix chat popup in prod
Eli Mallon
11 months ago
28c40398
a823ecbb
+48
-30
2 changed files
expand all
collapse all
unified
split
hack
firehose-proxy.sh
js
app
components
chat
chat-box.tsx
+8
hack/firehose-proxy.sh
···
1
1
+
#!/bin/bash
2
2
+
3
3
+
set -euo pipefail
4
4
+
5
5
+
upstream="${1:-"wss://bsky.network"}"
6
6
+
echo "listening on port 8765"
7
7
+
8
8
+
websocat --binary -E ws-l:0.0.0.0:8765 $upstream/xrpc/com.atproto.sync.subscribeRepos
+40
-30
js/app/components/chat/chat-box.tsx
···
5
5
selectIsReady,
6
6
selectUserProfile,
7
7
} from "features/bluesky/blueskySlice";
8
8
-
import { usePlayerLivestream } from "features/player/playerSlice";
8
8
+
import {
9
9
+
LivestreamViewHydrated,
10
10
+
usePlayerLivestream,
11
11
+
} from "features/player/playerSlice";
9
12
import {
10
13
chatWarn,
11
14
selectChatWarned,
···
26
29
const livestream = useAppSelector(usePlayerLivestream());
27
30
const textAreaRef = useRef<Input>(null);
28
31
const dispatch = useAppDispatch();
32
32
+
const navigate = useNavigation();
29
33
const submit = () => {
30
34
if (!isWeb) {
31
35
Keyboard.dismiss();
···
49
53
50
54
return (
51
55
<View position="relative">
52
52
-
{loggedOut && <Login />}
56
56
+
{loggedOut && (
57
57
+
<View flexDirection="row" justifyContent="center">
58
58
+
<Button
59
59
+
backgroundColor="$accentColor"
60
60
+
onPress={() => {
61
61
+
navigate.navigate("Login");
62
62
+
}}
63
63
+
>
64
64
+
Log in to chat
65
65
+
</Button>
66
66
+
<PopoutButton livestream={livestream} isPopout={isPopout} />
67
67
+
</View>
68
68
+
)}
53
69
{!loggedOut && (
54
70
<Form
55
71
zIndex={1}
···
112
128
buttonProps={{ backgroundColor: "transparent" }}
113
129
text={(color) => <Palette size={16} color={color} />}
114
130
/>
115
115
-
{isWeb && !isPopout && (
116
116
-
<Button
117
117
-
flexShrink={0}
118
118
-
backgroundColor="transparent"
119
119
-
disabled={loggedOut}
120
120
-
onPress={() => {
121
121
-
window.open(
122
122
-
"http://127.0.0.1:38080/chat-popout/iame.li",
123
123
-
"_blank",
124
124
-
"popup=true",
125
125
-
);
126
126
-
}}
127
127
-
>
128
128
-
<SquareArrowOutUpRight size={16} />
129
129
-
</Button>
130
130
-
)}
131
131
+
<PopoutButton livestream={livestream} isPopout={isPopout} />
131
132
<Button
132
133
flexShrink={0}
133
134
backgroundColor="transparent"
···
145
146
);
146
147
}
147
148
148
148
-
const Login = () => {
149
149
-
const navigate = useNavigation();
149
149
+
const PopoutButton = ({
150
150
+
livestream,
151
151
+
isPopout,
152
152
+
}: {
153
153
+
livestream: LivestreamViewHydrated | null;
154
154
+
isPopout?: boolean;
155
155
+
}) => {
156
156
+
if (!isWeb || isPopout) {
157
157
+
return <></>;
158
158
+
}
150
159
return (
151
151
-
<View alignItems="center">
152
152
-
<Button
153
153
-
backgroundColor="$accentColor"
154
154
-
onPress={() => {
155
155
-
navigate.navigate("Login");
156
156
-
}}
157
157
-
>
158
158
-
Log in to chat
159
159
-
</Button>
160
160
-
</View>
160
160
+
<Button
161
161
+
flexShrink={0}
162
162
+
backgroundColor="transparent"
163
163
+
onPress={() => {
164
164
+
const u = new URL(window.location.href);
165
165
+
u.pathname = `/chat-popout/${livestream?.author?.did}`;
166
166
+
window.open(u.toString(), "_blank", "popup=true");
167
167
+
}}
168
168
+
>
169
169
+
<SquareArrowOutUpRight size={16} />
170
170
+
</Button>
161
171
);
162
172
};