mirror of
https://github.com/Awuqing/BackupX.git
synced 2026-06-29 13:31:22 +08:00
Compare commits
1 Commits
v1.3.1
...
fix/critic
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3023a089fb |
@@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
type StorageTargetUpsertInput struct {
|
type StorageTargetUpsertInput struct {
|
||||||
Name string `json:"name" binding:"required,min=1,max=128"`
|
Name string `json:"name" binding:"required,min=1,max=128"`
|
||||||
Type string `json:"type" binding:"required,oneof=local_disk google_drive s3 webdav"`
|
Type string `json:"type" binding:"required,oneof=local_disk google_drive s3 webdav aliyun_oss tencent_cos qiniu_kodo ftp rclone"`
|
||||||
Description string `json:"description" binding:"max=255"`
|
Description string `json:"description" binding:"max=255"`
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
Config map[string]any `json:"config" binding:"required"`
|
Config map[string]any `json:"config" binding:"required"`
|
||||||
|
|||||||
@@ -26,8 +26,12 @@ func newProvider(providerType storage.ProviderType, rfs fs.Fs) *Provider {
|
|||||||
|
|
||||||
func (p *Provider) Type() storage.ProviderType { return p.providerType }
|
func (p *Provider) Type() storage.ProviderType { return p.providerType }
|
||||||
|
|
||||||
// TestConnection 通过列出根目录验证连通性。
|
// TestConnection 验证连通性。对本地磁盘会先确保目录存在。
|
||||||
func (p *Provider) TestConnection(ctx context.Context) error {
|
func (p *Provider) TestConnection(ctx context.Context) error {
|
||||||
|
// 确保根目录存在(本地磁盘等后端需要预创建)
|
||||||
|
if err := p.rfs.Mkdir(ctx, ""); err != nil {
|
||||||
|
return fmt.Errorf("rclone test connection (mkdir): %w", err)
|
||||||
|
}
|
||||||
_, err := p.rfs.List(ctx, "")
|
_, err := p.rfs.List(ctx, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("rclone test connection: %w", err)
|
return fmt.Errorf("rclone test connection: %w", err)
|
||||||
|
|||||||
@@ -301,5 +301,5 @@ export const storageTargetTypeOptions = [
|
|||||||
{ label: 'Google Drive', value: 'google_drive' },
|
{ label: 'Google Drive', value: 'google_drive' },
|
||||||
{ label: 'WebDAV', value: 'webdav' },
|
{ label: 'WebDAV', value: 'webdav' },
|
||||||
{ label: 'FTP', value: 'ftp' },
|
{ label: 'FTP', value: 'ftp' },
|
||||||
{ label: 'Rclone (70+ 后端)', value: 'rclone' },
|
{ label: 'Rclone — SFTP / Azure / Dropbox / OneDrive 等 70+ 后端', value: 'rclone' },
|
||||||
] as const
|
] as const
|
||||||
|
|||||||
Reference in New Issue
Block a user