Pārlūkot izejas kodu

智能解析服务器链接;调整网盘相关文件以及变量命名

chendeben 9 mēneši atpakaļ
vecāks
revīzija
74e8d0adbb

+ 1 - 1
entry/src/main/ets/common/enums/WebdavManagerStates.ets → entry/src/main/ets/common/enums/RemoteDriveManagerStates.ets

@@ -1,4 +1,4 @@
-export enum WebdavManagerStates{
+export enum RemoteDriveManagerStates{
   // 账户管理
   QueryAccountsSucceed = "QueryAccountsSucceed",
   QueryAccountsFailed = "QueryAccountsFailed",

+ 2 - 2
entry/src/main/ets/common/network/SmbFileCache.ets

@@ -1,5 +1,5 @@
 import { MD5 } from '@pura/harmony-utils';
-import { WebdavManager } from '../util/WebdavManager';
+import { RemoteDriveManager } from '../util/RemoteDriveManager';
 import FileManager, { merge2paths } from '../util/FileManager';
 import { WebDavAccount } from '../../viewmodel/WebDavAccount';
 import Logger from '../util/Logger';
@@ -102,7 +102,7 @@ async function buildCacheFileName(relativePath: string): Promise<string> {
 }
 
 export async function ensureSmbFileCached(account: WebDavAccount, relativePath: string): Promise<string> {
-  const manager = WebdavManager.getInstance();
+  const manager = RemoteDriveManager.getInstance();
   if (!manager.context) {
     throw new Error('App context is not initialized');
   }

+ 4 - 4
entry/src/main/ets/common/util/DataBaseUtil.ets

@@ -116,7 +116,7 @@ export class DataBaseUtil {
     }
   }
 
-  // 查询数据(简化版,用于WebdavManager)
+  // 查询数据(简化版,用于RemoteDriveManager)
   public async queryData(tableName: string, columns: Array<string>, predicates?: relationalStore.RdbPredicates): Promise<relationalStore.ResultSet> {
     try {
       const db = await this.getDB();
@@ -133,17 +133,17 @@ export class DataBaseUtil {
     }
   }
 
-  // 插入数据(简化版,用于WebdavManager)
+  // 插入数据(简化版,用于RemoteDriveManager)
   public async insertData(tableName: string, values: relationalStore.ValuesBucket): Promise<number> {
     return await this.insert(tableName, values);
   }
 
-  // 更新数据(简化版,用于WebdavManager)
+  // 更新数据(简化版,用于RemoteDriveManager)
   public async updateData(tableName: string, values: relationalStore.ValuesBucket, predicates: relationalStore.RdbPredicates): Promise<number> {
     return await this.update(tableName, values, predicates);
   }
 
-  // 删除数据(简化版,用于WebdavManager)
+  // 删除数据(简化版,用于RemoteDriveManager)
   public async deleteData(predicates: relationalStore.RdbPredicates): Promise<number> {
     return await this.delete(predicates);
   }

+ 31 - 0
entry/src/main/ets/common/util/RemoteDriveLabel.ets

@@ -0,0 +1,31 @@
+import { RemoteDriveType } from '../enums/RemoteDriveType';
+
+const BASE_LABEL = '网盘';
+
+export function getRemoteDriveBaseLabel(): string {
+  return BASE_LABEL;
+}
+
+export function getRemoteDriveAccountLabel(): string {
+  return `${BASE_LABEL}账户`;
+}
+
+export function getRemoteDriveProtocolLabel(type?: number): string {
+  switch (type) {
+    case RemoteDriveType.Smb:
+      return 'SMB';
+    case RemoteDriveType.WebDav:
+    default:
+      return 'WebDAV';
+  }
+}
+
+export function getRemoteDriveDisplayLabel(type?: number): string {
+  const protocol = getRemoteDriveProtocolLabel(type);
+  return `${BASE_LABEL}${protocol ? `(${protocol})` : ''}`;
+}
+
+export function getRemoteDrivePlaylistPrefix(type?: number): string {
+  const protocol = getRemoteDriveProtocolLabel(type);
+  return `${BASE_LABEL}${protocol ? `-${protocol}` : ''}`;
+}

+ 30 - 30
entry/src/main/ets/common/util/WebdavManager.ets → entry/src/main/ets/common/util/RemoteDriveManager.ets

@@ -1,10 +1,10 @@
-// WebdavManager - WebDAV管理器(简化版)
+// RemoteDriveManager - WebDAV管理器(简化版)
 import { VideoItem } from '../../viewmodel/VideoItem';
 import { common } from '@kit.AbilityKit';
 import { FileInfo } from '../../viewmodel/FileInfo';
 import FileManager, { merge2paths } from './FileManager';
 import { BusinessError } from '@kit.BasicServicesKit';
-import { WebdavManagerStates } from '../enums/WebdavManagerStates';
+import { RemoteDriveManagerStates } from '../enums/RemoteDriveManagerStates';
 import { RcpSocket } from './RcpSocketUtil';
 import { DataBaseUtil } from './DataBaseUtil';
 import { WebDavAccount } from '../../viewmodel/WebDavAccount';
@@ -18,7 +18,7 @@ import { MusicInfo, parseMusicFileName, Utility } from './Utility';
 import { RemoteDriveType } from '../enums/RemoteDriveType';
 import { listSmbDirectory, SmbDirectoryEntry } from '../network/SmbBridge';
 
-const TAG = 'heanup WebdavManager';
+const TAG = 'heanup RemoteDriveManager';
 
 // WebDAV认证信息接口
 export interface WebDavAuthInfo {
@@ -39,11 +39,11 @@ export interface TransferTask {
 }
 
 @Observed
-export class WebdavManager {
+export class RemoteDriveManager {
   public rcpSocket: RcpSocket = RcpSocket.getInstance();
   private dataBaseUtil = DataBaseUtil.getInstance();
   public observers: Array<(event: string) => void> = [];
-  public static instance: WebdavManager;
+  public static instance: RemoteDriveManager;
   public context: common.Context | undefined;
   public DownloadDirectoryFilePath: string = '';
   public audioExtensions = Constants.AUDIO_EXTENSIONS;
@@ -90,11 +90,11 @@ export class WebdavManager {
     });
   }
 
-  public static getInstance(): WebdavManager {
-    if (!WebdavManager.instance) {
-      WebdavManager.instance = new WebdavManager();
+  public static getInstance(): RemoteDriveManager {
+    if (!RemoteDriveManager.instance) {
+      RemoteDriveManager.instance = new RemoteDriveManager();
     }
-    return WebdavManager.instance;
+    return RemoteDriveManager.instance;
   }
 
   public setContext(context: common.Context): void {
@@ -543,11 +543,11 @@ export class WebdavManager {
       resultSet.close();
 
       Logger.info(TAG, '从数据库加载了', this.webDavAccounts.length.toString(), '个WebDAV账户');
-      this.notifyObservers(WebdavManagerStates.QueryAccountsSucceed);
+      this.notifyObservers(RemoteDriveManagerStates.QueryAccountsSucceed);
     } catch (err) {
       const error = err as Error;
       Logger.error(TAG, '查询WebDAV账户失败:', error.message);
-      this.notifyObservers(WebdavManagerStates.QueryAccountsFailed);
+      this.notifyObservers(RemoteDriveManagerStates.QueryAccountsFailed);
       throw error;
     }
   }
@@ -596,11 +596,11 @@ export class WebdavManager {
       Logger.info(TAG, '插入WebDAV账户成功:', name);
 
       await this.queryWebDavAccountsFromDB();
-      this.notifyObservers(WebdavManagerStates.InsertAccountSucceed);
+      this.notifyObservers(RemoteDriveManagerStates.InsertAccountSucceed);
     } catch (err) {
       const error = err as Error;
       Logger.error(TAG, '插入WebDAV账户失败:', error.message);
-      this.notifyObservers(WebdavManagerStates.InsertAccountFailed);
+      this.notifyObservers(RemoteDriveManagerStates.InsertAccountFailed);
       throw error;
     }
   }
@@ -635,11 +635,11 @@ export class WebdavManager {
       Logger.info(TAG, '更新WebDAV账户成功:', account.name);
 
       await this.queryWebDavAccountsFromDB();
-      this.notifyObservers(WebdavManagerStates.EditAccountSucceed);
+      this.notifyObservers(RemoteDriveManagerStates.EditAccountSucceed);
     } catch (err) {
       const error = err as Error;
       Logger.error(TAG, '更新WebDAV账户失败:', error.message);
-      this.notifyObservers(WebdavManagerStates.EditAccountFailed);
+      this.notifyObservers(RemoteDriveManagerStates.EditAccountFailed);
       throw error;
     }
   }
@@ -654,11 +654,11 @@ export class WebdavManager {
       Logger.info(TAG, '删除WebDAV账户成功:', account.name);
 
       await this.queryWebDavAccountsFromDB();
-      this.notifyObservers(WebdavManagerStates.RemoveAccountSucceed);
+      this.notifyObservers(RemoteDriveManagerStates.RemoveAccountSucceed);
     } catch (err) {
       const error = err as Error;
       Logger.error(TAG, '删除WebDAV账户失败:', error.message);
-      this.notifyObservers(WebdavManagerStates.RemoveAccountFailed);
+      this.notifyObservers(RemoteDriveManagerStates.RemoveAccountFailed);
       throw error;
     }
   }
@@ -688,7 +688,7 @@ export class WebdavManager {
     const account = await this.getActiveWebDavAccount();
     if (!account) {
       Logger.error(TAG, '没有激活的WebDAV账户');
-      this.notifyObservers(WebdavManagerStates.LoadFilesInfoFailed);
+      this.notifyObservers(RemoteDriveManagerStates.LoadFilesInfoFailed);
       return;
     }
     await this.loadFilesInfoFromAccount(account, customPath);
@@ -704,7 +704,7 @@ export class WebdavManager {
     }
 
     try {
-      this.notifyObservers(WebdavManagerStates.LoadFilesInfoStart);
+      this.notifyObservers(RemoteDriveManagerStates.LoadFilesInfoStart);
 
       // 使用自定义路径或账户默认路径
       const normalizedFullPath = this.normalizeFullPath(customPath !== undefined ? customPath : account.filepath);
@@ -716,10 +716,10 @@ export class WebdavManager {
         await this.loadWebDavFiles(account, normalizedFullPath);
       }
 
-      this.notifyObservers(WebdavManagerStates.LoadFilesInfoSucceed);
+      this.notifyObservers(RemoteDriveManagerStates.LoadFilesInfoSucceed);
     } catch (error) {
       this.ErrorMessage = error as BusinessError;
-      this.notifyObservers(WebdavManagerStates.LoadFilesInfoFailed);
+      this.notifyObservers(RemoteDriveManagerStates.LoadFilesInfoFailed);
     }
   }
 
@@ -1017,7 +1017,7 @@ export class WebdavManager {
     await this.loadFilesInfoFromAccount(this.currentAccount, path);
   }
 
-  // 在 WebdavManager 类中添加以下方法
+  // 在 RemoteDriveManager 类中添加以下方法
   navigateToBreadcrumb(breadcrumbIndex: number): Promise<string> {
     return new Promise((resolve, reject) => {
       try {
@@ -1116,7 +1116,7 @@ export class WebdavManager {
     const task: TransferTask = { song, account };
     this.downloadQueue.push(task);
     Logger.info(TAG, '添加到下载队列:', song.name);
-    this.notifyObservers(WebdavManagerStates.DownloadQueueChanged);
+    this.notifyObservers(RemoteDriveManagerStates.DownloadQueueChanged);
   }
 
   // 从下载队列移除
@@ -1125,7 +1125,7 @@ export class WebdavManager {
       const task = this.downloadQueue[index];
       this.downloadQueue.splice(index, 1);
       Logger.info(TAG, '从下载队列移除:', task.song.name);
-      this.notifyObservers(WebdavManagerStates.DownloadQueueChanged);
+      this.notifyObservers(RemoteDriveManagerStates.DownloadQueueChanged);
     }
   }
 
@@ -1133,7 +1133,7 @@ export class WebdavManager {
   public clearDownloadQueue(): void {
     this.downloadQueue = [];
     Logger.info(TAG, '清空下载队列');
-    this.notifyObservers(WebdavManagerStates.DownloadQueueChanged);
+    this.notifyObservers(RemoteDriveManagerStates.DownloadQueueChanged);
   }
 
   // ==================== 上传队列管理 ====================
@@ -1143,7 +1143,7 @@ export class WebdavManager {
     const task: TransferTask = { song, account };
     this.uploadQueue.push(task);
     Logger.info(TAG, '添加到上传队列:', song.name);
-    this.notifyObservers(WebdavManagerStates.UploadQueueChanged);
+    this.notifyObservers(RemoteDriveManagerStates.UploadQueueChanged);
   }
 
   // 从上传队列移除
@@ -1152,7 +1152,7 @@ export class WebdavManager {
       const task = this.uploadQueue[index];
       this.uploadQueue.splice(index, 1);
       Logger.info(TAG, '从上传队列移除:', task.song.name);
-      this.notifyObservers(WebdavManagerStates.UploadQueueChanged);
+      this.notifyObservers(RemoteDriveManagerStates.UploadQueueChanged);
     }
   }
 
@@ -1160,7 +1160,7 @@ export class WebdavManager {
   public clearUploadQueue(): void {
     this.uploadQueue = [];
     Logger.info(TAG, '清空上传队列');
-    this.notifyObservers(WebdavManagerStates.UploadQueueChanged);
+    this.notifyObservers(RemoteDriveManagerStates.UploadQueueChanged);
   }
 
   // ==================== 安全认证方法 ====================
@@ -1252,8 +1252,8 @@ export async function buildHttpHeadersWithWebDav(
       try {
         if (webDavAuthItem && webDavAuthItem.accountId) {
           Logger.info(`heanup 找到WebDAV认证信息,账户ID: ${webDavAuthItem.accountId}`);
-          // 使用WebdavManager获取认证头
-          const webdavManager = WebdavManager.getInstance();
+          // 使用RemoteDriveManager获取认证头
+          const webdavManager = RemoteDriveManager.getInstance();
           const authHeaders = await webdavManager.getWebDavAuthHeaders(webDavAuthItem.accountId.toString());
 
           if (authHeaders) {

+ 196 - 33
entry/src/main/ets/dialog/WebDavAccountDialog.ets → entry/src/main/ets/dialog/RemoteDriveAccountDialog.ets

@@ -1,4 +1,4 @@
-import { StrUtil, ToastUtil } from '@pura/harmony-utils';
+import { ToastUtil } from '@pura/harmony-utils';
 import { CommonConstants } from '../common/constants/CommonConstants';
 import { RemoteDriveType } from '../common/enums/RemoteDriveType';
 import { WebDavAccount } from '../viewmodel/WebDavAccount';
@@ -6,6 +6,15 @@ import { ImagePickerUtil } from '../common/util/ImagePickerUtil';
 import Logger from '../common/util/Logger';
 import { ConfigurationConstant, Context } from '@kit.AbilityKit';
 
+interface ParsedConnectionParts {
+  protocol: string;
+  username?: string;
+  password?: string;
+  host: string;
+  port?: number;
+  path?: string;
+}
+
 // 工具函数:将 #RRGGBB 字符串和透明度转为 'rgba(r,g,b,a)' 字符串,深色模式下可返回深色变体
 function themeColorWithAlpha(themeColor: string, alpha: number, isDarkMode: boolean = false): string {
   if (isDarkMode) {
@@ -19,16 +28,16 @@ function themeColorWithAlpha(themeColor: string, alpha: number, isDarkMode: bool
   return `rgba(${r},${g},${b},${alpha})`;
 }
 
-// WebDAV账户对话框
+// 网盘账户对话框
 @Component
-export struct WebDavAccountDialog {
+export struct RemoteDriveAccountDialog {
   @Prop isEditMode: boolean = false;
   @Prop account: WebDavAccount;
   onConfirm?: (account: WebDavAccount) => void;
   onCancel?: () => void;
-  @State accountName: string = 'demo';
+  @State accountName: string = '新建WebDAV';
   @State host: string = '';
-  @State port: number = 5005;
+  @State port: number = -1;
   @State filepath: string = '/';
   @State username: string = '';
   @State password: string = '';
@@ -42,6 +51,10 @@ export struct WebDavAccountDialog {
   @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
     ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
 
+  private nameCustomized: boolean = false;
+  private portCustomized: boolean = false;
+  private suppressPortChange: boolean = false;
+
   onColorModeChange() {
     this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
   }
@@ -53,7 +66,7 @@ export struct WebDavAccountDialog {
     if(this.isEditMode){
       this.accountName = this.account.name;
       this.host = this.account.host;
-      this.port = this.account.port;
+      this.updatePortState(this.account.port, true);
       this.filepath = this.account.filepath;
       this.username = this.account.account;
       this.password = this.account.password;
@@ -62,10 +75,13 @@ export struct WebDavAccountDialog {
       this.shareName = this.account.smbShare ?? '';
       this.domain = this.account.smbDomain ?? '';
       this.coverPath = this.account.coverPath || '';
-      Logger.info('heanup WebDavAccountDialog', `编辑模式加载账户: ${this.accountName}, 封面路径: ${this.coverPath}`);
+      this.nameCustomized = true;
+      Logger.info('heanup RemoteDriveAccountDialog', `编辑模式加载账户: ${this.accountName}, 封面路径: ${this.coverPath}`);
       if (this.coverPath) {
-        Logger.info('heanup WebDavAccountDialog', `封面文件是否存在: ${ImagePickerUtil.imageExists(this.coverPath)}`);
+        Logger.info('heanup RemoteDriveAccountDialog', `封面文件是否存在: ${ImagePickerUtil.imageExists(this.coverPath)}`);
       }
+    } else {
+      this.applyTypeDefaults(this.driveType);
     }
   }
 
@@ -170,6 +186,7 @@ export struct WebDavAccountDialog {
           .maxLines(1)
           .onChange((value: string) => {
             this.accountName = value;
+            this.nameCustomized = true;
           });
       }
       .width('100%')
@@ -177,17 +194,22 @@ export struct WebDavAccountDialog {
 
       // 服务器地址
       Row({ space: 8 }) {
-        Text('服务器')
+        Text(this.getServerLabel())
           .fontSize(14)
           .maxLines(2)
           .fontColor($r('app.color.index_tab_font_color'));
-        TextArea({ placeholder: '例如: example.com', text: this.host })
+        TextArea({ placeholder: '服务器地址或连接串', text: this.host })
           .layoutWeight(1)
           .onChange((value: string) => {
-            this.host = value;
+            const trimmed = value.trim();
+            if (trimmed.includes('://') && this.tryParseConnectionString(trimmed)) {
+              return;
+            }
+            this.host = trimmed;
           });
       }
       .alignItems(VerticalAlign.Center);
+      this.buildHelperText(this.getServerHint())
 
       // 端口
       Row({ space: 8 }) {
@@ -199,15 +221,21 @@ export struct WebDavAccountDialog {
           .maxLines(1)
           .type(InputType.Number)
           .onChange((value: string) => {
+            if (this.suppressPortChange) {
+              this.suppressPortChange = false;
+              return;
+            }
             const parsed = parseInt(value);
-            if (Number.isNaN(parsed)) {
-              this.port = this.driveType === RemoteDriveType.Smb ? 445 : (this.enableHttps ? 443 : 80);
+            const defaultPort = this.driveType === RemoteDriveType.Smb ? 445 : (this.enableHttps ? 443 : 5005);
+            if (Number.isNaN(parsed) || parsed === -1) {
+              this.updatePortState(defaultPort, false);
             } else {
-              this.port = parsed;
+              this.updatePortState(parsed, true);
             }
           });
       }
       .alignItems(VerticalAlign.Center);
+      this.buildHelperText('若留空将自动使用协议默认端口')
 
       if (this.driveType === RemoteDriveType.Smb) {
         // SMB 共享名称
@@ -215,7 +243,7 @@ export struct WebDavAccountDialog {
           Text('共享名称')
             .fontSize(14)
             .fontColor($r('app.color.index_tab_font_color'));
-          TextInput({ placeholder: '例如: music', text: this.shareName })
+          TextInput({ placeholder: '共享名称', text: this.shareName })
             .layoutWeight(1)
             .maxLines(1)
             .onChange((value: string) => {
@@ -223,12 +251,13 @@ export struct WebDavAccountDialog {
             });
         }
         .alignItems(VerticalAlign.Center);
+        this.buildHelperText('NAS 上共享根目录的名称,例如 music、share')
 
         Row({ space: 8 }) {
           Text('域/工作组')
             .fontSize(14)
             .fontColor($r('app.color.index_tab_font_color'));
-          TextInput({ placeholder: '可选,例如: WORKGROUP', text: this.domain })
+          TextInput({ placeholder: '可选', text: this.domain })
             .layoutWeight(1)
             .maxLines(1)
             .onChange((value: string) => {
@@ -236,6 +265,7 @@ export struct WebDavAccountDialog {
             });
         }
         .alignItems(VerticalAlign.Center);
+        this.buildHelperText('可选,用于需要域/工作组认证的 SMB 服务器')
       }
 
       // 文件目录
@@ -243,7 +273,7 @@ export struct WebDavAccountDialog {
         Text('文件目录')
           .fontSize(14)
           .fontColor($r('app.color.index_tab_font_color'));
-        TextInput({ placeholder: '例如: /music', text: this.filepath })
+        TextInput({ placeholder: '远程目录', text: this.filepath })
           .layoutWeight(1)
           .maxLines(1)
           .onChange((value: string) => {
@@ -251,6 +281,7 @@ export struct WebDavAccountDialog {
           });
       }
       .alignItems(VerticalAlign.Center);
+      this.buildHelperText('从共享根开始的路径,例如 /music 或 /音乐/歌单1')
 
       // 用户名
       Row({ space: 8 }) {
@@ -292,7 +323,9 @@ export struct WebDavAccountDialog {
             .selectedColor(this.themeColor)
             .onChange((isOn: boolean) => {
               this.enableHttps = isOn;
-              this.port = isOn ? 443 : 80;
+              if (!this.portCustomized && this.driveType === RemoteDriveType.WebDav) {
+                this.updatePortState(isOn ? 443 : 5005, false);
+              }
             });
         }
         .width('100%');
@@ -374,25 +407,155 @@ export struct WebDavAccountDialog {
       .backgroundColor(this.driveType === type ? this.themeColor : (this.isDarkMode ? '#2C2C2E' : $r('app.color.input_background')))
       .fontColor(this.driveType === type ? Color.White : $r('app.color.index_tab_font_color'))
       .onClick(() => {
-        this.driveType = type;
-        if (type === RemoteDriveType.Smb) {
-          this.enableHttps = false;
-          if (!this.port || this.port === 80 || this.port === 0) {
-            this.port = 445;
-          }
-        } else {
-          if (!this.port || this.port === 445) {
-            this.port = this.enableHttps ? 443 : 80;
-          }
-        }
+        this.handleDriveTypeChange(type);
       });
   }
 
+  private handleDriveTypeChange(type: RemoteDriveType) {
+    if (this.driveType === type) {
+      return;
+    }
+    this.driveType = type;
+    if (type === RemoteDriveType.Smb) {
+      this.enableHttps = false;
+    }
+    this.applyTypeDefaults(type, true);
+  }
+
+  private applyTypeDefaults(type: RemoteDriveType, forcePort: boolean = false) {
+    if (!this.nameCustomized) {
+      this.accountName = this.getDefaultAccountName(type);
+    }
+    this.updatePortForType(type, forcePort);
+  }
+
+  private updatePortForType(type: RemoteDriveType, force: boolean = false) {
+    if (!force && this.portCustomized) {
+      return;
+    }
+    if (type === RemoteDriveType.Smb) {
+      this.updatePortState(445, false);
+      return;
+    }
+    this.updatePortState(this.enableHttps ? 443 : 5005, false);
+  }
+
+  private getDefaultAccountName(type: RemoteDriveType): string {
+    return type === RemoteDriveType.Smb ? '新建SMB' : '新建WebDAV';
+  }
+
+  private getServerLabel(): string {
+    return '服务器';
+  }
+
+  private getServerHint(): string {
+    return this.driveType === RemoteDriveType.Smb
+      ? '支持 smb://user:pass@host/share 输入,自动拆分账户、共享、路径'
+      : '支持 https://user:pass@host:port/path 输入,自动填充协议、端口和目录';
+  }
+
   private getPortPlaceholder(): string {
     if (this.driveType === RemoteDriveType.Smb) {
       return '默认: 445';
     }
-    return this.enableHttps ? '默认: 443' : '默认: 80';
+    return this.enableHttps ? '默认: 443' : '默认: 5005';
+  }
+
+  private updatePortState(value: number, customized: boolean) {
+    this.suppressPortChange = true;
+    this.port = value;
+    this.portCustomized = customized;
+  }
+
+  @Builder
+  private buildHelperText(text: string) {
+    if (text && text.trim().length > 0) {
+      Text(text)
+        .fontSize(12)
+        .fontColor(this.isDarkMode ? '#8E8E93' : '#999999')
+        .opacity(0.9)
+        .alignSelf(ItemAlign.Start)
+    }
+  }
+
+  private tryParseConnectionString(input: string): boolean {
+    const parsed = this.parseConnectionString(input);
+    if (!parsed) {
+      return false;
+    }
+    if (parsed.protocol === 'http' || parsed.protocol === 'https') {
+      this.applyParsedWebDav(parsed);
+      ToastUtil.showToast('已解析 WebDAV 连接');
+      return true;
+    }
+    if (parsed.protocol === 'smb' || parsed.protocol === 'cifs') {
+      this.applyParsedSmb(parsed);
+      ToastUtil.showToast('已解析 SMB 连接');
+      return true;
+    }
+    return false;
+  }
+
+  private applyParsedWebDav(parsed: ParsedConnectionParts): void {
+    this.handleDriveTypeChange(RemoteDriveType.WebDav);
+    this.enableHttps = parsed.protocol === 'https';
+    this.host = parsed.host;
+    if (parsed.port) {
+      this.updatePortState(parsed.port, true);
+    } else {
+      this.updatePortForType(RemoteDriveType.WebDav, true);
+    }
+    if (parsed.username) {
+      this.username = parsed.username;
+    }
+    if (parsed.password) {
+      this.password = parsed.password;
+    }
+    this.filepath = parsed.path?.length ? parsed.path : '/';
+  }
+
+  private applyParsedSmb(parsed: ParsedConnectionParts): void {
+    this.handleDriveTypeChange(RemoteDriveType.Smb);
+    this.host = parsed.host;
+    if (parsed.port) {
+      this.updatePortState(parsed.port, true);
+    } else {
+      this.updatePortForType(RemoteDriveType.Smb, true);
+    }
+    if (parsed.username) {
+      this.username = parsed.username;
+    }
+    if (parsed.password) {
+      this.password = parsed.password;
+    }
+    const segments = parsed.path?.replace(/^\/+/, '').split('/') ?? [];
+    this.shareName = segments.length > 0 && segments[0].length > 0 ? segments[0] : this.shareName;
+    const relative = segments.length > 1 ? segments.slice(1).join('/') : '';
+    this.filepath = relative ? `/${relative}` : '/';
+  }
+
+  private parseConnectionString(input: string): ParsedConnectionParts | null {
+    const pattern = /^([a-z][a-z0-9+\-.]*):\/\/(?:([^:@\/]+)(?::([^@\/]*))?@)?([^\/:]+)(?::(\d+))?(\/.*)?$/i;
+    const match = input.match(pattern);
+    if (!match) {
+      Logger.warn('heanup RemoteDriveAccountDialog', `连接字符串解析失败: ${input}`);
+      return null;
+    }
+    const protocol = match[1].toLowerCase();
+    const username = match[2] ? this.safeDecode(match[2]) : undefined;
+    const password = match[3] ? this.safeDecode(match[3]) : undefined;
+    const host = match[4];
+    const port = match[5] ? Number(match[5]) : undefined;
+    const path = match[6] && match[6].length > 0 ? match[6] : undefined;
+    return { protocol, username, password, host, port, path };
+  }
+
+  private safeDecode(value: string): string {
+    try {
+      return decodeURIComponent(value);
+    } catch (_error) {
+      return value;
+    }
   }
 
   /**
@@ -414,10 +577,10 @@ export struct WebDavAccountDialog {
           ImagePickerUtil.deleteImage(this.coverPath)
         }
         this.coverPath = selectedPath
-        Logger.info('heanup WebDavAccountDialog', `选择封面成功: ${selectedPath}`)
+        Logger.info('heanup RemoteDriveAccountDialog', `选择封面成功: ${selectedPath}`)
       }
     } catch (error) {
-        Logger.error('heanup WebDavAccountDialog', `选择封面失败: ${(error as Error).message}`)
+        Logger.error('heanup RemoteDriveAccountDialog', `选择封面失败: ${(error as Error).message}`)
         ToastUtil.showToast('选择封面失败')
     }
   }
@@ -436,7 +599,7 @@ export struct WebDavAccountDialog {
         ImagePickerUtil.deleteImage(this.coverPath)
       }
       this.coverPath = ''
-      Logger.info('heanup WebDavAccountDialog', '移除封面成功')
+      Logger.info('heanup RemoteDriveAccountDialog', '移除封面成功')
     }
   }
 }

+ 3 - 3
entry/src/main/ets/entryability/EntryAbility.ets

@@ -133,9 +133,9 @@ export default class EntryAbility extends UIAbility {
             // const PreferencesUtil = (await import('../common/util/PreferencesUtil')).default;
             // PreferencesUtil.getInstance().setContext(this.context);
 
-            // 3. 初始化WebdavManager
-            const WebdavManagerModule = await import('../common/util/WebdavManager');
-            const webdavManager = WebdavManagerModule.WebdavManager.getInstance();
+            // 3. 初始化RemoteDriveManager
+            const RemoteDriveManagerModule = await import('../common/util/RemoteDriveManager');
+            const webdavManager = RemoteDriveManagerModule.RemoteDriveManager.getInstance();
             webdavManager.setContext(this.context);
 
             // 4. 创建WebDAV数据库表

+ 43 - 43
entry/src/main/ets/pages/NewIndex.ets

@@ -46,9 +46,10 @@ import { showCreatePlaylistDialog } from '../dialog/PlaylistDialog';
 import { ImagePickerUtil } from '../common/util/ImagePickerUtil';
 import { WebDavMainPage } from './WebDavMainPage';
 import { WebDavAccount } from '../viewmodel/WebDavAccount';
-import { WebdavManager } from '../common/util/WebdavManager';
-import { WebDavAccountDialog } from '../dialog/WebDavAccountDialog';
+import { RemoteDriveManager } from '../common/util/RemoteDriveManager';
+import { RemoteDriveAccountDialog } from '../dialog/RemoteDriveAccountDialog';
 import ReqPermissionUtil from '../common/util/ReqPermissionUtil';
+import { getRemoteDriveAccountLabel, getRemoteDriveDisplayLabel, getRemoteDriveProtocolLabel } from '../common/util/RemoteDriveLabel';
 
 // import { FFmpeg, FFProgressMessageParser } from '@sj/ffmpeg';
 
@@ -177,10 +178,10 @@ struct NewIndex {
   @State selectedPlaylist: Playlist | null = null
   private playlistTable: PlaylistTable | null = null
 
-  // WebDAV账户相关状态变量
+  // 网盘账户相关状态变量
   @State webDavAccounts: WebDavAccount[] = []
-  private webdavManager: WebdavManager = WebdavManager.getInstance()
-  private _webDavLoading: boolean = false // 防止重复加载WebDAV账户的标志
+  private webdavManager: RemoteDriveManager = RemoteDriveManager.getInstance()
+  private _webDavLoading: boolean = false // 防止重复加载网盘账户的标志
   @State selectedAccount: WebDavAccount = new WebDavAccount()
   /**
    * 返回键处理逻辑:
@@ -230,10 +231,10 @@ struct NewIndex {
 
 
   onPageShow() {
-    LogUtil.info('heanup NewIndex', 'onPageShow 被调用,刷新歌单列表和WebDAV账户列表')
+    LogUtil.info('heanup NewIndex', 'onPageShow 被调用,刷新歌单列表和网盘账户列表')
     // 加载歌单列表
     this.loadPlaylistList()
-    // 加载WebDAV账户列表
+    // 加载网盘账户列表
     this.loadWebDavAccounts()
   }
   /**
@@ -1195,7 +1196,7 @@ struct NewIndex {
    */
   @Builder
   buildCloudStorageTab() {
-    // 当前只支持WebDAV账户,将来可以在这里添加其他类型的网盘账户
+    // 当前只支持网盘账户,将来可以在这里添加其他类型的网盘账户
     // 例如:OneDrive, Google Drive, Dropbox等
     // 添加新账户按钮
     ListItem() {
@@ -1208,7 +1209,7 @@ struct NewIndex {
             .alignSelf(ItemAlign.Center)
             .margin({ left: 25 })
 
-          Text('添加WebDAV账户')
+          Text(`添加${getRemoteDriveAccountLabel()}`)
             .margin({ left: 10, right: 20 })
             .fontSize(14)
             .fontColor($r('app.color.index_tab_font_color'))
@@ -1228,11 +1229,11 @@ struct NewIndex {
       .backgroundColor(Color.Transparent)
       .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.6 })
       .onClick(() => {
-        console.info('heanup', '点击添加WebDAV账户')
-        this.showAddWebDavAccountDialog(false)
+        console.info('heanup', '点击添加网盘账户')
+        this.showRemoteDriveAccountDialog(false)
       })
     }
-    // 显示所有WebDAV账户
+    // 显示所有网盘账户
     ForEach(this.webDavAccounts, (account: WebDavAccount,index:number) => {
       ListItem() {
         Button({ type: ButtonType.Capsule, stateEffect: true }) {
@@ -1260,7 +1261,7 @@ struct NewIndex {
 
               Row() {
                 // 账户类型标签
-                Text('WebDAV')
+                Text(getRemoteDriveDisplayLabel(account.webType))
                   .fontSize(10)
                   .fontColor(this.selectedAccount==account?this.themeColor:$r('app.color.index_tab_font_color'))
                   .opacity(0.8)
@@ -1293,7 +1294,7 @@ struct NewIndex {
         .backgroundColor(Color.Transparent)
         .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.8 })
         .onClick(() => {
-          console.info('heanup', '点击WebDAV账户:', account.name)
+          console.info('heanup', '点击网盘账户:', account.name)
           this.selectWebDavAccount(account)
         })
         .bindContextMenu(this.MenuDavBuilder(account), ResponseType.LongPress,
@@ -1316,7 +1317,7 @@ struct NewIndex {
     // 如果没有账户,显示提示信息
     if (this.webDavAccounts.length === 0) {
       ListItem() {
-        Text('暂无WebDAV账户,点击上方按钮添加')
+        Text(`暂无${getRemoteDriveAccountLabel()},点击上方按钮添加`)
           .fontSize(14)
           .fontColor($r('app.color.index_tab_font_color'))
           .opacity(0.6)
@@ -1360,7 +1361,7 @@ struct NewIndex {
         content: '编辑'
       })
         .onClick(async() => {
-         this.showAddWebDavAccountDialog(true,account)
+         this.showRemoteDriveAccountDialog(true,account)
         })
 
       MenuItem({
@@ -1376,7 +1377,7 @@ struct NewIndex {
 
 
   /**
-   * 删除WebDAV账户
+   * 删除网盘账户
    */
   async deleteWebDavAccount(account: WebDavAccount) {
     try {
@@ -1394,19 +1395,19 @@ struct NewIndex {
           action: async () => {
             try {
               await this.webdavManager.removeAccount(account)
-              ToastUtil.showToast('WebDAV账户删除成功')
-              // 重新加载WebDAV账户列表
+              ToastUtil.showToast('网盘账户删除成功')
+              // 重新加载网盘账户列表
               await this.loadWebDavAccounts()
-              LogUtil.info('heanup NewIndex', 'WebDAV账户删除成功:', account.name)
+              LogUtil.info('heanup NewIndex', '网盘账户删除成功:', account.name)
             } catch (error) {
-              LogUtil.error('heanup NewIndex', `删除WebDAV账户失败: ${(error as Error).message}`)
+              LogUtil.error('heanup NewIndex', `删除网盘账户失败: ${(error as Error).message}`)
               ToastUtil.showToast('删除失败')
             }
           }
         }
       })
     } catch (error) {
-      LogUtil.error('heanup NewIndex', `删除WebDAV账户操作失败: ${(error as Error).message}`)
+      LogUtil.error('heanup NewIndex', `删除网盘账户操作失败: ${(error as Error).message}`)
       ToastUtil.showToast('操作失败')
     }
   }
@@ -1543,7 +1544,7 @@ struct NewIndex {
       // 设置WebDAV管理器的上下文
       this.webdavManager.setContext(this.context)
 
-      // 创建WebDAV账户表
+      // 创建网盘账户表
       await this.webdavManager.createWebDavTableInDB()
 
       // 订阅WebDAV管理器事件
@@ -1554,7 +1555,7 @@ struct NewIndex {
         }
       })
 
-      // 首页EntryAblility去加载WebDAV账户了。所以这边不加载
+      // 首页EntryAblility去加载网盘账户了。所以这边不加载
       // await this.loadWebDavAccounts()
 
       LogUtil.info('heanup NewIndex', 'WebDAV管理器初始化成功')
@@ -1564,28 +1565,28 @@ struct NewIndex {
   }
 
   /**
-   * 加载WebDAV账户列表
+   * 加载网盘账户列表
    */
   async loadWebDavAccounts() {
     try {
-      LogUtil.info('heanup NewIndex', '开始加载WebDAV账户列表')
+      LogUtil.info('heanup NewIndex', '开始加载网盘账户列表')
       await this.webdavManager.queryWebDavAccountsFromDB()
       // 强制触发UI更新
       this.webDavAccounts = this.webdavManager.getAllWebDavAccounts().slice()
       this.isRefreshing = false
-      LogUtil.info('heanup NewIndex', `成功加载 ${this.webDavAccounts.length} 个WebDAV账户`)
+      LogUtil.info('heanup NewIndex', `成功加载 ${this.webDavAccounts.length} 个网盘账户`)
     } catch (error) {
       this.isRefreshing = false
-      LogUtil.error('heanup NewIndex', `加载WebDAV账户列表失败: ${(error as Error).message}`)
+      LogUtil.error('heanup NewIndex', `加载网盘账户列表失败: ${(error as Error).message}`)
     }
   }
 
   /**
-   * 选择WebDAV账户
+   * 选择网盘账户
    */
   selectWebDavAccount(account: WebDavAccount) {
     try {
-      LogUtil.info('heanup NewIndex', '选择WebDAV账户:', account.name)
+      LogUtil.info('heanup NewIndex', '选择网盘账户:', account.name)
       // 如果账户未激活,先激活它
       if (!account.isActivate) {
         // 先将所有账户设为未激活
@@ -1597,11 +1598,11 @@ struct NewIndex {
         account.isActivate = true
         // 更新数据库中的激活状态
         this.webdavManager.editAccount(account).then(() => {
-          LogUtil.info('heanup NewIndex', 'WebDAV账户编辑成功:', account.name)
+          LogUtil.info('heanup NewIndex', '网盘账户编辑成功:', account.name)
 
 
         }).catch((error: Error) => {
-          LogUtil.error('heanup NewIndex', `编辑WebDAV账户失败: ${error.message}`)
+          LogUtil.error('heanup NewIndex', `编辑网盘账户失败: ${error.message}`)
           ToastUtil.showToast('编辑账户失败')
         })
       }
@@ -1610,16 +1611,16 @@ struct NewIndex {
       this.mType = 6
       this.doShowDrawer()
     } catch (error) {
-      LogUtil.error('heanup NewIndex', `选择WebDAV账户失败: ${(error as Error).message}`)
+      LogUtil.error('heanup NewIndex', `选择网盘账户失败: ${(error as Error).message}`)
       ToastUtil.showToast('选择账户失败')
     }
   }
 
   /**
-   * 显示添加WebDAV账户对话框
+   * 显示添加网盘账户对话框
    */
   @State addDavDialogId:number = 1
-  showAddWebDavAccountDialog(isEditMode?: boolean,account?: WebDavAccount) {
+  showRemoteDriveAccountDialog(isEditMode?: boolean,account?: WebDavAccount) {
 
     const node: FrameNode | null = this.getUIContext().getFrameNodeById("test_text") || null;
     this.getUIContext().getPromptAction().openCustomDialog({
@@ -1637,7 +1638,7 @@ struct NewIndex {
 
   @Builder
   webDavAccountBuilder(isEditMode?: boolean,account?: WebDavAccount) {
-     WebDavAccountDialog({
+     RemoteDriveAccountDialog({
        isEditMode: isEditMode,
        account: account,
        onCancel: () => {
@@ -1651,11 +1652,11 @@ struct NewIndex {
            // 编辑模式:更新现有账户
            this.webdavManager.editAccount(account).then(() => {
              ToastUtil.showToast('修改成功')
-             // 重新加载WebDAV账户列表,观察着模式去更新了,所以这里不需要更新,先注释掉
+             // 重新加载网盘账户列表,观察着模式去更新了,所以这里不需要更新,先注释掉
              // this.loadWebDavAccounts()
-             LogUtil.info('heanup NewIndex', 'WebDAV账户修改成功:', account.name)
+             LogUtil.info('heanup NewIndex', '网盘账户修改成功:', account.name)
            }).catch((error: Error) => {
-             LogUtil.error('heanup NewIndex', `修改WebDAV账户失败: ${error.message}`)
+             LogUtil.error('heanup NewIndex', `修改网盘账户失败: ${error.message}`)
              ToastUtil.showToast('修改失败')
            })
          } else {
@@ -1679,11 +1680,11 @@ struct NewIndex {
             account.smbDomain
           ).then(() => {
              ToastUtil.showToast('添加成功')
-             // 重新加载WebDAV账户列表 观察着模式去更新了,所以这里不需要更新,先注释掉
+             // 重新加载网盘账户列表 观察着模式去更新了,所以这里不需要更新,先注释掉
              // this.loadWebDavAccounts()
-             LogUtil.info('heanup NewIndex', 'WebDAV账户添加成功:', account.name)
+             LogUtil.info('heanup NewIndex', '网盘账户添加成功:', account.name)
            }).catch((error: Error) => {
-             LogUtil.error('heanup NewIndex', `添加WebDAV账户失败: ${error.message}`)
+             LogUtil.error('heanup NewIndex', `添加网盘账户失败: ${error.message}`)
              ToastUtil.showToast('添加失败')
            })
          }
@@ -1716,4 +1717,3 @@ interface HiCarAspectRatio {
   context: Context;
   playlistId: string;
 }
-

+ 15 - 14
entry/src/main/ets/pages/WebDavMainPage.ets

@@ -1,7 +1,7 @@
-import { WebdavManager } from '../common/util/WebdavManager';
+import { RemoteDriveManager } from '../common/util/RemoteDriveManager';
 import { WebDavAccount } from '../viewmodel/WebDavAccount';
 import { Song } from '../viewmodel/Song';
-import { WebdavManagerStates } from '../common/enums/WebdavManagerStates';
+import { RemoteDriveManagerStates } from '../common/enums/RemoteDriveManagerStates';
 import Logger from '../common/util/Logger';
 import { promptAction, router, window } from '@kit.ArkUI';
 import { CommonConstants } from '../common/constants/CommonConstants';
@@ -14,6 +14,7 @@ import { EventConstants } from '../common/constants/EventConstants';
 import { LazyDataSource } from '../common/util/LazyDataSource';
 import { PreferencesUtil } from '@pura/harmony-utils';
 import { ButtonFancyModifier, ShadowModifier, SymbolGlyphFancyModifier } from '../common/util/AttributeModifierUtil';
+import { getRemoteDriveAccountLabel, getRemoteDriveDisplayLabel, getRemoteDrivePlaylistPrefix } from '../common/util/RemoteDriveLabel';
 
 /**
  * 歌单播放事件数据
@@ -62,7 +63,7 @@ function decodeUrlEncodedString(encodedStr: string): string {
 @Component
 export struct WebDavMainPage {
   @StorageProp('topSafeHeight') topSafeHeight: number = 0;
-  @State webdavManager: WebdavManager = WebdavManager.getInstance();
+  @State webdavManager: RemoteDriveManager = RemoteDriveManager.getInstance();
   @State accounts: WebDavAccount[] = [];
   @Prop @Watch('onSwitchAccount') selectedAccount: WebDavAccount;
   @State songs: VideoItem[] = [];
@@ -184,7 +185,7 @@ export struct WebDavMainPage {
   // 处理WebDAV事件
   private handleWebdavEvent(event: string): void {
     switch (event) {
-      case WebdavManagerStates.LoadFilesInfoSucceed:
+      case RemoteDriveManagerStates.LoadFilesInfoSucceed:
         this.songs = this.webdavManager.webDavSongs;
         this.updateListData(this.songs)
         // 直接引用webdavManager的数组,避免@Observed序列化问题
@@ -198,13 +199,13 @@ export struct WebDavMainPage {
         //   message: '加载成功: ' + this.webDavFiles.filter(f => f.isDirectory).length + '个文件夹, ' + this.songs.length + '首歌曲'
         // });
         break;
-      case WebdavManagerStates.LoadFilesInfoFailed:
+      case RemoteDriveManagerStates.LoadFilesInfoFailed:
         this.isLoading = false;
         this.getUIContext().getPromptAction().showToast({ message: '加载失败' });
         break;
-      case WebdavManagerStates.InsertAccountSucceed:
-      case WebdavManagerStates.EditAccountSucceed:
-      case WebdavManagerStates.RemoveAccountSucceed:
+      case RemoteDriveManagerStates.InsertAccountSucceed:
+      case RemoteDriveManagerStates.EditAccountSucceed:
+      case RemoteDriveManagerStates.RemoveAccountSucceed:
         this.loadAccounts();
         break;
     }
@@ -322,8 +323,8 @@ export struct WebDavMainPage {
       const eventPlaylistPlay: emitter.InnerEvent = { eventId: EventConstants.EVENT_PLAYLIST_PLAY };
 
       const playlistData: PlaylistEventData = {
-        playlistId: 'webdav-playlist', // 使用特殊的ID标识WebDAV播放列表
-        playlistName: 'WebDAV - ' + (this.selectedAccount?.name || '未知账户'),
+        playlistId: 'webdav-playlist', // 使用特殊的ID标识网盘播放列表
+        playlistName: `${getRemoteDriveDisplayLabel(this.selectedAccount?.webType)} - ${this.selectedAccount?.name || '未知账户'}`,
         songCount: this.songs.length,
         startIndex: index,
         songFilePaths: songFilePaths
@@ -358,7 +359,7 @@ export struct WebDavMainPage {
     try {
       Logger.info(TAG, 'heanup 一键创建歌单开始');
       if (!this.selectedAccount || !this.selectedAccount.id) {
-        this.getUIContext().getPromptAction().showToast({ message: '请先选择WebDAV账户' });
+        this.getUIContext().getPromptAction().showToast({ message: `请先选择${getRemoteDriveAccountLabel()}` });
         return;
       }
       if (!this.songs || this.songs.length === 0) {
@@ -382,7 +383,7 @@ export struct WebDavMainPage {
       // 构建歌单名称:账户名 + 当前路径(简化)
       const rawPath = this.webdavManager.currentPath || '/';
       const shortPath = rawPath === '/' ? '根目录' : rawPath.replace(/\/$/, '').split('/').slice(-1)[0];
-      const playlistName = `WebDAV-${this.selectedAccount.name}-${shortPath}`;
+      const playlistName = `${getRemoteDrivePlaylistPrefix(this.selectedAccount.webType)}-${this.selectedAccount.name}-${shortPath}`;
 
       // 创建歌单
       // 安全获取HostContext
@@ -436,7 +437,7 @@ export struct WebDavMainPage {
         return;
       }
       Logger.info(TAG, `heanup 准备创建歌单: ${playlistName}`);
-      const created = await playlistTable.createPlaylist(playlistName, `来自WebDAV账户: ${this.selectedAccount.name} 路径: ${rawPath}`);
+      const created = await playlistTable.createPlaylist(playlistName, `来自${getRemoteDriveDisplayLabel(this.selectedAccount.webType)}: ${this.selectedAccount.name} 路径: ${rawPath}`);
       if (!created) {
         this.getUIContext().getPromptAction().showToast({ message: '歌单创建失败' });
         return;
@@ -558,7 +559,7 @@ export struct WebDavMainPage {
         .height(120)
         .opacity(0.3)
 
-      Text('暂无WebDAV账户')
+      Text(`暂无${getRemoteDriveAccountLabel()}`)
         .fontSize(16)
         .fontColor($r('app.color.index_tab_font_color'))
         .opacity(0.6)

+ 4 - 4
entry/src/main/ets/view/LocalMusic.ets

@@ -99,9 +99,9 @@ import { convertPlaylistSongsToVideoItems, emptyView,updateAllSongsSortOrder } f
 import { Playlist, PlaylistSong } from '../viewmodel/Playlist';
 import { Song } from '../viewmodel/Song';
 import { SongType } from '../common/enums/SongType';
-import { WebdavManager, WebDavAuthInfo as WebDavManagerAuthInfo,
+import { RemoteDriveManager, WebDavAuthInfo as WebDavManagerAuthInfo,
   buildHttpHeadersWithWebDav,
-  WebDavAuthItem} from '../common/util/WebdavManager';
+  WebDavAuthItem} from '../common/util/RemoteDriveManager';
 import PermissionUtil from '../common/util/PermissionUtil'
 import { EditAudio, setRingTone } from './EditAudio';
 import { ExtractAccompaniment } from './ExtractAccompaniment';
@@ -259,7 +259,7 @@ async function setVideoUrlForSong(song: VideoItem): Promise<string> {
 
   if (isSmbType(song.type) && song.webdav_account_id) {
     try {
-      const manager = WebdavManager.getInstance();
+      const manager = RemoteDriveManager.getInstance();
       const account = await manager.getWebDavAccountById(song.webdav_account_id);
       if (!account) {
         throw new Error('SMB账号不可用');
@@ -12340,7 +12340,7 @@ export struct LocalMusic {
       Logger.info(`heanup WebDAV歌曲认证 - 歌曲名: ${this.currentSong.name}, webdav_account_id: ${this.currentSong.webdav_account_id || '未设置'}`);
       if (this.currentSong.webdav_account_id) {
         try {
-          const webdavManager = WebdavManager.getInstance();
+          const webdavManager = RemoteDriveManager.getInstance();
           const webDavHeaders = await webdavManager.buildHttpHeadersWithAccountId(this.currentSong, this.videoUrl);
           if (webDavHeaders && webDavHeaders.size > 0) {
             webDavHeaders.forEach((value, key) => headers.set(key, value));