Browse Source

feat: Add language support and ID comparison feature

- Introduced a new language display in the banner, showing the current language (Simplified Chinese or English).
- Added a function to display a comparison of old and new IDs after configuration updates.
- Implemented a new function to read existing configuration from a file.
- Updated success and warning messages to use distinct colors for better visibility.

This commit enhances user experience by providing language context and ID comparison during configuration updates.
pull/9/head v0.0.2
Xx 6 months ago
parent
commit
f7fe868d5e
  1. BIN
      bin/cursor_id_modifier_v1.0.0_linux_amd64
  2. BIN
      bin/cursor_id_modifier_v1.0.0_mac_intel
  3. BIN
      bin/cursor_id_modifier_v1.0.0_mac_m1
  4. BIN
      bin/cursor_id_modifier_v1.0.0_windows_amd64.exe
  5. 65
      main.go

BIN
bin/cursor_id_modifier_v1.0.0_linux_amd64

BIN
bin/cursor_id_modifier_v1.0.0_mac_intel

BIN
bin/cursor_id_modifier_v1.0.0_mac_m1

BIN
bin/cursor_id_modifier_v1.0.0_windows_amd64.exe

65
main.go

@ -117,6 +117,7 @@ func printCyberpunkBanner() {
cyan := color.New(color.FgCyan, color.Bold) cyan := color.New(color.FgCyan, color.Bold)
yellow := color.New(color.FgYellow, color.Bold) yellow := color.New(color.FgYellow, color.Bold)
magenta := color.New(color.FgMagenta, color.Bold) magenta := color.New(color.FgMagenta, color.Bold)
green := color.New(color.FgGreen, color.Bold)
banner := ` banner := `
@ -129,6 +130,15 @@ func printCyberpunkBanner() {
cyan.Println(banner) cyan.Println(banner)
yellow.Println("\t\t>> Cursor ID Modifier v1.0 <<") yellow.Println("\t\t>> Cursor ID Modifier v1.0 <<")
magenta.Println("\t\t [ By Pancake Fruit Rolled Shark Chili ]") magenta.Println("\t\t [ By Pancake Fruit Rolled Shark Chili ]")
// 添加语言标识
langText := "当前语言/Language: "
if currentLanguage == CN {
langText += "简体中文"
} else {
langText += "English"
}
green.Printf("\n\t\t %s\n\n", langText)
} }
type ProgressSpinner struct { type ProgressSpinner struct {
@ -241,8 +251,11 @@ func saveConfig(config *StorageConfig) error {
// showSuccess 显示成功信息 // showSuccess 显示成功信息
func showSuccess() { func showSuccess() {
text := texts[currentLanguage] text := texts[currentLanguage]
color.Green(text.SuccessMessage)
color.Yellow(text.RestartMessage)
successColor := color.New(color.FgGreen, color.Bold)
warningColor := color.New(color.FgYellow, color.Bold)
successColor.Printf("\n%s\n", text.SuccessMessage)
warningColor.Printf("%s\n", text.RestartMessage)
} }
// 修改 loadAndUpdateConfig 函数使用 configPath // 修改 loadAndUpdateConfig 函数使用 configPath
@ -299,12 +312,19 @@ func main() {
setupProgram() setupProgram()
oldConfig, err := readExistingConfig()
if err != nil {
oldConfig = nil
}
config, err := loadAndUpdateConfig() config, err := loadAndUpdateConfig()
if err != nil { if err != nil {
handleError("配置更新失败", err) handleError("配置更新失败", err)
return return
} }
showIdComparison(oldConfig, config)
if err := saveConfig(config); err != nil { if err := saveConfig(config); err != nil {
handleError("保存配置失败", err) handleError("保存配置失败", err)
return return
@ -429,3 +449,44 @@ func detectLanguage() Language {
} }
return EN return EN
} }
// 添加新函数用于显示ID对比
func showIdComparison(oldConfig *StorageConfig, newConfig *StorageConfig) {
cyan := color.New(color.FgCyan)
yellow := color.New(color.FgYellow)
fmt.Println("\n=== ID 修改对比 ===")
if oldConfig != nil {
cyan.Println("\n[原始 ID]")
yellow.Printf("Machine ID: %s\n", oldConfig.TelemetryMachineId)
yellow.Printf("Mac Machine ID: %s\n", oldConfig.TelemetryMacMachineId)
yellow.Printf("Dev Device ID: %s\n", oldConfig.TelemetryDevDeviceId)
}
cyan.Println("\n[新生成 ID]")
yellow.Printf("Machine ID: %s\n", newConfig.TelemetryMachineId)
yellow.Printf("Mac Machine ID: %s\n", newConfig.TelemetryMacMachineId)
yellow.Printf("Dev Device ID: %s\n", newConfig.TelemetryDevDeviceId)
fmt.Println()
}
// 新增函数用于读取现有配置
func readExistingConfig() (*StorageConfig, error) {
configPath, err := getConfigPath()
if err != nil {
return nil, err
}
data, err := os.ReadFile(configPath)
if err != nil {
return nil, err
}
var config StorageConfig
if err := json.Unmarshal(data, &config); err != nil {
return nil, err
}
return &config, nil
}
Loading…
Cancel
Save