Documentation
¶
Overview ¶
Package flatpak 桌面实例管理(KasmVNC 启动/停止/状态)
Package flatpak HTTP 处理器 ¶
Package flatpak KasmVNC 自动安装/升级管理
Package flatpak Flatpak 应用模块 ¶
Package flatpak 核心服务 ¶
Package flatpak 类型定义
Index ¶
- type ActiveInstall
- type Desktop
- func (d *Desktop) GetConfig() DesktopConfig
- func (d *Desktop) GetRunningApps() []*RunningApp
- func (d *Desktop) GetStatus() *DesktopStatus
- func (d *Desktop) LaunchApp(appID, name string, args []string) error
- func (d *Desktop) Restart() error
- func (d *Desktop) SetConfig(config DesktopConfig)
- func (d *Desktop) Start() error
- func (d *Desktop) Stop()
- type DesktopConfig
- type DesktopStatus
- type FlatpakApp
- type GHProxyProvider
- type Handler
- func (h *Handler) GetActiveInstalls(c *gin.Context)
- func (h *Handler) GetDesktopConfig(c *gin.Context)
- func (h *Handler) GetDesktopStatus(c *gin.Context)
- func (h *Handler) GetInstalledApps(c *gin.Context)
- func (h *Handler) GetRecommendedApps(c *gin.Context)
- func (h *Handler) GetRecommendedCategories(c *gin.Context)
- func (h *Handler) GetSetupStatus(c *gin.Context)
- func (h *Handler) InstallAppStream(c *gin.Context)
- func (h *Handler) ProxyVNC(c *gin.Context)
- func (h *Handler) RegisterRoutes(r *gin.RouterGroup)
- func (h *Handler) RestartDesktop(c *gin.Context)
- func (h *Handler) RunApp(c *gin.Context)
- func (h *Handler) RunSetupStream(c *gin.Context)
- func (h *Handler) SearchApps(c *gin.Context)
- func (h *Handler) ServeIcon(c *gin.Context)
- func (h *Handler) StartDesktop(c *gin.Context)
- func (h *Handler) StopDesktop(c *gin.Context)
- func (h *Handler) UninstallApp(c *gin.Context)
- func (h *Handler) UpdateDesktopConfig(c *gin.Context)
- func (h *Handler) WatchInstallProgress(c *gin.Context)
- type InstallRequest
- type Installer
- func (inst *Installer) CheckSystemDeps() *SetupStatus
- func (inst *Installer) GetBinaryPath() string
- func (inst *Installer) GetDownloadURL() (string, string, error)
- func (inst *Installer) GetInstalledVersion() string
- func (inst *Installer) GetVNCServerPath() string
- func (inst *Installer) GetWebDir() string
- func (inst *Installer) Install(onProgress func(line string)) error
- func (inst *Installer) IsInstalled() bool
- func (inst *Installer) NeedsUpdate() bool
- func (inst *Installer) SetGHProxyProvider(provider GHProxyProvider)
- type Module
- func (m *Module) Dependencies() []string
- func (m *Module) GetInstaller() *Installer
- func (m *Module) ID() string
- func (m *Module) Init(ctx *module.Context) error
- func (m *Module) Name() string
- func (m *Module) RegisterRoutes(group *gin.RouterGroup)
- func (m *Module) Start() error
- func (m *Module) Stop() error
- func (m *Module) Version() string
- type RecommendedApp
- type RunRequest
- type RunningApp
- type Service
- func (s *Service) GetActiveInstalls() []ActiveInstall
- func (s *Service) GetDesktopConfig() DesktopConfig
- func (s *Service) GetDesktopStatus() *DesktopStatus
- func (s *Service) GetInstalledApps() []*FlatpakApp
- func (s *Service) GetRecommendedApps(category string) []*FlatpakApp
- func (s *Service) GetRecommendedCategories() []string
- func (s *Service) GetSetupStatus() *SetupStatus
- func (s *Service) InstallApp(appID string, appName string, onProgress func(line string), ...)
- func (s *Service) RestartDesktop() error
- func (s *Service) RunApp(appID string, args []string) error
- func (s *Service) RunSetup(onProgress func(line string), onComplete func(err error))
- func (s *Service) SearchApps(query string, limit int) []*FlatpakApp
- func (s *Service) Start() error
- func (s *Service) StartDesktop() error
- func (s *Service) Stop()
- func (s *Service) StopDesktop()
- func (s *Service) UninstallApp(appID string) error
- func (s *Service) UnsubscribeInstall(appID string, ch chan string)
- func (s *Service) UpdateDesktopConfig(config DesktopConfig)
- func (s *Service) WatchInstallProgress(appID string) (logs []string, ch chan string, status string, errMsg string, exists bool)
- type SetupStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveInstall ¶
type ActiveInstall struct {
AppID string `json:"app_id"`
AppName string `json:"app_name"`
StartedAt time.Time `json:"started_at"`
Status string `json:"status"` // installing, success, error
Error string `json:"error,omitempty"`
}
ActiveInstall 正在进行的安装任务
type Desktop ¶
type Desktop struct {
// contains filtered or unexported fields
}
Desktop KasmVNC 桌面实例管理器
func NewDesktop ¶
NewDesktop 创建桌面管理器
func (*Desktop) GetRunningApps ¶
func (d *Desktop) GetRunningApps() []*RunningApp
GetRunningApps 获取运行中的应用
type DesktopConfig ¶
type DesktopConfig struct {
Display int `json:"display"`
WebSocketPort int `json:"websocket_port"`
DefaultResolution string `json:"default_resolution"`
AudioEnabled bool `json:"audio_enabled"`
ClipboardSync bool `json:"clipboard_sync"`
AutoStart bool `json:"auto_start"`
}
DesktopConfig 桌面配置
type DesktopStatus ¶
type DesktopStatus struct {
Running bool `json:"running"`
Display int `json:"display"`
WebSocketPort int `json:"websocket_port"`
VNCURL string `json:"vnc_url"`
PID int `json:"pid"`
Uptime int64 `json:"uptime"`
Resolution string `json:"resolution"`
RunningApps []string `json:"running_apps"`
KasmVNCVersion string `json:"kasmvnc_version"`
}
DesktopStatus 桌面实例状态
type FlatpakApp ¶
type FlatpakApp struct {
AppID string `json:"app_id"`
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Icon string `json:"icon,omitempty"`
Category string `json:"category,omitempty"`
Installed bool `json:"installed"`
Size string `json:"size,omitempty"`
Runtime string `json:"runtime,omitempty"`
Remote string `json:"remote,omitempty"`
Running bool `json:"running"`
}
FlatpakApp Flatpak 应用
type GHProxyProvider ¶
type GHProxyProvider interface {
// IsPremium 是否为付费会员
IsPremium() bool
// GetGHProxyURL 获取 GitHub 加速代理 URL
GetGHProxyURL(originalURL string) (string, error)
}
GHProxyProvider GitHub 加速代理提供者接口 由 premium 模块实现,为 flatpak 提供加速下载能力
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler HTTP 处理器
func (*Handler) GetActiveInstalls ¶
GetActiveInstalls 获取当前正在安装的应用列表
func (*Handler) GetDesktopConfig ¶
GetDesktopConfig 获取桌面配置
func (*Handler) GetDesktopStatus ¶
GetDesktopStatus 获取桌面状态
func (*Handler) GetInstalledApps ¶
GetInstalledApps 获取已安装的 Flatpak 应用
func (*Handler) GetRecommendedApps ¶
GetRecommendedApps 获取推荐应用列表
func (*Handler) GetRecommendedCategories ¶
GetRecommendedCategories 获取推荐分类
func (*Handler) GetSetupStatus ¶
GetSetupStatus 获取环境检测状态
func (*Handler) InstallAppStream ¶
InstallAppStream SSE 流式安装应用
func (*Handler) RegisterRoutes ¶
func (h *Handler) RegisterRoutes(r *gin.RouterGroup)
RegisterRoutes 注册路由
func (*Handler) RestartDesktop ¶
RestartDesktop 重启桌面
func (*Handler) RunSetupStream ¶
RunSetupStream SSE 流式执行环境安装
func (*Handler) UpdateDesktopConfig ¶
UpdateDesktopConfig 更新桌面配置
func (*Handler) WatchInstallProgress ¶
WatchInstallProgress SSE 重连安装进度
type InstallRequest ¶
type InstallRequest struct {
AppID string `json:"app_id" binding:"required"`
AppName string `json:"app_name"`
}
InstallRequest 安装请求
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer KasmVNC 安装管理器
func (*Installer) CheckSystemDeps ¶
func (inst *Installer) CheckSystemDeps() *SetupStatus
CheckSystemDeps 检查系统依赖
func (*Installer) GetBinaryPath ¶
GetBinaryPath 获取 kasmvncserver / Xkasmvnc 可执行文件路径
func (*Installer) GetDownloadURL ¶
GetDownloadURL 获取下载地址(国内自动走 ghproxy 加速)
func (*Installer) GetInstalledVersion ¶
GetInstalledVersion 获取已安装的版本
func (*Installer) GetVNCServerPath ¶
GetVNCServerPath 获取 kasmvncserver 脚本路径
func (*Installer) IsInstalled ¶
IsInstalled 检查 KasmVNC 是否已安装(通过系统包管理器)
func (*Installer) SetGHProxyProvider ¶
func (inst *Installer) SetGHProxyProvider(provider GHProxyProvider)
SetGHProxyProvider 设置 GitHub 加速代理提供者
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module Flatpak 模块
func (*Module) Dependencies ¶
func (*Module) GetInstaller ¶
GetInstaller 获取安装管理器实例(供其他模块注入加速提供者)
func (*Module) RegisterRoutes ¶
func (m *Module) RegisterRoutes(group *gin.RouterGroup)
RegisterRoutes 注册路由
type RecommendedApp ¶
type RecommendedApp struct {
AppID string `json:"app_id"`
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
Icon string `json:"icon,omitempty"`
}
RecommendedApp 推荐应用
type RunRequest ¶
type RunRequest struct {
AppID string `json:"app_id" binding:"required"`
Args []string `json:"args,omitempty"`
}
RunRequest 启动应用请求
type RunningApp ¶
type RunningApp struct {
AppID string `json:"app_id"`
Name string `json:"name"`
PID int `json:"pid"`
StartedAt time.Time `json:"started_at"`
}
RunningApp 运行中的应用进程
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service Flatpak 服务
func (*Service) GetActiveInstalls ¶
func (s *Service) GetActiveInstalls() []ActiveInstall
GetActiveInstalls 获取当前正在安装的应用列表
func (*Service) GetDesktopConfig ¶
func (s *Service) GetDesktopConfig() DesktopConfig
GetDesktopConfig 获取桌面配置
func (*Service) GetDesktopStatus ¶
func (s *Service) GetDesktopStatus() *DesktopStatus
GetDesktopStatus 获取桌面状态
func (*Service) GetInstalledApps ¶
func (s *Service) GetInstalledApps() []*FlatpakApp
GetInstalledApps 获取已安装的 Flatpak 应用
func (*Service) GetRecommendedApps ¶
func (s *Service) GetRecommendedApps(category string) []*FlatpakApp
GetRecommendedApps 获取推荐应用列表
func (*Service) GetRecommendedCategories ¶
GetRecommendedCategories 获取推荐分类
func (*Service) GetSetupStatus ¶
func (s *Service) GetSetupStatus() *SetupStatus
GetSetupStatus 获取环境检测状态
func (*Service) InstallApp ¶
func (s *Service) InstallApp(appID string, appName string, onProgress func(line string), onComplete func(err error))
InstallApp 安装 Flatpak 应用(带流式进度) 如果已有同一应用的安装任务正在运行,直接返回(前端应通过 WatchInstallProgress 重连)
func (*Service) SearchApps ¶
func (s *Service) SearchApps(query string, limit int) []*FlatpakApp
SearchApps 搜索 Flathub 应用
func (*Service) UninstallApp ¶
UninstallApp 卸载 Flatpak 应用
func (*Service) UnsubscribeInstall ¶
UnsubscribeInstall 取消订阅
func (*Service) UpdateDesktopConfig ¶
func (s *Service) UpdateDesktopConfig(config DesktopConfig)
UpdateDesktopConfig 更新桌面配置
type SetupStatus ¶
type SetupStatus struct {
KasmVNCInstalled bool `json:"kasmvnc_installed"`
KasmVNCVersion string `json:"kasmvnc_version"`
KasmVNCExpected string `json:"kasmvnc_expected"`
FlatpakInstalled bool `json:"flatpak_installed"`
FlatpakRemoteOK bool `json:"flatpak_remote_ok"`
OpenboxInstalled bool `json:"openbox_installed"`
PulseAudioInstalled bool `json:"pulseaudio_installed"`
PulseAudioRunning bool `json:"pulseaudio_running"`
VirtualSinkReady bool `json:"virtual_sink_ready"`
Ready bool `json:"ready"`
}
SetupStatus 环境检测状态