Skip to content

Commit 40fc18c

Browse files
committed
chore: 清理注释并补充中文文档
1 parent d0d7e2e commit 40fc18c

7 files changed

Lines changed: 151 additions & 253 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,30 @@
1-
name: CI/CD Pipeline
1+
name: CI
22

33
on:
44
push:
5-
branches: [ main, master, develop ]
5+
branches: [ main, master ]
66
pull_request:
7-
branches: [ main, master, develop ]
7+
branches: [ main, master ]
88

99
jobs:
10-
test:
11-
name: Test
10+
build-and-test:
11+
name: Build and Test
1212
runs-on: ubuntu-latest
13-
14-
strategy:
15-
matrix:
16-
node-version: [18.x, 20.x]
17-
1813
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v4
21-
22-
- name: Setup Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v4
24-
with:
25-
node-version: ${{ matrix.node-version }}
26-
cache: 'npm'
27-
28-
- name: Install dependencies
29-
run: npm ci
30-
31-
- name: Run tests
32-
run: npm test
33-
34-
- name: Run tests with coverage
35-
run: npm test -- --coverage
36-
37-
- name: Upload coverage to Codecov
38-
uses: codecov/codecov-action@v4
39-
with:
40-
token: ${{ secrets.CODECOV_TOKEN }}
41-
file: ./coverage/lcov.info
42-
fail_ci_if_error: false
14+
- name: Checkout code
15+
uses: actions/checkout@v4
4316

44-
build:
45-
name: Build
46-
runs-on: ubuntu-latest
47-
needs: test
48-
49-
steps:
50-
- name: Checkout code
51-
uses: actions/checkout@v4
52-
53-
- name: Setup Node.js
54-
uses: actions/setup-node@v4
55-
with:
56-
node-version: '20.x'
57-
cache: 'npm'
58-
59-
- name: Install dependencies
60-
run: npm ci
61-
62-
- name: Build project
63-
run: npm run build
64-
65-
- name: Upload build artifacts
66-
uses: actions/upload-artifact@v4
67-
with:
68-
name: build-files
69-
path: build/
70-
retention-days: 7
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: "20"
21+
cache: npm
7122

72-
deploy:
73-
name: Deploy to GitHub Pages
74-
runs-on: ubuntu-latest
75-
needs: build
76-
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
77-
78-
permissions:
79-
contents: read
80-
pages: write
81-
id-token: write
82-
83-
steps:
84-
- name: Checkout code
85-
uses: actions/checkout@v4
86-
87-
- name: Download build artifacts
88-
uses: actions/download-artifact@v4
89-
with:
90-
name: build-files
91-
path: build/
92-
93-
- name: Setup Pages
94-
uses: actions/configure-pages@v4
95-
96-
- name: Upload to GitHub Pages
97-
uses: actions/upload-pages-artifact@v2
98-
with:
99-
path: build/
100-
101-
- name: Deploy to GitHub Pages
102-
id: deployment
103-
uses: actions/deploy-pages@v3
23+
- name: Install dependencies
24+
run: npm ci
10425

105-
docker:
106-
name: Build Docker Image
107-
runs-on: ubuntu-latest
108-
needs: test
109-
110-
steps:
111-
- name: Checkout code
112-
uses: actions/checkout@v4
113-
114-
- name: Set up Docker Buildx
115-
uses: docker/setup-buildx-action@v3
116-
117-
- name: Build Docker image
118-
uses: docker/build-push-action@v5
119-
with:
120-
context: .
121-
push: false
122-
tags: protobuf-decoder:latest
123-
cache-from: type=gha
124-
cache-to: type=gha,mode=max
26+
- name: Run tests
27+
run: npm test
28+
29+
- name: Build project
30+
run: npm run build

README.md

Lines changed: 50 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,82 @@
1-
# Protobuf Decoder
1+
# ProtoDecodeX
22

3-
[![CircleCI](https://circleci.com/gh/pawitp/protobuf-decoder.svg?style=svg)](https://circleci.com/gh/pawitp/protobuf-decoder)
4-
[![codecov](https://codecov.io/gh/pawitp/protobuf-decoder/branch/master/graph/badge.svg)](https://codecov.io/gh/pawitp/protobuf-decoder)
5-
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
3+
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
64

7-
Protobuf Decoder is a web application based on React to decode and visualize Protobuf data into prettified table layout.
5+
ProtoDecodeX is a React-based web app that decodes and visualizes Protobuf data in a readable table view.
86

97
> For live version, please visit: https://protobuf-decoder.netlify.app/
108
119
## Getting Started
12-
1310
To start application locally, use `npm` to get the dependencies and start the application.
1411

15-
```
16-
$ npm install
17-
$ npm start
12+
```bash
13+
npm install
14+
npm start
1815
```
1916

20-
Once the application started, open http://localhost:5173 on web browser.
17+
Then open `http://localhost:3000`.
2118

2219
## Supported Input Formats
2320

24-
The decoder supports multiple input formats commonly used in development:
21+
1. Hexadecimal bytes (with or without spaces)
22+
2. Base64 string
23+
3. Java decimal byte array (supports negative values)
24+
4. Java escaped string (for `ISO_8859_1`/byte dump style)
2525

26-
### 1. Hexadecimal Format
27-
Traditional hex format with spaces or without spaces.
28-
```
26+
## Usage
27+
28+
1. Paste data into the input box
29+
2. Decoder auto-detects input format
30+
3. Click `Decode`
31+
4. Inspect parsed fields in the result table
32+
33+
## Example Data
34+
35+
### 1) Hexadecimal Format
36+
37+
```text
2938
0a 80 04 0a db 03 1a 2a 9f 2e 2a 2a 2a 2a 97 2e
3039
```
3140

32-
### 2. Base64 Format
33-
Base64 encoded protobuf data.
34-
```
41+
### 2) Base64 Format
42+
43+
```text
3544
CoCAEAq7Aw0aKp8uKioqKlcqni4qgiIK4isqgiInb19YRVpP
3645
```
3746

38-
### 3. Java Decimal Array Format
39-
Comma-separated decimal values (supports negative numbers).
40-
```
41-
10, 96, 10, 43, 10, 16, 65, 67, 51, 49, 90, 69, 72, 52, 65, 72, 51, 78, 48, 54, 51, 51, 18, 23, 16, 1, 24, 1, 32, 0, 40, 1, 48, 8, 56, -124, 1, 64, -106, -90, 63, 74, 4, -122, -125, -112, 13, 16, 96, 24, 32, 32, 1, 40, 1, 64, -47, 1, 72, 2, 80, 43, 88, 1, 112, -88, -101, -84, 1, 120, -127, -90, 1, -128, 1, 3, -120, 1, 1, -62, 1, 16, 72, 74, 51, 49, 90, 68, 72, 52, 90, 70, 55, 50, 48, 48, 53, 57
42-
```
47+
### 3) Hex stream (XOR / nested-message scenario)
4348

44-
### 4. Java Escape String Format
45-
Java string with octal/hex escape sequences.
49+
```text
50+
0a 80 04 0a db 03 1a 2a 9f 2e 2a 2a 2a 2a 97 2e 4e 8e 97 96 f0 2e 2a 82 22 e2 2b 98 22 27 6f 5f 58 45 5a 4f 05 68 4f 58 46 43 44 92 22 2b bf 25 2a 2a ba 68 b7 25 2a 2a e2 68 ea 25 aa 34 da 25 99 04 d2 25 99 04 ba 3a 36 b2 3a 0b 8a 3a 0b 82 3a 0b 9f 3a 2a 2a ba 68 97 3a 2a 2a e2 68 ca 3a 99 04 c2 3a 99 04 da 3a 75 d2 3a 2a b2 3b 2b e2 3b 2a fa 3b 2a e7 3c 2a 2a 2a 2a fa 3c 2a cf 3d 6f 1a 02 6a c7 3d 02 d9 bc 97 e0 32 28 0a 2b 82 30 2a ff 31 c1 17 03 6a f2 36 9a 23 ca 36 cb 26 c2 36 29 da 36 aa 34 b7 0a 2a 2a 62 6e 8f 0a 2a 2a 62 6e 87 0a 2a 2a 2a 2a 9f 0a 2a 2a 2a 2a ea 0a 2b e2 0a 8a 2c ff 0f 2a 2a 12 e8 87 0c ad de 45 69 97 0c eb d8 6d 68 ef 0c 2a 2a 2a 2a f2 0c 2b b0 0d 2a 92 07 8a 2c e2 07 2a fa 07 2f f2 07 bb 64 9a 05 2b 90 05 2a ea 05 28 a0 1b 3e 3a 2b 30 3a 68 61 18 1b 70 6f 68 1b 69 6b 1b 1b 1a 18 1b 1a a8 17 3f 20 22 22 ba cf df ed 2c 3a 4e 20 23 22 ba d9 8b e4 2c 3a e2 2b a2 17 2a b8 17 2a 8a 17 2a 82 17 2b 9a 17 2a 92 17 2b ea 17 a8 ea db de 2d e2 17 8a 2c f2 17 2a ca 17 2a c2 17 9d 3b da 17 2b d2 17 2b af 14 2a 2a 2a 2a a7 14 2a 2a 2a 2a ba 14 4e b2 14 2b 8f 14 2c 6a d6 1d 87 14 93 8f 20 15 9f 14 ba ee 19 10 97 14 23 b6 19 17 ef 14 25 76 02 6a e7 14 0c f8 78 14 ff 14 2a 2a 2a 2a f7 14 2a 2a 2a aa cf 14 2a 2a 62 6e ff 61 2a 2a 2a 2a f7 61 2a 2a 2a 2a ca 61 2a da 65 2b aa 7a d6 3b a2 7a 9a 23 ba 7a 9a 23 b2 7a f6 21 8a 7a f6 21 82 7a 2b ca 7a 2a c0 7a 2a d8 7a 2a d0 7a 2a aa 7b 2a 92 77 8a 2c ea 77 2a e2 77 2a 10 02 18 20 20 01 28 01 30 01 38 03 40 fe 01 48 15 50 db 03 70 aa cc 8d 01 78 82 70 80 01 03 88 01 01
4651
```
47-
\2605\006\027}\276\255\270\270\360\373\220\271
48-
```
49-
50-
## Usage
51-
52-
1. Paste Protobuf data in any supported format
53-
2. The decoder automatically detects the format and shows it with a colored label
54-
3. Press **Decode** button to parse the data
55-
4. View the decoded protobuf structure in a formatted table
56-
57-
## Features
5852

59-
- **Multiple Input Formats**: Support for hex, base64, Java decimal arrays, and Java escape strings
60-
- **Automatic Format Detection**: No need to specify the format manually
61-
- **Smart Decode**: Conditional XOR decryption for encrypted protobuf data
62-
- **Schema-Based Display**: Display decoded data using custom protobuf schemas
63-
- **Performance Optimized**: Caching and memoization for better performance
64-
- **Responsive UI**: Modern interface with expand/collapse functionality
65-
- **File Upload**: Support for uploading binary files directly
53+
### 4) Multi-message stream
6654

67-
## Example Data
55+
```text
56+
0a 2f 0a 08 4a 6f 68 6e 20 44 6f 65 10 01 1a 10 6a 6f 68 6e 40 65 78 61 6d 70 6c 65 2e 63 6f 6d 22 0f 0a 0b 31 31 31 2d 32 32 32 2d 33 33 33 10 01 0a 1e 0a 08 4a 61 6e 65 20 44 6f 65 10 02 1a 10 6a 61 6e 65 40 65 78 61 6d 70 6c 65 2e 63 6f 6d
57+
```
6858

69-
**Input (Hexadecimal)**
59+
### 5) Java decimal array
7060

71-
> 0a 2f 0a 08 4a 6f 68 6e 20 44 6f 65 10 01 1a 10 6a 6f 68 6e 40 65 78 61 6d 70 6c 65 2e 63 6f 6d 22 0f 0a 0b 31 31 31 2d 32 32 32 2d 33 33 33 10 01 0a 1e 0a 08 4a 61 6e 65 20 44 6f 65 10 02 1a 10 6a 61 6e 65 40 65 78 61 6d 70 6c 65 2e 63 6f 6d
61+
```text
62+
10, 96, 10, 43, 10, 16, 65, 67, 51, 49, 90, 69, 72, 52, 65, 72, 51, 78, 48, 54, 51, 51, 18, 23, 16, 1, 24, 1, 32, 0, 40, 1, 48, 8, 56, -124, 1, 64, -106, -90, 63, 74, 4, -122, -125, -112, 13, 16, 96, 24, 32, 32, 1, 40, 1, 64, -47, 1, 72, 2, 80, 43, 88, 1, 112, -88, -101, -84, 1, 120, -127, -90, 1, -128, 1, 3, -120, 1, 1, -62, 1, 16, 72, 74, 51, 49, 90, 68, 72, 52, 90, 70, 55, 50, 48, 48, 53, 57, 10, 96, 10, 43, 10, 16, 65, 67, 51, 49, 90, 69, 72, 52, 65, 72, 51, 78, 48, 54, 51, 51, 18, 23, 16, 1, 24, 1, 32, 0, 40, 1, 48, 8, 56, -124, 1, 64, -96, 71, -121, 0, 4, -122, -125, -112, 13, 16, 96, 24, 32, 32, 1, 40, 1, 64, -47, 1, 72, 2, 80, 43, 88, 1, 112, -61, -41, -85, 1, 120, -127, -90, 1, -128, 1, 3, -120, 1, 1, -62, 1, 16, 72, 74, 51, 49, 90, 68, 72, 52, 90, 70, 55, 50, 48, 48, 53, 57
63+
```
7264

73-
**Input (Java Decimal Array)**
65+
### 6) Java escaped string
7466

75-
> 10, 96, 10, 43, 10, 16, 65, 67, 51, 49, 90, 69, 72, 52, 65, 72, 51, 78, 48, 54, 51, 51, 18, 23, 16, 1, 24, 1, 32, 0, 40, 1, 48, 8, 56, -124, 1, 64, -106, -90, 63, 74, 4, -122, -125, -112, 13, 16, 96, 24, 32, 32, 1, 40, 1, 64, -47, 1, 72, 2, 80, 43, 88, 1, 112, -88, -101, -84, 1, 120, -127, -90, 1, -128, 1, 3, -120, 1, 1, -62, 1, 16, 72, 74, 51, 49, 90, 68, 72, 52, 90, 70, 55, 50, 48, 48, 53, 57
67+
```text
68+
\2605\006\027}\276\255\270\270\360\373\220\271
69+
```
7670

77-
**Output**
71+
## Features
7872

79-
<img src="https://raw.githubusercontent.com/pugkung/protobuf-decoder/master/screenshot.jpg" alt="screenshot" width="500"/>
73+
- Multi-format input support
74+
- Automatic format detection
75+
- Smart decode (conditional XOR)
76+
- Schema-based display
77+
- Expand/collapse table interaction
78+
- File upload support
8079

81-
## Recent Updates
80+
## License
8281

83-
- ✅ Added support for Java decimal array format
84-
- ✅ Added support for Java escape string format
85-
- ✅ Automatic format detection with visual indicators
86-
- ✅ Smart decode feature with conditional XOR decryption
87-
- ✅ Schema-based display for custom protobuf definitions
88-
- ✅ Performance optimizations and caching
89-
- ✅ Improved UI with expand/collapse functionality
90-
- ✅ Better error handling and user feedback
82+
MIT

README.zh-CN.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# ProtoDecodeX
2+
3+
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
4+
5+
ProtoDecodeX 是一个基于 React 的 Web 应用,可将 Protobuf 数据解码并以易读的表格形式展示。
6+
7+
> 在线体验:https://protobuf-decoder.netlify.app/
8+
9+
## 快速开始
10+
11+
```bash
12+
npm install
13+
npm start
14+
```
15+
16+
然后在浏览器中打开 `http://localhost:3000`
17+
18+
## 支持的输入格式
19+
20+
1. 十六进制字节流(可带空格或不带空格)
21+
2. Base64 字符串
22+
3. Java 十进制字节数组(支持负数)
23+
4. Java 转义字符串(适用于 `ISO_8859_1` / 字节转储场景)
24+
25+
## 使用方式
26+
27+
1. 将数据粘贴到输入框中
28+
2. 解码器会自动识别输入格式
29+
3. 点击 `Decode`
30+
4. 在结果表格中查看解析后的字段
31+
32+
## 示例数据
33+
34+
### 1) 十六进制格式
35+
36+
```text
37+
0a 80 04 0a db 03 1a 2a 9f 2e 2a 2a 2a 2a 97 2e
38+
```
39+
40+
### 2) Base64编码格式
41+
42+
```text
43+
CoCAEAq7Aw0aKp8uKioqKlcqni4qgiIK4isqgiInb19YRVpP
44+
```
45+
46+
### 2) 十六进制数据流(XOR / 嵌套消息场景)
47+
48+
```text
49+
0a 80 04 0a db 03 1a 2a 9f 2e 2a 2a 2a 2a 97 2e 4e 8e 97 96 f0 2e 2a 82 22 e2 2b 98 22 27 6f 5f 58 45 5a 4f 05 68 4f 58 46 43 44 92 22 2b bf 25 2a 2a ba 68 b7 25 2a 2a e2 68 ea 25 aa 34 da 25 99 04 d2 25 99 04 ba 3a 36 b2 3a 0b 8a 3a 0b 82 3a 0b 9f 3a 2a 2a ba 68 97 3a 2a 2a e2 68 ca 3a 99 04 c2 3a 99 04 da 3a 75 d2 3a 2a b2 3b 2b e2 3b 2a fa 3b 2a e7 3c 2a 2a 2a 2a fa 3c 2a cf 3d 6f 1a 02 6a c7 3d 02 d9 bc 97 e0 32 28 0a 2b 82 30 2a ff 31 c1 17 03 6a f2 36 9a 23 ca 36 cb 26 c2 36 29 da 36 aa 34 b7 0a 2a 2a 62 6e 8f 0a 2a 2a 62 6e 87 0a 2a 2a 2a 2a 9f 0a 2a 2a 2a 2a ea 0a 2b e2 0a 8a 2c ff 0f 2a 2a 12 e8 87 0c ad de 45 69 97 0c eb d8 6d 68 ef 0c 2a 2a 2a 2a f2 0c 2b b0 0d 2a 92 07 8a 2c e2 07 2a fa 07 2f f2 07 bb 64 9a 05 2b 90 05 2a ea 05 28 a0 1b 3e 3a 2b 30 3a 68 61 18 1b 70 6f 68 1b 69 6b 1b 1b 1a 18 1b 1a a8 17 3f 20 22 22 ba cf df ed 2c 3a 4e 20 23 22 ba d9 8b e4 2c 3a e2 2b a2 17 2a b8 17 2a 8a 17 2a 82 17 2b 9a 17 2a 92 17 2b ea 17 a8 ea db de 2d e2 17 8a 2c f2 17 2a ca 17 2a c2 17 9d 3b da 17 2b d2 17 2b af 14 2a 2a 2a 2a a7 14 2a 2a 2a 2a ba 14 4e b2 14 2b 8f 14 2c 6a d6 1d 87 14 93 8f 20 15 9f 14 ba ee 19 10 97 14 23 b6 19 17 ef 14 25 76 02 6a e7 14 0c f8 78 14 ff 14 2a 2a 2a 2a f7 14 2a 2a 2a aa cf 14 2a 2a 62 6e ff 61 2a 2a 2a 2a f7 61 2a 2a 2a 2a ca 61 2a da 65 2b aa 7a d6 3b a2 7a 9a 23 ba 7a 9a 23 b2 7a f6 21 8a 7a f6 21 82 7a 2b ca 7a 2a c0 7a 2a d8 7a 2a d0 7a 2a aa 7b 2a 92 77 8a 2c ea 77 2a e2 77 2a 10 02 18 20 20 01 28 01 30 01 38 03 40 fe 01 48 15 50 db 03 70 aa cc 8d 01 78 82 70 80 01 03 88 01 01
50+
```
51+
52+
### 3) 多消息流(Multi-message)
53+
54+
```text
55+
0a 2f 0a 08 4a 6f 68 6e 20 44 6f 65 10 01 1a 10 6a 6f 68 6e 40 65 78 61 6d 70 6c 65 2e 63 6f 6d 22 0f 0a 0b 31 31 31 2d 32 32 32 2d 33 33 33 10 01 0a 1e 0a 08 4a 61 6e 65 20 44 6f 65 10 02 1a 10 6a 61 6e 65 40 65 78 61 6d 70 6c 65 2e 63 6f 6d
56+
```
57+
58+
### 4) Java 十进制数组
59+
60+
```text
61+
10, 96, 10, 43, 10, 16, 65, 67, 51, 49, 90, 69, 72, 52, 65, 72, 51, 78, 48, 54, 51, 51, 18, 23, 16, 1, 24, 1, 32, 0, 40, 1, 48, 8, 56, -124, 1, 64, -106, -90, 63, 74, 4, -122, -125, -112, 13, 16, 96, 24, 32, 32, 1, 40, 1, 64, -47, 1, 72, 2, 80, 43, 88, 1, 112, -88, -101, -84, 1, 120, -127, -90, 1, -128, 1, 3, -120, 1, 1, -62, 1, 16, 72, 74, 51, 49, 90, 68, 72, 52, 90, 70, 55, 50, 48, 48, 53, 57, 10, 96, 10, 43, 10, 16, 65, 67, 51, 49, 90, 69, 72, 52, 65, 72, 51, 78, 48, 54, 51, 51, 18, 23, 16, 1, 24, 1, 32, 0, 40, 1, 48, 8, 56, -124, 1, 64, -96, 71, -121, 0, 4, -122, -125, -112, 13, 16, 96, 24, 32, 32, 1, 40, 1, 64, -47, 1, 72, 2, 80, 43, 88, 1, 112, -61, -41, -85, 1, 120, -127, -90, 1, -128, 1, 3, -120, 1, 1, -62, 1, 16, 72, 74, 51, 49, 90, 68, 72, 52, 90, 70, 55, 50, 48, 48, 53, 57
62+
```
63+
64+
### 5) Java 转义字符串
65+
66+
```text
67+
\2605\006\027}\276\255\270\270\360\373\220\271
68+
```
69+
70+
## 功能特性
71+
72+
- 支持多种输入格式
73+
- 自动识别输入格式
74+
- 智能解码(条件 XOR)
75+
- 基于 Schema 的展示
76+
- 表格支持展开/折叠交互
77+
- 支持文件上传
78+
79+
## 许可证
80+
81+
MIT

0 commit comments

Comments
 (0)