diff --git a/web-front/src/components/DirectoryTree.vue b/web-front/src/components/DirectoryTree.vue
index 805d54b..fa90d1a 100644
--- a/web-front/src/components/DirectoryTree.vue
+++ b/web-front/src/components/DirectoryTree.vue
@@ -190,6 +190,14 @@
>
发送到下载器
+
+ 复制直链
+
@@ -258,6 +266,14 @@
>
发送到下载器
+
+ 复制直链
+
@@ -324,6 +340,14 @@
>
发送到下载器
+
+ 复制直链
+
@@ -391,6 +415,7 @@ export default {
downloadInfo: null,
downloadLoading: false,
singleSendLoading: false,
+ copyLinkLoading: false,
treeProps: {
label: 'fileName',
children: 'children',
@@ -743,6 +768,32 @@ export default {
this.fileDialogVisible = false
this.selectedFile = null
},
+ async copyDirectLink(file) {
+ if (!file?.parserUrl) {
+ this.$message.warning('该文件暂无直链')
+ return
+ }
+ const rawUrl = file.parserUrl.startsWith('http') ? file.parserUrl : (window.location.origin + file.parserUrl)
+ const url = this.appendToken(rawUrl)
+ this.copyLinkLoading = true
+ try {
+ await navigator.clipboard.writeText(url)
+ this.$message.success('直链已复制到剪贴板')
+ } catch {
+ // fallback
+ const ta = document.createElement('textarea')
+ ta.value = url
+ ta.style.position = 'fixed'
+ ta.style.opacity = '0'
+ document.body.appendChild(ta)
+ ta.select()
+ document.execCommand('copy')
+ document.body.removeChild(ta)
+ this.$message.success('直链已复制到剪贴板')
+ } finally {
+ this.copyLinkLoading = false
+ }
+ },
closePreview() {
this.isPreviewing = false
this.previewUrl = ''