Compare commits

...
9 Commits
14 changed files with 61 additions and 39 deletions
+10 -1
View File
@@ -40,4 +40,13 @@ jobs:
dist/*.tar.gz
dist/checksums.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup OSSUTIL
uses: yizhoumo/setup-ossutil@v1
with:
endpoint: ${{ secrets.OSS_ENDPOINT }}
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
ossutil-version: '1.7.14'
- name: Upload Assets to OSS
- run: ossutil cp -r dist/ oss://resource-fit2cloud-com/1panel/package/stable/${{ github.ref_name }}/release/ --include "*.tar.gz" --include "checksums.txt" --only-current-dir
-4
View File
@@ -314,10 +314,6 @@ func upgradeInstall(installId uint, detailId uint) error {
install.Version = detail.Version
install.AppDetailId = detailId
go func() {
_, _ = http.Get(detail.DownloadCallBackUrl)
}()
if out, err := compose.Down(install.GetComposePath()); err != nil {
if out != "" {
upErr = errors.New(out)
+1 -1
View File
@@ -99,7 +99,7 @@ func handleAppBackup(install *model.AppInstall, backupDir, fileName string) erro
return err
}
appPath := fmt.Sprintf("%s/%s", install.GetPath(), install.Name)
appPath := install.GetPath()
if err := handleTar(appPath, tmpDir, "app.tar.gz", ""); err != nil {
return err
}
+1 -1
View File
@@ -196,7 +196,7 @@ func handleTar(sourceDir, targetDir, name, exclusionRules string) error {
path := ""
if strings.Contains(sourceDir, "/") {
itemDir := strings.ReplaceAll(sourceDir[strings.LastIndex(sourceDir, "/"):], "/", "")
aheadDir := strings.ReplaceAll(sourceDir, itemDir, "")
aheadDir := sourceDir[:strings.LastIndex(sourceDir, "/")]
path += fmt.Sprintf("-C %s %s", aheadDir, itemDir)
} else {
path = sourceDir
+18 -15
View File
@@ -231,7 +231,8 @@ func (u *SSHService) LoadLog(req dto.SearchSSHLog) (*dto.SSHLog, error) {
}
for i := 0; i < len(fileList); i++ {
if strings.HasPrefix(path.Base(fileList[i]), "secure") {
dataItem := loadFailedSecureDatas(fmt.Sprintf("cat %s | grep -a 'Failed password for' | grep -v 'invalid' %s", fileList[i], command))
commandItem := fmt.Sprintf("cat %s | grep -a 'Failed password for' | grep -v 'invalid' %s", fileList[i], command)
dataItem := loadFailedSecureDatas(commandItem)
data.FailedCount += len(dataItem)
data.TotalCount += len(dataItem)
if req.Status != constant.StatusSuccess {
@@ -239,14 +240,16 @@ func (u *SSHService) LoadLog(req dto.SearchSSHLog) (*dto.SSHLog, error) {
}
}
if strings.HasPrefix(path.Base(fileList[i]), "auth.log") {
dataItem := loadFailedAuthDatas(fmt.Sprintf("cat %s | grep -a 'Connection closed by authenticating user' | grep -a 'preauth' %s", fileList[i], command))
commandItem := fmt.Sprintf("cat %s | grep -a 'Connection closed by authenticating user' | grep -a 'preauth' %s", fileList[i], command)
dataItem := loadFailedAuthDatas(commandItem)
data.FailedCount += len(dataItem)
data.TotalCount += len(dataItem)
if req.Status != constant.StatusSuccess {
data.Logs = append(data.Logs, dataItem...)
}
}
dataItem := loadSuccessDatas(fmt.Sprintf("cat %s | grep Accepted %s", fileList[i], command))
commandItem := fmt.Sprintf("cat %s | grep Accepted %s", fileList[i], command)
dataItem := loadSuccessDatas(commandItem)
data.TotalCount += len(dataItem)
if req.Status != constant.StatusFailed {
data.Logs = append(data.Logs, dataItem...)
@@ -257,6 +260,18 @@ func (u *SSHService) LoadLog(req dto.SearchSSHLog) (*dto.SSHLog, error) {
return nil, nil
}
var itemDatas []dto.SSHHistory
total, start, end := len(data.Logs), (req.Page-1)*req.PageSize, req.Page*req.PageSize
if start > total {
itemDatas = make([]dto.SSHHistory, 0)
} else {
if end >= total {
end = total
}
itemDatas = data.Logs[start:end]
}
data.Logs = itemDatas
timeNow := time.Now()
nyc, _ := time.LoadLocation(common.LoadTimeZone())
qqWry, err := qqwry.NewQQwry()
@@ -271,18 +286,6 @@ func (u *SSHService) LoadLog(req dto.SearchSSHLog) (*dto.SSHLog, error) {
}
data.Logs = itemLogs
var itemDatas []dto.SSHHistory
total, start, end := len(data.Logs), (req.Page-1)*req.PageSize, req.Page*req.PageSize
if start > total {
itemDatas = make([]dto.SSHHistory, 0)
} else {
if end >= total {
end = total
}
itemDatas = data.Logs[start:end]
}
data.Logs = itemDatas
return &data, nil
}
+1 -1
View File
@@ -22,7 +22,7 @@ func syncApp() {
}
global.LOG.Info("sync app start...")
if err := service.NewIAppService().SyncAppListFromRemote(); err != nil {
global.LOG.Errorf("sync app error: %s", err.Error())
global.LOG.Errorf("sync app error")
return
}
global.LOG.Info("sync app successful")
+12 -5
View File
@@ -1,8 +1,8 @@
package client
import (
"bufio"
"fmt"
"io"
"net"
"os"
"path"
@@ -75,11 +75,18 @@ func (s sftpClient) Upload(src, target string) (bool, error) {
return false, err
}
defer dstFile.Close()
ff, err := io.ReadAll(srcFile)
if err != nil {
return false, err
reader := bufio.NewReaderSize(srcFile, 128*1024*1024)
for {
chunk, err := reader.Peek(8 * 1024 * 1024)
if len(chunk) != 0 {
_, _ = dstFile.Write(chunk)
_, _ = reader.Discard(len(chunk))
}
if err != nil {
break
}
}
_, _ = dstFile.Write(ff)
return true, nil
}
@@ -56,7 +56,7 @@
<MdEditor
v-model="upgradeInfo.releaseNote"
previewOnly
:theme="globalStore.$state.themeConfig.theme || 'light'"
:theme="globalStore.$state.themeConfig.theme === 'dark' ? 'dark' : 'light'"
/>
</div>
<template #footer>
+2 -2
View File
@@ -1157,8 +1157,8 @@ const message = {
containerName: '容器名称',
containerNameHelper: '可以为空,为空自动生成',
allowPort: '端口外部访问',
allowPortHelper: '允许外部端口访问会放开防火墙端口,php运行环境请勿放开',
appInstallWarn: '应用默认不放开外部访问端口,可以在高级设置中选择放开',
allowPortHelper: '允许端口外部访问会放开防火墙端口,php运行环境请勿放开',
appInstallWarn: '应用端口默认不允许外部访问,可以在下方高级设置中选择放开',
upgradeStart: '开始升级!请稍后刷新页面',
toFolder: '进入安装目录',
editCompose: '编辑 compose 文件',
@@ -83,7 +83,11 @@
</div>
</div>
<div style="margin-left: 10px">
<MdEditor v-model="app.readMe" previewOnly :themes="globalStore.$state.themeConfig.theme || 'light'" />
<MdEditor
v-model="app.readMe"
previewOnly
:theme="globalStore.$state.themeConfig.theme === 'dark' ? 'dark' : 'light'"
/>
</div>
</template>
</LayoutContent>
@@ -11,7 +11,7 @@
</template>
<el-row v-loading="loading">
<el-col :span="22" :offset="1">
<el-alert type="info" :closable="false">
<el-alert type="error" :closable="false">
<p>{{ $t('app.appInstallWarn') }}</p>
</el-alert>
<el-form
@@ -103,7 +103,7 @@
<el-form-item :label="$t('container.cutLog')" prop="hasLogOption">
<el-switch v-model="form.logOptionShow" @change="handleLogOption"></el-switch>
<span class="input-help"></span>
<div v-if="form.logOptionShow">
<div v-if="logOptionShow">
<el-tag>{{ $t('container.maxSize') }}: {{ form.logMaxSize }}</el-tag>
<el-tag style="margin-left: 5px">
{{ $t('container.maxFile') }}: {{ form.logMaxFile }}
@@ -251,6 +251,7 @@ const registriesRef = ref();
const confirmDialogRefLive = ref();
const confirmDialogRefCgroup = ref();
const confirmDialogRefIptable = ref();
const logOptionShow = ref();
const form = reactive({
isSwarm: false,
@@ -437,10 +438,12 @@ const search = async () => {
form.registries = res.data.insecureRegistries ? res.data.insecureRegistries.join('\n') : '';
if (res.data.logMaxFile || res.data.logMaxSize) {
form.logOptionShow = true;
logOptionShow.value = true;
form.logMaxFile = Number(res.data.logMaxFile);
form.logMaxSize = res.data.logMaxSize;
} else {
form.logOptionShow = false;
logOptionShow.value = false;
}
};
@@ -26,10 +26,10 @@
<el-input v-model.number="form.logMaxSize">
<template #append>
<el-select v-model="form.sizeUnit" style="width: 70px">
<el-option label="byte" value="b"></el-option>
<el-option label="kb" value="k"></el-option>
<el-option label="mb" value="m"></el-option>
<el-option label="gb" value="g"></el-option>
<el-option label="Byte" value="b"></el-option>
<el-option label="KB" value="k"></el-option>
<el-option label="MB" value="m"></el-option>
<el-option label="GB" value="g"></el-option>
</el-select>
</template>
</el-input>
@@ -263,7 +263,7 @@ const onSaveConf = async () => {
};
const loadContainerLog = async (containerID: string) => {
dialogContainerLogRef.value!.acceptParams({ containerID: containerID, container: mysqlName.value });
dialogContainerLogRef.value!.acceptParams({ containerID: containerID, container: containerID });
};
const loadBaseInfo = async () => {