feat(sub): per-client external links and remote subscriptions

Add a Links tab to the client form for attaching third-party share
links and remote subscription URLs per client. They are merged into
the client's raw/JSON/Clash subscription output: links are emitted
verbatim and parsed for JSON/Clash; subscription URLs are fetched
(cached, with a short timeout) and their configs merged in.

i18n keys added across all 13 locales.
This commit is contained in:
MHSanaei
2026-06-14 20:57:14 +02:00
parent 7c2598fae9
commit dcb923b4a1
33 changed files with 1204 additions and 28 deletions
+25
View File
@@ -629,6 +629,31 @@ type ClientInbound struct {
func (ClientInbound) TableName() string { return "client_inbounds" }
// ClientExternalLink is a per-client entry surfaced in the client's
// subscription. Two kinds:
// - "link": a single third-party share link (vless://, vmess://, trojan://,
// ss://, hysteria2://, wireguard://). Emitted verbatim in raw subs; parsed
// into an outbound/proxy for JSON and Clash.
// - "subscription": a remote subscription URL. The panel fetches it (cached),
// decodes its links, and merges them into the client's subscription.
type ClientExternalLink struct {
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
ClientId int `json:"clientId" gorm:"index;column:client_id"`
Kind string `json:"kind" gorm:"column:kind"`
Value string `json:"value" gorm:"column:value"`
Remark string `json:"remark" gorm:"column:remark"`
SortIndex int `json:"sortIndex" gorm:"column:sort_index"`
CreatedAt int64 `json:"createdAt" gorm:"autoCreateTime:milli"`
}
func (ClientExternalLink) TableName() string { return "client_external_links" }
// External link kinds.
const (
ExternalLinkKindLink = "link"
ExternalLinkKindSubscription = "subscription"
)
type InboundFallback struct {
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
MasterId int `json:"masterId" gorm:"index;not null;column:master_id"`