Fix torrent path

Need also update deps
This commit is contained in:
CakesTwix 2024-11-19 09:22:51 +02:00
parent a05de0640f
commit af6a581f96
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
6 changed files with 86 additions and 9 deletions

View file

@ -12,3 +12,14 @@ def config_route():
config[section] = dict(config[section]) config[section] = dict(config[section])
return jsonify(config) return jsonify(config)
@api_bp.route("/api/config/<section>/<element>/<value>")
def config_edit_route(section: str, element: str, value: str):
config = initiate_config()
config = config.app_config
config[section][element] = value
with open("data/app.ini", "w") as f:
config.write(f)
return jsonify({"result": True})

View file

@ -61,6 +61,7 @@ def add_route():
index=int(request.json["episodeIndex"].split(".")[0]), index=int(request.json["episodeIndex"].split(".")[0]),
correction=int(request.json["adjustedEpisodeNumber"]), correction=int(request.json["adjustedEpisodeNumber"]),
title=request.json["dirname"], title=request.json["dirname"],
path=request.json["filepath"],
) )
config.args = requestData config.args = requestData

View file

@ -5,6 +5,7 @@ class RequestData:
correction: int = 0 correction: int = 0
title: str = "" title: str = ""
codename: str = "" codename: str = ""
path: str = ""
force: bool = False force: bool = False
def __init__( def __init__(
@ -15,6 +16,7 @@ class RequestData:
correction=0, correction=0,
title="", title="",
codename="", codename="",
path="",
force=False, force=False,
): ):
self.url = url self.url = url
@ -23,4 +25,5 @@ class RequestData:
self.correction = correction self.correction = correction
self.title = title self.title = title
self.codename = codename self.codename = codename
self.path = path
self.force = force self.force = force

View file

@ -62,7 +62,7 @@
</nav> </nav>
</dialog> </dialog>
<dialog class="active" v-if="Object.keys(editFormData).length > 0"> <dialog :class="{ 'active': Object.keys(editFormData).length > 0 }">
<h5 class="primary-text">Редагування</h5> <h5 class="primary-text">Редагування</h5>
<form @submit.prevent="editTitle" class="grid"> <form @submit.prevent="editTitle" class="grid">
<div class="field label prefix border s12"> <div class="field label prefix border s12">

View file

@ -18,7 +18,7 @@
</article> </article>
<article class="primary-text"> <article class="primary-text">
<a class="row wave"> <a class="row wave" @click="openDialog('login')">
<i>person</i> <i>person</i>
<div class="max"> <div class="max">
<h6 class="small">Логін</h6> <h6 class="small">Логін</h6>
@ -26,7 +26,7 @@
</div> </div>
</a> </a>
<hr> <hr>
<a class="row wave"> <a class="row wave" @click="openDialog('password')">
<i>password</i> <i>password</i>
<div class="max"> <div class="max">
<h6 class="small">Пароль</h6> <h6 class="small">Пароль</h6>
@ -34,7 +34,7 @@
</div> </div>
</a> </a>
<hr> <hr>
<a class="row wave"> <a class="row wave" @click="openDialog('hub')">
<i>hub</i> <i>hub</i>
<div class="max"> <div class="max">
<h6 class="small">Торрент клієнт</h6> <h6 class="small">Торрент клієнт</h6>
@ -42,7 +42,7 @@
</div> </div>
</a> </a>
<hr> <hr>
<a class="row wave"> <a class="row wave" @click="openDialog('directory')">
<i>description</i> <i>description</i>
<div class="max"> <div class="max">
<h6 class="small">Директорія завантажень</h6> <h6 class="small">Директорія завантажень</h6>
@ -50,7 +50,7 @@
</div> </div>
</a> </a>
<hr> <hr>
<a class="row wave"> <a class="row wave" @click="openDialog('delay')">
<i>hourglass_top</i> <i>hourglass_top</i>
<div class="max"> <div class="max">
<h6 class="small">Затримка</h6> <h6 class="small">Затримка</h6>
@ -62,6 +62,24 @@
<hr> <hr>
</article> </article>
<dialog :class="{ 'active': isDialogOpen }">
<h5 class="primary-text">Редагування</h5>
<form @submit.prevent="editTitle" class="grid">
<div class="field label prefix border s12">
<i>folder</i>
<input type="text" v-model="dialogValue" placeholder="Назва директорії" required />
<label>Назва директорії</label>
</div>
<nav class="right-align small-padding s12">
<button class="border small-round" @click="closeDialog">
<i>cancel</i>
</button>
<button class="border small-round" type="submit">
<i>edit</i>
</button>
</nav>
</form>
</dialog>
</template> </template>
@ -70,6 +88,9 @@ import axios from 'axios';
export default { export default {
data() { data() {
return { return {
isDialogOpen: false,
dialogValue: '',
currentField: ''
}; };
}, },
created() { created() {
@ -77,9 +98,50 @@ export default {
}, },
methods: { methods: {
goBack() {
this.$router.back();
},
openDialog(field) {
this.currentField = field;
this.dialogValue = field; // очищаем значение при открытии диалога
this.isDialogOpen = true;
},
closeDialog() {
this.isDialogOpen = false;
},
async editTitle() {
try {
// Здесь можно установить URL вашего API
const response = await fetch(`https://your-api-endpoint/${this.currentField}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
value: this.dialogValue
})
});
if (!response.ok) {
throw new Error('Network response was not ok');
}
const data = await response.json();
// Обработка ответа сервера (если необходимо)
console.log(data);
this.closeDialog();
} catch (error) {
console.error('Ошибка:', error);
}
},
goBack() { goBack() {
this.$router.back(); this.$router.back();
} }
} }
} }
</script> </script>
<style scoped>
</style>

View file

@ -1 +1 @@
{"root":["./src/main.ts","./src/vite-env.d.ts","./src/App.vue","./src/components/Navbar.vue","./src/pages/index.vue"],"version":"5.6.2"} {"root":["./src/main.ts","./src/vite-env.d.ts","./src/App.vue","./src/components/Navbar.vue","./src/pages/about.vue","./src/pages/add.vue","./src/pages/index.vue","./src/pages/settings/account.vue","./src/pages/settings/bittorrent.vue","./src/pages/settings/debug.vue","./src/pages/settings/index.vue","./src/pages/settings/palette.vue"],"version":"5.6.2"}