This commit is contained in:
2025-04-18 17:33:48 +02:00
parent 26fb8b1678
commit 57346dd811
10 changed files with 757 additions and 19 deletions

View File

@@ -15,7 +15,7 @@
<v-divider/>
<UserStats :stats="user_stats"/>
<v-divider/>
{{dm_status}}
<!-- {{dm_status}}-->
<DM v-if="dm_activated" :dm_files="dm_files" :dm_status="dm_status" :dm_download_location="dm_download_location"/>
</v-navigation-drawer>
<v-navigation-drawer v-model="right_drawer" location="right" temporary>
@@ -157,6 +157,7 @@ export default {
this.dm_status = data;
})
this.$qt.on("upload_torrent", data => {
console.log(typeof data);
this.uploadTorrentB64(data);
})
this.$qt.on("files_updated", data => {
@@ -220,7 +221,8 @@ export default {
},
async uploadTorrentB64(b64_torrent){
let form = new FormData();
form.append("torrent", b64_torrent);
form.append("file", b64_torrent);
form.append("file_mode", "base64");
let response = await fetch("/api/torrents/", {
method: "POST",
headers: {

View File

@@ -6,12 +6,19 @@
</v-dialog>
<v-list-item
:prepend-icon="dm_status.pause ? 'mdi-play' : 'mdi-pause'"
@click="$qt.callMethod('set_pause', !dm_status.pause)"
@click="setPause(!dm_status.pause)"
:disabled="!start_available"
>
<template v-slot:title>
{{ dm_status.pause ? 'Start':'Pause' }}
</template>
</v-list-item>
<v-list-item
prepend-icon="mdi-delete-sweep"
:disabled="!dm_status.pause"
@click="$qt.callMethod('del_files', Object.keys(dm_files))"
title="Clear"
/>
<v-list-item prepend-icon="mdi-speedometer">
<template v-slot:title>
{{fs_speed_format(dm_status.speed)}}/s
@@ -42,7 +49,7 @@ import {fs_format, fs_speed_format} from "@/plugins/utils.js";
export default {
methods: {fs_format, fs_speed_format},
props: {
dm_files: {
required: true,
@@ -60,6 +67,20 @@ export default {
data(){
return {
details_enabled: false,
start_available: true
}
},
methods: {
fs_format, fs_speed_format,
setPause(pause){
this.start_available = false
this.$qt.callMethod('set_pause', pause);
if(pause){
setTimeout(() => {this.start_available = true;}, 1000);
}else{
this.start_available = true;
}
}
},
computed: {

View File

@@ -14,8 +14,8 @@
{{ file.rel_path }}
</template>
<template v-slot:subtitle>
<v-progress-linear
:model-value="file.stats.percent" height="12" color="blue">
<v-progress-linear :model-value="file.stats.percent" height="14" color="blue">
{{file.stats.percent.toFixed(1)}}% ({{fs_speed_format(file.stats.speed)}}/s)
</v-progress-linear>
</template>
</v-list-item>
@@ -97,9 +97,10 @@ export default {
for(const [file_id, file] of Object.entries(this.dm_files)){
if(file.downloaded){
finished[file_id] = file;
}else if(file_id in this.dm_status.downloading){
}else if(this.dm_status.downloading.includes(file_id)){
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"] = {