diff --git a/backend/utils/cloud_storage/client/kodo.go b/backend/utils/cloud_storage/client/kodo.go
index 488f72b77..d1fcf28eb 100644
--- a/backend/utils/cloud_storage/client/kodo.go
+++ b/backend/utils/cloud_storage/client/kodo.go
@@ -2,6 +2,7 @@ package client
import (
"context"
+ "strconv"
"time"
"github.com/1Panel-dev/1Panel/backend/utils/files"
@@ -10,10 +11,11 @@ import (
)
type kodoClient struct {
- bucket string
- domain string
- auth *auth.Credentials
- client *storage.BucketManager
+ bucket string
+ domain string
+ timeout string
+ auth *auth.Credentials
+ client *storage.BucketManager
}
func NewKodoClient(vars map[string]interface{}) (*kodoClient, error) {
@@ -21,14 +23,17 @@ func NewKodoClient(vars map[string]interface{}) (*kodoClient, error) {
secretKey := loadParamFromVars("secretKey", vars)
bucket := loadParamFromVars("bucket", vars)
domain := loadParamFromVars("domain", vars)
-
+ timeout := loadParamFromVars("timeout", vars)
+ if timeout == "" {
+ timeout = "1"
+ }
conn := auth.New(accessKey, secretKey)
cfg := storage.Config{
UseHTTPS: false,
}
bucketManager := storage.NewBucketManager(conn, &cfg)
- return &kodoClient{client: bucketManager, auth: conn, bucket: bucket, domain: domain}, nil
+ return &kodoClient{client: bucketManager, auth: conn, bucket: bucket, domain: domain, timeout: timeout}, nil
}
func (k kodoClient) ListBuckets() ([]interface{}, error) {
@@ -66,8 +71,13 @@ func (k kodoClient) Delete(path string) (bool, error) {
}
func (k kodoClient) Upload(src, target string) (bool, error) {
+
+ int64Value, _ := strconv.ParseInt(k.timeout, 10, 64)
+ unixTimestamp := int64Value * 3600
+
putPolicy := storage.PutPolicy{
- Scope: k.bucket,
+ Scope: k.bucket,
+ Expires: uint64(unixTimestamp),
}
upToken := putPolicy.UploadToken(k.auth)
cfg := storage.Config{UseHTTPS: true, UseCdnDomains: false}
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 1c18372dc..05abc7e01 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -917,6 +917,9 @@ const message = {
errPath: 'Backup path [{0}] error, cannot download!',
cutWebsiteLog: 'Cut Website Log',
cutWebsiteLogHelper: 'The cut log files will be backed up to the backup directory of 1Panel',
+
+ requestExpirationTime: 'Upload Request Expiration Time',
+ unitHours: 'Unit: Hours',
},
monitor: {
monitor: 'Monitor',
diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts
index ddce60a0c..f29d8b0bd 100644
--- a/frontend/src/lang/modules/tw.ts
+++ b/frontend/src/lang/modules/tw.ts
@@ -873,6 +873,9 @@ const message = {
errPath: '備份路徑 [{0}] 錯誤,無法下載!',
cutWebsiteLog: '切割網站日誌',
cutWebsiteLogHelper: '切割的日誌文件會備份到 1Panel 的 backup 目錄下',
+
+ requestExpirationTime: '上傳請求過期時間',
+ unitHours: '單位:小時',
},
monitor: {
monitor: '監控',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index efed10dcf..88a77f1b0 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -874,6 +874,9 @@ const message = {
errPath: '备份路径 [{0}] 错误,无法下载!',
cutWebsiteLog: '切割网站日志',
cutWebsiteLogHelper: '切割的日志文件会备份到 1Panel 的 backup 目录下',
+
+ requestExpirationTime: '上传请求过期时间',
+ unitHours: '单位:小时',
},
monitor: {
monitor: '监控',
diff --git a/frontend/src/views/setting/backup-account/kodo/index.vue b/frontend/src/views/setting/backup-account/kodo/index.vue
index 2e715260c..a7431e549 100644
--- a/frontend/src/views/setting/backup-account/kodo/index.vue
+++ b/frontend/src/views/setting/backup-account/kodo/index.vue
@@ -49,6 +49,18 @@
{{ $t('commons.rule.requiredSelect') }}
+
+
+
+ {{ $t('cronjob.unitHours') }}
+
+
@@ -107,6 +119,9 @@ const acceptParams = (params: DialogProps): void => {
domainProto.value = httpItem.proto;
}
title.value = i18n.global.t('commons.button.' + kodoData.value.title);
+ if (kodoData.value.rowData!.varsJson['timeout'] === undefined) {
+ kodoData.value.rowData!.varsJson['timeout'] = 1;
+ }
drawerVisible.value = true;
};