Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler stack to solve #42 #67

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1

- run: bun install
- run: bun run build

- uses: actions/upload-pages-artifact@v3
with:
path: ./dist
path: ./

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:

- run: bun install
- run: bun lint
- run: bun vitest
- run: bun test
Binary file modified bun.lockb
Binary file not shown.
34 changes: 33 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,42 @@
content="Update your comma device to the latest software"
/>
<title>flash.comma.ai</title>
<link href="https://cdn.jsdelivr.net/npm/@fontsource-variable/[email protected]/index.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@fontsource-variable/[email protected]/index.min.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com?plugins=typography"></script>
<script>
tailwind.config = {
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
fontFamily: {
sans: ['Inter Variable', 'sans-serif'],
monospace: ['JetBrains Mono Variable', 'monospace'],
},
}
}
}
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
<script type="importmap">
{
"imports": {
"react": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"react-dom": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"comlink": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"crc-32": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"jssha": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"xz-decompress": "https://cdn.jsdelivr.net/npm/[email protected]/+esm"
}
}
</script>
<script type="module" src="/src/main.js"></script>
<script
defer
data-domain="flash.comma.ai"
Expand Down
49 changes: 13 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,22 @@
{
"name": "@commaai/flash",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"start": "vite preview",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives",
"test": "vitest"
"devDependencies": {
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7"
},
"engines": {
"node": ">=20.11.0"
},
"dependencies": {
"@fontsource-variable/inter": "^5.0.18",
"@fontsource-variable/jetbrains-mono": "^5.0.21",
"comlink": "^4.4.1",
"crc-32": "^1.2.2",
"jssha": "^3.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"xz-decompress": "^0.2.1"
"private": true,
"scripts": {
"dev": "python3 -m http.server 5173",
"build": "echo \"Error: no build specified\" && exit 0",
"start": "python3 -m http.server 5173",
"lint": "echo \"Error: no lint confugured\" && exit 0",
"test": "echo \"Error: no test confugured\" && exit 0"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.0",
"autoprefixer": "10.4.14",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"jsdom": "^22.1.0",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"vite": "^5.2.12",
"vite-svg-loader": "^5.1.0",
"vitest": "^1.6.0"
}
"type": "module"
}
6 changes: 0 additions & 6 deletions postcss.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/QDL/firehose.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { xmlParser } from "./xmlParser"
import { concatUint8Array, containsBytes, compareStringToBytes, sleep, readBlobAsBuffer } from "./utils"
import * as Sparse from "./sparse"
import { xmlParser } from "./xmlParser.js"
import { concatUint8Array, containsBytes, compareStringToBytes, sleep, readBlobAsBuffer } from "./utils.js"
import * as Sparse from "./sparse.js"


class response {
Expand Down
5 changes: 3 additions & 2 deletions src/QDL/gpt.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { containsBytes, bytes2Number } from "./utils"
import { buf as crc32 } from "crc-32"
import { containsBytes, bytes2Number } from "./utils.js"
import CRC32 from "crc-32"

export const AB_FLAG_OFFSET = 6;
export const AB_PARTITION_ATTR_SLOT_ACTIVE = (0x1 << 2);
export const PART_ATT_PRIORITY_BIT = BigInt(48)
export const PART_ATT_ACTIVE_BIT = BigInt(50)
export const PART_ATT_ACTIVE_VAL = BigInt(0x1) << PART_ATT_ACTIVE_BIT

const crc32 = CRC32.buf
const efiType = {
0x00000000 : "EFI_UNUSED",
0xEBD0A0A2 : "EFI_BASIC_DATA",
Expand Down
10 changes: 5 additions & 5 deletions src/QDL/qdl.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as gpt from "./gpt"
import { usbClass } from "./usblib"
import { Sahara } from "./sahara"
import { Firehose } from "./firehose"
import { concatUint8Array, runWithTimeout, containsBytes } from "./utils"
import * as gpt from "./gpt.js"
import { usbClass } from "./usblib.js"
import { Sahara } from "./sahara.js"
import { Firehose } from "./firehose.js"
import { concatUint8Array, runWithTimeout, containsBytes } from "./utils.js"


export class qdlDevice {
Expand Down
6 changes: 3 additions & 3 deletions src/QDL/sahara.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommandHandler, cmd_t, sahara_mode_t, status_t, exec_cmd_t } from "./saharaDefs"
import { concatUint8Array, packGenerator, readBlobAsBuffer } from "./utils";
import config from "@/config"
import { CommandHandler, cmd_t, sahara_mode_t, status_t, exec_cmd_t } from "./saharaDefs.js"
import { concatUint8Array, packGenerator, readBlobAsBuffer } from "./utils.js";
import config from "../config.js"


export class Sahara {
Expand Down
2 changes: 1 addition & 1 deletion src/QDL/saharaDefs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { structHelper_io } from "./utils"
import { structHelper_io } from "./utils.js"


export const cmd_t = {
Expand Down
2 changes: 1 addition & 1 deletion src/QDL/sparse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readBlobAsBuffer } from "./utils";
import { readBlobAsBuffer } from "./utils.js";

const FILE_MAGIC = 0xed26ff3a;
export const FILE_HEADER_SIZE = 28;
Expand Down
2 changes: 1 addition & 1 deletion src/QDL/usblib.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { concatUint8Array, sleep } from "./utils";
import { concatUint8Array, sleep } from "./utils.js";

const vendorID = 0x05c6;
const productID = 0x9008;
Expand Down
Loading