Skip to content

Commit 7161bd0

Browse files
committed
Refactor websocket handling
1 parent 7eb6af0 commit 7161bd0

35 files changed

+1694
-1827
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Use Node.js
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: 18
22+
node-version: 22
2323
- run: |
2424
pnpm install
2525
pnpm precommit

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

alfc.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"cpuFanTable": [[40, 15], [83, 50], [88, 50]],
2+
"cpuFanTable": [[40, 15], [83, 50], [88, 100]],
33
"gpuFanTable": [[40, 15], [78, 50], [83, 100]],
44
"gpuBoost": true,
55
"pl1": 37,

common/types.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,25 @@ export type FanControlActivity = {
5050
target: number;
5151
};
5252

53-
export type MessageToClient =
54-
| {
55-
kind: MessageToClientKind.State;
56-
data: State;
57-
}
58-
| {
59-
kind: MessageToClientKind.Success;
60-
data?: unknown;
61-
}
62-
| {
63-
kind: MessageToClientKind.Error;
64-
data: string;
65-
}
66-
| {
67-
kind: MessageToClientKind.FanControlActivity;
68-
data: FanControlActivity;
69-
};
53+
export type MessageToClient = Pick<MessageToServer, "methodName" | "methodId"> &
54+
(
55+
| {
56+
kind: MessageToClientKind.State;
57+
data: State;
58+
}
59+
| {
60+
kind: MessageToClientKind.Success;
61+
data?: unknown;
62+
}
63+
| {
64+
kind: MessageToClientKind.Error;
65+
data: string;
66+
}
67+
| {
68+
kind: MessageToClientKind.FanControlActivity;
69+
data: FanControlActivity;
70+
}
71+
);
7072

7173
export type MessageToServer = {
7274
kind: MessageToServerKind;

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import tseslint from "typescript-eslint";
33
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
44
import reactPlugin from "eslint-plugin-react";
55
import hooksPlugin from "eslint-plugin-react-hooks";
6+
import reactRefresh from "eslint-plugin-react-refresh";
67
import globals from "globals";
78
import { includeIgnoreFile } from "@eslint/compat";
89
import path from "node:path";
@@ -56,6 +57,7 @@ export default tseslint.config(
5657
{
5758
plugins: {
5859
"react-hooks": hooksPlugin,
60+
"react-refresh": reactRefresh,
5961
},
6062
rules: hooksPlugin.configs.recommended.rules,
6163
},

frontend/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="./public/favicon.ico" />
5+
<link rel="icon" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#ACD132" />
88
<meta
99
name="description"
1010
content="Control the fans (and more) of the Aorus 15G."
1111
/>
12-
<link rel="apple-touch-icon" href="./public/logo192.png" />
13-
<link rel="manifest" href="./public/manifest.json" />
12+
<link rel="apple-touch-icon" href="/logo192.png" />
13+
<link rel="manifest" href="/manifest.json" />
1414
<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;500&display=swap" rel="stylesheet">
1515
<title>Aorus Laptop Fan Control</title>
1616
</head>

frontend/package.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "frontend",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
56
"scripts": {
67
"start": "vite",
78
"build": "vite build"
@@ -19,33 +20,29 @@
1920
]
2021
},
2122
"dependencies": {
22-
"@csstools/normalize.css": "10.1.0",
23+
"@csstools/normalize.css": "12.1.1",
2324
"@emotion/core": "11.0.0",
2425
"@emotion/styled": "11.14.0",
25-
"@fortawesome/fontawesome-svg-core": "1.2.30",
26-
"@fortawesome/free-solid-svg-icons": "5.14.0",
26+
"@fortawesome/fontawesome-svg-core": "6.7.2",
27+
"@fortawesome/free-solid-svg-icons": "6.7.2",
2728
"@fortawesome/react-fontawesome": "0.2.2",
28-
"bootstrap": "4.5.2",
29-
"emotion": "10.0.27",
30-
"lodash": "4.17.20",
31-
"react": "^18.2.0",
32-
"react-dom": "^18.2.0",
33-
"react-toastify": "6.0.8",
29+
"bootstrap": "5.3.3",
30+
"lodash": "4.17.21",
31+
"react": "18.2.0",
32+
"react-dom": "18.2.0",
33+
"react-error-boundary": "^5.0.0",
34+
"react-toastify": "11.0.2",
35+
"react-use-websocket": "4.11.1",
3436
"reactstrap": "9.2.3"
3537
},
3638
"devDependencies": {
37-
"@babel/core": "^7.26.0",
38-
"@babel/runtime": "7.26.0",
3939
"@types/lodash": "4.17.14",
4040
"@types/node": "^18",
4141
"@types/react": "^18",
4242
"@types/react-dom": "^18",
43-
"@types/react-fontawesome": "1.6.4",
44-
"@types/reactstrap": "8.5.1",
45-
"@vitejs/plugin-react": "^4.0.1",
46-
"@welldone-software/why-did-you-render": "4.2.7",
47-
"babel-plugin-emotion": "10.0.33",
43+
"@types/react-fontawesome": "1.6.8",
44+
"@vitejs/plugin-react": "^4.3.4",
4845
"cross-env": "^7.0.3",
49-
"vite": "^4.3.9"
46+
"vite": "^6.0.7"
5047
}
5148
}

0 commit comments

Comments
 (0)