fix: adapt to new Baimiao API v2 with OSS upload#4
fix: adapt to new Baimiao API v2 with OSS upload#4zeta987 wants to merge 2 commits intoTechDecryptor:mainfrom
Conversation
- Use /api/perm/single with version "v2" parameter - Fetch OSS signature via /api/oss/sign - Upload image to Aliyun OSS before calling OCR API - Pass fileKey instead of dataUrl to OCR endpoint - Use MD5 hash of image binary instead of SHA1 of dataUrl - Support multiple image formats (PNG, JPEG, GIF, WebP) Fixes TechDecryptor#3 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
main.js
Outdated
| username: username, | ||
| password: password, | ||
| type: /^[0-9]*$/.test(username) ? "mobile" : "email" | ||
| type: "email" |
There was a problem hiding this comment.
If you fill in the cell phone number, it will be recognized incorrectly, here you can automatically select the cell phone number and email address according to the presence or absence of "@".
There was a problem hiding this comment.
If you fill in the cell phone number, it will be recognized incorrectly, here you can automatically select the cell phone number and email address according to the presence or absence of "@".
Maybe there was a problem. A few minutes ago, I tried to sign in with my email and phone number, but it kept saying “邮箱地址不正确.” After a few minutes, I was able to sign in with my email.
There was a problem hiding this comment.
Implemented in <3703ed8>.
Login type is now auto-detected:
- use "email" when username contains "@"
- otherwise use "mobile"
Thanks for the suggestion.
There was a problem hiding this comment.
If you fill in the cell phone number, it will be recognized incorrectly, here you can automatically select the cell phone number and email address according to the presence or absence of "@".
Maybe there was a problem. A few minutes ago, I tried to sign in with my email and phone number, but it kept saying “邮箱地址不正确.” After a few minutes, I was able to sign in with my email.
Based on testing, the login issue can be resolved by clearing the residual plugin data. This can be accomplished using either of the following methods:
Method 1: Reinstall via Application
- Completely remove the plugin within the
potapp. - Restart the application.
- Reinstall the plugin.
Method 2: Manually Delete the Plugin Directory
- Close the
potapp. - Delete the following directory:
%APPDATA%\com.pot-app.desktop\plugins\recognize\plugin.com.TechDecryptor.baimiao_ocr - Restart the application and reinstall the plugin.
Performing either step clears the cached configuration and restores normal login functionality.
Fixes #3
Problem
Baimiao web API has changed. The old
dataUrlinline upload no longer works:{ "code": 0, "data": { "hash": "8591a..." }, "msg": "图片上传出错,请强制刷新网页后重试" }Solution
Adapt to the new API flow: upload image to Aliyun OSS first, then pass
fileKeyto OCR endpoint.