|
69 | 69 | background: $background-tertiary; |
70 | 70 | height: $menu-height; |
71 | 71 | flex-shrink: 0; |
72 | | - display: flex; |
| 72 | + // KERNEL: hide it |
| 73 | + // display: flex; |
| 74 | + display: none; |
73 | 75 | } |
74 | 76 |
|
75 | 77 | .video-container { |
|
85 | 87 | max-width: 100%; |
86 | 88 | flex-shrink: 0; |
87 | 89 | flex-direction: column; |
88 | | - display: flex; |
| 90 | + // KERNEL: hide it |
| 91 | + // display: flex; |
| 92 | + display: none; |
89 | 93 |
|
90 | 94 | .room-menu { |
91 | 95 | max-width: 100%; |
|
186 | 190 | components: { |
187 | 191 | 'neko-connect': Connect, |
188 | 192 | 'neko-video': Video, |
189 | | - 'neko-menu': Menu, |
| 193 | + // 'neko-menu': Menu, |
190 | 194 | //'neko-side': Side, |
191 | | - 'neko-controls': Controls, |
| 195 | + // 'neko-controls': Controls, |
192 | 196 | //'neko-members': Members, |
193 | 197 | //'neko-emotes': Emotes, |
194 | 198 | //'neko-about': About, |
|
251 | 255 | } |
252 | 256 | } |
253 | 257 |
|
| 258 | + // KERNEL: begin custom resolution, frame rate, and readOnly control via query params |
| 259 | +
|
| 260 | + // Add a watcher so that when we are connected we can set the resolution from query params |
| 261 | + @Watch('connected', { immediate: true }) |
| 262 | + onConnected(value: boolean) { |
| 263 | + if (value) { |
| 264 | + this.applyQueryResolution() |
| 265 | + } |
| 266 | + } |
| 267 | +
|
| 268 | + // Read ?width=, ?height=, and optional ?rate= (or their short aliases w/h/r) from the URL |
| 269 | + // and set the resolution accordingly. If the current user is an admin we also request the |
| 270 | + // server to switch to that resolution. |
| 271 | + private applyQueryResolution() { |
| 272 | + const params = new URL(location.href).searchParams |
| 273 | +
|
| 274 | + // Helper to parse integer query parameters and return `undefined` when the value is not a valid number. |
| 275 | + const parseIntSafe = (keys: string[], fallback?: number): number | undefined => { |
| 276 | + for (const key of keys) { |
| 277 | + const value = params.get(key) |
| 278 | + if (value !== null) { |
| 279 | + const num = parseInt(value, 10) |
| 280 | + if (!isNaN(num)) return num |
| 281 | + } |
| 282 | + } |
| 283 | + return fallback |
| 284 | + } |
| 285 | +
|
| 286 | + const width = parseIntSafe(['width', 'w']) |
| 287 | + const height = parseIntSafe(['height', 'h']) |
| 288 | + const rate = parseIntSafe(['rate', 'r'], 30) as number |
| 289 | +
|
| 290 | + if (width !== undefined && height !== undefined) { |
| 291 | + const resolution = { width, height, rate } |
| 292 | + this.$accessor.video.setResolution(resolution) |
| 293 | + if (this.$accessor.user && this.$accessor.user.admin) { |
| 294 | + this.$accessor.video.screenSet(resolution) |
| 295 | + } |
| 296 | + } |
| 297 | +
|
| 298 | + // Handle readOnly query param (e.g., ?readOnly=true or ?readonly=1) |
| 299 | + const readOnlyParam = params.get('readOnly') || params.get('readonly') || params.get('ro') |
| 300 | + const readOnly = typeof readOnlyParam === 'string' && ['1', 'true', 'yes'].includes(readOnlyParam.toLowerCase()) |
| 301 | + if (readOnly) { |
| 302 | + // Disable implicit hosting so the user doesn't automatically gain control |
| 303 | + this.$accessor.remote.setImplicitHosting(false) |
| 304 | + // Lock the session locally to block any input even if hosting is later requested |
| 305 | + this.$accessor.remote.setLocked(true) |
| 306 | + } |
| 307 | + } |
| 308 | +
|
| 309 | + // KERNEL: end custom resolution, frame rate, and readOnly control via query params |
| 310 | +
|
254 | 311 | controlAttempt() { |
255 | 312 | if (this.shakeKbd || this.$accessor.remote.hosted) return |
256 | 313 |
|
|
0 commit comments