fix(workspace): 工作空间「查看」媒体文件直接播放(2026-09-18用户要求)——workspace_view.dspy原只渲染txt/md/json,视频/音频/图片全落'其他→下载查看'弹提示;补媒体分支:video_exts→VideoPlayer/audio_exts→AudioPlayer/image_exts→Image控件直接播放(三控件均已注册bricks.Factory,声明式widgetBuild可解析;workspace_file.dspy的FileResponse支持Range请求可拖进度);扩展名覆盖对齐workspace_open.dspy(编辑入口本就播放,查看入口补齐)
This commit is contained in:
parent
b02ee5f345
commit
7a6185f937
@ -102,6 +102,43 @@ if ext in md_exts:
|
||||
}]
|
||||
}
|
||||
|
||||
# 媒体文件 → 直接用播放控件打开(2026-09-18 用户要求:查看即播放,不再让下载)
|
||||
# 控件均已注册进 bricks.Factory(videoplayer.js/audio.js/image.js),声明式 widgetBuild 可解析;
|
||||
# workspace_file.dspy 已用 FileResponse 提供媒体流(支持 Range 请求,可拖动进度)。
|
||||
video_exts = ['.mp4', '.m3u8', '.mpd', '.webm', '.mov', '.avi', '.mkv']
|
||||
audio_exts = ['.mp3', '.wav', '.aac', '.flac', '.m4a', '.ogg']
|
||||
image_exts = ['.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp', '.bmp', '.ico']
|
||||
|
||||
if ext in video_exts:
|
||||
return {
|
||||
"widgettype": "PopupWindow",
|
||||
"options": {"title": name + " (播放)", "width": "70%", "height": "70%", "auto_open": True, "resizable": True},
|
||||
"subwidgets": [{
|
||||
"widgettype": "VideoPlayer",
|
||||
"options": {"url": file_url, "width": "100%", "height": "100%"}
|
||||
}]
|
||||
}
|
||||
|
||||
if ext in audio_exts:
|
||||
return {
|
||||
"widgettype": "PopupWindow",
|
||||
"options": {"title": name + " (播放)", "width": "50%", "height": "30%", "auto_open": True, "resizable": True},
|
||||
"subwidgets": [{
|
||||
"widgettype": "AudioPlayer",
|
||||
"options": {"url": file_url, "width": "100%", "height": "100%"}
|
||||
}]
|
||||
}
|
||||
|
||||
if ext in image_exts:
|
||||
return {
|
||||
"widgettype": "PopupWindow",
|
||||
"options": {"title": name + " (查看)", "width": "70%", "height": "70%", "auto_open": True, "resizable": True},
|
||||
"subwidgets": [{
|
||||
"widgettype": "Image",
|
||||
"options": {"url": file_url, "width": "100%", "height": "100%"}
|
||||
}]
|
||||
}
|
||||
|
||||
# 其他 → 下载查看
|
||||
download_url = file_url + "&download=1"
|
||||
download_script = (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user