feat: update xpack integration behavior

This commit is contained in:
ssongliu
2026-04-09 14:34:28 +08:00
committed by zhengkunwang223
parent 0e28f27819
commit d9cedeca09
14 changed files with 153 additions and 20 deletions

View File

@@ -4,11 +4,15 @@ package xpack
import (
"crypto/tls"
"errors"
"net"
"net/http"
"time"
baseDto "github.com/1Panel-dev/1Panel/core/app/dto"
"github.com/1Panel-dev/1Panel/core/init/session/psession"
"github.com/1Panel-dev/1Panel/core/utils/ssh"
"github.com/1Panel-dev/1Panel/core/xpack/app/model"
"github.com/gin-gonic/gin"
)
@@ -40,3 +44,30 @@ func LoadNodeInfo(currentNode string) (*ssh.ConnInfo, string, error) {
func Sync(dataType string) error { return nil }
func AutoUpgradeWithMaster() {}
func Login(_ *gin.Context, _ baseDto.Login, _ string) (*baseDto.UserLoginInfo, string, error) {
return nil, "", errors.New("not xpackee build")
}
func LoadSessionTimeout(sessionUser psession.SessionUser, defaultTTL int) int { return defaultTTL }
func RemoveBindNode(nodeID uint) error { return nil }
func CheckLicenseStatus(isXpack bool, licenseID, nodeID uint) error {
return nil
}
func LoadLicenseByNodeID(nodeID uint) (bool, model.License, error) {
return false, model.License{}, nil
}
func Bind(node model.Node, license *model.License, withInit, withSync, withDryRun, withDockerRestart bool) error {
return nil
}
func BindFree(node model.Node, licenseID uint) error {
return nil
}
func Unbind(node model.Node, license model.License, withReset, withSync, withDockerRestart bool) error {
return nil
}
func UnbindFree(node model.Node, licenseID uint) error {
return nil
}

View File

@@ -3,9 +3,13 @@
package xpack
import (
"errors"
"net/http"
baseDto "github.com/1Panel-dev/1Panel/core/app/dto"
"github.com/1Panel-dev/1Panel/core/init/session/psession"
"github.com/1Panel-dev/1Panel/core/utils/ssh"
"github.com/1Panel-dev/1Panel/core/xpack/app/model"
edition "github.com/1Panel-dev/1Panel/core/xpack/edition"
"github.com/gin-gonic/gin"
)
@@ -33,3 +37,30 @@ func LoadNodeInfo(currentNode string) (*ssh.ConnInfo, string, error) {
func Sync(dataType string) error { return edition.Sync(dataType) }
func AutoUpgradeWithMaster() { edition.AutoUpgradeWithMaster() }
func Login(_ *gin.Context, _ baseDto.Login, _ string) (*baseDto.UserLoginInfo, string, error) {
return nil, "", errors.New("not xpackee build")
}
func LoadSessionTimeout(sessionUser psession.SessionUser, defaultTTL int) int { return defaultTTL }
func RemoveBindNode(nodeID uint) error { return nil }
func CheckLicenseStatus(isXpack bool, licenseID, nodeID uint) error {
return edition.CheckLicenseStatus(isXpack, licenseID, nodeID)
}
func LoadLicenseByNodeID(nodeID uint) (bool, model.License, error) {
return edition.LoadLicenseByNodeID(nodeID)
}
func Bind(node model.Node, license *model.License, withInit, withSync, withDryRun, withDockerRestart bool) error {
return edition.Bind(node, license, withInit, withSync, withDryRun, withDockerRestart)
}
func BindFree(node model.Node, licenseID uint) error {
return edition.BindFree(node, licenseID)
}
func Unbind(node model.Node, license model.License, withReset, withSync, withDockerRestart bool) error {
return edition.Unbind(node, license, withReset, withSync, withDockerRestart)
}
func UnbindFree(node model.Node, licenseID uint) error {
return edition.UnbindFree(node, licenseID)
}

View File

@@ -6,8 +6,10 @@ import (
"net/http"
"github.com/1Panel-dev/1Panel/core/app/dto"
"github.com/1Panel-dev/1Panel/core/init/session/psession"
"github.com/1Panel-dev/1Panel/core/utils/ssh"
edition "github.com/1Panel-dev/1Panel/core/xpack-ee/edition"
"github.com/1Panel-dev/1Panel/core/xpack/app/model"
"github.com/gin-gonic/gin"
)
@@ -39,6 +41,27 @@ func Login(c *gin.Context, info dto.Login, entrance string) (*dto.UserLoginInfo,
return edition.Login(c, info, entrance)
}
func MFALogin(c *gin.Context, info dto.MFALogin, entrance string) (*dto.UserLoginInfo, string, error) {
return edition.MFALogin(c, info, entrance)
func LoadSessionTimeout(sessionUser psession.SessionUser, defaultTTL int) int {
return edition.LoadSessionTimeout(sessionUser, defaultTTL)
}
func RemoveBindNode(nodeID uint) error { return nil }
func CheckLicenseStatus(isXpack bool, licenseID, nodeID uint) error {
return edition.CheckLicenseStatus(isXpack, licenseID, nodeID)
}
func LoadLicenseByNodeID(nodeID uint) (bool, model.License, error) {
return edition.LoadLicenseByNodeID(nodeID)
}
func Bind(node model.Node, license *model.License, withInit, withSync, withDryRun, withDockerRestart bool) error {
return edition.Bind(node, license, withInit, withSync, withDryRun, withDockerRestart)
}
func BindFree(node model.Node, licenseID uint) error {
return edition.BindFree(node, licenseID)
}
func Unbind(node model.Node, license model.License, withReset, withSync, withDockerRestart bool) error {
return edition.Unbind(node, license, withReset, withSync, withDockerRestart)
}
func UnbindFree(node model.Node, licenseID uint) error {
return edition.UnbindFree(node, licenseID)
}