feat: restore direct download link button in share dialog

Add back the missing direct download link button that was removed.
This button allows users to copy a direct download URL for shared files,
which is different from the share page URL.

Changes:
- Add direct download link button with content_paste_go icon
- Import pub API for download URL generation
- Add hasDownloadLink() method to check if file can be directly downloaded
- Add buildDownloadLink() method to generate direct download URLs
- Only show button for single file selections (not directories)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wx-11-ot 2025-08-07 11:34:52 +08:00
parent 6d620c00a1
commit 49203f7599

View File

@ -32,6 +32,16 @@
<i class="material-icons">content_paste</i>
</button>
</td>
<td class="small" v-if="hasDownloadLink()">
<button
class="action copy-clipboard"
:aria-label="$t('buttons.copyDownloadLinkToClipboard')"
:title="$t('buttons.copyDownloadLinkToClipboard')"
@click="copyToClipboard(buildDownloadLink(link))"
>
<i class="material-icons">content_paste_go</i>
</button>
</td>
<td class="small">
<button
class="action"
@ -132,7 +142,7 @@
<script>
import { mapActions, mapState } from "pinia";
import { useFileStore } from "@/stores/file";
import { share as api } from "@/api";
import { share as api, pub as pubApi } from "@/api";
import dayjs from "dayjs";
import { useLayoutStore } from "@/stores/layout";
import { copy } from "@/utils/clipboard";
@ -247,6 +257,14 @@ export default {
buildLink(share) {
return api.getShareURL(share);
},
hasDownloadLink() {
return (
this.selectedCount === 1 && !this.req.items[this.selected[0]].isDir
);
},
buildDownloadLink(share) {
return pubApi.getDownloadURL(share);
},
sort() {
this.links = this.links.sort((a, b) => {
if (a.expire === 0) return -1;