feat: 修改main路径,增加打包静态资源

pull/32/head
zhengkunwang223 2 years ago committed by zhengkunwang223
parent 5f5a48041b
commit 115b75c1cb

6
.gitignore vendored

@ -5,6 +5,12 @@
*.so
*.dylib
.idea
cmd/server/web/assets/
cmd/server/web/monacoeditorwork
cmd/server/web/favicon.ico
cmd/server/web/index.html
build
# Test binary, built with `go test -c`
*.test

@ -0,0 +1,22 @@
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOARCH=$(shell go env GOARCH)
GOOS=$(shell go env GOOS )
BASE_PAH := $(shell pwd)
BUILD_PATH = $(BASE_PAH)/build
WEB_PATH=$(BASE_PAH)/frontend
SERVER_PATH=$(BASE_PAH)/backend
MAIN= $(BASE_PAH)/cmd/server/main.go
APP_NAME=1panel
build_web:
cd $(WEB_PATH) && npm install && npm run build:dev
build_bin:
cd $(SERVER_PATH) \
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags "-s -w" -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
build_all: build_web build_bin

@ -1,4 +1,4 @@
{
"version": "0.0.1",
"version": "0.0.3",
"package": ""
}

@ -1,5 +1,5 @@
{
"version": "0.1",
"version": "0.0.2",
"tags": [
{
"key": "WebSite",
@ -56,6 +56,20 @@
"limit": 0,
"crossVersionUpdate": true,
"source": "http://wordpress.org/"
},
{
"key": "redis",
"name": "redis",
"tags": ["Datastore"],
"versions": ["7.0.5","6.0.16"],
"short_desc": "缓存数据库",
"icon": "redis.png",
"author": "Salvatore Sanfilippo",
"type": "runtime",
"required": [""],
"limit": 0,
"crossVersionUpdate": true,
"source": "https://redis.io/"
}
]
}

@ -20,3 +20,7 @@ services:
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
networks:
1panel:
external: true

@ -3,6 +3,8 @@ services:
container_name: ${CONTAINER_NAME}
image: nginx:1.23.1
restart: always
networks:
- 1panel
ports:
- ${PANEL_APP_PORT_HTTP}:80
- ${PANEL_APP_PORT_HTTPS}:443
@ -12,3 +14,7 @@ services:
- ./log:/var/log/nginx
- ./conf/conf.d:/etc/nginx/conf.d/
- ./html:/usr/share/nginx/html
networks:
1panel:
external: true

@ -0,0 +1,20 @@
{
"formFields": [
{
"type": "text",
"labelZh": "密码",
"labelEn": "Password",
"required": true,
"default": "eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81",
"envKey": "PANEL_DB_ROOT_PASSWORD"
},
{
"type": "number",
"labelZh": "端口",
"labelEn": "Port",
"required": true,
"default": 6379,
"envKey": "PANEL_APP_PORT_HTTP"
}
]
}

@ -0,0 +1,15 @@
version: '3'
services:
redis-6.0.16:
image: redis:6.0.16
restart: always
networks:
- 1panel
ports:
- ${PANEL_APP_PORT_HTTP}:6379
command: redis-server --save 20 1 --loglevel warning --requirepass eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81
volumes:
- ./data:/data
networks:
1panel:
external: true

@ -0,0 +1,20 @@
{
"formFields": [
{
"type": "text",
"labelZh": "密码",
"labelEn": "Password",
"required": true,
"default": "eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81",
"envKey": "PANEL_DB_ROOT_PASSWORD"
},
{
"type": "number",
"labelZh": "端口",
"labelEn": "Port",
"required": true,
"default": 6379,
"envKey": "PANEL_APP_PORT_HTTP"
}
]
}

@ -0,0 +1,15 @@
version: '3'
services:
redis-7.0.5:
image: redis:7.0.5
restart: always
networks:
- 1panel
ports:
- ${PANEL_APP_PORT_HTTP}:6379
command: redis-server --save 20 1 --loglevel warning --requirepass eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81
volumes:
- ./data:/data
networks:
1panel:
external: true

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

@ -3,12 +3,12 @@ package v1
import (
"errors"
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/captcha"
"github.com/1Panel-dev/1Panel/utils/encrypt"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/captcha"
"github.com/1Panel-dev/1Panel/backend/utils/encrypt"
"github.com/gin-gonic/gin"
)

@ -1,10 +1,10 @@
package v1
import (
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
)

@ -1,10 +1,10 @@
package v1
import (
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
)

@ -4,10 +4,10 @@ import (
"os"
"time"
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
)

@ -1,6 +1,6 @@
package v1
import "github.com/1Panel-dev/1Panel/app/service"
import "github.com/1Panel-dev/1Panel/backend/app/service"
type ApiGroup struct {
BaseApi

@ -2,11 +2,11 @@ package v1
import (
"fmt"
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
websocket2 "github.com/1Panel-dev/1Panel/utils/websocket"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
websocket2 "github.com/1Panel-dev/1Panel/backend/utils/websocket"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"net/http"

@ -1,10 +1,10 @@
package v1
import (
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
)

@ -6,9 +6,9 @@ import (
"github.com/pkg/errors"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/i18n"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/i18n"
"github.com/gin-gonic/gin"
)

@ -1,12 +1,12 @@
package v1
import (
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/copier"
"github.com/1Panel-dev/1Panel/utils/ssh"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/copier"
"github.com/1Panel-dev/1Panel/backend/utils/ssh"
"github.com/gin-gonic/gin"
)

@ -3,11 +3,11 @@ package v1
import (
"time"
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
"github.com/shirou/gopsutil/net"
)

@ -1,10 +1,10 @@
package v1
import (
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
)

@ -3,12 +3,12 @@ package v1
import (
"errors"
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/mfa"
"github.com/1Panel-dev/1Panel/utils/ntp"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/mfa"
"github.com/1Panel-dev/1Panel/backend/utils/ntp"
"github.com/gin-gonic/gin"
)

@ -5,12 +5,12 @@ import (
"strconv"
"time"
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/copier"
"github.com/1Panel-dev/1Panel/utils/ssh"
"github.com/1Panel-dev/1Panel/utils/terminal"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/copier"
"github.com/1Panel-dev/1Panel/backend/utils/ssh"
"github.com/1Panel-dev/1Panel/backend/utils/terminal"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"github.com/pkg/errors"

@ -2,7 +2,7 @@ package dto
import (
"encoding/json"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/backend/app/model"
)
type AppRes struct {

@ -1,7 +1,7 @@
package dto
import (
"github.com/1Panel-dev/1Panel/utils/files"
"github.com/1Panel-dev/1Panel/backend/utils/files"
)
type FileOption struct {

@ -1,7 +1,7 @@
package model
import (
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/constant"
"path"
)

@ -7,4 +7,5 @@ type AppInstallBackup struct {
Param string `gorm:"type:longtext;" json:"param"`
AppDetailId uint `gorm:"type:integer;not null" json:"app_detail_id"`
AppInstallId uint `gorm:"type:integer;not null" json:"app_install_id"`
AppDetail AppDetail `json:"-"`
}

@ -2,7 +2,7 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/backend/app/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)

@ -2,7 +2,7 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/backend/app/model"
"gorm.io/gorm"
)

@ -2,7 +2,7 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/backend/app/model"
"gorm.io/gorm"
)

@ -2,7 +2,7 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/backend/app/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
@ -20,12 +20,13 @@ func (a AppInstallBackupRepo) Create(ctx context.Context, backup model.AppInstal
return getTx(ctx).Omit(clause.Associations).Create(&backup).Error
}
func (a AppInstallBackupRepo) Delete(opts ...DBOption) error {
return getDb(opts...).Omit(clause.Associations).Delete(&model.AppInstallBackup{}).Error
func (a AppInstallBackupRepo) Delete(ctx context.Context, opts ...DBOption) error {
return getTx(ctx, opts...).Omit(clause.Associations).Delete(&model.AppInstallBackup{}).Error
}
func (a AppInstallBackupRepo) GetBy(opts ...DBOption) ([]model.AppInstallBackup, error) {
var backups []model.AppInstallBackup
if err := getDb(opts...).Find(&backups); err != nil {
if err := getDb(opts...).Preload("AppDetail").Find(&backups); err != nil {
return backups, nil
}
return backups, nil
@ -34,7 +35,7 @@ func (a AppInstallBackupRepo) GetBy(opts ...DBOption) ([]model.AppInstallBackup,
func (a AppInstallBackupRepo) GetFirst(opts ...DBOption) (model.AppInstallBackup, error) {
var backup model.AppInstallBackup
db := getDb(opts...).Model(&model.AppInstallBackup{})
err := db.First(&backup).Error
err := db.Preload("AppDetail").First(&backup).Error
return backup, err
}
@ -43,6 +44,6 @@ func (a AppInstallBackupRepo) Page(page, size int, opts ...DBOption) (int64, []m
db := getDb(opts...).Model(&model.AppInstallBackup{})
count := int64(0)
db = db.Count(&count)
err := db.Debug().Limit(size).Offset(size * (page - 1)).Find(&backups).Error
err := db.Limit(size).Offset(size * (page - 1)).Preload("AppDetail").Find(&backups).Error
return count, backups, err
}

@ -2,8 +2,8 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -2,8 +2,8 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -1,8 +1,8 @@
package repo
import (
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
)
type BackupRepo struct{}

@ -1,8 +1,8 @@
package repo
import (
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -2,7 +2,7 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -3,9 +3,9 @@ package repo
import (
"time"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -2,8 +2,8 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -1,8 +1,8 @@
package repo
import (
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -1,8 +1,8 @@
package repo
import (
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -1,8 +1,8 @@
package repo
import (
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
)
type OperationRepo struct{}

@ -1,8 +1,8 @@
package repo
import (
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -2,8 +2,8 @@ package repo
import (
"context"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -5,15 +5,15 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/app/repo"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/common"
"github.com/1Panel-dev/1Panel/utils/compose"
"github.com/1Panel-dev/1Panel/utils/docker"
"github.com/1Panel-dev/1Panel/utils/files"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/app/repo"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/common"
"github.com/1Panel-dev/1Panel/backend/utils/compose"
"github.com/1Panel-dev/1Panel/backend/utils/docker"
"github.com/1Panel-dev/1Panel/backend/utils/files"
"golang.org/x/net/context"
"gopkg.in/yaml.v3"
"os"
@ -175,35 +175,9 @@ func (a AppService) OperateInstall(req dto.AppInstallOperate) error {
}
install.Status = constant.Running
case dto.Delete:
op := files.NewFileOp()
appDir := install.GetPath()
dir, _ := os.Stat(appDir)
if dir != nil {
out, err := compose.Down(dockerComposePath)
if err != nil {
return handleErr(install, err, out)
}
if err := op.DeleteDir(appDir); err != nil {
return err
}
}
tx, ctx := getTxAndContext()
if err := appInstallRepo.Delete(ctx, install); err != nil {
tx.Rollback()
return err
}
if err := deleteLink(ctx, &install); err != nil {
tx.Rollback()
return err
}
tx.Commit()
return nil
return deleteAppInstall(install)
case dto.Sync:
if err := a.SyncInstalled(install.ID); err != nil {
return err
}
return nil
return a.SyncInstalled(install.ID)
case dto.Backup:
tx, ctx := getTxAndContext()
if err := backupInstall(ctx, install); err != nil {
@ -213,11 +187,7 @@ func (a AppService) OperateInstall(req dto.AppInstallOperate) error {
tx.Commit()
return nil
case dto.Restore:
installBackup, err := appInstallBackupRepo.GetFirst(commonRepo.WithByID(req.BackupId))
if err != nil {
return err
}
return restoreInstall(install, installBackup)
return restoreInstall(install, req.BackupId)
case dto.Update:
return updateInstall(install.ID, req.DetailId)
default:
@ -344,7 +314,7 @@ func (a AppService) DeleteBackup(req dto.AppBackupDeleteRequest) error {
errStr.WriteString(err.Error())
continue
}
if err := appInstallBackupRepo.Delete(commonRepo.WithIdsIn(req.Ids)); err != nil {
if err := appInstallBackupRepo.Delete(nil, commonRepo.WithIdsIn(req.Ids)); err != nil {
errStr.WriteString(err.Error())
}
}

@ -4,14 +4,14 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/cmd"
"github.com/1Panel-dev/1Panel/utils/common"
"github.com/1Panel-dev/1Panel/utils/compose"
"github.com/1Panel-dev/1Panel/utils/files"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
"github.com/1Panel-dev/1Panel/backend/utils/common"
"github.com/1Panel-dev/1Panel/backend/utils/compose"
"github.com/1Panel-dev/1Panel/backend/utils/files"
"github.com/joho/godotenv"
"github.com/pkg/errors"
"gopkg.in/yaml.v3"
@ -140,6 +140,37 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
return nil
}
func deleteAppInstall(install model.AppInstall) error {
op := files.NewFileOp()
appDir := install.GetPath()
dir, _ := os.Stat(appDir)
if dir != nil {
out, err := compose.Down(install.GetComposePath())
if err != nil {
return handleErr(install, err, out)
}
if err := op.DeleteDir(appDir); err != nil {
return err
}
}
tx, ctx := getTxAndContext()
if err := appInstallRepo.Delete(ctx, install); err != nil {
tx.Rollback()
return err
}
if err := deleteLink(ctx, &install); err != nil {
tx.Rollback()
return err
}
if err := appInstallBackupRepo.Delete(ctx, appInstallBackupRepo.WithAppInstallID(install.ID)); err != nil {
tx.Rollback()
return err
}
tx.Commit()
return nil
}
func deleteLink(ctx context.Context, install *model.AppInstall) error {
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithAppInstallId(install.ID))
if len(resources) == 0 {
@ -171,12 +202,20 @@ func updateInstall(installId uint, detailId uint) error {
if err != nil {
return err
}
oldDetail, err := appDetailRepo.GetFirst(commonRepo.WithByID(install.AppDetailId))
if err != nil {
return err
}
detail, err := appDetailRepo.GetFirst(commonRepo.WithByID(detailId))
if err != nil {
return err
}
if oldDetail.LastVersion == detail.Version {
install.CanUpdate = false
}
if install.Version == detail.Version {
return errors.New("two version is save")
return errors.New("two version is same")
}
tx, ctx := getTxAndContext()
if err := backupInstall(ctx, install); err != nil {
@ -188,6 +227,7 @@ func updateInstall(installId uint, detailId uint) error {
}
install.DockerCompose = detail.DockerCompose
install.Version = detail.Version
fileOp := files.NewFileOp()
if err := fileOp.WriteFile(install.GetComposePath(), strings.NewReader(install.DockerCompose), 0775); err != nil {
return err
@ -221,7 +261,11 @@ func backupInstall(ctx context.Context, install model.AppInstall) error {
return nil
}
func restoreInstall(install model.AppInstall, backup model.AppInstallBackup) error {
func restoreInstall(install model.AppInstall, backupId uint) error {
backup, err := appInstallBackupRepo.GetFirst(commonRepo.WithByID(backupId))
if err != nil {
return err
}
if _, err := compose.Down(install.GetComposePath()); err != nil {
return err
}
@ -284,6 +328,7 @@ func restoreInstall(install model.AppInstall, backup model.AppInstallBackup) err
return handleErr(install, err, out)
}
install.AppDetailId = backup.AppDetailId
install.Version = backup.AppDetail.Version
install.Status = constant.Running
return appInstallRepo.Save(&install)
}

@ -3,11 +3,11 @@ package service
import (
"strconv"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/encrypt"
"github.com/1Panel-dev/1Panel/utils/jwt"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/encrypt"
"github.com/1Panel-dev/1Panel/backend/utils/jwt"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
uuid "github.com/satori/go.uuid"

@ -3,10 +3,10 @@ package service
import (
"encoding/json"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/utils/cloud_storage"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/utils/cloud_storage"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
)

@ -1,9 +1,9 @@
package service
import (
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
)

@ -8,11 +8,11 @@ import (
"strings"
"time"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/cloud_storage"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/cloud_storage"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/robfig/cron/v3"

@ -11,10 +11,10 @@ import (
"strings"
"time"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/cloud_storage"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/cloud_storage"
"github.com/pkg/errors"
"github.com/robfig/cron/v3"
)

@ -1,6 +1,6 @@
package service
import "github.com/1Panel-dev/1Panel/app/repo"
import "github.com/1Panel-dev/1Panel/backend/app/repo"
type ServiceGroup struct {
AuthService

@ -2,10 +2,10 @@ package service
import (
"fmt"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/common"
"github.com/1Panel-dev/1Panel/utils/files"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/common"
"github.com/1Panel-dev/1Panel/backend/utils/files"
"github.com/pkg/errors"
uuid "github.com/satori/go.uuid"
"io/fs"

@ -1,8 +1,8 @@
package service
import (
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
)

@ -2,7 +2,7 @@ package service
import (
"context"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/gorm"
)

@ -3,9 +3,9 @@ package service
import (
"fmt"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
)

@ -3,10 +3,10 @@ package service
import (
"encoding/json"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
)

@ -5,10 +5,10 @@ import (
"strconv"
"time"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/utils/encrypt"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/encrypt"
"github.com/gin-gonic/gin"
)

@ -3,11 +3,11 @@ package cron
import (
"time"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/app/service"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/cron/job"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/app/service"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/cron/job"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/robfig/cron/v3"
)

@ -4,9 +4,9 @@ import (
"strconv"
"time"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/app/repo"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/app/repo"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/load"

@ -1,9 +1,9 @@
package global
import (
"github.com/1Panel-dev/1Panel/configs"
"github.com/1Panel-dev/1Panel/init/cache/badger_db"
"github.com/1Panel-dev/1Panel/init/session/psession"
"github.com/1Panel-dev/1Panel/backend/configs"
"github.com/1Panel-dev/1Panel/backend/init/cache/badger_db"
"github.com/1Panel-dev/1Panel/backend/init/session/psession"
"github.com/go-playground/validator/v10"
"github.com/robfig/cron/v3"
"github.com/sirupsen/logrus"

@ -1,8 +1,8 @@
package cache
import (
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/init/cache/badger_db"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/init/cache/badger_db"
"github.com/dgraph-io/badger/v3"
"time"
)

@ -1,6 +1,6 @@
package db
import "github.com/1Panel-dev/1Panel/global"
import "github.com/1Panel-dev/1Panel/backend/global"
func Init() {
switch global.CONF.System.DbType {

@ -1,7 +1,7 @@
package db
import (
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/driver/mysql"
"gorm.io/gorm"

@ -1,7 +1,7 @@
package db
import (
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/driver/sqlite"
"gorm.io/gorm"

@ -6,8 +6,8 @@ import (
"strings"
"time"
"github.com/1Panel-dev/1Panel/configs"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/configs"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/natefinch/lumberjack"
"github.com/sirupsen/logrus"
@ -45,7 +45,7 @@ func (s *MineFormatter) Format(entry *logrus.Entry) ([]byte, error) {
var cstSh, _ = time.LoadLocation(global.CONF.LogConfig.TimeZone)
detailInfo := ""
if entry.Caller != nil {
funcion := strings.ReplaceAll(entry.Caller.Function, "github.com/1Panel-dev/1Panel/", "")
funcion := strings.ReplaceAll(entry.Caller.Function, "github.com/1Panel-dev/1Panel/backend/", "")
detailInfo = fmt.Sprintf("(%s: %d)", funcion, entry.Caller.Line)
}
if len(entry.Data) == 0 {

@ -1,8 +1,8 @@
package migration
import (
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/init/migration/migrations"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/init/migration/migrations"
"github.com/go-gormigrate/gormigrate/v2"
)

@ -3,7 +3,7 @@ package migrations
import (
"time"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"

@ -1,17 +1,16 @@
package router
import (
"html/template"
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/docs"
"github.com/1Panel-dev/1Panel/i18n"
"github.com/1Panel-dev/1Panel/middleware"
rou "github.com/1Panel-dev/1Panel/router"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/docs"
"github.com/1Panel-dev/1Panel/backend/i18n"
"github.com/1Panel-dev/1Panel/backend/middleware"
rou "github.com/1Panel-dev/1Panel/backend/router"
ginI18n "github.com/gin-contrib/i18n"
"github.com/gin-gonic/gin"
swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"html/template"
)
func Routers() *gin.Engine {

@ -2,7 +2,7 @@ package psession
import (
"encoding/json"
"github.com/1Panel-dev/1Panel/init/cache/badger_db"
"github.com/1Panel-dev/1Panel/backend/init/cache/badger_db"
"time"
)

@ -1,8 +1,8 @@
package session
import (
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/init/session/psession"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/init/session/psession"
)
func Init() {

@ -4,7 +4,7 @@ import (
"regexp"
"unicode"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/go-playground/validator/v10"
)

@ -2,9 +2,9 @@ package viper
import (
"fmt"
"github.com/1Panel-dev/1Panel/configs"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/configs"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"path"
"github.com/fsnotify/fsnotify"

@ -1,7 +0,0 @@
package main
import "github.com/1Panel-dev/1Panel/server"
func main() {
server.Start()
}

@ -3,8 +3,8 @@ package middleware
import (
"net/http"
"github.com/1Panel-dev/1Panel/configs"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/configs"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
)

@ -3,7 +3,7 @@ package middleware
import (
"net/http"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
"github.com/gorilla/csrf"
adapter "github.com/gwatts/gin-adapter"

@ -4,11 +4,11 @@ import (
"strconv"
"time"
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/repo"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
jwtUtils "github.com/1Panel-dev/1Panel/utils/jwt"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/repo"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
jwtUtils "github.com/1Panel-dev/1Panel/backend/utils/jwt"
"github.com/golang-jwt/jwt/v4"
"github.com/gin-gonic/gin"

@ -9,9 +9,9 @@ import (
"strings"
"time"
"github.com/1Panel-dev/1Panel/app/model"
"github.com/1Panel-dev/1Panel/app/service"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/app/service"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package middleware
import (
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/gin-gonic/gin"
)

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

@ -3,10 +3,10 @@ package middleware
import (
"strconv"
"github.com/1Panel-dev/1Panel/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/app/repo"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
"github.com/1Panel-dev/1Panel/backend/app/repo"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -1,8 +1,8 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
"github.com/1Panel-dev/1Panel/middleware"
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)

@ -3,20 +3,22 @@ package server
import (
"encoding/gob"
"fmt"
"github.com/1Panel-dev/1Panel/cmd/server/web"
"net/http"
"time"
"github.com/1Panel-dev/1Panel/cron"
"github.com/1Panel-dev/1Panel/init/cache"
"github.com/1Panel-dev/1Panel/init/session"
"github.com/1Panel-dev/1Panel/init/session/psession"
"github.com/1Panel-dev/1Panel/backend/cron"
"github.com/1Panel-dev/1Panel/backend/init/cache"
"github.com/1Panel-dev/1Panel/backend/init/session"
"github.com/1Panel-dev/1Panel/backend/init/session/psession"
"github.com/1Panel-dev/1Panel/global"
"github.com/1Panel-dev/1Panel/init/db"
"github.com/1Panel-dev/1Panel/init/log"
"github.com/1Panel-dev/1Panel/init/migration"
"github.com/1Panel-dev/1Panel/init/router"
"github.com/1Panel-dev/1Panel/init/validator"
"github.com/1Panel-dev/1Panel/init/viper"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/init/db"
"github.com/1Panel-dev/1Panel/backend/init/log"
"github.com/1Panel-dev/1Panel/backend/init/migration"
"github.com/1Panel-dev/1Panel/backend/init/router"
"github.com/1Panel-dev/1Panel/backend/init/validator"
"github.com/1Panel-dev/1Panel/backend/init/viper"
"github.com/fvbock/endless"
"github.com/gin-gonic/gin"
@ -34,9 +36,17 @@ func Start() {
gin.SetMode(global.CONF.System.Level)
cron.Run()
routers := router.Routers()
rootRouter := router.Routers()
address := fmt.Sprintf(":%d", global.CONF.System.Port)
s := initServer(address, routers)
rootRouter.StaticFS("/login/onepanel", http.FS(web.IndexHtml))
rootRouter.StaticFS("/1panel", http.FS(web.IndexHtml))
rootRouter.GET("/assets/*filepath", func(c *gin.Context) {
staticServer := http.FileServer(http.FS(web.Assets))
staticServer.ServeHTTP(c.Writer, c.Request)
})
s := initServer(address, rootRouter)
global.LOG.Infof("server run success on %d", global.CONF.System.Port)
if err := s.ListenAndServe(); err != nil {
global.LOG.Error(err)

@ -3,8 +3,8 @@ package captcha
import (
"strings"
"github.com/1Panel-dev/1Panel/app/dto"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/mojocn/base64Captcha"
)

@ -8,7 +8,7 @@ import (
"os"
"strings"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
)

@ -1,7 +1,7 @@
package client
import (
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/constant"
osssdk "github.com/aliyun/aliyun-oss-go-sdk/oss"
)

@ -3,7 +3,7 @@ package client
import (
"os"
"github.com/1Panel-dev/1Panel/constant"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save