admin

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindingExternalAccount

func BindingExternalAccount(c *gin.Context)

func CreatePluginMarketSource

func CreatePluginMarketSource(c *gin.Context)

func CreateThemeMarketSource

func CreateThemeMarketSource(c *gin.Context)

func DeleteFavicon

func DeleteFavicon(c *gin.Context)

func DeletePluginMarketSource

func DeletePluginMarketSource(c *gin.Context)

func DeleteTheme

func DeleteTheme(c *gin.Context)

DeleteTheme 删除主题

func DeleteThemeMarketSource

func DeleteThemeMarketSource(c *gin.Context)

func Disable2FA

func Disable2FA(c *gin.Context)

func DownloadBackup

func DownloadBackup(c *gin.Context)

DownloadBackup 使用白名单打包 ./data 及数据库文件为 zip 并下载, 同时归档到 ./data/backup/ 确保 Docker 挂载后备份文件可持久化。

归档文件由前端后续统一管理,服务端只负责生成并保存。

func DownloadMarketURL

func DownloadMarketURL(rawURL string, maxSize int64) ([]byte, error)

DownloadMarketURL performs a market download. When SSRF protection is enabled, URLs resolving to private or internal addresses are rejected (including on every redirect hop); when disabled, downloads proceed without address filtering.

func Enable2FA

func Enable2FA(c *gin.Context)

func Generate2FA

func Generate2FA(c *gin.Context)

func ImportTheme

func ImportTheme(c *gin.Context)

ImportTheme 导入远程主题 支持preview查询参数:preview=true时仅返回主题信息,否则下载安装 请求body: {"url": "https://..."} URL支持GitHub仓库地址(自动取latest release)和直接ZIP下载链接

func InstallPluginFromMarket

func InstallPluginFromMarket(c *gin.Context)

func InstallThemeFromMarket

func InstallThemeFromMarket(c *gin.Context)

func IsSSRFProtectionEnabled

func IsSSRFProtectionEnabled() bool

IsSSRFProtectionEnabled reports whether SSRF protection is enabled for market downloads. An unreadable setting is treated as enabled so callers using this status helper fail closed.

func ListPluginMarketCatalog

func ListPluginMarketCatalog(c *gin.Context)

func ListPluginMarketSources

func ListPluginMarketSources(c *gin.Context)

func ListThemeMarketCatalog

func ListThemeMarketCatalog(c *gin.Context)

func ListThemeMarketSources

func ListThemeMarketSources(c *gin.Context)

func ListThemes

func ListThemes(c *gin.Context)

ListThemes 列出所有主题

func NewArchiveUploadHandler

func NewArchiveUploadHandler() *upload.Handler

func Rebind2FA added in v0.1.14

func Rebind2FA(c *gin.Context)

Rebind2FA starts a replacement enrollment for an account that already has a factor. It is the recovery path for a lost authenticator: /2fa/disable requires a valid code, so without this the only way back in was the disable2FA command on the server. The account password is the step-up, and it is checked against the same buckets as login so a stolen session cannot use this endpoint to grind passwords for free. The current factor keeps working until the new code is verified, so a failed replacement leaves the account as it was.

func RegisterPprofRoutes

func RegisterPprofRoutes(group *gin.RouterGroup)

RegisterPprofRoutes adds diagnostic endpoints to an already administrator- protected route group. It deliberately uses runtime/pprof directly instead of net/http/pprof, which would register unauthenticated /debug/pprof routes on http.DefaultServeMux as a package side effect.

func ServePluginFile

func ServePluginFile(c *gin.Context)

ServePluginFile serves a static file from an installed plugin directory, used by injected plugin admin pages.

func SetTheme

func SetTheme(c *gin.Context)

SetTheme 设置主题

func UnbindExternalAccount

func UnbindExternalAccount(c *gin.Context)

func UpdateMmdbGeoIP

func UpdateMmdbGeoIP(c *gin.Context)

func UpdatePluginMarketSource

func UpdatePluginMarketSource(c *gin.Context)

func UpdateTheme

func UpdateTheme(c *gin.Context)

UpdateTheme 更新主题 支持四种更新方式: 1. 使用主题原有URL下载更新 2. 提供新的直接下载URL进行更新 3. 提供GitHub仓库信息,从最新release下载更新 4. 如果主题URL是GitHub仓库地址,自动获取最新release

func UpdateThemeMarketSource

func UpdateThemeMarketSource(c *gin.Context)

func UpdateThemeSettings

func UpdateThemeSettings(c *gin.Context)

func UpdateUser

func UpdateUser(c *gin.Context)

func UploadFavicon

func UploadFavicon(c *gin.Context)

Types

type PluginMarketPlugin

type PluginMarketPlugin struct {
	Name        any    `json:"name"`
	Short       string `json:"short"`
	Description any    `json:"description"`
	Version     string `json:"version"`
	Author      any    `json:"author"`
	URL         string `json:"url"`
	Download    string `json:"download"`
	SHA256      string `json:"sha256"`
	Komari      string `json:"komari"`
	Installable bool   `json:"installable"`
	SourceID    string `json:"source_id,omitempty"`
	SourceName  string `json:"source_name,omitempty"`
}

type PluginMarketSource

type PluginMarketSource struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	URL     string `json:"url"`
	Enabled bool   `json:"enabled"`
}

type ThemeMarketSource

type ThemeMarketSource struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	URL     string `json:"url"`
	Enabled bool   `json:"enabled"`
}

type ThemeMarketTheme

type ThemeMarketTheme struct {
	Name        any    `json:"name"`
	Short       string `json:"short"`
	Description any    `json:"description"`
	Version     string `json:"version"`
	Author      any    `json:"author"`
	URL         string `json:"url"`
	Preview     string `json:"preview"`
	Download    string `json:"download"`
	SHA256      string `json:"sha256"`
	Installable bool   `json:"installable"`
	SourceID    string `json:"source_id,omitempty"`
	SourceName  string `json:"source_name,omitempty"`
}

Jump to

Keyboard shortcuts

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