2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:47:20 +08:00
Files
panel/pkg/types/website.go
Copilot a386dc3a2a Add redirect and advanced settings tabs to website editor (#1267)
* Initial plan

* Add redirect tab to website editor with drag-and-drop support

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* Add advanced settings tab with rate limiting and basic auth

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* Add htpasswd file support for basic auth (nginx and apache compatible)

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* Fix code review issues: prevent duplicate usernames in basic auth

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: bug

* fix: bug

* feat: 支持real ip设置

* feat: 支持real ip设置

* fix: lint

* fix: lint

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>
Co-authored-by: 耗子 <haozi@loli.email>
2026-01-22 06:32:13 +08:00

68 lines
2.3 KiB
Go

package types
import "github.com/acepanel/panel/pkg/webserver/types"
// WebsiteListen 网站监听配置
type WebsiteListen struct {
Address string `form:"address" json:"address" validate:"required"` // 监听地址 e.g. 80 0.0.0.0:80 [::]:80
HTTPS bool `form:"https" json:"https"` // 是否启用HTTPS
QUIC bool `form:"quic" json:"quic"` // 是否启用QUIC
}
// WebsiteSetting 网站设置
type WebsiteSetting struct {
ID uint `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Listens []types.Listen `form:"listens" json:"listens" validate:"required"`
Domains []string `json:"domains"`
Path string `json:"path"` // 网站目录
Root string `json:"root"` // 运行目录
Index []string `json:"index"`
// SSL 相关
SSL bool `json:"ssl"`
SSLCert string `json:"ssl_cert"`
SSLKey string `json:"ssl_key"`
HSTS bool `json:"hsts"`
OCSP bool `json:"ocsp"`
HTTPRedirect bool `json:"http_redirect"`
SSLProtocols []string `json:"ssl_protocols"`
SSLCiphers string `json:"ssl_ciphers"`
SSLNotBefore string `json:"ssl_not_before"`
SSLNotAfter string `json:"ssl_not_after"`
SSLDNSNames []string `json:"ssl_dns_names"`
SSLIssuer string `json:"ssl_issuer"`
SSLOCSPServer []string `json:"ssl_ocsp_server"`
AccessLog string `json:"access_log"`
ErrorLog string `json:"error_log"`
// PHP 相关
PHP uint `json:"php"`
Rewrite string `json:"rewrite"`
OpenBasedir bool `json:"open_basedir"`
// 反向代理
Upstreams []types.Upstream `json:"upstreams"`
Proxies []types.Proxy `json:"proxies"`
// 重定向
Redirects []types.Redirect `json:"redirects"`
// 高级设置
RateLimit *types.RateLimit `json:"rate_limit"` // 限流限速配置
RealIP *types.RealIP `json:"real_ip"` // 真实 IP 配置
BasicAuth map[string]string `json:"basic_auth"` // 基本认证配置
// 自定义配置
CustomConfigs []WebsiteCustomConfig `json:"custom_configs"`
}
// WebsiteCustomConfig 网站自定义配置
type WebsiteCustomConfig struct {
Name string `json:"name"` // 配置名称
Scope string `json:"scope"` // 作用域: site(此网站), shared(全局)
Content string `json:"content"` // 配置内容
}