Skip to content

Commit 6915d93

Browse files
committed
Gstreamer: Doc update and Code Rabbit Fixes
1 parent c952471 commit 6915d93

5 files changed

Lines changed: 30 additions & 23 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ Quality couch keyboards are not so accessible, STT on Linux isn’t in a good st
3131
>
3232
> On Wayland, screen capture requires a working PipeWire + XDG Desktop Portal setup (typically provided by your desktop environment).
3333
>
34-
> Your user must also have permission to access `/dev/uinput`. A common setup is:
34+
> Your user must also have permission to access `/dev/uinput`. A recommended setup is:
3535
>
3636
> ```bash
37+
> sudo groupadd -f uinput
38+
>
3739
> sudo tee /etc/udev/rules.d/99-rein.rules <<EOF
38-
> KERNEL=="uinput", MODE="0660", GROUP="input"
40+
> KERNEL=="uinput", MODE="0660", GROUP="uinput"
3941
> EOF
4042
>
41-
> sudo usermod -aG input $USER
43+
> sudo usermod -aG uinput $USER
4244
>
4345
> sudo udevadm control --reload-rules
4446
> sudo udevadm trigger
@@ -55,7 +57,7 @@ Quality couch keyboards are not so accessible, STT on Linux isn’t in a good st
5557
> which should show:
5658
>
5759
> ```text
58-
> crw-rw---- 1 root input ... /dev/uinput
60+
> crw-rw---- 1 root uinput ... /dev/uinput
5961
> ```
6062
>
6163
> Additionally, some native dependencies are required. Install them via your package manager (see [`shell.nix`](shell.nix) for the list), or use `nix-shell` directly.

src/hooks/useWebRtcStream.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,17 @@ export function useWebRtcStream({ token }: UseWebRtcStreamOptions) {
215215
const sendInputOffer = async () => {
216216
const offer = await inputPc.createOffer()
217217
await inputPc.setLocalDescription(offer)
218-
await fetch("/api/webrtc/input-offer", {
218+
const response = await fetch("/api/webrtc/input-offer", {
219219
method: "POST",
220220
headers: {
221221
"Content-Type": "application/json",
222222
...(token ? { Authorization: `Bearer ${token}` } : {}),
223223
},
224224
body: JSON.stringify({ sessionId: activeSessionId, sdp: offer.sdp }),
225225
})
226+
if (!response.ok) {
227+
throw new Error(`[WebRTC] Input offer failed: ${response.status}`)
228+
}
226229
}
227230

228231
sendInputOffer().catch(console.error)

src/server/drivers/linux/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,7 @@ class UinputDevice {
8181
console.error(
8282
`[${this.name}] Ensure /dev/uinput exists and the process has write permission.`,
8383
)
84-
console.error(
85-
`[${this.name}] Run: sudo chown root:input /dev/uinput && sudo chmod 0660 /dev/uinput or add udev rule.`,
86-
)
87-
throw new Error(
88-
`Failed to open /dev/uinput. Ensure your user has write permissions (run: sudo chown root:input /dev/uinput && sudo chmod 0660 /dev/uinput)`,
89-
)
84+
return false
9085
}
9186
}
9287

src/server/server.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,19 @@ export function attachSignalingRoutes(
103103
const match = pathname.match(route.pattern)
104104
if (!match) continue
105105

106-
const anyRes = res as ServerResponse & { __handledByRein?: boolean }
106+
const anyRes = res as ServerResponse & {
107+
__handledByRein?: boolean
108+
__reinOriginalWrite?: typeof originalWrite
109+
}
107110
anyRes.__handledByRein = true
108111

109112
const originalSetHeader = res.setHeader.bind(res)
110113
const originalWriteHead = res.writeHead.bind(res)
111114
const originalWrite = res.write.bind(res)
112115
const originalEnd = res.end.bind(res)
113116

117+
anyRes.__reinOriginalWrite = originalWrite
118+
114119
res.setHeader = ((...args: Parameters<typeof res.setHeader>) => {
115120
if (anyRes.__handledByRein && !reinStorage.getStore()) {
116121
return res
@@ -144,16 +149,18 @@ export function attachSignalingRoutes(
144149
}) as typeof res.end
145150

146151
const params = match.slice(1)
147-
Promise.resolve(
148-
reinStorage.run(true, () => route.handler(req, res, ...params)),
149-
).catch((err) => {
150-
logger.error(`Signaling route error: ${String(err)}`)
151-
if (!res.headersSent) {
152-
reinStorage.run(true, () => {
153-
json(res, 500, { error: "Internal server error" })
154-
})
155-
}
156-
})
152+
Promise.resolve()
153+
.then(() =>
154+
reinStorage.run(true, () => route.handler(req, res, ...params)),
155+
)
156+
.catch((err) => {
157+
logger.error(`Signaling route error: ${String(err)}`)
158+
if (!res.headersSent) {
159+
reinStorage.run(true, () => {
160+
json(res, 500, { error: "Internal server error" })
161+
})
162+
}
163+
})
157164
return
158165
}
159166
},

src/utils/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const i18n = {
1111
connectedButNoVideo: "Establishing stream...",
1212
establishingSecure: "Establishing secure connection",
1313
settingUpScreen: "Setting up screen sharing",
14-
checkNetwork: "Please check your network or token",
14+
checkNetwork: "Attempting to connect to the host.",
1515
},
1616
},
1717
} as const

0 commit comments

Comments
 (0)