fix(dashcam): add missing dash-col CSS rules, correct MOV mime type and range clamp

- yaris.css: add dash-col-size/date/upload hide rules on mobile (<576px),
  dash-col-file truncation on tablet, btn-icon-mobile label hide
- app.py: clamp byte2 to file_size-1 to prevent Content-Length mismatch;
  detect MIME from file extension (.mov -> video/quicktime)

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-10 00:12:33 -04:00
co-authored by Copilot
parent 375b93fcea
commit ea03ef7f6c
2 changed files with 23 additions and 6 deletions
+5 -3
View File
@@ -150,16 +150,18 @@ def local_video_file():
except FileNotFoundError: except FileNotFoundError:
return jsonify(error=f"Local video not found: {relative_path}"), 404 return jsonify(error=f"Local video not found: {relative_path}"), 404
ext = os.path.splitext(path)[1].lower()
mime_map = {".mp4": "video/mp4", ".mov": "video/quicktime", ".avi": "video/x-msvideo", ".mkv": "video/x-matroska"}
mime = mime_map.get(ext, "video/mp4")
file_size = os.path.getsize(path) file_size = os.path.getsize(path)
mime = "video/mp4"
range_header = request.headers.get("Range") range_header = request.headers.get("Range")
if range_header: if range_header:
# Parse "bytes=start-end"
byte1, byte2 = 0, None
m = range_header.strip().replace("bytes=", "").split("-") m = range_header.strip().replace("bytes=", "").split("-")
byte1 = int(m[0]) if m[0] else 0 byte1 = int(m[0]) if m[0] else 0
byte2 = int(m[1]) if len(m) > 1 and m[1] else file_size - 1 byte2 = int(m[1]) if len(m) > 1 and m[1] else file_size - 1
byte2 = min(byte2, file_size - 1)
length = byte2 - byte1 + 1 length = byte2 - byte1 + 1
def generate_range(): def generate_range():
+18 -3
View File
@@ -147,8 +147,8 @@ body {
.main-content { .main-content {
flex: 1; flex: 1;
/* on mobile, leave room for the bottom nav */ padding-top: 1.5rem;
padding-bottom: 5rem; padding-bottom: 7rem; /* mobile: leave room above bottom nav */
} }
/* ── Mobile bottom navigation ─────────────────────────────────────────────── */ /* ── Mobile bottom navigation ─────────────────────────────────────────────── */
@@ -199,7 +199,7 @@ body {
margin-left: 0 !important; margin-left: 0 !important;
} }
.main-content { .main-content {
padding-bottom: 5rem; padding-bottom: 7rem;
} }
} }
@@ -269,6 +269,21 @@ body {
/* ── Dashcam / video ─────────────────────────────────────────────────────── */ /* ── Dashcam / video ─────────────────────────────────────────────────────── */
/* Hide less-important columns on mobile to keep the table usable */
@media (max-width: 575.98px) {
.dash-col-size,
.dash-col-date,
.dash-col-upload { display: none; }
}
@media (max-width: 767.98px) {
.dash-col-file { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* Icon-only action buttons on mobile */
@media (max-width: 575.98px) {
.btn-icon-mobile .btn-label { display: none; }
}
.local-video-thumbnail { .local-video-thumbnail {
width: 8rem; width: 8rem;
aspect-ratio: 16 / 9; aspect-ratio: 16 / 9;