packages

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package packages 提供内置套件管理功能 将内置 Go 模块映射为前端可识别的"套件",提供套件列表、状态、前端资源服务等 API

Index

Constants

View Source
const (
	ModuleID      = "packages"
	ModuleName    = "Package Manager"
	ModuleVersion = "1.0.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendConfig

type BackendConfig struct {
	Binary      string            `json:"binary,omitempty"`
	Port        int               `json:"port,omitempty"`
	HealthCheck string            `json:"healthCheck,omitempty"`
	AutoStart   bool              `json:"autoStart,omitempty"`
	Env         map[string]string `json:"env,omitempty"`
}

BackendConfig 后端配置

type FrontendConfig

type FrontendConfig struct {
	Root      string `json:"root,omitempty"` // 前端文件根目录,默认 "frontend/dist"
	Entry     string `json:"entry,omitempty"`
	Title     string `json:"title,omitempty"`
	Width     int    `json:"width,omitempty"`
	Height    int    `json:"height,omitempty"`
	MinWidth  int    `json:"minWidth,omitempty"`
	MinHeight int    `json:"minHeight,omitempty"`
	Resizable *bool  `json:"resizable,omitempty"`
	Singleton bool   `json:"singleton,omitempty"`
}

FrontendConfig 前端配置

type Manifest

type Manifest struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description"`
	Author      string `json:"author"`
	Icon        string `json:"icon"`
	Category    string `json:"category"`

	Frontend *FrontendConfig `json:"frontend,omitempty"`
	Backend  *BackendConfig  `json:"backend,omitempty"`

	HasFrontend bool `json:"hasFrontend,omitempty"`
	HasBackend  bool `json:"hasBackend,omitempty"`
}

Manifest 对应套件的 manifest.json 结构

type Module

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

Module 套件管理模块

func New

func New(registry *module.Registry) *Module

New 创建套件管理模块

func (*Module) Dependencies

func (m *Module) Dependencies() []string

func (*Module) ID

func (m *Module) ID() string

func (*Module) Init

func (m *Module) Init(ctx *module.Context) error

Init 初始化模块,扫描并加载 manifest

func (*Module) Name

func (m *Module) Name() string

func (*Module) RegisterRoutes

func (m *Module) RegisterRoutes(group *gin.RouterGroup)

RegisterRoutes 注册套件管理 API

func (*Module) Start

func (m *Module) Start() error

func (*Module) Stop

func (m *Module) Stop() error

func (*Module) Version

func (m *Module) Version() string

type PackageDetail

type PackageDetail struct {
	PackageInfo
	InstallPath string   `json:"installPath"`
	DataPath    string   `json:"dataPath"`
	BackendPort int      `json:"backendPort,omitempty"`
	Permissions []string `json:"permissions"`
	ServiceName string   `json:"serviceName,omitempty"`
}

PackageDetail 套件详情

type PackageInfo

type PackageInfo struct {
	ID             string          `json:"id"`
	Name           string          `json:"name"`
	Version        string          `json:"version"`
	Description    string          `json:"description"`
	Author         string          `json:"author"`
	Category       string          `json:"category"`
	Icon           string          `json:"icon"`
	State          string          `json:"state"` // running, stopped, error
	HasFrontend    bool            `json:"hasFrontend"`
	HasBackend     bool            `json:"hasBackend"`
	InstalledAt    string          `json:"installedAt"`
	AutoStart      bool            `json:"autoStart"`
	FrontendConfig *FrontendConfig `json:"frontendConfig,omitempty"`
	FrontendURL    string          `json:"frontendUrl,omitempty"`
}

PackageInfo 套件信息(返回给前端)

Jump to

Keyboard shortcuts

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