communityscripts

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubRepo             = "https://github.com/community-scripts/ProxmoxVE"
	GitHubAPIRepo          = "https://api.github.com/repos/community-scripts/ProxmoxVE"
	RawGitHubRepo          = "https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main"
	RawGitHubDevRepo       = "https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main"
	MetadataPocketBaseBase = "https://db.community-scripts.org"
	MetadataPocketBaseAPI  = MetadataPocketBaseBase + "/api/collections"
)

GitHubRepo is the URL to the Proxmox Community Scripts repository.

View Source
const (
	ScriptMetadataTTL = 24 * time.Hour // Cache script metadata for 24 hours
	ScriptListTTL     = 12 * time.Hour // Cache script list for 12 hours
)

Cache TTLs.

View Source
const (
	ScriptMetadataListCacheKey = "communityscripts_script_metadata_list_v3"
	ScriptListCacheKey         = "communityscripts_script_list_v3"
	ScriptCacheKeyPrefix       = "communityscripts_script_"
)

Cache keys.

View Source
const PluginID = "community-scripts"

PluginID identifies the community scripts plugin when referencing it from configuration.

Variables

This section is empty.

Functions

func InstallScript

func InstallScript(user, nodeIP string, script Script, skipWait bool) (int, error)

InstallScript installs a script on a Proxmox node. Returns the remote exit code (0 on success) and any error encountered. When skipWait is true, it will not prompt/await Enter after completion.

func InstallScriptInLXC added in v1.0.14

func InstallScriptInLXC(user, nodeIP string, vmid int, script Script, skipWait bool) (int, error)

InstallScriptInLXC installs a script inside an existing LXC container via pct exec. It SSHes to the node, then runs pct exec <vmid> -- bash -c "curl ... | bash".

func ValidateConnection

func ValidateConnection(user, nodeIP string) error

ValidateConnection checks if SSH connection to the node is possible.

Types

type GitHubContent

type GitHubContent struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Type        string `json:"type"` // "file" or "dir"
	DownloadURL string `json:"download_url"`
}

GitHubContent represents a file or directory in the GitHub API.

func GetScriptMetadataFiles

func GetScriptMetadataFiles() ([]GitHubContent, error)

GetScriptMetadataFiles fetches the list of script metadata JSON files from the repository.

type Plugin

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

Plugin implements the components.Plugin interface to provide community script functionality.

func New

func New() *Plugin

New returns a fresh plugin instance.

func (*Plugin) Description

func (p *Plugin) Description() string

Description describes the plugin's purpose.

func (*Plugin) ID

func (p *Plugin) ID() string

ID returns the stable plugin identifier.

func (*Plugin) Initialize

func (p *Plugin) Initialize(ctx context.Context, app *components.App, registrar components.PluginRegistrar) error

Initialize wires the plugin into the host application.

func (*Plugin) ModalPageNames added in v1.0.9

func (p *Plugin) ModalPageNames() []string

ModalPageNames returns the list of modal page names this plugin registers.

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns a human-friendly plugin name.

func (*Plugin) Shutdown

func (p *Plugin) Shutdown(ctx context.Context) error

Shutdown releases resources held by the plugin.

type Script

type Script struct {
	Name          string   `json:"name"`
	Slug          string   `json:"slug"`
	Description   string   `json:"description"`
	Categories    []string `json:"categories"`
	Type          string   `json:"type"` // "ct" for containers, "vm" for VMs
	Updateable    bool     `json:"updateable"`
	Privileged    bool     `json:"privileged"`
	InterfacePort int      `json:"interface_port"`
	Documentation string   `json:"documentation"`
	Website       string   `json:"website"`
	ConfigPath    string   `json:"config_path"`
	ScriptPath    string   // Added for our use, not in the JSON
	DateCreated   string   `json:"date_created"`
	IsDev         bool     `json:"is_dev"`
	IsDisabled    bool     `json:"is_disabled"`
	IsDeleted     bool     `json:"is_deleted"`
}

Script represents a single script from the repository.

func FetchScripts

func FetchScripts() ([]Script, error)

FetchScripts fetches all available scripts from the repository.

func GetScriptMetadata

func GetScriptMetadata(metadataURL string) (*Script, error)

GetScriptMetadata fetches and parses the metadata for a specific script.

func GetScriptsByCategory

func GetScriptsByCategory(category string) ([]Script, error)

GetScriptsByCategory returns scripts for a specific category.

type ScriptCategory

type ScriptCategory struct {
	Name        string
	Description string
	Path        string
}

ScriptCategory represents a category of Proxmox scripts.

func GetScriptCategories

func GetScriptCategories() []ScriptCategory

GetScriptCategories returns the available script categories.

type ScriptSelector

type ScriptSelector struct {
	*tview.Pages
	// contains filtered or unexported fields
}

ScriptSelector represents a page-based script selector for installing community scripts.

func NewScriptSelector

func NewScriptSelector(app *components.App, node *api.Node, vm *api.VM, user string) *ScriptSelector

NewScriptSelector creates a new script selector.

func (*ScriptSelector) Hide

func (s *ScriptSelector) Hide()

Hide hides the script selector.

func (*ScriptSelector) Show

func (s *ScriptSelector) Show()

Show displays the script selector.

Jump to

Keyboard shortcuts

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