docs: rewrite README with features/tech stack, add MIT LICENSE

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-23 22:05:40 +08:00
parent 3b979089d9
commit 8965cf4977
2 changed files with 105 additions and 32 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 shumengya
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

116
README.md
View File

@@ -1,20 +1,64 @@
# CryptoCoin
# CryptoCoin · 桌面行情挂件
Windows 桌面迷你行情挂件Tauri 2 + 币安 24hr API
> Windows 桌面迷你行情挂件,基于 **Tauri 2 + Rust + 币安 24hr 行情 API**
## 设置文件(重要)
一个常驻桌面的轻量挂件,实时显示加密货币与美股的最新价格和 24 小时涨跌幅,全部操作通过系统托盘完成。
配置保存在 **与 `CryptoCoin.exe` 同级**`data` 文件夹:
## 功能特性
- 💹 **实时行情** — 拉取币安 `24hr ticker`,显示最新价与涨跌幅,红绿配色一目了然
- 🪙 **多标的支持** — 内置主流加密货币BTC / ETH / SOL / BNB…与美股标的AAPL / TSLA / NVDA…托盘勾选自由组合
- 🎨 **多种背景主题**`dark` / `slate` / `navy` / `charcoal` / `midnight` / `forest` / `light`,托盘一键切换
- ⏱️ **可调刷新间隔** — 3s / 5s / 10s / 30s / 1m / 3m / 5m / 10m避免 API 限流
- 🌐 **直连或代理** — 本机无法直连币安时,可走 Cloudflare Worker 代理,直连与代理一键切换
- 🖱️ **托盘菜单操作** — 选择标的、切换主题、调整间隔、打开设置目录、直连/代理切换
- 💾 **便携配置** — 配置保存在 exe 同级 `data/` 目录,迁移方便
## 技术栈
| 层级 | 技术 |
|------|------|
| 桌面框架 | [Tauri 2](https://v2.tauri.app/) |
| 后端 | Rust`reqwest` 请求、`serde` 序列化、系统托盘) |
| 前端 | TypeScript + Vite 6JetBrains Mono 字体) |
| 数据源 | 币安 24hr Ticker API现货 / 合约) |
| 代理(可选) | Cloudflare Worker |
## 快速开始
### 环境要求
- [Node.js](https://nodejs.org/) ≥ 18
- [Rust](https://www.rust-lang.org/tools/install) 工具链
-Windows[Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/)
### 开发运行
```bash
npm install
npm run tauri dev
```
### 构建安装包
```bash
npm run tauri build
```
> 修改代码后必须重新打包,旧 exe 不会包含新逻辑。
安装包:`src-tauri/target/release/bundle/nsis/CryptoCoin_*_x64-setup.exe`
## 配置说明
配置保存在 **与 `CryptoCoin.exe` 同级**`data` 目录(开发时位于 `target/debug/data/` 等):
```
D:\WindowsApp\CryptoCoin\data\settings.json
```
(便携安装;开发时则在 `target\debug\data\` 等目录。)
首次从旧版 `%APPDATA%\com.smy.cryptocoin\` 升级时会自动迁移 `settings.json``data`
可将项目内 `src-tauri/settings.json` 复制为 `data\settings.json` 模板。托盘 **打开设置目录** 会打开 `data` 文件夹。
> 首次从旧版 `%APPDATA%\com.smy.cryptocoin\` 升级时会自动迁移 `settings.json` 到 `data`。
> 托盘「打开设置目录」可直接定位该文件夹。
示例:
@@ -28,29 +72,37 @@ D:\WindowsApp\CryptoCoin\data\settings.json
}
```
`backgroundTheme` 可选:`dark``slate``navy``charcoal``midnight``forest``light`;也可在托盘 **背景颜色** 中切换。
- `useProxy: true``proxyBaseUrl` 非空 → 走代理
- `useProxy: false` → 直连(`proxyBaseUrl` 保留,便于下次切回代理)
- `refreshIntervalMs` 最小 **3000**(托盘从 3 秒起,避免 API 限流)
## 开发
```bash
npm install
npm run tauri dev
```
## 发布安装包
修改代码后需重新打包,旧 exe 不会包含新逻辑:
```bash
npm run tauri build
```
安装包:`src-tauri/target/release/bundle/nsis/CryptoCoin_*_x64-setup.exe`
| 字段 | 说明 |
|------|------|
| `enabled` | 展示的标的列表(也可在托盘勾选) |
| `proxyBaseUrl` | 代理地址;切回直连时仍会保留,便于下次复用 |
| `useProxy` | `true` 走代理,`false` 直连 |
| `refreshIntervalMs` | 刷新间隔,最小 **3000**3 秒,避免限流) |
| `backgroundTheme` | `dark` / `slate` / `navy` / `charcoal` / `midnight` / `forest` / `light` |
## 代理 Worker
见 [cryptocoin-binance-proxy/README.md](cryptocoin-binance-proxy/README.md)。
本机无法直连 `api.binance.com` 时,可部署内置的 Cloudflare Worker 转发行情请求。
详见 [cryptocoin-binance-proxy/README.md](cryptocoin-binance-proxy/README.md)。
## 项目结构
```text
CryptoCoin/
├── src/ # 前端TypeScript + Vite
├── src-tauri/
│ ├── src/
│ │ ├── lib.rs # 主逻辑 + 托盘
│ │ ├── coins.rs # 标的定义(加密货币 / 美股)
│ │ └── settings.rs # 设置、主题、刷新间隔
│ ├── settings.json # 配置模板
│ └── tauri.conf.json
├── cryptocoin-binance-proxy/ # Cloudflare Worker 代理
├── package.json
└── README.md
```
## 许可证
MIT