allowes for setting download folder in downloader bar;other minor chanages

This commit is contained in:
huangjx
2022-05-03 17:30:17 +08:00
parent 11e07132e5
commit d0084197a7
7 changed files with 96 additions and 15 deletions

View File

@@ -0,0 +1,50 @@
<template>
<div
@click="handler"
class="torrent-file-header"
data-tippy-content="Set Download Folder"
:data-path="path"
></div>
</template>
<script>
import Http from "../lib/http";
import helper from "../utils/helper";
export default {
name: "folderSettings",
methods: {
handler(event) {
let element = event.target;
const cb = function (path) {
let dlPath = element.getAttribute("data-path");
if (dlPath == path) {
helper.info("Same folder,No need to update");
return;
}
let data = { ncd_downloader_dir: path };
let url = helper.generateUrl("/apps/ncdownloader/personal/save");
Http.getInstance(url)
.setData(data)
.setHandler((data) => {
if (data.status) {
helper.info("Download folder updated to " + path);
}
})
.send();
};
helper.filepicker(cb);
},
},
props: ["path"],
};
</script>
<style scoped lang="scss">
@import "../css/variables.scss";
.torrent-file-header {
width: 45px;
height: 100%;
background: $bg-color url("../../img/folder.svg") bottom left no-repeat;
background-size: 40px 40px;
background-clip: border-box;
}
</style>

View File

@@ -44,6 +44,7 @@
@uploadfile="uploadFile"
:path="uris.upload_url"
></uploadFile>
<folderSettings :path="dlPath"></folderSettings>
</div>
</div>
<searchInput
@@ -61,6 +62,7 @@ import searchInput from "./searchInput.vue";
import actionButton from "./actionButton";
import uploadFile from "./uploadFile";
import { translate as t } from "@nextcloud/l10n";
import folderSettings from "./folderSettings.vue";
export default {
inject: ["settings", "search_sites"],
@@ -68,6 +70,7 @@ export default {
return {
checkedValue: false,
path: this.uris.aria2_url,
dlPath: this.settings.settings.ncd_downloader_dir,
inputType: "download",
checkboxes: false,
downloadType: "aria2",
@@ -82,6 +85,7 @@ export default {
actionButton,
searchInput,
uploadFile,
folderSettings,
},
created() {},
computed: {},