refactor: remove CursorAccountCard component and related localization entries

- Deleted the CursorAccountCard.vue component, which handled user account login and status.
- Removed associated localization entries from catalog.json and various language files.
- Updated Home.vue to eliminate references to the removed component.
- Refactored clientApi.js to remove unused account-related API functions.
This commit is contained in:
leookun
2026-08-08 21:19:57 +08:00
parent 3cf8bdbc3c
commit c274a9db4c
32 changed files with 1225 additions and 1746 deletions
-35
View File
@@ -1,35 +0,0 @@
package client
import (
"context"
"fmt"
"time"
"cursor/internal/cursoraccount"
)
type CursorAccountStatus = cursoraccount.Status
func (s *ProxyService) GetCursorAccountStatus() CursorAccountStatus {
if s == nil || s.cursorAccount == nil {
return CursorAccountStatus{State: cursoraccount.StateSignedOut}
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
s.cursorAccount.EnsureEmail(ctx)
return s.cursorAccount.Status()
}
func (s *ProxyService) StartCursorAccountLogin() (CursorAccountStatus, error) {
if s == nil || s.cursorAccount == nil {
return CursorAccountStatus{State: cursoraccount.StateError}, fmt.Errorf("Cursor 账号服务未初始化")
}
return s.cursorAccount.StartLogin()
}
func (s *ProxyService) DisconnectCursorAccount() (CursorAccountStatus, error) {
if s == nil || s.cursorAccount == nil {
return CursorAccountStatus{State: cursoraccount.StateSignedOut}, nil
}
return s.cursorAccount.Disconnect()
}
+2 -9
View File
@@ -11,7 +11,6 @@ import (
"cursor/internal/logger"
"cursor/internal/mitm"
"cursor/internal/netproxy"
localruntime "cursor/internal/runtime"
"github.com/wailsapp/wails/v3/pkg/application"
)
@@ -85,11 +84,8 @@ func (s *ProxyService) StartProxy() (ProxyState, error) {
if err := s.ensureProxy(cfg); err != nil {
return fail("ensure_proxy", err)
}
// 启动时注入账号信息
if err := cursor.InjectCursorUserInfo(localruntime.InjectAccountEmail, localruntime.InjectAuthToken); err != nil {
logger.Errorf("injectCursorUserInfo failed: %v", err)
// 不阻断启动,仅记录日志
if err := cursor.DisableCursorStatsigGates(); err != nil {
logger.Errorf("disableCursorStatsigGates failed: %v", err)
}
if s.proxy != nil && !s.proxy.IsRunning() {
@@ -265,9 +261,6 @@ func (s *ProxyService) ShutdownForQuit() {
finalErr = errors.Join(finalErr, err)
}
}
if s.cursorAccount != nil {
s.cursorAccount.Shutdown()
}
if finalErr != nil {
s.setLastError(finalErr)
}
+14 -10
View File
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"net/http"
"path/filepath"
"sync"
"time"
@@ -12,7 +11,6 @@ import (
backend "cursor/internal/backend"
serverconfig "cursor/internal/backend/server/config"
"cursor/internal/certs"
"cursor/internal/cursoraccount"
"cursor/internal/logger"
"cursor/internal/mitm"
"cursor/internal/netproxy"
@@ -37,8 +35,6 @@ type ProxyService struct {
certManager *certs.Manager
// backendHost 表示当前嵌入式 backend 服务。
backendHost *backend.Host
// cursorAccount 持有仅供插件、Skills 和 MCP 控制面使用的真实 Cursor 身份。
cursorAccount *cursoraccount.Manager
// mu 表示当前声明中的 mu。
mu sync.RWMutex
@@ -88,12 +84,8 @@ func NewProxyService(proxy *mitm.ProxyServer, certManager *certs.Manager, caCert
publicClient: netproxy.NewHTTPClient(publicAPITimeout),
modelTestResults: make(map[string]ModelAdapterTestResult),
}
service.cursorAccount = cursoraccount.NewManager(
filepath.Join(appdata.DataRootPath(), "cursor-account.json"),
netproxy.NewHTTPClient(publicAPITimeout),
)
service.store = serverconfig.NewStore(service.configPath, service.logsRoot)
host, err := backend.NewHost(service.store, service.cursorAccount)
host, err := service.newBackendHost()
if err != nil {
logger.Errorf("init backend host failed: %v", err)
} else {
@@ -109,7 +101,7 @@ func (s *ProxyService) ensureBackendHost() error {
if s.backendHost != nil {
return nil
}
host, err := backend.NewHost(s.store, s.cursorAccount)
host, err := s.newBackendHost()
if err != nil {
return err
}
@@ -117,6 +109,18 @@ func (s *ProxyService) ensureBackendHost() error {
return nil
}
func (s *ProxyService) newBackendHost() (*backend.Host, error) {
options := []backend.HostOption{}
if s != nil && s.certManager != nil {
certificate, err := s.certManager.CertificateForServerName("localhost")
if err != nil {
return nil, fmt.Errorf("create localhost backend certificate: %w", err)
}
options = append(options, backend.WithTLSCertificate(certificate))
}
return backend.NewHost(s.store, options...)
}
func (s *ProxyService) ensureProxy(cfg serverconfig.Config) error {
if s == nil {
return nil