feat: ШАГ 1 — Bridge HTTP-сервер для браузерного расширения
- internal/core/bridge/ — лёгкий HTTP-сервер на 127.0.0.1 - POST /api/events — приём батча событий от расширения - GET /api/ping — healthcheck для расширения - X-Verstak-Secret — аутентификация по shared-secret - AutoGenPort — случайный порт если 9786 занят - config.BridgeConfig — порт, секрет, auto_gen_port - App: интеграция startBridge/stopBridge при open/close vault - bindings_bridge.go — BridgeInfo(), startBridge(), saveBridgeConfig() - Тесты: ping, auth, success, empty batch, secret gen, auto-port
This commit is contained in:
@@ -32,10 +32,23 @@ type WindowConfig struct {
|
||||
}
|
||||
|
||||
// VaultAppConfig holds per-vault settings in the global config.
|
||||
//
|
||||
// FileWatcher controls real-time filesystem monitoring:
|
||||
// - Включается автоматически при открытии vault (snapshot scan ВСЕГДА запускается,
|
||||
// real-time watcher только при FileWatcher=true)
|
||||
// - Snapshot scan детектит missing/restored/modified/new файлы при загрузке
|
||||
// - Real-time watcher (fsnotify) реагирует на CREATE/REMOVE/WRITE мгновенно
|
||||
// - Отключение: Settings → "File Watcher" toggle, или правка config.json
|
||||
// - VERSTAK_NO_WATCHER=1 — выключить watcher через env (переопределяет config)
|
||||
// - --no-watcher — CLI флаг (переопределяет config и env)
|
||||
//
|
||||
// Bridge holds the local HTTP API for browser extension integration.
|
||||
type VaultAppConfig struct {
|
||||
VaultID string `json:"vault_id,omitempty"`
|
||||
CreatedAt string `json:"created_at,omitempty"`
|
||||
Sync SyncSettings `json:"sync,omitempty"`
|
||||
VaultID string `json:"vault_id,omitempty"`
|
||||
CreatedAt string `json:"created_at,omitempty"`
|
||||
Sync SyncSettings `json:"sync,omitempty"`
|
||||
FileWatcher bool `json:"file_watcher"`
|
||||
Bridge BridgeConfig `json:"bridge,omitempty"`
|
||||
}
|
||||
|
||||
// SyncSettings holds sync configuration for the current vault.
|
||||
@@ -50,6 +63,13 @@ type SyncSettings struct {
|
||||
LastError string `json:"last_error,omitempty"`
|
||||
}
|
||||
|
||||
// BridgeConfig holds local HTTP bridge settings for browser extension.
|
||||
type BridgeConfig struct {
|
||||
Port int `json:"port"`
|
||||
Secret string `json:"secret,omitempty"` // shared secret for extension auth
|
||||
AutoGenPort bool `json:"auto_gen_port,omitempty"` // pick random port if port taken
|
||||
}
|
||||
|
||||
func DefaultAppConfig() *AppConfig {
|
||||
return &AppConfig{
|
||||
Version: AppConfigVersion,
|
||||
@@ -57,6 +77,9 @@ func DefaultAppConfig() *AppConfig {
|
||||
Language: "ru",
|
||||
EnabledTemplates: []string{"folder.default", "project.default", "client.default", "document.default", "recipe.default"},
|
||||
EnabledPlugins: []string{},
|
||||
Vault: VaultAppConfig{
|
||||
FileWatcher: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user