Skip to content

Commit f18a810

Browse files
authored
Merge pull request #2 from SimDevices-Project/copilot/fix-1
Fix firmware update UI with modern design, progress bars and auto-download functionality
2 parents 15564ad + 821c7b3 commit f18a810

6 files changed

Lines changed: 1763 additions & 119 deletions

File tree

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
7+
# Allow one concurrent deployment
8+
concurrency:
9+
group: "pages"
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-and-deploy:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '18'
29+
cache: 'npm'
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Build project
35+
run: npm run build
36+
37+
- name: Prepare deployment files
38+
run: |
39+
# Copy all files from public to dist
40+
cp -r public/* dist/
41+
# List files to verify
42+
echo "Files in dist directory:"
43+
ls -la dist/
44+
45+
- name: Deploy to GitHub Pages
46+
uses: peaceiris/actions-gh-pages@v3
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: ./dist
50+
force_orphan: true

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# SimGEKI-WebControl
2+
3+
一个用于 SimGEKI 设备的网页控制工具,支持固件刷写和设备配置。
4+
5+
## 功能特性
6+
7+
- 🔧 固件刷写:支持下载最新版本和每日构建固件
8+
- ⚙️ 设备配置:实时摇杆监控和配置调整
9+
- 🌐 网页界面:无需安装软件,直接在浏览器中使用
10+
- 🔄 自动部署:每次提交后自动构建并部署到 GitHub Pages
11+
12+
## 在线使用
13+
14+
访问:https://simdevices-project.github.io/SimGEKI-WebControl/
15+
16+
## 本地开发
17+
18+
### 安装依赖
19+
20+
```bash
21+
npm install
22+
```
23+
24+
### 开发模式
25+
26+
```bash
27+
npm run dev
28+
```
29+
30+
### 构建生产版本
31+
32+
```bash
33+
npm run build
34+
```
35+
36+
## 自动部署
37+
38+
项目配置了 GitHub Actions 自动构建工作流:
39+
40+
- 当代码推送到 `main``master` 分支时,会自动触发构建
41+
- 构建完成后,自动部署到 `gh-pages` 分支
42+
- 部署的静态页面可通过 GitHub Pages 访问
43+
44+
### 工作流程
45+
46+
1. **检出代码** - 获取最新的源代码
47+
2. **设置 Node.js 环境** - 安装 Node.js 18
48+
3. **安装依赖** - 运行 `npm ci` 安装项目依赖
49+
4. **执行 webpack 生产构建** - 编译和压缩 JavaScript 代码
50+
5. **复制静态文件** - 将 `public` 目录的文件复制到 `dist` 目录
51+
6. **部署到 gh-pages 分支** - 自动推送构建结果到 GitHub Pages
52+
53+
### 启用 GitHub Pages
54+
55+
要使自动部署生效,需要在 GitHub 仓库设置中:
56+
57+
1. 进入仓库的 **Settings** 页面
58+
2. 在左侧菜单找到 **Pages** 选项
59+
3.**Source** 中选择 **Deploy from a branch**
60+
4. 选择 **gh-pages** 分支作为源
61+
5. 根目录选择 **/ (root)**
62+
6. 点击 **Save** 保存设置
63+
64+
### 本地预览生产版本
65+
66+
```bash
67+
npm run preview
68+
```
69+
70+
## 浏览器支持
71+
72+
需要支持 WebHID API 的现代浏览器:
73+
- Chrome 89+
74+
- Edge 89+
75+
- Opera 75+
76+
77+
## 许可证
78+
79+
AGPLv3 License

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"dev": "webpack serve",
9-
"pack": "webpack --mode=production "
9+
"build": "webpack --mode=production",
10+
"pack": "webpack --mode=production",
11+
"preview": "webpack serve --mode=production --open",
12+
"clean": "rimraf dist"
1013
},
1114
"author": "",
12-
"license": "ISC",
15+
"license": "AGPL-3.0",
1316
"dependencies": {
1417
},
1518
"devDependencies": {
1619
"webpack": "^5.82.1",
1720
"webpack-cli": "^5.1.1",
18-
"webpack-dev-server": "^4.15.0"
21+
"webpack-dev-server": "^4.15.0",
22+
"rimraf": "^5.0.1"
1923
}
2024
}

0 commit comments

Comments
 (0)