mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-08-18 12:07:02 +08:00
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:
+14
-10
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user