Skip to content

Commit 24811e5

Browse files
authored
fix: firehose parsing (commaai#332)
comma's firehose uploads go to a different host; the URL structure is different this is also a much cleaner way of identifying when firehose data is getting uploaded <img width="561" alt="image" src="https://github.com/user-attachments/assets/f592f8a4-bfcf-4831-922f-abfadde74e4d" />
1 parent 45ec059 commit 24811e5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/components/UploadQueue.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createSignal, For, Match, onCleanup, Show, Switch, VoidComponent } from 'solid-js'
2-
import { cancelUpload, COMMA_CONNECT_PRIORITY, getUploadQueue } from '~/api/athena'
2+
import { cancelUpload, getUploadQueue } from '~/api/athena'
33
import { UploadFilesToUrlsRequest, UploadQueueItem } from '~/types'
44
import LinearProgress from './material/LinearProgress'
55
import Icon from './material/Icon'
@@ -13,11 +13,16 @@ interface DecoratedUploadQueueItem extends UploadQueueItem {
1313
route: string
1414
segment: number
1515
filename: string
16+
isFirehose: boolean
1617
}
1718

1819
const parseUploadPath = (url: string) => {
19-
const parts = new URL(url).pathname.split('/')
20-
return { route: parts[3], segment: parseInt(parts[4], 10), filename: parts[5] }
20+
const parsed = new URL(url)
21+
const parts = parsed.pathname.split('/')
22+
if (parsed.hostname === 'upload.commadotai.com') {
23+
return { route: parts[2], segment: parseInt(parts[3], 10), filename: parts[4], isFirehose: true }
24+
}
25+
return { route: parts[3], segment: parseInt(parts[4], 10), filename: parts[5], isFirehouse: false }
2126
}
2227

2328
const cancel = (dongleId: string, ids: string[]) => {
@@ -32,10 +37,7 @@ const UploadQueueRow: VoidComponent<{ dongleId: string; item: DecoratedUploadQue
3237
<div class="flex flex-col">
3338
<div class="flex items-center justify-between flex-wrap mb-1 gap-x-4 min-w-0">
3439
<div class="flex items-center min-w-0 flex-1">
35-
<Icon
36-
class="text-on-surface-variant flex-shrink-0 mr-2"
37-
name={item.priority === COMMA_CONNECT_PRIORITY ? 'person' : 'local_fire_department'}
38-
/>
40+
<Icon class="text-on-surface-variant flex-shrink-0 mr-2" name={item.isFirehose ? 'local_fire_department' : 'person'} />
3941
<div class="flex min-w-0 gap-1">
4042
<span class="text-body-sm font-mono truncate text-on-surface">{[item.route, item.segment, item.filename].join(' ')}</span>
4143
</div>

0 commit comments

Comments
 (0)