mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-09 08:00:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbf4f8ec36 | ||
|
|
3e3b1f2c56 | ||
|
|
e5a7f104f1 | ||
|
|
17062da52e | ||
|
|
512c7daeee | ||
|
|
ff120c421e | ||
|
|
4d5993c6ab | ||
|
|
627e1e3755 |
@@ -67,7 +67,8 @@ type LocalAppInstallDefine struct {
|
||||
}
|
||||
|
||||
type ExtraProperties struct {
|
||||
Tags []Tag `json:"tags"`
|
||||
Tags []Tag `json:"tags"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
type AppProperty struct {
|
||||
|
||||
@@ -668,6 +668,21 @@ func (a AppService) GetAppUpdate() (*response.AppUpdateRes, error) {
|
||||
res.CanUpdate = true
|
||||
return res, err
|
||||
}
|
||||
if err = getAppFromRepo(fmt.Sprintf("%s/%s/1panel.json.zip", global.CONF.System.AppRepo, global.CONF.System.Mode)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
listFile := path.Join(constant.ResourceDir, "1panel.json")
|
||||
content, err := os.ReadFile(listFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := &dto.AppList{}
|
||||
if err = json.Unmarshal(content, list); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list.Extra.Version != "" && setting.SystemVersion != list.Extra.Version && !common.CompareVersion(setting.SystemVersion, list.Extra.Version) {
|
||||
return nil, buserr.New("ErrVersionTooLow")
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@@ -766,7 +781,8 @@ func (a AppService) SyncAppListFromRemote() (err error) {
|
||||
version := v.Name
|
||||
detail := detailsMap[version]
|
||||
|
||||
dockerComposeUrl := fmt.Sprintf("%s/%s/%s/%s", baseRemoteUrl, app.Key, version, "docker-compose.yml")
|
||||
remoteVersionUrl := fmt.Sprintf("%s/%s/%s", baseRemoteUrl, app.Key, version)
|
||||
dockerComposeUrl := fmt.Sprintf("%s/%s", remoteVersionUrl, "docker-compose.yml")
|
||||
composeRes, err := http.Get(dockerComposeUrl)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -779,7 +795,7 @@ func (a AppService) SyncAppListFromRemote() (err error) {
|
||||
|
||||
paramByte, _ := json.Marshal(v.AppForm)
|
||||
detail.Params = string(paramByte)
|
||||
detail.DownloadUrl = v.DownloadUrl
|
||||
detail.DownloadUrl = fmt.Sprintf("%s/%s", remoteVersionUrl, version+".tar.gz")
|
||||
detail.DownloadCallBackUrl = v.DownloadCallBackUrl
|
||||
detail.Update = true
|
||||
detail.LastModified = v.LastModified
|
||||
|
||||
@@ -378,25 +378,25 @@ func (h *HostToolService) OperateSupervisorProcess(req request.SupervisorProcess
|
||||
}
|
||||
|
||||
func (h *HostToolService) LoadProcessStatus() ([]response.ProcessStatus, error) {
|
||||
var datas []response.ProcessStatus
|
||||
statuLines, err := cmd.Exec("supervisorctl status")
|
||||
if err != nil {
|
||||
return datas, fmt.Errorf("exec `supervisorctl status` failed, err: %v", statuLines)
|
||||
var res []response.ProcessStatus
|
||||
statusLines, _ := cmd.Exec("supervisorctl status")
|
||||
if len(statusLines) == 0 {
|
||||
return res, nil
|
||||
}
|
||||
lines := strings.Split(string(statuLines), "\n")
|
||||
lines := strings.Split(statusLines, "\n")
|
||||
for _, line := range lines {
|
||||
fields := strings.Fields(line)
|
||||
if len(fields) > 1 {
|
||||
datas = append(datas, response.ProcessStatus{Name: fields[0]})
|
||||
res = append(res, response.ProcessStatus{Name: fields[0]})
|
||||
}
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(datas))
|
||||
for i := 0; i < len(datas); i++ {
|
||||
wg.Add(len(res))
|
||||
for i := 0; i < len(res); i++ {
|
||||
go func(index int) {
|
||||
for t := 0; t < 3; t++ {
|
||||
status, err := cmd.ExecWithTimeOut(fmt.Sprintf("supervisorctl status %s", datas[index].Name), 2*time.Second)
|
||||
status, err := cmd.ExecWithTimeOut(fmt.Sprintf("supervisorctl status %s", res[index].Name), 2*time.Second)
|
||||
if err != nil {
|
||||
time.Sleep(2 * time.Second)
|
||||
continue
|
||||
@@ -406,25 +406,25 @@ func (h *HostToolService) LoadProcessStatus() ([]response.ProcessStatus, error)
|
||||
time.Sleep(2 * time.Second)
|
||||
continue
|
||||
}
|
||||
datas[index].Name = fields[0]
|
||||
datas[index].Status = fields[1]
|
||||
res[index].Name = fields[0]
|
||||
res[index].Status = fields[1]
|
||||
if fields[1] != "RUNNING" {
|
||||
datas[index].Msg = strings.Join(fields[2:], " ")
|
||||
res[index].Msg = strings.Join(fields[2:], " ")
|
||||
break
|
||||
}
|
||||
datas[index].PID = strings.TrimSuffix(fields[3], ",")
|
||||
datas[index].Uptime = fields[5]
|
||||
res[index].PID = strings.TrimSuffix(fields[3], ",")
|
||||
res[index].Uptime = fields[5]
|
||||
break
|
||||
}
|
||||
if len(datas[index].Status) == 0 {
|
||||
datas[index].Status = "FATAL"
|
||||
datas[index].Msg = "Timeout for getting process status"
|
||||
if len(res[index].Status) == 0 {
|
||||
res[index].Status = "FATAL"
|
||||
res[index].Msg = "Timeout for getting process status"
|
||||
}
|
||||
wg.Done()
|
||||
}(i)
|
||||
}
|
||||
wg.Wait()
|
||||
return datas, nil
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (h *HostToolService) GetSupervisorProcessConfig() ([]response.SupervisorProcessConfig, error) {
|
||||
|
||||
@@ -46,6 +46,7 @@ ErrContainerNotFound: '{{ .name }} container does not exist'
|
||||
ErrContainerMsg: '{{ .name }} container is abnormal, please check the log on the container page for details'
|
||||
ErrAppBackup: '{{ .name }} application backup failed err {{.err}}'
|
||||
ErrImagePull: '{{ .name }} image pull failed err {{.err}}'
|
||||
ErrVersionTooLow: 'The current 1Panel version is too low to update the app store, please upgrade the version'
|
||||
|
||||
#file
|
||||
ErrFileCanNotRead: "File can not read"
|
||||
|
||||
@@ -46,6 +46,7 @@ ErrContainerNotFound: '{{ .name }} 容器不存在'
|
||||
ErrContainerMsg: '{{ .name }} 容器異常,具體請在容器頁面查看日誌'
|
||||
ErrAppBackup: '{{ .name }} 應用備份失敗 err {{.err}}'
|
||||
ErrImagePull: '{{ .name }} 鏡像拉取失敗 err {{.err}}'
|
||||
ErrVersionTooLow: '當前 1Panel 版本過低,無法更新應用商店,請升級版本之後操作'
|
||||
|
||||
#file
|
||||
ErrFileCanNotRead: "此文件不支持預覽"
|
||||
|
||||
@@ -46,6 +46,7 @@ ErrContainerNotFound: '{{ .name }} 容器不存在'
|
||||
ErrContainerMsg: '{{ .name }} 容器异常,具体请在容器页面查看日志'
|
||||
ErrAppBackup: '{{ .name }} 应用备份失败 err {{.err}}'
|
||||
ErrImagePull: '镜像拉取失败 {{.err}}'
|
||||
ErrVersionTooLow: '当前 1Panel 版本过低,无法更新应用商店,请升级版本之后操作'
|
||||
|
||||
#file
|
||||
ErrFileCanNotRead: "此文件不支持预览"
|
||||
|
||||
@@ -518,6 +518,13 @@ func (f FileOp) Decompress(srcFile string, dst string, cType CompressType) error
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
parentDir := path.Dir(filePath)
|
||||
if !f.Stat(parentDir) {
|
||||
if err := f.Fs.MkdirAll(parentDir, info.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
fr, err := archFile.Open()
|
||||
if err != nil {
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/buserr"
|
||||
"github.com/1Panel-dev/1Panel/backend/constant"
|
||||
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
|
||||
"github.com/1Panel-dev/1Panel/backend/utils/mysql/client"
|
||||
)
|
||||
|
||||
@@ -28,9 +27,6 @@ type MysqlClient interface {
|
||||
|
||||
func NewMysqlClient(conn client.DBInfo) (MysqlClient, error) {
|
||||
if conn.From == "local" {
|
||||
if cmd.CheckIllegal(conn.Address, conn.Username, conn.Password) {
|
||||
return nil, buserr.New(constant.ErrCmdIllegal)
|
||||
}
|
||||
connArgs := []string{"exec", conn.Address, "mysql", "-u" + conn.Username, "-p" + conn.Password, "-e"}
|
||||
return client.NewLocal(connArgs, conn.Address, conn.Password, conn.From), nil
|
||||
}
|
||||
|
||||
@@ -51,7 +51,9 @@
|
||||
</el-table-column>
|
||||
<el-table-column width="90">
|
||||
<template #default="{ row }">
|
||||
<el-tag effect="dark" round v-if="row.isSystem">system</el-tag>
|
||||
<el-tag effect="dark" round v-if="row.isSystem || row.name === '1panel-network'">
|
||||
system
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -78,11 +80,12 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createdAt"
|
||||
show-overflow-tooltip
|
||||
min-width="90"
|
||||
:label="$t('commons.table.date')"
|
||||
:formatter="dateFormat"
|
||||
/>
|
||||
<fu-table-operations :buttons="buttons" :label="$t('commons.table.operate')" fix />
|
||||
<fu-table-operations width="100" :buttons="buttons" :label="$t('commons.table.operate')" fix />
|
||||
</ComplexTable>
|
||||
</template>
|
||||
</LayoutContent>
|
||||
@@ -222,7 +225,7 @@ const onInspect = async (id: string) => {
|
||||
};
|
||||
|
||||
function isSystem(val: string) {
|
||||
return val === 'bridge' || val === '1panel-network' || val === 'none' || val === 'host';
|
||||
return val === 'bridge' || val === 'none' || val === 'host';
|
||||
}
|
||||
|
||||
const buttons = [
|
||||
|
||||
@@ -247,7 +247,7 @@ const onDelete = async (row: Host.RuleIP | null) => {
|
||||
}
|
||||
}
|
||||
loading.value = true;
|
||||
await batchOperateRule({ type: 'port', rules: rules })
|
||||
await batchOperateRule({ type: 'address', rules: rules })
|
||||
.then(() => {
|
||||
loading.value = false;
|
||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||
|
||||
@@ -184,6 +184,7 @@ const setting = () => {
|
||||
|
||||
const getStatus = (status: any) => {
|
||||
supervisorStatus.value = status;
|
||||
search();
|
||||
};
|
||||
|
||||
const showStopped = computed((): boolean => {
|
||||
@@ -211,6 +212,9 @@ const openCreate = () => {
|
||||
};
|
||||
|
||||
const search = async () => {
|
||||
if (!supervisorStatus.value.isExist) {
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
loadStatus();
|
||||
try {
|
||||
@@ -231,9 +235,7 @@ const loadStatus = async () => {
|
||||
process.status.push(item);
|
||||
}
|
||||
}
|
||||
if (process.status.length !== 0) {
|
||||
process.hasLoad = true;
|
||||
}
|
||||
process.hasLoad = true;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
Reference in New Issue
Block a user