init
This commit is contained in:
@@ -73,6 +73,8 @@ import DM from "@/components/torrent/DM.vue";
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
@@ -154,9 +156,9 @@ export default {
|
||||
this.$qt.on("status_updated", data => {
|
||||
this.dm_status = data;
|
||||
})
|
||||
// this.$qt.on("stats_updated", data => {
|
||||
// this.dm_stats = data;
|
||||
// })
|
||||
this.$qt.on("upload_torrent", data => {
|
||||
this.uploadTorrentB64(data);
|
||||
})
|
||||
this.$qt.on("files_updated", data => {
|
||||
this.dm_files = data;
|
||||
})
|
||||
@@ -216,6 +218,17 @@ export default {
|
||||
setTimeout(() => this.fetchTorrent(torrent_id), 1000);
|
||||
}
|
||||
},
|
||||
async uploadTorrentB64(b64_torrent){
|
||||
let form = new FormData();
|
||||
form.append("torrent", b64_torrent);
|
||||
let response = await fetch("/api/torrents/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-CSRFToken": Cookies.get('csrftoken')
|
||||
},
|
||||
body: form
|
||||
})
|
||||
},
|
||||
async updateTorrent(torrent_id, updated_fields){
|
||||
if(torrent_id in this.torrentsAsObject){
|
||||
for(let key in updated_fields){
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<v-list>
|
||||
<v-list-item prepend-icon="mdi-details" @click="details_enabled = true" title="Download Manager"/>
|
||||
<v-dialog width="80%" v-model="details_enabled">
|
||||
<DMDetails :dm_files="dm_files" :dm_status="dm_status" :dm_download_location="dm_download_location"/>
|
||||
<DMDetails v-if="details_enabled" :dm_files="dm_files" :dm_status="dm_status" :dm_download_location="dm_download_location"/>
|
||||
</v-dialog>
|
||||
<v-list-item
|
||||
:prepend-icon="dm_status.pause ? 'mdi-play' : 'mdi-pause'"
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
{{ file.rel_path }}
|
||||
</template>
|
||||
<template v-slot:subtitle>
|
||||
|
||||
<v-progress-linear
|
||||
:model-value="file.stats.percent" height="12" color="blue">
|
||||
</v-progress-linear>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
@@ -97,6 +99,17 @@ export default {
|
||||
finished[file_id] = file;
|
||||
}else if(file_id in this.dm_status.downloading){
|
||||
downloading[file_id] = file;
|
||||
if(file_id in this.dm_status["downloader_stats"]){
|
||||
downloading[file_id]["stats"] = this.dm_status["downloader_stats"][file_id];
|
||||
}else{
|
||||
downloading[file_id]["stats"] = {
|
||||
total_size: file.size,
|
||||
downloaded_size: 0,
|
||||
speed: 0,
|
||||
percent: 0,
|
||||
eta: 0,
|
||||
};
|
||||
}
|
||||
}else{
|
||||
waiting[file_id] = file;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user