feat: 创建 PHP 运行环境网站支持同步创建数据库 (#6051)

This commit is contained in:
zhengkunwang 2024-08-07 13:52:34 +08:00 committed by GitHub
parent 5cf174be84
commit b359c7d990
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
97 changed files with 462 additions and 195 deletions

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/1Panel-dev/1Panel/agent/global" "github.com/1Panel-dev/1Panel/agent/global"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,11 +1,11 @@
package v1 package v2
import ( import (
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"path" "path"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"strconv" "strconv"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/1Panel-dev/1Panel/agent/global" "github.com/1Panel-dev/1Panel/agent/global"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"time" "time"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/1Panel-dev/1Panel/agent/utils/common" "github.com/1Panel-dev/1Panel/agent/utils/common"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"errors" "errors"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"encoding/base64" "encoding/base64"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,10 +1,10 @@
package v1 package v2
import ( import (
"context" "context"
"encoding/base64" "encoding/base64"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,10 +1,10 @@
package v1 package v2
import ( import (
"context" "context"
"encoding/base64" "encoding/base64"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"encoding/base64" "encoding/base64"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"encoding/base64" "encoding/base64"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"os" "os"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,4 +1,4 @@
package v1 package v2
import "github.com/1Panel-dev/1Panel/agent/app/service" import "github.com/1Panel-dev/1Panel/agent/app/service"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"os" "os"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -1,4 +1,4 @@
package v1 package v2
import ( import (
"errors" "errors"
@ -12,7 +12,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/app/dto/response" "github.com/1Panel-dev/1Panel/agent/app/dto/response"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"encoding/base64" "encoding/base64"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/1Panel-dev/1Panel/agent/utils/encrypt" "github.com/1Panel-dev/1Panel/agent/utils/encrypt"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"sort" "sort"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
websocket2 "github.com/1Panel-dev/1Panel/agent/utils/websocket" websocket2 "github.com/1Panel-dev/1Panel/agent/utils/websocket"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/1Panel-dev/1Panel/agent/global" "github.com/1Panel-dev/1Panel/agent/global"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,4 +1,4 @@
package v1 package v2
import ( import (
"encoding/base64" "encoding/base64"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -1,11 +1,11 @@
package v1 package v2
import ( import (
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,4 +1,4 @@
package v1 package v2
import ( import (
"net/http" "net/http"
@ -6,7 +6,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"

View File

@ -27,12 +27,12 @@ type WebsiteCreate struct {
AppID uint `json:"appID"` AppID uint `json:"appID"`
AppInstallID uint `json:"appInstallID"` AppInstallID uint `json:"appInstallID"`
FtpUser string `json:"ftpUser"`
FtpPassword string `json:"ftpPassword"`
RuntimeID uint `json:"runtimeID"` RuntimeID uint `json:"runtimeID"`
TaskID string `json:"taskID"` TaskID string `json:"taskID"`
RuntimeConfig RuntimeConfig
FtpConfig
DataBaseConfig
} }
type RuntimeConfig struct { type RuntimeConfig struct {
@ -40,6 +40,20 @@ type RuntimeConfig struct {
Port int `json:"port"` Port int `json:"port"`
} }
type FtpConfig struct {
FtpUser string `json:"ftpUser"`
FtpPassword string `json:"ftpPassword"`
}
type DataBaseConfig struct {
CreateDb bool `json:"createDb"`
DbName string `json:"dbName"`
DbUser string `json:"dbUser"`
DbPassword string `json:"dbPassword"`
DbHost string `json:"dbHost"`
DBFormat string `json:"dbFormat"`
}
type NewAppInstall struct { type NewAppInstall struct {
Name string `json:"name"` Name string `json:"name"`
AppDetailId uint `json:"appDetailID"` AppDetailId uint `json:"appDetailID"`

View File

@ -31,6 +31,7 @@ type WebsiteRes struct {
RuntimeName string `json:"runtimeName"` RuntimeName string `json:"runtimeName"`
SSLExpireDate time.Time `json:"sslExpireDate"` SSLExpireDate time.Time `json:"sslExpireDate"`
SSLStatus string `json:"sslStatus"` SSLStatus string `json:"sslStatus"`
AppInstallID uint `json:"appInstallId"`
} }
type WebsiteOption struct { type WebsiteOption struct {

View File

@ -31,6 +31,9 @@ type Website struct {
User string `gorm:"type:varchar;" json:"user"` User string `gorm:"type:varchar;" json:"user"`
Group string `gorm:"type:varchar;" json:"group"` Group string `gorm:"type:varchar;" json:"group"`
DbType string `json:"dbType"`
DbID uint `json:"dbID"`
Domains []WebsiteDomain `json:"domains" gorm:"-:migration"` Domains []WebsiteDomain `json:"domains" gorm:"-:migration"`
WebsiteSSL WebsiteSSL `json:"webSiteSSL" gorm:"-:migration"` WebsiteSSL WebsiteSSL `json:"webSiteSSL" gorm:"-:migration"`
} }

View File

@ -26,7 +26,7 @@ import (
"github.com/1Panel-dev/1Panel/agent/utils/cmd" "github.com/1Panel-dev/1Panel/agent/utils/cmd"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/app/dto/request"
"github.com/1Panel-dev/1Panel/agent/i18n" "github.com/1Panel-dev/1Panel/agent/i18n"
"github.com/subosito/gotenv" "github.com/subosito/gotenv"

View File

@ -29,7 +29,7 @@ import (
"github.com/1Panel-dev/1Panel/agent/utils/compose" "github.com/1Panel-dev/1Panel/agent/utils/compose"
"github.com/1Panel-dev/1Panel/agent/utils/env" "github.com/1Panel-dev/1Panel/agent/utils/env"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/cmd/server/nginx_conf" "github.com/1Panel-dev/1Panel/agent/cmd/server/nginx_conf"
"github.com/1Panel-dev/1Panel/agent/utils/cmd" "github.com/1Panel-dev/1Panel/agent/utils/cmd"
"github.com/1Panel-dev/1Panel/agent/utils/nginx" "github.com/1Panel-dev/1Panel/agent/utils/nginx"
@ -143,6 +143,7 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
var ( var (
appName string appName string
runtimeName string runtimeName string
appInstallID uint
) )
switch web.Type { switch web.Type {
case constant.Deployment: case constant.Deployment:
@ -151,12 +152,14 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
return 0, nil, err return 0, nil, err
} }
appName = appInstall.Name appName = appInstall.Name
appInstallID = appInstall.ID
case constant.Runtime: case constant.Runtime:
runtime, err := runtimeRepo.GetFirst(commonRepo.WithByID(web.RuntimeID)) runtime, err := runtimeRepo.GetFirst(commonRepo.WithByID(web.RuntimeID))
if err != nil { if err != nil {
return 0, nil, err return 0, nil, err
} }
runtimeName = runtime.Name runtimeName = runtime.Name
appInstallID = runtime.ID
} }
sitePath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", web.Alias) sitePath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", web.Alias)
@ -175,6 +178,7 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
SSLStatus: checkSSLStatus(web.WebsiteSSL.ExpireDate), SSLStatus: checkSSLStatus(web.WebsiteSSL.ExpireDate),
RuntimeName: runtimeName, RuntimeName: runtimeName,
SitePath: sitePath, SitePath: sitePath,
AppInstallID: appInstallID,
}) })
} }
return total, websiteDTOs, nil return total, websiteDTOs, nil
@ -263,10 +267,62 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
return err return err
} }
if create.CreateDb {
createDataBase := func(t *task.Task) error {
database, _ := databaseRepo.Get(commonRepo.WithByName(create.DbHost))
if database.ID == 0 {
return nil
}
dbConfig := create.DataBaseConfig
switch database.Type {
case constant.AppPostgresql, constant.AppPostgres:
iPostgresqlRepo := repo.NewIPostgresqlRepo()
oldPostgresqlDb, _ := iPostgresqlRepo.Get(commonRepo.WithByName(create.DbName), iPostgresqlRepo.WithByFrom(constant.ResourceLocal))
if oldPostgresqlDb.ID > 0 {
return buserr.New(constant.ErrDbUserNotValid)
}
var createPostgresql dto.PostgresqlDBCreate
createPostgresql.Name = dbConfig.DbName
createPostgresql.Username = dbConfig.DbUser
createPostgresql.Database = database.Name
createPostgresql.Format = dbConfig.DBFormat
createPostgresql.Password = dbConfig.DbPassword
createPostgresql.From = database.From
createPostgresql.SuperUser = true
pgDB, err := NewIPostgresqlService().Create(context.Background(), createPostgresql)
if err != nil {
return err
}
website.DbID = pgDB.ID
website.DbType = database.Type
case constant.AppMysql, constant.AppMariaDB:
iMysqlRepo := repo.NewIMysqlRepo()
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName), iMysqlRepo.WithByFrom(constant.ResourceLocal))
if oldMysqlDb.ID > 0 {
return buserr.New(constant.ErrDbUserNotValid)
}
var createMysql dto.MysqlDBCreate
createMysql.Name = dbConfig.DbName
createMysql.Username = dbConfig.DbUser
createMysql.Database = database.Name
createMysql.Format = dbConfig.DBFormat
createMysql.Permission = "%"
createMysql.Password = dbConfig.DbPassword
createMysql.From = database.From
mysqlDB, err := NewIMysqlService().Create(context.Background(), createMysql)
if err != nil {
return err
}
website.DbID = mysqlDB.ID
website.DbType = database.Type
}
return nil
}
createTask.AddSubTask(task.GetTaskName(create.DbName, task.TaskCreate, task.TaskScopeDatabase), createDataBase, nil)
}
var proxy string var proxy string
switch create.Type { switch create.Type {
case constant.Deployment: case constant.Deployment:
if create.AppType == constant.NewApp { if create.AppType == constant.NewApp {
var ( var (
@ -349,8 +405,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
} }
deleteFtpUser := func(t *task.Task) { deleteFtpUser := func(t *task.Task) {
if website.FtpID > 0 { if website.FtpID > 0 {
req := dto.BatchDeleteReq{Ids: []uint{website.FtpID}} if err = NewIFtpService().Delete(dto.BatchDeleteReq{Ids: []uint{website.FtpID}}); err != nil {
if err = NewIFtpService().Delete(req); err != nil {
createTask.Log(err.Error()) createTask.Log(err.Error())
} }
} }

View File

@ -18,6 +18,7 @@ func Init() {
migrations.InitDefaultCA, migrations.InitDefaultCA,
migrations.InitPHPExtensions, migrations.InitPHPExtensions,
migrations.AddTask, migrations.AddTask,
migrations.UpdateWebsite,
}) })
if err := m.Migrate(); err != nil { if err := m.Migrate(); err != nil {
global.LOG.Error(err) global.LOG.Error(err)

View File

@ -295,3 +295,11 @@ var AddTask = &gormigrate.Migration{
&model.Task{}) &model.Task{})
}, },
} }
var UpdateWebsite = &gormigrate.Migration{
ID: "20240803-update-website",
Migrate: func(tx *gorm.DB) error {
return tx.AutoMigrate(
&model.Website{})
},
}

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/1Panel-dev/1Panel/agent/global" "github.com/1Panel-dev/1Panel/agent/global"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package middleware package middleware
import ( import (
"github.com/1Panel-dev/1Panel/agent/app/api/v1/helper" "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/agent/app/repo" "github.com/1Panel-dev/1Panel/agent/app/repo"
"github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type AppRouter struct {
func (a *AppRouter) InitRouter(Router *gin.RouterGroup) { func (a *AppRouter) InitRouter(Router *gin.RouterGroup) {
appRouter := Router.Group("apps") appRouter := Router.Group("apps")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
appRouter.POST("/sync", baseApi.SyncApp) appRouter.POST("/sync", baseApi.SyncApp)
appRouter.GET("/checkupdate", baseApi.GetAppListUpdate) appRouter.GET("/checkupdate", baseApi.GetAppListUpdate)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -9,7 +9,7 @@ type ContainerRouter struct{}
func (s *ContainerRouter) InitRouter(Router *gin.RouterGroup) { func (s *ContainerRouter) InitRouter(Router *gin.RouterGroup) {
baRouter := Router.Group("containers") baRouter := Router.Group("containers")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
baRouter.GET("/exec", baseApi.ContainerWsSsh) baRouter.GET("/exec", baseApi.ContainerWsSsh)
baRouter.GET("/stats/:id", baseApi.ContainerStats) baRouter.GET("/stats/:id", baseApi.ContainerStats)

View File

@ -1,8 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +9,7 @@ type CronjobRouter struct{}
func (s *CronjobRouter) InitRouter(Router *gin.RouterGroup) { func (s *CronjobRouter) InitRouter(Router *gin.RouterGroup) {
cmdRouter := Router.Group("cronjobs") cmdRouter := Router.Group("cronjobs")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
cmdRouter.POST("", baseApi.CreateCronjob) cmdRouter.POST("", baseApi.CreateCronjob)
cmdRouter.POST("/del", baseApi.DeleteCronjob) cmdRouter.POST("/del", baseApi.DeleteCronjob)

View File

@ -1,8 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +9,7 @@ type DashboardRouter struct{}
func (s *DashboardRouter) InitRouter(Router *gin.RouterGroup) { func (s *DashboardRouter) InitRouter(Router *gin.RouterGroup) {
cmdRouter := Router.Group("dashboard") cmdRouter := Router.Group("dashboard")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
cmdRouter.GET("/base/os", baseApi.LoadDashboardOsInfo) cmdRouter.GET("/base/os", baseApi.LoadDashboardOsInfo)
cmdRouter.GET("/base/:ioOption/:netOption", baseApi.LoadDashboardBaseInfo) cmdRouter.GET("/base/:ioOption/:netOption", baseApi.LoadDashboardBaseInfo)

View File

@ -1,8 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +9,7 @@ type DatabaseRouter struct{}
func (s *DatabaseRouter) InitRouter(Router *gin.RouterGroup) { func (s *DatabaseRouter) InitRouter(Router *gin.RouterGroup) {
cmdRouter := Router.Group("databases") cmdRouter := Router.Group("databases")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
cmdRouter.POST("/common/info", baseApi.LoadDBBaseInfo) cmdRouter.POST("/common/info", baseApi.LoadDBBaseInfo)
cmdRouter.POST("/common/load/file", baseApi.LoadDBFile) cmdRouter.POST("/common/load/file", baseApi.LoadDBFile)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +10,7 @@ type FileRouter struct {
func (f *FileRouter) InitRouter(Router *gin.RouterGroup) { func (f *FileRouter) InitRouter(Router *gin.RouterGroup) {
fileRouter := Router.Group("files") fileRouter := Router.Group("files")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
fileRouter.POST("/search", baseApi.ListFiles) fileRouter.POST("/search", baseApi.ListFiles)
fileRouter.POST("/upload/search", baseApi.SearchUploadWithPage) fileRouter.POST("/upload/search", baseApi.SearchUploadWithPage)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type WebsiteGroupRouter struct {
func (a *WebsiteGroupRouter) InitRouter(Router *gin.RouterGroup) { func (a *WebsiteGroupRouter) InitRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("groups") groupRouter := Router.Group("groups")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
groupRouter.POST("", baseApi.CreateGroup) groupRouter.POST("", baseApi.CreateGroup)
groupRouter.POST("/del", baseApi.DeleteGroup) groupRouter.POST("/del", baseApi.DeleteGroup)

View File

@ -1,8 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +9,7 @@ type HostRouter struct{}
func (s *HostRouter) InitRouter(Router *gin.RouterGroup) { func (s *HostRouter) InitRouter(Router *gin.RouterGroup) {
hostRouter := Router.Group("hosts") hostRouter := Router.Group("hosts")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
hostRouter.POST("", baseApi.CreateHost) hostRouter.POST("", baseApi.CreateHost)
hostRouter.POST("/del", baseApi.DeleteHost) hostRouter.POST("/del", baseApi.DeleteHost)

View File

@ -1,8 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +9,7 @@ type LogRouter struct{}
func (s *LogRouter) InitRouter(Router *gin.RouterGroup) { func (s *LogRouter) InitRouter(Router *gin.RouterGroup) {
operationRouter := Router.Group("logs") operationRouter := Router.Group("logs")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
operationRouter.GET("/system/files", baseApi.GetSystemFiles) operationRouter.GET("/system/files", baseApi.GetSystemFiles)
operationRouter.POST("/system", baseApi.GetSystemLogs) operationRouter.POST("/system", baseApi.GetSystemLogs)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type NginxRouter struct {
func (a *NginxRouter) InitRouter(Router *gin.RouterGroup) { func (a *NginxRouter) InitRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("openresty") groupRouter := Router.Group("openresty")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
groupRouter.GET("", baseApi.GetNginx) groupRouter.GET("", baseApi.GetNginx)
groupRouter.POST("/scope", baseApi.GetNginxConfigByScope) groupRouter.POST("/scope", baseApi.GetNginxConfigByScope)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +10,7 @@ type ProcessRouter struct {
func (f *ProcessRouter) InitRouter(Router *gin.RouterGroup) { func (f *ProcessRouter) InitRouter(Router *gin.RouterGroup) {
processRouter := Router.Group("process") processRouter := Router.Group("process")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
processRouter.GET("/ws", baseApi.ProcessWs) processRouter.GET("/ws", baseApi.ProcessWs)
processRouter.POST("/stop", baseApi.StopProcess) processRouter.POST("/stop", baseApi.StopProcess)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type RuntimeRouter struct {
func (r *RuntimeRouter) InitRouter(Router *gin.RouterGroup) { func (r *RuntimeRouter) InitRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("runtimes") groupRouter := Router.Group("runtimes")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
groupRouter.GET("/installed/delete/check/:runTimeId", baseApi.DeleteRuntimeCheck) groupRouter.GET("/installed/delete/check/:runTimeId", baseApi.DeleteRuntimeCheck)
groupRouter.POST("/search", baseApi.SearchRuntimes) groupRouter.POST("/search", baseApi.SearchRuntimes)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -9,7 +9,7 @@ type SettingRouter struct{}
func (s *SettingRouter) InitRouter(Router *gin.RouterGroup) { func (s *SettingRouter) InitRouter(Router *gin.RouterGroup) {
settingRouter := Router.Group("settings") settingRouter := Router.Group("settings")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
settingRouter.POST("/search", baseApi.GetSettingInfo) settingRouter.POST("/search", baseApi.GetSettingInfo)
settingRouter.GET("/search/available", baseApi.GetSystemAvailable) settingRouter.GET("/search/available", baseApi.GetSystemAvailable)

View File

@ -1,8 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +9,7 @@ type TerminalRouter struct{}
func (s *TerminalRouter) InitRouter(Router *gin.RouterGroup) { func (s *TerminalRouter) InitRouter(Router *gin.RouterGroup) {
terminalRouter := Router.Group("terminals") terminalRouter := Router.Group("terminals")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
terminalRouter.GET("", baseApi.WsSsh) terminalRouter.GET("", baseApi.WsSsh)
} }

View File

@ -1,8 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +9,7 @@ type ToolboxRouter struct{}
func (s *ToolboxRouter) InitRouter(Router *gin.RouterGroup) { func (s *ToolboxRouter) InitRouter(Router *gin.RouterGroup) {
toolboxRouter := Router.Group("toolbox") toolboxRouter := Router.Group("toolbox")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
toolboxRouter.POST("/device/base", baseApi.LoadDeviceBaseInfo) toolboxRouter.POST("/device/base", baseApi.LoadDeviceBaseInfo)
toolboxRouter.GET("/device/zone/options", baseApi.LoadTimeOption) toolboxRouter.GET("/device/zone/options", baseApi.LoadTimeOption)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type WebsiteRouter struct {
func (a *WebsiteRouter) InitRouter(Router *gin.RouterGroup) { func (a *WebsiteRouter) InitRouter(Router *gin.RouterGroup) {
websiteRouter := Router.Group("websites") websiteRouter := Router.Group("websites")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
websiteRouter.POST("/search", baseApi.PageWebsite) websiteRouter.POST("/search", baseApi.PageWebsite)
websiteRouter.GET("/list", baseApi.GetWebsites) websiteRouter.GET("/list", baseApi.GetWebsites)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type WebsiteAcmeAccountRouter struct {
func (a *WebsiteAcmeAccountRouter) InitRouter(Router *gin.RouterGroup) { func (a *WebsiteAcmeAccountRouter) InitRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites/acme") groupRouter := Router.Group("websites/acme")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
groupRouter.POST("/search", baseApi.PageWebsiteAcmeAccount) groupRouter.POST("/search", baseApi.PageWebsiteAcmeAccount)
groupRouter.POST("", baseApi.CreateWebsiteAcmeAccount) groupRouter.POST("", baseApi.CreateWebsiteAcmeAccount)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type WebsiteCARouter struct {
func (a *WebsiteCARouter) InitRouter(Router *gin.RouterGroup) { func (a *WebsiteCARouter) InitRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites/ca") groupRouter := Router.Group("websites/ca")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
groupRouter.POST("/search", baseApi.PageWebsiteCA) groupRouter.POST("/search", baseApi.PageWebsiteCA)
groupRouter.POST("", baseApi.CreateWebsiteCA) groupRouter.POST("", baseApi.CreateWebsiteCA)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type WebsiteDnsAccountRouter struct {
func (a *WebsiteDnsAccountRouter) InitRouter(Router *gin.RouterGroup) { func (a *WebsiteDnsAccountRouter) InitRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites/dns") groupRouter := Router.Group("websites/dns")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
groupRouter.POST("/search", baseApi.PageWebsiteDnsAccount) groupRouter.POST("/search", baseApi.PageWebsiteDnsAccount)
groupRouter.POST("", baseApi.CreateWebsiteDnsAccount) groupRouter.POST("", baseApi.CreateWebsiteDnsAccount)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/agent/app/api/v1" v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,7 +11,7 @@ type WebsiteSSLRouter struct {
func (a *WebsiteSSLRouter) InitRouter(Router *gin.RouterGroup) { func (a *WebsiteSSLRouter) InitRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites/ssl") groupRouter := Router.Group("websites/ssl")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
groupRouter.POST("/search", baseApi.PageWebsiteSSL) groupRouter.POST("/search", baseApi.PageWebsiteSSL)
groupRouter.POST("", baseApi.CreateWebsiteSSL) groupRouter.POST("", baseApi.CreateWebsiteSSL)

View File

@ -3482,28 +3482,6 @@ const docTemplate = `{
] ]
} }
}, },
"/core/settings/basedir": {
"get": {
"description": "获取安装根目录",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
},
"security": [
{
"ApiKeyAuth": []
}
],
"summary": "Load local backup dir",
"tags": [
"System Setting"
]
}
},
"/core/settings/bind/update": { "/core/settings/bind/update": {
"post": { "post": {
"consumes": [ "consumes": [
@ -9083,7 +9061,7 @@ const docTemplate = `{
"ApiKeyAuth": [] "ApiKeyAuth": []
} }
], ],
"summary": "Clean monitor datas", "summary": "Clean monitor data",
"tags": [ "tags": [
"Monitor" "Monitor"
], ],
@ -9120,12 +9098,71 @@ const docTemplate = `{
"ApiKeyAuth": [] "ApiKeyAuth": []
} }
], ],
"summary": "Load monitor datas", "summary": "Load monitor data",
"tags": [ "tags": [
"Monitor" "Monitor"
] ]
} }
}, },
"/hosts/monitor/setting": {
"get": {
"description": "获取默认监控设置",
"responses": {
"200": {
"description": "OK"
}
},
"security": [
{
"ApiKeyAuth": []
}
],
"summary": "Load monitor setting",
"tags": [
"Monitor"
]
}
},
"/hosts/monitor/setting/update": {
"post": {
"description": "更新默认监控设置",
"parameters": [
{
"description": "request",
"in": "body",
"name": "request",
"required": true,
"schema": {
"$ref": "#/definitions/dto.MonitorSettingUpdate"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"security": [
{
"ApiKeyAuth": []
}
],
"summary": "Update monitor setting",
"tags": [
"Monitor"
],
"x-panel-log": {
"BeforeFunctions": [],
"bodyKeys": [
"key",
"value"
],
"formatEN": "update default monitor [name]-[value]",
"formatZH": "修改默认监控网卡 [name]-[value]",
"paramKeys": []
}
}
},
"/hosts/search": { "/hosts/search": {
"post": { "post": {
"consumes": [ "consumes": [
@ -17958,6 +17995,26 @@ const docTemplate = `{
], ],
"type": "object" "type": "object"
}, },
"dto.MonitorSettingUpdate": {
"properties": {
"key": {
"enum": [
"MonitorStatus",
"MonitorStoreDays",
"MonitorInterval",
"DefaultNetwork"
],
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"key"
],
"type": "object"
},
"dto.MysqlDBCreate": { "dto.MysqlDBCreate": {
"properties": { "properties": {
"database": { "database": {
@ -19938,6 +19995,12 @@ const docTemplate = `{
"createdAt": { "createdAt": {
"type": "string" "type": "string"
}, },
"dbID": {
"type": "integer"
},
"dbType": {
"type": "string"
},
"defaultServer": { "defaultServer": {
"type": "boolean" "type": "boolean"
}, },
@ -20297,6 +20360,9 @@ const docTemplate = `{
"deleteDB": { "deleteDB": {
"type": "boolean" "type": "boolean"
}, },
"deleteImage": {
"type": "boolean"
},
"detailId": { "detailId": {
"type": "integer" "type": "integer"
}, },
@ -21788,6 +21854,24 @@ const docTemplate = `{
], ],
"type": "string" "type": "string"
}, },
"createDb": {
"type": "boolean"
},
"dbFormat": {
"type": "string"
},
"dbHost": {
"type": "string"
},
"dbName": {
"type": "string"
},
"dbPassword": {
"type": "string"
},
"dbUser": {
"type": "string"
},
"ftpPassword": { "ftpPassword": {
"type": "string" "type": "string"
}, },
@ -23081,6 +23165,12 @@ const docTemplate = `{
"createdAt": { "createdAt": {
"type": "string" "type": "string"
}, },
"dbID": {
"type": "integer"
},
"dbType": {
"type": "string"
},
"defaultServer": { "defaultServer": {
"type": "boolean" "type": "boolean"
}, },

View File

@ -1403,6 +1403,16 @@
"formatZH": "清空监控数据", "formatZH": "清空监控数据",
"paramKeys": [] "paramKeys": []
}, },
"/hosts/monitor/setting/update": {
"BeforeFunctions": [],
"bodyKeys": [
"key",
"value"
],
"formatEN": "update default monitor [name]-[value]",
"formatZH": "修改默认监控网卡 [name]-[value]",
"paramKeys": []
},
"/hosts/update": { "/hosts/update": {
"BeforeFunctions": [], "BeforeFunctions": [],
"bodyKeys": [ "bodyKeys": [

View File

@ -1,9 +1,9 @@
package v1 package v2
import ( import (
"encoding/base64" "encoding/base64"
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/dto" "github.com/1Panel-dev/1Panel/core/app/dto"
"github.com/1Panel-dev/1Panel/core/app/model" "github.com/1Panel-dev/1Panel/core/app/model"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"

View File

@ -1,4 +1,4 @@
package v1 package v2
import "github.com/1Panel-dev/1Panel/core/app/service" import "github.com/1Panel-dev/1Panel/core/app/service"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/dto" "github.com/1Panel-dev/1Panel/core/app/dto"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -1,4 +1,4 @@
package v1 package v2
import ( import (
"encoding/base64" "encoding/base64"
@ -6,7 +6,7 @@ import (
"os" "os"
"path" "path"
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/dto" "github.com/1Panel-dev/1Panel/core/app/dto"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/global" "github.com/1Panel-dev/1Panel/core/global"

View File

@ -1,7 +1,7 @@
package v1 package v2
import ( import (
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/dto" "github.com/1Panel-dev/1Panel/core/app/dto"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"strings" "strings"
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/repo" "github.com/1Panel-dev/1Panel/core/app/repo"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -5,7 +5,7 @@ import (
"net" "net"
"strings" "strings"
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/repo" "github.com/1Panel-dev/1Panel/core/app/repo"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/global" "github.com/1Panel-dev/1Panel/core/global"

View File

@ -3,7 +3,7 @@ package middleware
import ( import (
"strings" "strings"
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
jwtUtils "github.com/1Panel-dev/1Panel/core/utils/jwt" jwtUtils "github.com/1Panel-dev/1Panel/core/utils/jwt"

View File

@ -1,7 +1,7 @@
package middleware package middleware
import ( import (
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/repo" "github.com/1Panel-dev/1Panel/core/app/repo"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -5,7 +5,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/repo" "github.com/1Panel-dev/1Panel/core/app/repo"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/utils/common" "github.com/1Panel-dev/1Panel/core/utils/common"

View File

@ -8,7 +8,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/utils/xpack" "github.com/1Panel-dev/1Panel/core/utils/xpack"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@ -4,7 +4,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/1Panel-dev/1Panel/core/app/api/v1/helper" "github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
"github.com/1Panel-dev/1Panel/core/app/repo" "github.com/1Panel-dev/1Panel/core/app/repo"
"github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/constant"
"github.com/1Panel-dev/1Panel/core/global" "github.com/1Panel-dev/1Panel/core/global"

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/core/app/api/v1" v2 "github.com/1Panel-dev/1Panel/core/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -9,7 +9,7 @@ type BaseRouter struct{}
func (s *BaseRouter) InitRouter(Router *gin.RouterGroup) { func (s *BaseRouter) InitRouter(Router *gin.RouterGroup) {
baseRouter := Router.Group("auth") baseRouter := Router.Group("auth")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
baseRouter.GET("/captcha", baseApi.Captcha) baseRouter.GET("/captcha", baseApi.Captcha)
baseRouter.POST("/mfalogin", baseApi.MFALogin) baseRouter.POST("/mfalogin", baseApi.MFALogin)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/core/app/api/v1" v2 "github.com/1Panel-dev/1Panel/core/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,7 +10,7 @@ type LogRouter struct{}
func (s *LogRouter) InitRouter(Router *gin.RouterGroup) { func (s *LogRouter) InitRouter(Router *gin.RouterGroup) {
operationRouter := Router.Group("logs") operationRouter := Router.Group("logs")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
operationRouter.POST("/login", baseApi.GetLoginLogs) operationRouter.POST("/login", baseApi.GetLoginLogs)
operationRouter.POST("/operation", baseApi.GetOperationLogs) operationRouter.POST("/operation", baseApi.GetOperationLogs)

View File

@ -1,7 +1,7 @@
package router package router
import ( import (
v1 "github.com/1Panel-dev/1Panel/core/app/api/v1" v2 "github.com/1Panel-dev/1Panel/core/app/api/v2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -9,7 +9,7 @@ type SettingRouter struct{}
func (s *SettingRouter) InitRouter(Router *gin.RouterGroup) { func (s *SettingRouter) InitRouter(Router *gin.RouterGroup) {
settingRouter := Router.Group("settings") settingRouter := Router.Group("settings")
baseApi := v1.ApiGroupApp.BaseApi baseApi := v2.ApiGroupApp.BaseApi
{ {
settingRouter.POST("/search", baseApi.GetSettingInfo) settingRouter.POST("/search", baseApi.GetSettingInfo)
settingRouter.POST("/expired/handle", baseApi.HandlePasswordExpired) settingRouter.POST("/expired/handle", baseApi.HandlePasswordExpired)

View File

@ -2127,6 +2127,7 @@ const message = {
sni: 'Origin SNI', sni: 'Origin SNI',
sniHelper: sniHelper:
"When the reverse proxy backend is HTTPS, you might need to set the origin SNI. Please refer to the CDN service provider's documentation for details.", "When the reverse proxy backend is HTTPS, you might need to set the origin SNI. Please refer to the CDN service provider's documentation for details.",
createDb: 'Create Database',
}, },
php: { php: {
short_open_tag: 'Short tag support', short_open_tag: 'Short tag support',

View File

@ -1977,6 +1977,7 @@ const message = {
website404Helper: '網站 404 錯誤頁僅支援 PHP 運行環境網站和靜態網站', website404Helper: '網站 404 錯誤頁僅支援 PHP 運行環境網站和靜態網站',
sni: '回源 SNI', sni: '回源 SNI',
sniHelper: '反代後端為 https 的時候可能需要設置回源 SNI具體需要看 CDN 服務商文檔', sniHelper: '反代後端為 https 的時候可能需要設置回源 SNI具體需要看 CDN 服務商文檔',
createDb: '建立資料庫',
}, },
php: { php: {
short_open_tag: '短標簽支持', short_open_tag: '短標簽支持',

View File

@ -1979,6 +1979,7 @@ const message = {
website404Helper: '网站 404 错误页仅支持 PHP 运行环境网站和静态网站', website404Helper: '网站 404 错误页仅支持 PHP 运行环境网站和静态网站',
sni: '回源 SNI', sni: '回源 SNI',
sniHelper: '反代后端为 https 的时候可能需要设置回源 SNI具体需要看 CDN 服务商文档', sniHelper: '反代后端为 https 的时候可能需要设置回源 SNI具体需要看 CDN 服务商文档',
createDb: '创建数据库',
}, },
php: { php: {
short_open_tag: '短标签支持', short_open_tag: '短标签支持',

View File

@ -349,6 +349,72 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item prop="createDb" v-if="website.type === 'runtime'">
<el-checkbox
@change="random"
v-model="website.createDb"
:label="$t('website.createDb')"
size="large"
/>
</el-form-item>
<el-row :gutter="20" v-if="website.type === 'runtime' && website.createDb">
<el-col :span="24">
<el-form-item :label="$t('database.database')" prop="dbHost">
<el-row :gutter="20">
<el-col :span="12">
<el-select
v-model="website.dbType"
class="p-w-200"
@change="getAppByService(website.dbType)"
>
<el-option label="MySQL" value="mysql" />
<el-option label="MariaDB" value="mariadb" />
<el-option label="PostgreSQL" value="postgresql" />
</el-select>
</el-col>
<el-col :span="12">
<el-select v-model="website.dbHost" class="p-w-200">
<el-option
v-for="(service, index) in dbServices"
:key="index"
:label="service.label"
:value="service.value"
></el-option>
</el-select>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label="$t('commons.table.name')" prop="dbName">
<el-input clearable v-model.trim="website.dbName" @input="website.dbUser = website.dbName">
<template #append>
<el-select v-model="website.dbFormat" class="p-w-100">
<el-option label="utf8mb4" value="utf8mb4" />
<el-option label="utf-8" value="utf8" />
<el-option label="gbk" value="gbk" />
<el-option label="big5" value="big5" />
</el-select>
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('commons.login.username')" prop="dbUser">
<el-input clearable v-model.trim="website.dbUser" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('commons.login.password')" prop="dbPassword">
<el-input type="dbPassword" clearable show-password v-model.trim="website.dbPassword">
<template #append>
<el-button @click="randomDbPassword">{{ $t('commons.button.random') }}</el-button>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item :label="$t('website.remark')" prop="remark"> <el-form-item :label="$t('website.remark')" prop="remark">
<el-input type="textarea" :rows="3" clearable v-model="website.remark" /> <el-input type="textarea" :rows="3" clearable v-model="website.remark" />
</el-form-item> </el-form-item>
@ -389,6 +455,7 @@ import { SearchRuntimes } from '@/api/modules/runtime';
import { Runtime } from '@/api/interface/runtime'; import { Runtime } from '@/api/interface/runtime';
import { getRandomStr } from '@/utils/util'; import { getRandomStr } from '@/utils/util';
import TaskLog from '@/components/task-log/index.vue'; import TaskLog from '@/components/task-log/index.vue';
import { GetAppService } from '@/api/modules/app';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
const websiteForm = ref<FormInstance>(); const websiteForm = ref<FormInstance>();
@ -428,6 +495,13 @@ const website = ref({
proxyAddress: '', proxyAddress: '',
runtimeType: 'php', runtimeType: 'php',
taskID: '', taskID: '',
createDb: false,
dbName: '',
dbPassword: '',
dbFormat: 'utf8mb4',
dbUser: '',
dbType: 'mysql',
dbHost: '',
}); });
const rules = ref<any>({ const rules = ref<any>({
primaryDomain: [Rules.domainWithPort], primaryDomain: [Rules.domainWithPort],
@ -451,6 +525,10 @@ const rules = ref<any>({
proxyType: [Rules.requiredSelect], proxyType: [Rules.requiredSelect],
port: [Rules.port], port: [Rules.port],
runtimeType: [Rules.requiredInput], runtimeType: [Rules.requiredInput],
dbName: [Rules.requiredInput, Rules.dbName],
dbUser: [Rules.requiredInput, Rules.name],
dbPassword: [Rules.requiredInput, Rules.paramComplexity],
dbHost: [Rules.requiredSelect],
}); });
const open = ref(false); const open = ref(false);
@ -480,6 +558,7 @@ const runtimes = ref<Runtime.RuntimeDTO[]>([]);
const versionExist = ref(true); const versionExist = ref(true);
const em = defineEmits(['close']); const em = defineEmits(['close']);
const taskLog = ref(); const taskLog = ref();
const dbServices = ref();
const handleClose = () => { const handleClose = () => {
open.value = false; open.value = false;
@ -490,6 +569,10 @@ const random = async () => {
website.value.ftpPassword = getRandomStr(16); website.value.ftpPassword = getRandomStr(16);
}; };
const randomDbPassword = async () => {
website.value.dbPassword = getRandomStr(16);
};
const changeType = (type: string) => { const changeType = (type: string) => {
switch (type) { switch (type) {
case 'deployment': case 'deployment':
@ -500,6 +583,7 @@ const changeType = (type: string) => {
break; break;
case 'runtime': case 'runtime':
getRuntimes(); getRuntimes();
getAppByService(website.value.dbType);
break; break;
case 'proxy': case 'proxy':
website.value.proxyAddress = ''; website.value.proxyAddress = '';
@ -523,6 +607,11 @@ const searchAppInstalled = (appType: string) => {
}); });
}; };
const getAppByService = async (key: string) => {
const res = await GetAppService(key);
dbServices.value = res.data;
};
const changeInstall = () => { const changeInstall = () => {
appInstalls.value.forEach((app) => { appInstalls.value.forEach((app) => {
if (app.id === website.value.appInstallId) { if (app.id === website.value.appInstallId) {