Skip to content

feat:Add webdav batch-danmaku support closes #326 #330

Merged
MCDFsteve merged 1 commit intoMCDFsteve:mainfrom
makabaka11:feat/add-webdav-batch-danmaku-support
Mar 6, 2026
Merged

feat:Add webdav batch-danmaku support closes #326 #330
MCDFsteve merged 1 commit intoMCDFsteve:mainfrom
makabaka11:feat/add-webdav-batch-danmaku-support

Conversation

@makabaka11
Copy link
Contributor

新增了对webdav管理页面的批量匹配弹幕支持 Closes #326
只测试了Windows版本
fdead575-eb5e-4277-9a60-3900886230e5

Copilot AI review requested due to automatic review settings March 6, 2026 12:19
@MCDFsteve MCDFsteve merged commit 95949d7 into MCDFsteve:main Mar 6, 2026
2 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

这个 PR 为 WebDAV 媒体库管理页补齐了与本地一致的“批量匹配弹幕”能力,以解决 #326 提到的 WebDAV 无法批量匹配的问题,并对批量匹配对话框在处理 URL 形式文件路径时的显示做了适配。

Changes:

  • 在 WebDAV 文件夹节点中新增“批量匹配弹幕(本文件夹)”入口,批量将文件与剧集顺序对齐后写入匹配结果到观看历史。
  • 批量匹配弹幕对话框支持从 URL / 本地路径生成更友好的文件显示名。
  • 更新了 pubspec.lock(包含依赖源 url 切换与多处版本变更)。

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
pubspec.lock 依赖锁文件发生大范围变化(含 hosted 源切换与部分版本更新)。
lib/themes/nipaplay/widgets/library_management_tab.dart WebDAV 树新增“本文件夹批量匹配弹幕”入口,并在批量提交后触发刷新。
lib/themes/nipaplay/widgets/batch_danmaku_dialog.dart 批量匹配对话框对 URL 类型 filePath 生成更合适的 displayName。

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +2178 to +2206
final fileUrls = videoFiles
.map((f) => WebDAVService.instance.getFileUrl(connection, f.path))
.toList();
final folderDisplayName = (folderPath == '/' || folderPath.isEmpty)
? connection.name
: p.basename(folderPath);
return ListTile(
dense: true,
contentPadding: EdgeInsets.fromLTRB(indent, 0, 8, 0),
leading: Icon(Icons.playlist_add_check, color: iconColor, size: 18),
title: Text(
'批量匹配弹幕(本文件夹)',
locale: const Locale('zh-Hans', 'zh'),
style: TextStyle(color: titleColor, fontSize: 13),
),
subtitle: Text(
'对齐左侧文件顺序与右侧剧集顺序,一键匹配 ${videoFiles.length} 个文件',
locale: const Locale('zh-Hans', 'zh'),
style: TextStyle(color: subtitleColor, fontSize: 12),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onTap: () {
_showBatchDanmakuMatchDialog(
folderPath,
fileUrls,
initialSearchKeyword: folderDisplayName,
onSuccessRefresh: () => setState(() {}),
);
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里批量构建 fileUrls 使用了 WebDAVService.getFileUrl(connection, path),该方法会在 URL 的 userInfo 中拼接用户名/密码。批量匹配会为大量文件创建/更新 WatchHistoryItem(filePath 作为唯一键持久化到数据库),等于把 WebDAV 凭据以明文 URL 的形式落盘,存在凭据泄露风险(备份/日志/截图/数据库导出等场景)。建议将 WatchHistoryItem 的标识改为不含凭据的稳定形式(例如存 connection.name + relativePath,或存不带 userInfo 的 URL),播放/请求时再根据 connection 注入认证信息。

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +85
/// 从路径或 URL 得到显示名:URL 取 pathSegments 最后一段,本地路径用 basename。
static String _displayNameFromPath(String path) {
if (path.contains('://')) {
final segments = Uri.tryParse(path)?.pathSegments;
if (segments != null && segments.isNotEmpty) {
return segments.last;
}
return path;
}
return p.basename(path);
}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_displayNameFromPath 对 URL 直接取 pathSegments.last,但当 URL 以 “/” 结尾或最后一个 segment 为空时会返回空字符串,导致列表显示空文件名。建议在取值时跳过空 segment(例如取最后一个非空 segment),并在解析失败/为空时回退到原始 path。

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

希望webdav也能像本地一样批量匹配弹幕

3 participants