Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,10 @@ core/cmd/server/web/index.html
frontend/auto-imports.d.ts
frontend/components.d.ts
frontend/src/xpack
frontend/src/xpack-ee
agent/xpack
agent/router/entry_xpack.go
agent/server/init_xpack.go
agent/utils/xpack/xpack.go
agent/utils/xpack/xpack_xpack.go
core/xpack
core/router/entry_xpack.go
core/server/init_xpack.go
core/utils/xpack/xpack.go
core/utils/xpack/xpack_xpack.go
core/xpack-ee
core/router/entry_xpackee.go
core/server/init_xpackee.go
core/utils/xpack/xpack_xpackee.go

.history/
dist/
Expand Down
2 changes: 1 addition & 1 deletion agent/router/entry.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !xpack
//go:build !xpack && !xpackee

package router

Expand Down
19 changes: 19 additions & 0 deletions agent/router/entry_xpack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//go:build xpack

package router

import (
xpackRouter "github.com/1Panel-dev/1Panel/agent/xpack/router"
)

func RouterGroups() []CommonRouter {
baseRouter := commonGroups()
for _, ro := range xpackRouter.XpackGroups() {
if val, ok := ro.(CommonRouter); ok {
baseRouter = append(baseRouter, val)
}
}
return baseRouter
}

var RouterGroupApp = RouterGroups()
2 changes: 1 addition & 1 deletion agent/server/init.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !xpack
//go:build !xpack && !xpackee

package server

Expand Down
11 changes: 11 additions & 0 deletions agent/server/init_xpack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//go:build xpack

package server

import (
xpack "github.com/1Panel-dev/1Panel/agent/xpack"
)

func InitOthers() {
xpack.Init()
}
2 changes: 1 addition & 1 deletion agent/utils/xpack/community.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !xpack
//go:build !xpack && !xpackee
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore agent build coverage for xpackee tag

With this change, agent no longer has any implementation selected when building with -tags xpackee: the community files now require !xpack && !xpackee, while the only new replacements are tagged xpack (not xpackee). In that build mode, packages like agent/utils/xpack, agent/router, and agent/server lose required symbols (or all files), so enterprise builds that use the xpackee tag fail to compile.

Useful? React with 👍 / 👎.


package xpack

Expand Down
74 changes: 74 additions & 0 deletions agent/utils/xpack/xpack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//go:build xpack

package xpack

import (
"net/http"

"github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/model"
edition "github.com/1Panel-dev/1Panel/agent/xpack/edition"
"github.com/gin-gonic/gin"
)

func RemoveTamper(website string) {
edition.RemoveTamper(website)
}

func StartClam(startClam *model.Clam, isUpdate bool) (int, error) {
return edition.StartClam(startClam, isUpdate)
}

func LoadNodeInfo(isBase bool) (model.NodeInfo, error) {
return edition.LoadNodeInfo(isBase)
}

func GetImagePrefix() string {
return edition.GetImagePrefix()
}

func IsUseCustomApp() bool {
return edition.IsUseCustomApp()
}

func IsXpack() bool {
return edition.IsXpack()
}

func CreateTaskScanSMSAlertLog(info dto.AlertDTO, alertType string, create dto.AlertLogCreate, pushAlert dto.PushAlert, method string) error {
return edition.CreateTaskScanSMSAlertLog(info, alertType, create, pushAlert, method)
}

func CreateSMSAlertLog(alertType string, info dto.AlertDTO, create dto.AlertLogCreate, project string, params []dto.Param, method string) error {
return edition.CreateSMSAlertLog(alertType, info, create, project, params, method)
}

func CreateTaskScanWebhookAlertLog(alert dto.AlertDTO, alertType string, create dto.AlertLogCreate, pushAlert dto.PushAlert, method string, transport *http.Transport, agentInfo *dto.AgentInfo) error {
return edition.CreateTaskScanWebhookAlertLog(alert, alertType, create, pushAlert, method, transport, agentInfo)
}

func CreateWebhookAlertLog(alertType string, info dto.AlertDTO, create dto.AlertLogCreate, project string, params []dto.Param, method string, transport *http.Transport, agentInfo *dto.AgentInfo) error {
return edition.CreateWebhookAlertLog(alertType, info, create, project, params, method, transport, agentInfo)
}

func GetLicenseErrorAlert() (uint, error) {
return edition.GetLicenseErrorAlert()
}

func GetNodeErrorAlert() (uint, error) {
return edition.GetNodeErrorAlert()
}

func LoadRequestTransport() *http.Transport { return edition.LoadRequestTransport() }

func ValidateCertificate(c *gin.Context) bool {
return edition.ValidateCertificate(c)
}

func PushSSLToNode(websiteSSL *model.WebsiteSSL) error {
return edition.PushSSLToNode(websiteSSL)
}

func GetAgentInfo() (*dto.AgentInfo, error) {
return edition.GetAgentInfo()
}
2 changes: 1 addition & 1 deletion core/router/entry.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !xpack
//go:build !xpack && !xpackee

package router

Expand Down
19 changes: 19 additions & 0 deletions core/router/entry_xpack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//go:build xpack

package router

import (
xpackRouter "github.com/1Panel-dev/1Panel/core/xpack/router"
)

func RouterGroups() []CommonRouter {
baseRouter := commonGroups()
for _, ro := range xpackRouter.XpackGroups() {
if val, ok := ro.(CommonRouter); ok {
baseRouter = append(baseRouter, val)
}
}
return baseRouter
}

var RouterGroupApp = RouterGroups()
25 changes: 25 additions & 0 deletions core/router/entry_xpackee.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//go:build xpackee

package router

import (
xpackEERouter "github.com/1Panel-dev/1Panel/core/xpack-ee/router"
xpackRouter "github.com/1Panel-dev/1Panel/core/xpack/router"
)

func RouterGroups() []CommonRouter {
baseRouter := commonGroups()
for _, ro := range xpackRouter.XpackGroups() {
if val, ok := ro.(CommonRouter); ok {
baseRouter = append(baseRouter, val)
}
}
for _, ro := range xpackEERouter.XpackEEGroups() {
if val, ok := ro.(CommonRouter); ok {
baseRouter = append(baseRouter, val)
}
}
return baseRouter
}

var RouterGroupApp = RouterGroups()
2 changes: 1 addition & 1 deletion core/server/init.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !xpack
//go:build !xpack && !xpackee

package server

Expand Down
11 changes: 11 additions & 0 deletions core/server/init_xpack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//go:build xpack

package server

import (
xpack "github.com/1Panel-dev/1Panel/core/xpack"
)

func InitOthers() {
xpack.Init()
}
13 changes: 13 additions & 0 deletions core/server/init_xpackee.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build xpackee

package server

import (
xpack "github.com/1Panel-dev/1Panel/core/xpack"
xpackEE "github.com/1Panel-dev/1Panel/core/xpack-ee"
)

func InitOthers() {
xpack.Init()
xpackEE.Init()
}
2 changes: 1 addition & 1 deletion core/utils/xpack/community.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !xpack
//go:build !xpack && !xpackee

package xpack

Expand Down
35 changes: 35 additions & 0 deletions core/utils/xpack/xpack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//go:build xpack

package xpack

import (
"net/http"

"github.com/1Panel-dev/1Panel/core/utils/ssh"
edition "github.com/1Panel-dev/1Panel/core/xpack/edition"
"github.com/gin-gonic/gin"
)

func Proxy(c *gin.Context, currentNode string) {
edition.Proxy(c, currentNode)
}

func ProxyDocker(proxyURL string) error { return edition.ProxyDocker(proxyURL) }

func UpdateGroup(name string, group, newGroup uint) error {
return edition.UpdateGroup(name, group, newGroup)
}

func CheckBackupUsed(name string) error {
return edition.CheckBackupUsed(name)
}

func LoadRequestTransport() *http.Transport { return edition.LoadRequestTransport() }

func LoadNodeInfo(currentNode string) (*ssh.ConnInfo, string, error) {
return edition.LoadNodeInfo(currentNode)
}

func Sync(dataType string) error { return edition.Sync(dataType) }

func AutoUpgradeWithMaster() { edition.AutoUpgradeWithMaster() }
44 changes: 44 additions & 0 deletions core/utils/xpack/xpackee.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//go:build xpackee

package xpack

import (
"net/http"

"github.com/1Panel-dev/1Panel/core/app/dto"
"github.com/1Panel-dev/1Panel/core/utils/ssh"
edition "github.com/1Panel-dev/1Panel/core/xpack-ee/edition"
"github.com/gin-gonic/gin"
)

func Proxy(c *gin.Context, currentNode string) {
edition.Proxy(c, currentNode)
}

func ProxyDocker(proxyURL string) error { return edition.ProxyDocker(proxyURL) }

func UpdateGroup(name string, group, newGroup uint) error {
return edition.UpdateGroup(name, group, newGroup)
}

func CheckBackupUsed(name string) error {
return edition.CheckBackupUsed(name)
}

func LoadRequestTransport() *http.Transport { return edition.LoadRequestTransport() }

func LoadNodeInfo(currentNode string) (*ssh.ConnInfo, string, error) {
return edition.LoadNodeInfo(currentNode)
}

func Sync(dataType string) error { return edition.Sync(dataType) }

func AutoUpgradeWithMaster() { edition.AutoUpgradeWithMaster() }

func Login(c *gin.Context, info dto.Login, entrance string) (*dto.UserLoginInfo, string, error) {
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)
}
10 changes: 2 additions & 8 deletions frontend/src/components/backup/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,12 @@ import TaskLog from '@/components/log/task/index.vue';
import { routerToFileWithPath } from '@/utils/router';
import { useGlobalStore } from '@/composables/useGlobalStore';
import { mysqlArgs } from '@/views/cronjob/cronjob/helper';
import { loadOptionalComponent } from '@/extensions/optional';
const { currentNode } = useGlobalStore();

const emit = defineEmits(['close']);

const PushApp = defineAsyncComponent(async () => {
const modules = import.meta.glob('@/xpack/views/appstore/push-app/index.vue');
const loader = modules['/src/xpack/views/appstore/push-app/index.vue'];
if (loader) {
return ((await loader()) as any).default;
}
return { template: '<div></div>' };
});
const PushApp = defineAsyncComponent(() => loadOptionalComponent('/src/xpack/views/appstore/push-app/index.vue'));

const selects = ref<any>([]);
const args = ref([]);
Expand Down
24 changes: 10 additions & 14 deletions frontend/src/components/docker-proxy/dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<script lang="ts" setup>
import { getSettingInfo } from '@/api/modules/setting';
import { searchXpackSetting } from '@/extensions/xpack';

const open = ref(false);
const restart = ref(true);
Expand Down Expand Up @@ -58,21 +59,16 @@ const acceptParams = async (props: DialogProps): Promise<void> => {
return;
}

let searchXSetting;
const xpackModules = import.meta.glob('../../xpack/api/modules/setting.ts', { eager: true });
if (xpackModules['../../xpack/api/modules/setting.ts']) {
searchXSetting = xpackModules['../../xpack/api/modules/setting.ts']['searchXSetting'] || {};
const res = await searchXSetting();
if (!res) {
emit();
return;
}
if (res.data.proxyDocker === '') {
emit();
return;
}
open.value = true;
const res = await searchXpackSetting();
if (!res) {
emit();
return;
}
if (res.data.proxyDocker === '') {
emit();
return;
}
open.value = true;
};

const onConfirm = async () => {
Expand Down
Loading
Loading