From b2b2145c37f6f51469fba4cb5bb85b30172bed21 Mon Sep 17 00:00:00 2001 From: Nyako <46496367+Hell13Cat@users.noreply.github.com> Date: Sat, 6 Jun 2026 15:30:28 +0300 Subject: [PATCH] 0.2.0b --- run.py | 4 ++ system_module/tasks.py | 9 +++ templates/task.html | 136 +++++++++++++++++++++++++++++++++-------- 3 files changed, 123 insertions(+), 26 deletions(-) diff --git a/run.py b/run.py index 17b2a4d..66cdda5 100644 --- a/run.py +++ b/run.py @@ -56,6 +56,7 @@ def post(post_id): @app.route('/file/') def serve_image(filename): folder_path = tasks.find_file(filename, FILE_FOLDERS) + print(filename, FILE_FOLDERS) if folder_path == None: return make_response("Not found", 404) else: @@ -100,6 +101,9 @@ def api(): return "", 200 else: return "", 500 + if data["task"] == "not_found_file": + list_md5_not_found = tasks.get_files_not_found(database, CONFIG_ROOT) + return jsonify({'list': list_md5_not_found}), 200 elif data["type"] == "download": if not data or 'id' not in data: return jsonify({'status': 'error', 'message': 'URL not get'}), 400 diff --git a/system_module/tasks.py b/system_module/tasks.py index c015c76..07f138a 100644 --- a/system_module/tasks.py +++ b/system_module/tasks.py @@ -41,6 +41,15 @@ def get_size_edge(type_searсh: bool, file_list: list[str]): result = max(file_list, key=lambda f: Path(f).stat().st_size) return str(result) +def get_files_not_found(database, config): + all_db = database.get_all() + list_md5 = [] + for one_post in all_db: + file_path = find_file(one_post["local_filename"], config["file"]["repos"], is_folder=False) + if file_path == None: + list_md5.append(one_post["md5"]) + return list_md5 + def calculate_analytic(database, config): all_db = database.get_all() explicit_db = database.get_search(["e"], []) diff --git a/templates/task.html b/templates/task.html index ece992c..2b08645 100644 --- a/templates/task.html +++ b/templates/task.html @@ -17,20 +17,18 @@ /* Search Autocomplete Styles */ .search-wrapper { flex-grow: 1; max-width: 400px; position: relative; } .search-wrapper input { width: 100%; background-color: var(--bg-input); border: 1px solid var(--border-color); color: white; padding: 6px 10px; border-radius: 3px; outline: none; } - .autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; background-color: var(--bg-box); border: 1px solid var(--border-color); border-radius: 3px; margin-top: 4px; list-style: none; z-index: 1000; max-height: 250px; overflow-y: auto; box-shadow: 0 4px 10px rgba(0,0,0,0.5); display: none; } - .autocomplete-item { padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between; border-bottom: 1px solid #333; } - .autocomplete-item:hover { background-color: var(--bg-input); } - .autocomplete-count { color: var(--text-muted); font-size: 12px; } - + /* Main Content & Tasks Styles */ main { padding: 20px; max-width: 1000px; margin: 0 auto; } h1 { font-size: 20px; margin-bottom: 20px; color: white; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; } .task-list { display: flex; flex-direction: column; gap: 15px; } - .task-card { background-color: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 4px; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; transition: background-color 0.2s; } + /* Добавил flex-wrap: wrap чтобы результаты могли падать на новую строку */ + .task-card { background-color: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 4px; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; transition: background-color 0.2s; } .task-card:hover { background-color: var(--bg-box); } + .task-info { flex: 1; min-width: 250px; } .task-info h3 { font-size: 16px; color: var(--link-color); margin-bottom: 5px; } .task-info p { color: var(--text-muted); font-size: 13px; line-height: 1.4; } @@ -44,6 +42,10 @@ .task-status { font-weight: bold; font-size: 13px; min-width: 90px; text-align: right; } .status-success { color: var(--color-g); } .status-error { color: var(--color-e); } + + /* Стили для вывода результатов */ + .task-result-box { width: 100%; margin-top: 10px; border-top: 1px solid var(--border-color); padding-top: 15px; display: none; } + .task-result-box textarea { width: 100%; height: 150px; background-color: var(--bg-input); color: var(--text-main); border: 1px solid var(--border-color); border-radius: 3px; padding: 10px; margin-top: 10px; resize: vertical; outline: none; font-family: monospace; } @media (max-width: 700px) { header { flex-wrap: wrap; } @@ -75,48 +77,46 @@ - -
-

Новая задача

-

Описание новой задачи.

+

Поиск недоступных файлов

+

Ищет посты, для которых отсутствуют физические файлы на диске. Выводит список ссылок на экран и предлагает скачать их в формате .txt.

- + +
+ +
+
+ Найдено битых ссылок: 0 + +
+
- --> \ No newline at end of file