Help us shape the future of Go! Take the 2026 Go Developer Survey

settings

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SettingDescs = []string{
	"Clash API 服务地址",
	"API 认证密钥",
	"用于测试节点延迟的 URL",
	"连接超时时间(毫秒)",
	"HTTP/SOCKS5 代理地址",
	"界面显示语言",
	"数据自动刷新间隔(秒)",
}
View Source
var SettingKeys = []string{"api-address", "secret", "test-url", "timeout", "proxy-address", "language", "auto-refresh-interval"}
View Source
var SettingLabels = []string{"API 地址", "密钥", "测速URL", "超时(ms)", "代理地址", "语言", "自动刷新(秒)"}

Functions

func FetchMihomoVersion

func FetchMihomoVersion(client *api.Client) tea.Cmd

FetchMihomoVersion 返回一个拉取 Mihomo 版本信息的 Cmd

func GetSettingValue

func GetSettingValue(cfg *config.Config, index int) string

GetSettingValue 获取配置值

func LanguageSettingIndex

func LanguageSettingIndex() int

func RenderSettingsPage

func RenderSettingsPage(state PageState, width, height int) string

RenderSettingsPage 渲染设置页面

Types

type PageState

type PageState struct {
	Config          *config.Config
	SelectedSetting int
	EditMode        bool
	EditValue       string
	EditCursor      int
	// Toast 状态
	Toast *common.ToastManager

	MihomoVersion string
}

PageState 设置页面状态

type State

type State struct {
	// contains filtered or unexported fields
}

State 设置页面完整状态

func (State) ApplyMihomoVersion

func (s State) ApplyMihomoVersion(version string) State

ApplyMihomoVersion 应用版本信息

func (State) HandleMouseLeft

func (s State) HandleMouseLeft(pageX, pageY int, cfg *config.Config, configSvc *service.ConfigService) (State, *config.Config, string)

HandleMouseLeft 处理 settings 页面左键单击/双击

func (State) HandleMouseScroll

func (s State) HandleMouseScroll(up bool) State

HandleMouseScroll 鼠标滚轮处理

func (State) IsEditing

func (s State) IsEditing() bool

IsEditing 返回是否处于编辑模式

func (State) ToPageState

func (s State) ToPageState(cfg *config.Config) PageState

ToPageState 转换为渲染层所需的 PageState

func (State) Update

func (s State) Update(msg tea.KeyMsg, cfg *config.Config, configSvc *service.ConfigService) (State, *config.Config, string, tea.Cmd)

Update 处理设置页面按键,返回:(新状态, 更新后的cfg, 更新后的proxyAddr, cmd) proxyAddr 为空字符串时表示无变化

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL