mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 12:32:06 +08:00
Merge branch 'master' of https://github.com/yuaotian/go-cursor-help
merge
This commit is contained in:
commit
3501dd3602
22
README_CN.md
22
README_CN.md
@ -395,8 +395,30 @@ touch ~/Library/Application\ Support/Caches/cursor-updater
|
|||||||
- ✅ 错误处理和恢复
|
- ✅ 错误处理和恢复
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>重置 Cursor 免费试用</b></summary>
|
||||||
|
|
||||||
|
### 使用 `cursor_free_trial_reset.sh` 脚本
|
||||||
|
|
||||||
|
#### macOS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/yuaotian/go-cursor-help/refs/heads/master/scripts/run/cursor_free_trial_reset.sh -o ./cursor_free_trial_reset.sh && sudo bash ./cursor_free_trial_reset.sh && rm ./cursor_free_trial_reset.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Linux
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/yuaotian/go-cursor-help/refs/heads/master/scripts/run/cursor_free_trial_reset.sh | sudo bash
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
irm https://raw.githubusercontent.com/yuaotian/go-cursor-help/refs/heads/master/scripts/run/cursor_free_trial_reset.sh | iex
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## 联系方式
|
## 联系方式
|
||||||
|
|
||||||
|
@ -11,13 +11,13 @@ import (
|
|||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/yuaotian/go-cursor-help/internal/config"
|
"github.com/yuaotian/go-cursor-help/internal/config"
|
||||||
"github.com/yuaotian/go-cursor-help/internal/lang"
|
"github.com/yuaotian/go-cursor-help/internal/lang"
|
||||||
"github.com/yuaotian/go-cursor-help/internal/process"
|
"github.com/yuaotian/go-cursor-help/internal/process"
|
||||||
"github.com/yuaotian/go-cursor-help/internal/ui"
|
"github.com/yuaotian/go-cursor-help/internal/ui"
|
||||||
"github.com/yuaotian/go-cursor-help/pkg/idgen"
|
"github.com/yuaotian/go-cursor-help/pkg/idgen"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
@ -29,7 +29,15 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
setupErrorRecovery()
|
// Place defer at the beginning of main to ensure it can catch panics from all subsequent function calls
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
log.Errorf("Panic recovered: %v\n", r)
|
||||||
|
debug.PrintStack()
|
||||||
|
waitExit()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
handleFlags()
|
handleFlags()
|
||||||
setupLogger()
|
setupLogger()
|
||||||
|
|
||||||
@ -73,16 +81,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupErrorRecovery() {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
log.Errorf("Panic recovered: %v\n", r)
|
|
||||||
debug.PrintStack()
|
|
||||||
waitExit()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleFlags() {
|
func handleFlags() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *showVersion {
|
if *showVersion {
|
||||||
|
1122
scripts/run/cursor_free_trial_reset.sh
Normal file
1122
scripts/run/cursor_free_trial_reset.sh
Normal file
File diff suppressed because it is too large
Load Diff
14
scripts/run/cursor_linux_id_modifier.sh
Normal file → Executable file
14
scripts/run/cursor_linux_id_modifier.sh
Normal file → Executable file
@ -164,12 +164,12 @@ check_and_kill_cursor() {
|
|||||||
get_process_details() {
|
get_process_details() {
|
||||||
local process_name="$1"
|
local process_name="$1"
|
||||||
log_debug "正在获取 $process_name 进程详细信息:"
|
log_debug "正在获取 $process_name 进程详细信息:"
|
||||||
ps aux | grep -i "cursor" | grep -v grep
|
ps aux | grep -i "cursor" | grep -v grep | grep -v "cursor_linux_id_modifier.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
while [ $attempt -le $max_attempts ]; do
|
while [ $attempt -le $max_attempts ]; do
|
||||||
# 使用更精确的匹配来获取 Cursor 进程
|
# 使用更精确的匹配来获取 Cursor 进程,排除当前脚本和grep进程
|
||||||
CURSOR_PIDS=$(pgrep -f "cursor" || true)
|
CURSOR_PIDS=$(ps aux | grep -i "cursor" | grep -v "grep" | grep -v "cursor_linux_id_modifier.sh" | awk '{print $2}' || true)
|
||||||
|
|
||||||
if [ -z "$CURSOR_PIDS" ]; then
|
if [ -z "$CURSOR_PIDS" ]; then
|
||||||
log_info "未发现运行中的 Cursor 进程"
|
log_info "未发现运行中的 Cursor 进程"
|
||||||
@ -190,8 +190,8 @@ check_and_kill_cursor() {
|
|||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# 再次检查进程是否还在运行
|
# 再次检查进程是否还在运行,排除当前脚本和grep进程
|
||||||
if ! pgrep -f "cursor" > /dev/null; then
|
if ! ps aux | grep -i "cursor" | grep -v "grep" | grep -v "cursor_linux_id_modifier.sh" > /dev/null; then
|
||||||
log_info "Cursor 进程已成功关闭"
|
log_info "Cursor 进程已成功关闭"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -587,7 +587,7 @@ global.macMachineId = '$mac_machine_id';
|
|||||||
|
|
||||||
log_debug "完成最通用注入"
|
log_debug "完成最通用注入"
|
||||||
((modified_count++))
|
((modified_count++))
|
||||||
}
|
fi
|
||||||
else
|
else
|
||||||
log_info "文件已经被修改过,跳过修改"
|
log_info "文件已经被修改过,跳过修改"
|
||||||
fi
|
fi
|
||||||
@ -817,4 +817,4 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# 执行主函数
|
# 执行主函数
|
||||||
main
|
main
|
||||||
|
Loading…
x
Reference in New Issue
Block a user