Skip to content

Commit 3316f8b

Browse files
committed
feat: 添加自动安装脚本并优化文档
2 parents 9e7d6be + 2b2fb6d commit 3316f8b

File tree

6 files changed

+878
-65
lines changed

6 files changed

+878
-65
lines changed

README.md

Lines changed: 128 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,86 @@ this is a mistake.
2727

2828
### 💻 System Support
2929

30-
**Windows**AMD64 & ARM64
31-
**macOS**AMD64 & ARM64
32-
**Linux**AMD64 & ARM64
30+
**Windows**x64
31+
**macOS**Intel & M-series
32+
**Linux**x64 & ARM64
3333

3434
### 📥 Installation
3535

36+
#### Automatic Installation (Recommended)
37+
3638
**Linux/macOS**
3739
```bash
38-
curl -fsSL https://raw.githubusercontent.com/yuaotian/go-cursor-help/master/install.sh | bash
40+
curl -fsSL https://raw.githubusercontent.com/yuaotian/go-cursor-help/master/scripts/install.sh | sudo bash
3941
```
4042

41-
**Windows** (Run in PowerShell as Admin)
43+
**Windows** (Run PowerShell as Admin)
4244
```powershell
43-
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; $arch = if ([Environment]::Is64BitOperatingSystem) { if ([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture -eq 'Arm64') { 'arm64' } else { 'amd64' } } else { 'amd64' }; $ver = (irm https://api.github.com/repos/yuaotian/go-cursor-help/releases/latest).tag_name.TrimStart('v'); $outfile = "$env:TEMP\cursor_id_modifier.exe"; irm "https://github.com/yuaotian/go-cursor-help/releases/download/v${ver}/cursor_id_modifier_${ver}_windows_${arch}.exe" -OutFile $outfile; & $outfile; Remove-Item -Path $outfile -ErrorAction SilentlyContinue
45+
irm https://raw.githubusercontent.com/yuaotian/go-cursor-help/master/scripts/install.ps1 | iex
4446
```
4547

48+
The installation script will automatically:
49+
- Request necessary privileges (sudo/admin)
50+
- Close any running Cursor instances
51+
- Backup existing configuration
52+
- Install the tool
53+
- Add it to system PATH
54+
- Clean up temporary files
55+
56+
#### Manual Installation
57+
58+
1. Download the latest release for your system from the [releases page](https://github.com/yuaotian/go-cursor-help/releases)
59+
2. Extract and run with administrator/root privileges:
60+
```bash
61+
# Linux/macOS
62+
sudo ./cursor-id-modifier
63+
64+
# Windows (PowerShell Admin)
65+
.\cursor-id-modifier.exe
66+
```
67+
68+
#### Manual Configuration Method
69+
70+
1. Close Cursor completely
71+
2. Navigate to the configuration file location:
72+
- Windows: `%APPDATA%\Cursor\User\globalStorage\storage.json`
73+
- macOS: `~/Library/Application Support/Cursor/User/globalStorage/storage.json`
74+
- Linux: `~/.config/Cursor/User/globalStorage/storage.json`
75+
3. Create a backup of `storage.json`
76+
4. Edit `storage.json` and update these fields with new random UUIDs:
77+
```json
78+
{
79+
"telemetry.machineId": "generate-new-uuid",
80+
"telemetry.macMachineId": "generate-new-uuid",
81+
"telemetry.devDeviceId": "generate-new-uuid",
82+
"telemetry.sqmId": "generate-new-uuid",
83+
"lastModified": "2024-01-01T00:00:00.000Z",
84+
"version": "1.0.1"
85+
}
86+
```
87+
5. Save the file and restart Cursor
88+
4689
### 🔧 Technical Details
4790

48-
The program modifies Cursor's `storage.json` config file:
91+
#### Configuration Files
92+
The program modifies Cursor's `storage.json` config file located at:
4993
- Windows: `%APPDATA%\Cursor\User\globalStorage\`
5094
- macOS: `~/Library/Application Support/Cursor/User/globalStorage/`
5195
- Linux: `~/.config/Cursor/User/globalStorage/`
5296

53-
Generates new unique identifiers for:
97+
#### Modified Fields
98+
The tool generates new unique identifiers for:
5499
- `telemetry.machineId`
55100
- `telemetry.macMachineId`
56101
- `telemetry.devDeviceId`
57102
- `telemetry.sqmId`
58103

104+
#### Safety Features
105+
- Automatic backup of existing configuration
106+
- Safe process termination
107+
- Atomic file operations
108+
- Error handling and rollback
109+
59110
---
60111

61112
# 🌏 Chinese
@@ -73,37 +124,99 @@ this is a mistake.
73124

74125
### 💻 系统支持
75126

76-
**Windows**AMD64和ARM64
77-
**macOS**AMD64和ARM64
78-
**Linux**AMD64和ARM64
127+
**Windows**x64
128+
**macOS**Intel和M系列
129+
**Linux**x64和ARM64
79130

80131
### 📥 安装方法
81132

133+
#### 自动安装(推荐)
134+
82135
**Linux/macOS**
83136
```bash
84-
curl -fsSL https://raw.githubusercontent.com/yuaotian/go-cursor-help/master/install.sh | bash
137+
curl -fsSL https://raw.githubusercontent.com/yuaotian/go-cursor-help/master/scripts/install.sh | sudo bash
85138
```
86139

87140
**Windows** (以管理员身份运行PowerShell)
88141
```powershell
89-
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; $arch = if ([Environment]::Is64BitOperatingSystem) { if ([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture -eq 'Arm64') { 'arm64' } else { 'amd64' } } else { 'amd64' }; $ver = (irm https://api.github.com/repos/yuaotian/go-cursor-help/releases/latest).tag_name.TrimStart('v'); $outfile = "$env:TEMP\cursor_id_modifier.exe"; irm "https://github.com/yuaotian/go-cursor-help/releases/download/v${ver}/cursor_id_modifier_${ver}_windows_${arch}.exe" -OutFile $outfile; & $outfile; Remove-Item -Path $outfile -ErrorAction SilentlyContinue
142+
irm https://raw.githubusercontent.com/yuaotian/go-cursor-help/master/scripts/install.ps1 | iex
90143
```
91144

145+
安装脚本会自动:
146+
- 请求必要的权限(sudo/管理员)
147+
- 关闭所有运行中的Cursor实例
148+
- 备份现有配置
149+
- 安装工具
150+
- 添加到系统PATH
151+
- 清理临时文件
152+
153+
#### 手动安装
154+
155+
1.[发布页面](https://github.com/yuaotian/go-cursor-help/releases)下载适合您系统的最新版本
156+
2. 解压并以管理员/root权限运行:
157+
```bash
158+
# Linux/macOS
159+
sudo ./cursor-id-modifier
160+
161+
# Windows (PowerShell 管理员)
162+
.\cursor-id-modifier.exe
163+
```
164+
165+
#### 手动配置方法
166+
167+
1. 完全关闭 Cursor
168+
2. 找到配置文件位置:
169+
- Windows: `%APPDATA%\Cursor\User\globalStorage\storage.json`
170+
- macOS: `~/Library/Application Support/Cursor/User/globalStorage/storage.json`
171+
- Linux: `~/.config/Cursor/User/globalStorage/storage.json`
172+
3. 备份 `storage.json`
173+
4. 编辑 `storage.json` 并更新以下字段(使用新的随机UUID):
174+
```json
175+
{
176+
"telemetry.machineId": "生成新的uuid",
177+
"telemetry.macMachineId": "生成新的uuid",
178+
"telemetry.devDeviceId": "生成新的uuid",
179+
"telemetry.sqmId": "生成新的uuid",
180+
"lastModified": "2024-01-01T00:00:00.000Z",
181+
"version": "1.0.1"
182+
}
183+
```
184+
5. 保存文件并重启 Cursor
185+
92186
### 🔧 技术细节
93187

94-
程序修改Cursor的`storage.json`配置文件:
188+
#### 配置文件
189+
程序修改Cursor的`storage.json`配置文件,位于:
95190
- Windows: `%APPDATA%\Cursor\User\globalStorage\`
96191
- macOS: `~/Library/Application Support/Cursor/User/globalStorage/`
97192
- Linux: `~/.config/Cursor/User/globalStorage/`
98193

99-
生成新的唯一标识符:
194+
#### 修改字段
195+
工具会生成新的唯一标识符:
100196
- `telemetry.machineId`
101197
- `telemetry.macMachineId`
102198
- `telemetry.devDeviceId`
103199
- `telemetry.sqmId`
104200

201+
#### 安全特性
202+
- 自动备份现有配置
203+
- 安全的进程终止
204+
- 原子文件操作
205+
- 错误处理和回滚
206+
105207
## 📄 License
106208

107209
MIT License
108210

109211
Copyright (c) 2024
212+
213+
Permission is hereby granted, free of charge, to any person obtaining a copy
214+
of this software and associated documentation files (the "Software"), to deal
215+
in the Software without restriction, including without limitation the rights
216+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
217+
copies of the Software, and to permit persons to whom the Software is
218+
furnished to do so, subject to the following conditions:
219+
220+
The above copyright notice and this permission notice shall be included in all
221+
copies or substantial portions of the Software.
222+

install.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

scripts/build_all.bat

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
@echo off
2+
setlocal EnableDelayedExpansion
3+
4+
:: Messages / 消息
5+
set "EN_MESSAGES[0]=Starting build process for version"
6+
set "EN_MESSAGES[1]=Using optimization flags:"
7+
set "EN_MESSAGES[2]=Cleaning old builds..."
8+
set "EN_MESSAGES[3]=Cleanup completed"
9+
set "EN_MESSAGES[4]=bin directory does not exist, no cleanup needed"
10+
set "EN_MESSAGES[5]=Starting builds for all platforms..."
11+
set "EN_MESSAGES[6]=Building for"
12+
set "EN_MESSAGES[7]=Build successful:"
13+
set "EN_MESSAGES[8]=Build failed for"
14+
set "EN_MESSAGES[9]=All builds completed! Total time:"
15+
set "EN_MESSAGES[10]=seconds"
16+
17+
set "CN_MESSAGES[0]=开始构建版本"
18+
set "CN_MESSAGES[1]=使用优化标志:"
19+
set "CN_MESSAGES[2]=正在清理旧的构建文件..."
20+
set "CN_MESSAGES[3]=清理完成"
21+
set "CN_MESSAGES[4]=bin 目录不存在,无需清理"
22+
set "CN_MESSAGES[5]=开始编译所有平台..."
23+
set "CN_MESSAGES[6]=正在构建"
24+
set "CN_MESSAGES[7]=构建成功:"
25+
set "CN_MESSAGES[8]=构建失败:"
26+
set "CN_MESSAGES[9]=所有构建完成!总耗时:"
27+
set "CN_MESSAGES[10]="
28+
29+
:: 设置版本信息 / Set version
30+
set VERSION=2.0.0
31+
32+
:: 设置颜色代码 / Set color codes
33+
set "GREEN=[32m"
34+
set "RED=[31m"
35+
set "YELLOW=[33m"
36+
set "RESET=[0m"
37+
38+
:: 设置编译优化标志 / Set build optimization flags
39+
set "LDFLAGS=-s -w"
40+
set "BUILDMODE=pie"
41+
set "GCFLAGS=-N -l"
42+
43+
:: 设置 CGO / Set CGO
44+
set CGO_ENABLED=0
45+
46+
:: 检测系统语言 / Detect system language
47+
for /f "tokens=2 delims==" %%a in ('wmic os get OSLanguage /value') do set OSLanguage=%%a
48+
if "%OSLanguage%"=="2052" (set LANG=cn) else (set LANG=en)
49+
50+
:: 显示编译信息 / Display build info
51+
echo %YELLOW%!%LANG%_MESSAGES[0]! %VERSION%%RESET%
52+
echo %YELLOW%!%LANG%_MESSAGES[1]! LDFLAGS=%LDFLAGS%, BUILDMODE=%BUILDMODE%%RESET%
53+
echo %YELLOW%CGO_ENABLED=%CGO_ENABLED%%RESET%
54+
55+
:: 清理旧的构建文件 / Clean old builds
56+
echo %YELLOW%!%LANG%_MESSAGES[2]!%RESET%
57+
if exist "..\bin" (
58+
rd /s /q "..\bin"
59+
echo %GREEN%!%LANG%_MESSAGES[3]!%RESET%
60+
) else (
61+
echo %YELLOW%!%LANG%_MESSAGES[4]!%RESET%
62+
)
63+
64+
:: 创建输出目录 / Create output directory
65+
mkdir "..\bin" 2>nul
66+
67+
:: 定义目标平台数组 / Define target platforms array
68+
set platforms[0].os=windows
69+
set platforms[0].arch=amd64
70+
set platforms[0].ext=.exe
71+
set platforms[0].suffix=
72+
73+
set platforms[1].os=darwin
74+
set platforms[1].arch=amd64
75+
set platforms[1].ext=
76+
set platforms[1].suffix=_intel
77+
78+
set platforms[2].os=darwin
79+
set platforms[2].arch=arm64
80+
set platforms[2].ext=
81+
set platforms[2].suffix=_m1
82+
83+
set platforms[3].os=linux
84+
set platforms[3].arch=amd64
85+
set platforms[3].ext=
86+
set platforms[3].suffix=
87+
88+
:: 设置开始时间 / Set start time
89+
set start_time=%time%
90+
91+
:: 编译所有目标 / Build all targets
92+
echo !%LANG%_MESSAGES[5]!
93+
94+
for /L %%i in (0,1,3) do (
95+
set "os=!platforms[%%i].os!"
96+
set "arch=!platforms[%%i].arch!"
97+
set "ext=!platforms[%%i].ext!"
98+
set "suffix=!platforms[%%i].suffix!"
99+
100+
echo.
101+
echo !%LANG%_MESSAGES[6]! !os! !arch!...
102+
103+
set GOOS=!os!
104+
set GOARCH=!arch!
105+
106+
:: 构建输出文件名 / Build output filename
107+
set "outfile=..\bin\cursor_id_modifier_v%VERSION%_!os!_!arch!!suffix!!ext!"
108+
109+
:: 执行构建 / Execute build
110+
go build -trimpath -buildmode=%BUILDMODE% -ldflags="%LDFLAGS%" -gcflags="%GCFLAGS%" -o "!outfile!" ..\main.go
111+
112+
if !errorlevel! equ 0 (
113+
echo %GREEN%!%LANG%_MESSAGES[7]! !outfile!%RESET%
114+
) else (
115+
echo %RED%!%LANG%_MESSAGES[8]! !os! !arch!%RESET%
116+
)
117+
)
118+
119+
:: 计算总耗时 / Calculate total time
120+
set end_time=%time%
121+
set /a duration = %end_time:~0,2% * 3600 + %end_time:~3,2% * 60 + %end_time:~6,2% - (%start_time:~0,2% * 3600 + %start_time:~3,2% * 60 + %start_time:~6,2%)
122+
123+
echo.
124+
echo %GREEN%!%LANG%_MESSAGES[9]! %duration% !%LANG%_MESSAGES[10]!%RESET%
125+
if exist "..\bin" dir /b "..\bin"
126+
127+
pause
128+
endlocal

0 commit comments

Comments
 (0)