Skip to content

Commit f429208

Browse files
committed
chore: initial commit
0 parents  commit f429208

File tree

104 files changed

+10310
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+10310
-0
lines changed

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
src-tauri/target
15+
16+
# Editor directories and files
17+
.vscode/*
18+
!.vscode/extensions.json
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
3+
}

LICENSE

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

README.md

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<div align="center">
2+
<h1>AutoCode</h1>
3+
<p><strong>macOS 2FA Code Assistant · 验证码自动提取助手</strong></p>
4+
<p>
5+
<img alt="platform" src="https://img.shields.io/badge/platform-macOS%2012%2B-0f172a?style=flat-square">
6+
<img alt="stack" src="https://img.shields.io/badge/stack-Tauri%20v2%20%2B%20Rust%20%2B%20Vanilla%20JS-2563eb?style=flat-square">
7+
<img alt="license" src="https://img.shields.io/badge/license-MIT-16a34a?style=flat-square">
8+
</p>
9+
</div>
10+
11+
> [!IMPORTANT]
12+
> 本项目是参考 [MessAuto](https://github.com/LeeeSe/MessAuto) 思路后进行的重写实现(不是 fork)。
13+
> This project is a rewritten implementation inspired by [MessAuto](https://github.com/LeeeSe/MessAuto), not a fork.
14+
15+
## 目录 | Table of Contents
16+
17+
- [项目简介 | Overview](#项目简介--overview)
18+
- [核心功能 | Features](#核心功能--features)
19+
- [快速开始 | Quick Start](#快速开始--quick-start)
20+
- [权限说明 | Permissions](#权限说明--permissions)
21+
- [配置说明 | Configuration](#配置说明--configuration)
22+
- [项目结构 | Project Structure](#项目结构--project-structure)
23+
- [常见问题 | FAQ](#常见问题--faq)
24+
- [致谢 | Acknowledgement](#致谢--acknowledgement)
25+
- [许可证 | License](#许可证--license)
26+
27+
## 项目简介 | Overview
28+
29+
AutoCode 是一个面向 macOS 的验证码助手,自动监听 iMessage、Apple Mail、Outlook 中的新消息并提取验证码,然后按你的策略自动输入或复制到剪贴板。
30+
AutoCode is a macOS desktop app that monitors incoming messages/emails, extracts verification codes, then auto-types or copies them based on your settings.
31+
32+
## 核心功能 | Features
33+
34+
| 中文 | English |
35+
| --- | --- |
36+
| 多来源监听:iMessage / Apple Mail / Outlook(Spotlight) | Multi-source monitoring: iMessage / Apple Mail / Outlook via Spotlight |
37+
| 多策略提取:模板正则、发件人白名单、HTML 结构、关键词近邻 | Multi-strategy extraction: regex templates, sender whitelist, HTML structure, keyword proximity |
38+
| 粘贴模式:`smart` / `always` / `floating_only` / `clipboard_only` | Paste modes: `smart` / `always` / `floating_only` / `clipboard_only` |
39+
| 前端设置修改后,托盘勾选状态即时同步 | Tray check states sync immediately after settings are changed in UI |
40+
| 支持自动回车、开机自启、规则自定义 | Supports auto-enter, launch-at-login, and custom extraction rules |
41+
42+
## 快速开始 | Quick Start
43+
44+
### 运行环境 | Requirements
45+
46+
- macOS 12+
47+
- Node.js 18+
48+
- Rust stable (`rustup`)
49+
- Xcode Command Line Tools (`xcode-select --install`)
50+
51+
### 本地开发 | Development
52+
53+
```bash
54+
npm install
55+
npm run tauri dev
56+
```
57+
58+
### 生产构建 | Build
59+
60+
```bash
61+
npm install
62+
npm run tauri build
63+
```
64+
65+
构建产物通常位于 / Build artifacts are usually under:
66+
67+
- `src-tauri/target/release/bundle/`
68+
69+
## 权限说明 | Permissions
70+
71+
AutoCode 在 macOS 上需要以下权限:
72+
73+
1. `完全磁盘访问 (Full Disk Access)`
74+
- 用于读取 iMessage 数据库和 Apple Mail 文件
75+
2. `辅助功能 (Accessibility)`
76+
- 用于模拟键盘输入验证码、自动回车
77+
78+
如果权限未授予,应用仍可运行,但会降级为部分功能不可用。
79+
Without these permissions, the app still runs but some features are degraded.
80+
81+
## 配置说明 | Configuration
82+
83+
配置文件路径 / Config file path:
84+
85+
- `dirs::config_dir()/autocode/config.toml`
86+
- macOS 常见路径 / Typical macOS path: `~/Library/Application Support/autocode/config.toml`
87+
88+
### 关键配置项 | Key Fields
89+
90+
| Field | Default | 说明 (CN) | Description (EN) |
91+
| --- | --- | --- | --- |
92+
| `listen_imessage` | `true` | 是否监听 iMessage | Enable iMessage monitor |
93+
| `listen_apple_mail` | `true` | 是否监听 Apple Mail | Enable Apple Mail monitor |
94+
| `listen_outlook` | `true` | 是否监听 Outlook | Enable Outlook monitor |
95+
| `paste_mode` | `smart` | 粘贴策略模式 | Paste behavior mode |
96+
| `auto_enter` | `false` | 自动输入后回车 | Press Enter after auto-typing |
97+
| `launch_at_login` | `false` | 开机自启 | Launch at login |
98+
| `autofill_detect_delay_ms` | `1500` | Smart 模式等待时长 | Smart mode delay before fallback |
99+
| `verification_keywords` | built-in | 关键词提取列表 | Keyword extraction list |
100+
| `verification_patterns` | built-in | 模板正则列表 | Template regex list |
101+
| `known_2fa_senders` | built-in | 发件人白名单 | Trusted 2FA sender list |
102+
| `native_autofill_apps` | built-in | 原生 AutoFill 应用白名单 | Native AutoFill app whitelist |
103+
104+
### `paste_mode` 行为 | Mode Behavior
105+
106+
- `smart`:
107+
- iMessage 来源下遇到原生 AutoFill 应用时,先延迟检测,仍冲突则改为复制
108+
- For iMessage in native AutoFill apps, delay and fallback to copy to avoid conflicts
109+
- `always`:
110+
- 总是尝试自动输入,失败则保底复制
111+
- Always auto-type; fallback to copy on failure
112+
- `floating_only` / `clipboard_only`:
113+
- 不自动输入,仅通知并复制
114+
- No auto-typing; notify/copy only
115+
116+
## 项目结构 | Project Structure
117+
118+
```text
119+
AutoCode/
120+
├─ src/ # Frontend (Vanilla HTML/CSS/JS)
121+
├─ src-tauri/
122+
│ ├─ src/
123+
│ │ ├─ monitor/ # iMessage / Apple Mail / Outlook monitors
124+
│ │ ├─ extractor.rs # Multi-strategy code extraction
125+
│ │ ├─ paste.rs # Auto-typing and conflict handling
126+
│ │ ├─ permissions.rs # Permission checks and settings shortcuts
127+
│ │ ├─ autostart.rs # LaunchAgent startup integration
128+
│ │ └─ lib.rs # Tauri commands, tray, runtime wiring
129+
│ ├─ tauri.conf.json
130+
│ └─ Cargo.toml
131+
├─ README.md
132+
└─ LICENSE
133+
```
134+
135+
## 常见问题 | FAQ
136+
137+
### iMessage / Apple Mail 没有识别到验证码
138+
139+
- 检查 `完全磁盘访问` 是否已授予
140+
- 检查监控源开关是否开启(设置页或托盘)
141+
142+
### 识别成功但没自动输入
143+
144+
- 检查 `辅助功能` 权限
145+
- 如果在 `smart` 模式,可能因为 AutoFill 冲突规避而回退为“仅复制”
146+
147+
### Outlook 识别不稳定
148+
149+
- 依赖 Spotlight 索引
150+
- 先确认 `mdfind` 能在 Outlook 数据目录检索到目标邮件
151+
152+
## 致谢 | Acknowledgement
153+
154+
- 感谢 [LeeeSe/MessAuto](https://github.com/LeeeSe/MessAuto) 提供灵感和思路。
155+
- 本项目为参考其方向后进行的重写实现,代码组织与实现细节已按本项目需求重新设计。
156+
- Thanks to [LeeeSe/MessAuto](https://github.com/LeeeSe/MessAuto) for inspiration. This project is a rewritten implementation tailored for this codebase.
157+
158+
## 许可证 | License
159+
160+
本项目采用 [MIT License](./LICENSE)
161+
This project is licensed under the [MIT License](./LICENSE).

0 commit comments

Comments
 (0)