Skip to content

Commit 08090b9

Browse files
committed
refactor: restore symlink-based xpack integration
1 parent 6ea0742 commit 08090b9

File tree

33 files changed

+420
-136
lines changed

33 files changed

+420
-136
lines changed

.gitignore

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,10 @@ core/cmd/server/web/index.html
4141
frontend/auto-imports.d.ts
4242
frontend/components.d.ts
4343
frontend/src/xpack
44+
frontend/src/xpack-ee
4445
agent/xpack
45-
agent/router/entry_xpack.go
46-
agent/server/init_xpack.go
47-
agent/utils/xpack/xpack.go
48-
agent/utils/xpack/xpack_xpack.go
4946
core/xpack
50-
core/router/entry_xpack.go
51-
core/server/init_xpack.go
52-
core/utils/xpack/xpack.go
53-
core/utils/xpack/xpack_xpack.go
5447
core/xpack-ee
55-
core/router/entry_xpackee.go
56-
core/server/init_xpackee.go
57-
core/utils/xpack/xpack_xpackee.go
5848

5949
.history/
6050
dist/

agent/router/entry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !xpack
1+
//go:build !xpack && !xpackee
22

33
package router
44

agent/router/entry_xpack.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//go:build xpack
2+
3+
package router
4+
5+
import (
6+
xpackRouter "github.com/1Panel-dev/1Panel/agent/xpack/router"
7+
)
8+
9+
func RouterGroups() []CommonRouter {
10+
baseRouter := commonGroups()
11+
for _, ro := range xpackRouter.XpackGroups() {
12+
if val, ok := ro.(CommonRouter); ok {
13+
baseRouter = append(baseRouter, val)
14+
}
15+
}
16+
return baseRouter
17+
}
18+
19+
var RouterGroupApp = RouterGroups()

agent/server/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !xpack
1+
//go:build !xpack && !xpackee
22

33
package server
44

agent/server/init_xpack.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//go:build xpack
2+
3+
package server
4+
5+
import (
6+
xpack "github.com/1Panel-dev/1Panel/agent/xpack"
7+
)
8+
9+
func InitOthers() {
10+
xpack.Init()
11+
}

agent/utils/xpack/community.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !xpack
1+
//go:build !xpack && !xpackee
22

33
package xpack
44

agent/utils/xpack/xpack.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
//go:build xpack
2+
3+
package xpack
4+
5+
import (
6+
"net/http"
7+
8+
"github.com/1Panel-dev/1Panel/agent/app/dto"
9+
"github.com/1Panel-dev/1Panel/agent/app/model"
10+
edition "github.com/1Panel-dev/1Panel/agent/xpack/edition"
11+
"github.com/gin-gonic/gin"
12+
)
13+
14+
func RemoveTamper(website string) {
15+
edition.RemoveTamper(website)
16+
}
17+
18+
func StartClam(startClam *model.Clam, isUpdate bool) (int, error) {
19+
return edition.StartClam(startClam, isUpdate)
20+
}
21+
22+
func LoadNodeInfo(isBase bool) (model.NodeInfo, error) {
23+
return edition.LoadNodeInfo(isBase)
24+
}
25+
26+
func GetImagePrefix() string {
27+
return edition.GetImagePrefix()
28+
}
29+
30+
func IsUseCustomApp() bool {
31+
return edition.IsUseCustomApp()
32+
}
33+
34+
func IsXpack() bool {
35+
return edition.IsXpack()
36+
}
37+
38+
func CreateTaskScanSMSAlertLog(info dto.AlertDTO, alertType string, create dto.AlertLogCreate, pushAlert dto.PushAlert, method string) error {
39+
return edition.CreateTaskScanSMSAlertLog(info, alertType, create, pushAlert, method)
40+
}
41+
42+
func CreateSMSAlertLog(alertType string, info dto.AlertDTO, create dto.AlertLogCreate, project string, params []dto.Param, method string) error {
43+
return edition.CreateSMSAlertLog(alertType, info, create, project, params, method)
44+
}
45+
46+
func CreateTaskScanWebhookAlertLog(alert dto.AlertDTO, alertType string, create dto.AlertLogCreate, pushAlert dto.PushAlert, method string, transport *http.Transport, agentInfo *dto.AgentInfo) error {
47+
return edition.CreateTaskScanWebhookAlertLog(alert, alertType, create, pushAlert, method, transport, agentInfo)
48+
}
49+
50+
func CreateWebhookAlertLog(alertType string, info dto.AlertDTO, create dto.AlertLogCreate, project string, params []dto.Param, method string, transport *http.Transport, agentInfo *dto.AgentInfo) error {
51+
return edition.CreateWebhookAlertLog(alertType, info, create, project, params, method, transport, agentInfo)
52+
}
53+
54+
func GetLicenseErrorAlert() (uint, error) {
55+
return edition.GetLicenseErrorAlert()
56+
}
57+
58+
func GetNodeErrorAlert() (uint, error) {
59+
return edition.GetNodeErrorAlert()
60+
}
61+
62+
func LoadRequestTransport() *http.Transport { return edition.LoadRequestTransport() }
63+
64+
func ValidateCertificate(c *gin.Context) bool {
65+
return edition.ValidateCertificate(c)
66+
}
67+
68+
func PushSSLToNode(websiteSSL *model.WebsiteSSL) error {
69+
return edition.PushSSLToNode(websiteSSL)
70+
}
71+
72+
func GetAgentInfo() (*dto.AgentInfo, error) {
73+
return edition.GetAgentInfo()
74+
}

core/router/entry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !xpack
1+
//go:build !xpack && !xpackee
22

33
package router
44

core/router/entry_xpack.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//go:build xpack
2+
3+
package router
4+
5+
import (
6+
xpackRouter "github.com/1Panel-dev/1Panel/core/xpack/router"
7+
)
8+
9+
func RouterGroups() []CommonRouter {
10+
baseRouter := commonGroups()
11+
for _, ro := range xpackRouter.XpackGroups() {
12+
if val, ok := ro.(CommonRouter); ok {
13+
baseRouter = append(baseRouter, val)
14+
}
15+
}
16+
return baseRouter
17+
}
18+
19+
var RouterGroupApp = RouterGroups()

core/router/entry_xpackee.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//go:build xpackee
2+
3+
package router
4+
5+
import (
6+
xpackEERouter "github.com/1Panel-dev/1Panel/core/xpack-ee/router"
7+
xpackRouter "github.com/1Panel-dev/1Panel/core/xpack/router"
8+
)
9+
10+
func RouterGroups() []CommonRouter {
11+
baseRouter := commonGroups()
12+
for _, ro := range xpackRouter.XpackGroups() {
13+
if val, ok := ro.(CommonRouter); ok {
14+
baseRouter = append(baseRouter, val)
15+
}
16+
}
17+
for _, ro := range xpackEERouter.XpackEEGroups() {
18+
if val, ok := ro.(CommonRouter); ok {
19+
baseRouter = append(baseRouter, val)
20+
}
21+
}
22+
return baseRouter
23+
}
24+
25+
var RouterGroupApp = RouterGroups()

0 commit comments

Comments
 (0)