This commit is contained in:
2025-04-14 02:33:07 +02:00
parent fe3191d4a2
commit 26fb8b1678
3 changed files with 31 additions and 5 deletions

View File

@@ -73,6 +73,8 @@ import DM from "@/components/torrent/DM.vue";
</script> </script>
<script> <script>
import Cookies from "js-cookie";
export default { export default {
data(){ data(){
return { return {
@@ -154,9 +156,9 @@ export default {
this.$qt.on("status_updated", data => { this.$qt.on("status_updated", data => {
this.dm_status = data; this.dm_status = data;
}) })
// this.$qt.on("stats_updated", data => { this.$qt.on("upload_torrent", data => {
// this.dm_stats = data; this.uploadTorrentB64(data);
// }) })
this.$qt.on("files_updated", data => { this.$qt.on("files_updated", data => {
this.dm_files = data; this.dm_files = data;
}) })
@@ -216,6 +218,17 @@ export default {
setTimeout(() => this.fetchTorrent(torrent_id), 1000); 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){ async updateTorrent(torrent_id, updated_fields){
if(torrent_id in this.torrentsAsObject){ if(torrent_id in this.torrentsAsObject){
for(let key in updated_fields){ for(let key in updated_fields){

View File

@@ -2,7 +2,7 @@
<v-list> <v-list>
<v-list-item prepend-icon="mdi-details" @click="details_enabled = true" title="Download Manager"/> <v-list-item prepend-icon="mdi-details" @click="details_enabled = true" title="Download Manager"/>
<v-dialog width="80%" v-model="details_enabled"> <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-dialog>
<v-list-item <v-list-item
:prepend-icon="dm_status.pause ? 'mdi-play' : 'mdi-pause'" :prepend-icon="dm_status.pause ? 'mdi-play' : 'mdi-pause'"

View File

@@ -14,7 +14,9 @@
{{ file.rel_path }} {{ file.rel_path }}
</template> </template>
<template v-slot:subtitle> <template v-slot:subtitle>
<v-progress-linear
:model-value="file.stats.percent" height="12" color="blue">
</v-progress-linear>
</template> </template>
</v-list-item> </v-list-item>
</v-list> </v-list>
@@ -97,6 +99,17 @@ export default {
finished[file_id] = file; finished[file_id] = file;
}else if(file_id in this.dm_status.downloading){ }else if(file_id in this.dm_status.downloading){
downloading[file_id] = file; 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{ }else{
waiting[file_id] = file; waiting[file_id] = file;
} }