Skip to content

Commit

Permalink
修复分享页面,无法下载问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wyndem committed Jul 13, 2023
1 parent 970e74a commit 933aff8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_VERSION='2.1.1'
VITE_VERSION='2.1.2'
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@


## GitHub开源
[https://github.com/wyndem/ali-video] (https://github.com/wyndem/ali-video)
## 油猴地址
https://greasyfork.org/zh-CN/scripts/458626

## 鸣谢
开源脚手架: [vite-plugin-monkey] (https://github.com/lisonge/vite-plugin-monkey)
开源脚手架: https://github.com/lisonge/vite-plugin-monkey


# 说明
Expand Down
3 changes: 2 additions & 1 deletion src/api/aliyun.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const shareLinkDownloadUrl=(data,shareToken)=>axios({
},
headers:{
'content-type': 'application/json;charset=UTF-8',
'x-share-token': shareToken
'x-share-token': shareToken,
'_token':false
}

})
Expand Down
36 changes: 24 additions & 12 deletions src/page/DwoloadPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted, reactive } from "vue";
import { ref, onMounted, onUnmounted, reactive, withCtx } from "vue";
import { monkeyWindow } from '$';
import user from '../util/user';
import { getDownloadUrl, shareLinkDownloadUrl } from '../api/aliyun'
Expand Down Expand Up @@ -55,6 +55,13 @@ function group(array, subGroupLength) {
}
function updateHref(id) {
var $a = $(`a[data-id="${id}"]`);
var title = $a.attr('title');
$a.attr("href", title)
}
var shareToken;
const shareTokenV = reactive(user.getShareToken());
onMounted(async () => {
Expand Down Expand Up @@ -146,6 +153,7 @@ function getFileUrl(item, call) {
item.text = "正在获取下载地址中"
let showDnload;
if (item.share_id) {
showDnload = shareLinkDownloadUrl({
file_id: item.file_id,
Expand Down Expand Up @@ -217,11 +225,13 @@ onUnmounted(() => {
<el-link v-if="item.type == 'folder'" type="primary"
:href="home ? '/drive/folder/' + item.file_id : '/s/' + shareTokenV.share_id + '/folder/' + item.file_id">点击进入文件夹</el-link>

<el-link v-if="item.type == 'file' && !item.error" type="primary" :href="item.url" target="_blank">{{
item.text
}}</el-link>
<el-link @mousedown="updateHref(item.file_id)" @mouseup="updateHref(item.file_id)"
v-if="item.type == 'file' && !item.error" :data-id="item.file_id" type="primary" :title='item.url'
:href="item.url" >{{
item.text
}}</el-link>

<el-link v-if="item.type == 'file' && item.error" type="danger" :href="item.url" target="_blank">{{
<el-link v-if="item.type == 'file' && item.error" type="danger" :href="item.url">{{
item.text
}}</el-link>

Expand All @@ -232,17 +242,19 @@ onUnmounted(() => {
<div>
<div class="footer">
<div>
<ElButton type="primary" @click.stop="monkeyWindow.open('https://github.com/wyndem/ali-video', '_blank')">❤️
<ElButton type="primary"
@click.stop="monkeyWindow.open('https://github.com/wyndem/ali-video', '_blank')">❤️
开源地址</ElButton>

<ElButton type="primary" @click.stop="monkeyWindow.open('https://greasyfork.org/zh-CN/scripts/458626', '_blank')">👍
<ElButton type="primary"
@click.stop="monkeyWindow.open('https://greasyfork.org/zh-CN/scripts/458626', '_blank')">👍
点个赞</ElButton>

<ElButton type="primary" @click.stop="IDMPush">IDM 导出文件</ElButton>

<ElButton type="primary" @click.stop="aria2Push">{{data.pushBtonText }}</ElButton>
<ElButton type="primary"
style="margin-left: 10px;width: auto;border: 0 solid transparent;" class="aria2-set" @click.stop="showSet" circle >⚙️</ElButton>
<ElButton type="primary" @click.stop="IDMPush">IDM 导出文件</ElButton>

<ElButton type="primary" @click.stop="aria2Push">{{ data.pushBtonText }}</ElButton>
<ElButton type="primary" style="margin-left: 10px;width: auto;border: 0 solid transparent;"
class="aria2-set" @click.stop="showSet" circle>⚙️</ElButton>
</div>
</div>
</div>
Expand Down

0 comments on commit 933aff8

Please sign in to comment.