diff --git a/app/api/config_api.py b/app/api/config_api.py index 407c5ac..f16ab0e 100644 --- a/app/api/config_api.py +++ b/app/api/config_api.py @@ -12,3 +12,14 @@ def config_route(): config[section] = dict(config[section]) return jsonify(config) + +@api_bp.route("/api/config/
//") +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}) diff --git a/app/api/titles.py b/app/api/titles.py index 5b1e05c..eb67b66 100644 --- a/app/api/titles.py +++ b/app/api/titles.py @@ -61,6 +61,7 @@ def add_route(): index=int(request.json["episodeIndex"].split(".")[0]), correction=int(request.json["adjustedEpisodeNumber"]), title=request.json["dirname"], + path=request.json["filepath"], ) config.args = requestData @@ -108,7 +109,7 @@ def edit_route(): for title in titles.sections(): if titles._sections[title]["hash"] != request.json["hash"]: continue - + titles._sections[title]["episode_index"] = request.json["episodeIndex"] titles._sections[title]["season_number"] = request.json["seasonNumber"] titles._sections[title]["torrent_name"] = request.json["torrentName"] diff --git a/app/models/request_data.py b/app/models/request_data.py index 0d7f0a5..9f39e4c 100644 --- a/app/models/request_data.py +++ b/app/models/request_data.py @@ -5,6 +5,7 @@ class RequestData: correction: int = 0 title: str = "" codename: str = "" + path: str = "" force: bool = False def __init__( @@ -15,6 +16,7 @@ class RequestData: correction=0, title="", codename="", + path="", force=False, ): self.url = url @@ -23,4 +25,5 @@ class RequestData: self.correction = correction self.title = title self.codename = codename + self.path = path self.force = force diff --git a/frontend/src/pages/index.vue b/frontend/src/pages/index.vue index e044678..e0ac650 100644 --- a/frontend/src/pages/index.vue +++ b/frontend/src/pages/index.vue @@ -62,7 +62,7 @@ - +
Редагування
diff --git a/frontend/src/pages/settings/account.vue b/frontend/src/pages/settings/account.vue index 1dbecac..bb79fe8 100644 --- a/frontend/src/pages/settings/account.vue +++ b/frontend/src/pages/settings/account.vue @@ -18,7 +18,7 @@ + +
Редагування
+ +
+ folder + + +
+ + +
@@ -70,6 +88,9 @@ import axios from 'axios'; export default { data() { return { + isDialogOpen: false, + dialogValue: '', + currentField: '' }; }, created() { @@ -77,9 +98,50 @@ export default { }, 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() { this.$router.back(); } } } - \ No newline at end of file + + + \ No newline at end of file diff --git a/frontend/tsconfig.app.tsbuildinfo b/frontend/tsconfig.app.tsbuildinfo index f0a3b1b..9b0b6cb 100644 --- a/frontend/tsconfig.app.tsbuildinfo +++ b/frontend/tsconfig.app.tsbuildinfo @@ -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"} \ No newline at end of file +{"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"} \ No newline at end of file