From 2d8a7bbbc3df53f2598208c08d3600cf57524bcc Mon Sep 17 00:00:00 2001
From: ssongliu <73214554+ssongliu@users.noreply.github.com>
Date: Thu, 2 Nov 2023 14:29:46 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E8=85=BE=E8=AE=AF=20COS=20=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E5=A4=A7=E6=96=87=E4=BB=B6=E5=88=86=E7=89=87=E4=B8=8A?=
=?UTF-8?q?=E4=BC=A0=20(#2772)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/utils/cloud_storage/client/cos.go | 22 +++++++++++++++++++++
backend/utils/ssl/acme_test.go | 2 +-
frontend/src/views/cronjob/record/index.vue | 11 ++++++++++-
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/backend/utils/cloud_storage/client/cos.go b/backend/utils/cloud_storage/client/cos.go
index ba153a5d6..8eef7cbe1 100644
--- a/backend/utils/cloud_storage/client/cos.go
+++ b/backend/utils/cloud_storage/client/cos.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "os"
"github.com/1Panel-dev/1Panel/backend/constant"
cosSDK "github.com/tencentyun/cos-go-sdk-v5"
@@ -97,6 +98,27 @@ func (cos cosClient) Upload(src, target string) (bool, error) {
if err != nil {
return false, err
}
+ fileInfo, err := os.Stat(src)
+ if err != nil {
+ return false, err
+ }
+ if fileInfo.Size() > 5368709120 {
+ opt := &cosSDK.MultiUploadOptions{
+ OptIni: &cosSDK.InitiateMultipartUploadOptions{
+ ACLHeaderOptions: nil,
+ ObjectPutHeaderOptions: &cosSDK.ObjectPutHeaderOptions{
+ XCosStorageClass: cos.scType,
+ },
+ },
+ PartSize: 200,
+ }
+ if _, _, err := client.Object.MultiUpload(
+ context.Background(), target, src, opt,
+ ); err != nil {
+ return false, err
+ }
+ return true, nil
+ }
if _, err := client.Object.PutFromFile(context.Background(), target, src, &cosSDK.ObjectPutOptions{
ACLHeaderOptions: nil,
ObjectPutHeaderOptions: &cosSDK.ObjectPutHeaderOptions{
diff --git a/backend/utils/ssl/acme_test.go b/backend/utils/ssl/acme_test.go
index a4f9a299f..231a2441f 100644
--- a/backend/utils/ssl/acme_test.go
+++ b/backend/utils/ssl/acme_test.go
@@ -144,7 +144,7 @@ func TestAppToV2(t *testing.T) {
}
_ = fileOp.DeleteFile(newVersionDir + "/config.json")
oldReadMefile := newVersionDir + "/README.md"
- _ = fileOp.Cut([]string{oldReadMefile}, newAppDir)
+ // _ = fileOp.Cut([]string{oldReadMefile}, newAppDir)
_ = fileOp.DeleteFile(oldReadMefile)
}
}
diff --git a/frontend/src/views/cronjob/record/index.vue b/frontend/src/views/cronjob/record/index.vue
index 806f2f233..87103634a 100644
--- a/frontend/src/views/cronjob/record/index.vue
+++ b/frontend/src/views/cronjob/record/index.vue
@@ -42,6 +42,9 @@
{{ loadZero(dialogData.rowData?.hour) }} :
{{ loadZero(dialogData.rowData?.minute) }}
+
+ {{ loadZero(dialogData.rowData?.hour) }} : {{ loadZero(dialogData.rowData?.minute) }}
+
{{ loadWeek(dialogData.rowData?.week) }} {{ loadZero(dialogData.rowData?.hour) }} :
{{ loadZero(dialogData.rowData?.minute) }}
@@ -127,7 +130,13 @@
-
+