Skip to content

Commit

Permalink
Bump version to 0.8.4 in Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeeSe committed May 7, 2024
1 parent 55f7f26 commit 65ee965
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 131 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "MessAuto"
version = "0.8.3"
version = "0.8.4"
edition = "2021"
description = "Automatic extraction of Email and SMS verification code for Mac platform."

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ ARM64 版本打开时会提示文件损坏,因其需要 Apple 开发者签名
- 移动 MessAuto.app 到 `/Applications` 文件夹下
- 终端执行`xattr -cr /Applications/MessAuto.app`

如果 MessAuto 出现无法自动粘贴验证码的问题,一般出现在重新安装新版本时,可以尝试以下解决方案:
如果 MessAuto 出现无法自动粘贴验证码的问题,一般是没有辅助功能权限或者自动化权限,可以尝试以下解决方案:

打开系统偏好设置 -> 安全性与隐私 -> 辅助功能,将其中 MessAuto 删除,并添加新的 MessAuto.app
1. 打开系统偏好设置 -> 安全性与隐私 -> 辅助功能,将其中 MessAuto 删除,并添加新的 MessAuto.app
2. 运行`tccutil reset AppleEvents com.doe.messauto`来重置 MessAuto 的自动化权限,然后重启应用并不断勾选自动粘贴选项来让 MessAuto 主动发起自动化权限请求

## TODO

Expand Down Expand Up @@ -104,6 +105,7 @@ macOS 平台可以方便地接收来自 iPhone 的短信,无需每次打开手
- 邮件 App 需要常驻后台,否则无法实时获取到最新的邮件
- 完全磁盘访问权限(为了访问位于 `~/Library` 下的 `Message.app``chat.db` 文件,以获取最新的短信)
- 辅助功能权限(模拟键盘操作,自动粘贴并回车)
- 自动化权限(模拟键盘操作,位置:设置->安全性与隐私->隐私->自动化,此权限只能程序主动请求用户同意,用户无法主动授予)

## 已知缺陷

Expand All @@ -121,7 +123,7 @@ cd MessAuto
cargo run

# 安装 cargo-bundle
cargo install cargo-bundle
cargo install cargo-bundle --git https://github.com/zed-industries/cargo-bundle.git --branch add-plist-extension
# 打包应用
cargo bundle --release
```
Expand All @@ -137,7 +139,7 @@ cargo bundle --release

- 给了权限但还是弹出权限请求:暂时的解决方法是从设置面板的辅助功能和磁盘权限列表中将原来的 MessAuto 通过下面的"-"号移除,当再次弹出权限请求时正常同意即可工作

- 如果 MessAuto 出现无法自动粘贴验证码的问题,一般出现在重新安装新版本时,可以尝试:打开系统偏好设置 -> 安全性与隐私 -> 辅助功能,将其中 MessAuto 删除,并添加新的 MessAuto.app
- 权限都给了,验证码可以提取到剪贴板但不会自动粘贴,可能是程序初次请求自动化权限用户拒绝或直接忽略了,这个权限的位置在:设置->安全性与隐私->隐私->自动化,用户无法直接添加,只能通过程序再次请求,所以只能通过重置权限的方式解决,运行这条命令并重启程序:`tccutil reset AppleEvents com.doe.messauto`,反复勾选自动粘贴选项来触发自动化权限请求:`tccutil reset AppleEvents com.doe.messauto`

## 感谢

Expand Down
114 changes: 1 addition & 113 deletions docs/README-EN.md
Original file line number Diff line number Diff line change
@@ -1,113 +1 @@
<p align="center">
<img src="../images/icon.png" width=240 />
</p>

<p align="center">
[<a href="../README.md">中文</a>] [<a href="./README-EN.md">English</a>]<br>
</p>

# MessAuto

MessAuto is a macOS app that automatically extracts Email and SMS verification codes to pasteboard. It is 100% developed
with Rust and is suitable for any app. It is a free alternative to [2FHey](https://2fhey.com/).

The following GIF shows the process of completing SMS verification and login within ten seconds with the support of
MessAuto. After clicking the button, you only need to wait for about 5 seconds.

<p align="center">
<img src="../images/Verification-in-10s.gif" alt="Verification-in-10s.gif" width=640 style="padding:20px" >
</p>

Features:

- Not just iMessage.app, but Mail.app too!
- Multi-language support: currently supports Chinese, English, and Korean; automatically switches based on the system
language.
- Light-weight: the app occupies 4 M storage and 14 M memory.
- Concise: without GUI, only a quiet taskbar tray icon, but powerful.
- Wide applicability: the Safari plan can only be used in the Safari browser, and this app is suitable for any app.
- Open source and free: the fee-based plan [2FHey](https://2fhey.com/) requires at least $5.

## Usage

MessAuto is a menu bar app without GUI. When you launch it for the first time, MessAuto will pop up a window to guide
you to authorize full disk access permission.

After granting permission, you can see the MessAuto icon in the menu bar by restarting the app. Click the icon to list
the menu:

- Auto paste: MessAuto stores the detected verification code in your clipboard. If you don't want to paste it manually,
you can enable this option. When this option is enabled, MessAuto will actively remind you to authorize the
accessibility feature.
- Auto enter: one step further than auto paste. Only when auto paste is enabled, can auto enter be selected.
- Hide for now: temporarily hide the icon. The icon will reappear when the app is restarted, suitable for users who do
not often restart the Mac.
- Hide forever: permanently hide the icon. Even if the app is restarted, the icon will not appear again. This is
suitable for users who restart Mac frequently. If you need to show the icon again, you need to delete
the `~/.config/messauto/messauto.json` file and restart the app.
- Launch at login: Nobody doesn't open it, right?
- Configuration: click on it will open a configuration file in json format, in which you can customize the keywords
- Listen email: turn on to listen to emails at the same time

> Keywords: also called trigger words, when the message contains keywords such as "verification code", the program will
> perform a series of subsequent operations, otherwise the message will be ignored.
<p align="center">
<img src="../images/status_item_en.png" alt="statesitem.jpg" width=548 style="padding:20px" >
</p>

⚠️ Note that the ARM64 version will prompt a file damage when opened because it needs Apple developer signature to start
normally. The author does not have an Apple developer certificate. However, you can still solve the problem through one
command:

- Move MessAuto.app to the `/Applications` folder.
- Execute `xattr -cr /Applications/MessAuto.app` in Terminal.

## TODO

- [x] Optimize CAPTCHA extraction rules
- [x] Customized Keywords
- [x] Add configuration options to the menu
- [ ] ~~Automatic deletion of extracted CAPTCHA text messages (no valid ideas)~~
- [x] In-App Updates
- [x] Github Action automated release
- [x] Add log
- [ ] Make App Home Page
- [x] Add email verification code detection function

## Motivation

macOS can conveniently receive short messages from the iPhone without having to open the phone to check the verification
code every time. Safari can even directly obtain the verification code and display it in the input box automatically.
However, this useful feature is only available in Safari, but not everyone likes to use it. In order to bring this
feature to all apps, I developed this app.

In the subsequent use, I also found that many verification codes are not only sent via SMS, but also via email, so I
added support for email.

## Requirements

- Use a **macOS system** and can receive **messages** from an iPhone.
- The Mail app needs to be resident in the background, otherwise the latest email cannot be obtained in real time.
- Full disk access permission (to access the `chat.db` file in `~/Library/Message.app` to get the latest message.)
- Accessibility permissions (simulates keyboard operations, auto paste and enter)

## Known issues

- Some apps or websites do not support Enter login and require manual clicking of login.

## Build

- `git clone https://github.com/LeeeSe/MessAuto.git`
- `cd MessAuto`
- `cargo install cargo-bundle`
- `cargo bundle --release`

## Thanks

* Thanks to [@尚善若拙](https://sspai.com/post/73072) for providing ideas for obtaining SMS.

## Log directory

Log file directory: `~/.local/share/messauto/logs/messauto.log`
Keep only the log of the most recent startup of the software
TODO.
12 changes: 8 additions & 4 deletions src/float_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,15 @@ pub fn main(code: &str, from_app: &str) -> Result<(), slint::PlatformError> {
let old_clpb_contents = get_old_clipboard_contents();

clpb.set_text(captcha.as_str()).unwrap();
paste_script().unwrap();
info!("{}", t!("paste-verification-code"));
match paste_script() {
Ok(_) => info!("{}", t!("paste-verification-code")),
Err(e) => error!("{}: {:?}", t!("error-paste-verification-code"), e),
}
if config.auto_return {
return_script().unwrap();
info!("{}", t!("press-enter"));
match return_script() {
Ok(_) => info!("{}", t!("press-enter")),
Err(e) => error!("{}: {:?}", t!("error-press-enter"), e),
}
}
if config.recover_clipboard {
sleep(Duration::from_secs(2));
Expand Down
30 changes: 22 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,15 @@ pub fn messages_thread() {
let _child = open_app(real_captcha, t!("imessage").to_string());
} else if config.auto_paste && !config.float_window {
ctx.set_text(&real_captcha).unwrap();
paste_script().unwrap();
info!("{}", t!("paste-verification-code"));
match paste_script() {
Ok(_) => info!("{}", t!("paste-verification-code")),
Err(e) => error!("{}: {:?}", t!("error-paste-verification-code"), e),
}
if config.auto_return {
return_script().unwrap();
info!("{}", t!("press-enter"));
match return_script() {
Ok(_) => info!("{}", t!("press-enter")),
Err(e) => error!("{}: {:?}", t!("error-press-enter"), e),
}
}
if config.recover_clipboard {
sleep(Duration::from_secs(2)); // wait applescript to finish
Expand Down Expand Up @@ -695,11 +699,21 @@ async fn async_watch<P: AsRef<Path>>(path: P) -> notify::Result<()> {
let _child = open_app(real_captcha, t!("mail").to_string());
} else if config.auto_paste {
clpb.set_text(&real_captcha).unwrap();
paste_script().unwrap();
info!("{}", t!("paste-verification-code"));
match paste_script() {
Ok(_) => info!("{}", t!("paste-verification-code")),
Err(e) => error!(
"{}: {:?}",
t!("error-paste-verification-code"),
e
),
}
if config.auto_return {
return_script().unwrap();
info!("{}", t!("press-enter"));
match return_script() {
Ok(_) => info!("{}", t!("press-enter")),
Err(e) => {
error!("{}: {:?}", t!("error-press-enter"), e)
}
}
}
if config.recover_clipboard {
async_std::task::sleep(Duration::from_secs(2)).await; //wait for pasted
Expand Down
2 changes: 2 additions & 0 deletions ui/info.plist
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<key>NSAppleEventsUsageDescription</key>
<string>MessAuto needs to control System Events</string>
<key>LSUIElement</key>
<true/>

0 comments on commit 65ee965

Please sign in to comment.