Update app.py
Browse files
app.py
CHANGED
|
@@ -398,7 +398,6 @@ def login():
|
|
| 398 |
data = load_data()
|
| 399 |
if token in data['users'] and len(token) == 13:
|
| 400 |
session['token'] = token
|
| 401 |
-
# Сохранение токена в localStorage перенесено в JavaScript
|
| 402 |
return redirect(url_for('dashboard'))
|
| 403 |
else:
|
| 404 |
flash('Неверный токен! Токен должен быть 13 символов.')
|
|
@@ -495,7 +494,8 @@ def dashboard(folder_path='root'):
|
|
| 495 |
elif 'move_file' in request.form:
|
| 496 |
file_index = int(request.form.get('file_index'))
|
| 497 |
target_folder = request.form.get('target_folder')
|
| 498 |
-
file = current_folder['files']
|
|
|
|
| 499 |
target = get_folder(data, token, target_folder)
|
| 500 |
target['files'].append(file)
|
| 501 |
save_data(data)
|
|
@@ -605,7 +605,7 @@ def dashboard(folder_path='root'):
|
|
| 605 |
</form>
|
| 606 |
</div>
|
| 607 |
{% endfor %}
|
| 608 |
-
{% for
|
| 609 |
<div class="file-item">
|
| 610 |
{% if file['type'] == 'video' %}
|
| 611 |
<video class="file-preview" preload="metadata" muted loading="lazy" onclick="openModal('https://huggingface.co/datasets/{{ repo_id }}/resolve/main/{{ file['path'] }}', true)">
|
|
@@ -619,7 +619,7 @@ def dashboard(folder_path='root'):
|
|
| 619 |
<p>{{ file['upload_date'] }} ({{ "%.2f" % (file['size'] / (1024 * 1024)) }} МБ)</p>
|
| 620 |
<a href="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/{{ file['path'] }}" class="btn download-btn" download="{{ file['filename'] }}">Скачать</a>
|
| 621 |
<form method="POST" style="margin-top: 10px;">
|
| 622 |
-
<input type="hidden" name="file_index" value="{{
|
| 623 |
<select name="target_folder">
|
| 624 |
<option value="">Переместить в...</option>
|
| 625 |
{% for f_name in current_folder['subfolders'] %}
|
|
|
|
| 398 |
data = load_data()
|
| 399 |
if token in data['users'] and len(token) == 13:
|
| 400 |
session['token'] = token
|
|
|
|
| 401 |
return redirect(url_for('dashboard'))
|
| 402 |
else:
|
| 403 |
flash('Неверный токен! Токен должен быть 13 символов.')
|
|
|
|
| 494 |
elif 'move_file' in request.form:
|
| 495 |
file_index = int(request.form.get('file_index'))
|
| 496 |
target_folder = request.form.get('target_folder')
|
| 497 |
+
file = current_folder['files'][file_index]
|
| 498 |
+
current_folder['files'].pop(file_index)
|
| 499 |
target = get_folder(data, token, target_folder)
|
| 500 |
target['files'].append(file)
|
| 501 |
save_data(data)
|
|
|
|
| 605 |
</form>
|
| 606 |
</div>
|
| 607 |
{% endfor %}
|
| 608 |
+
{% for file in current_folder['files'] %}
|
| 609 |
<div class="file-item">
|
| 610 |
{% if file['type'] == 'video' %}
|
| 611 |
<video class="file-preview" preload="metadata" muted loading="lazy" onclick="openModal('https://huggingface.co/datasets/{{ repo_id }}/resolve/main/{{ file['path'] }}', true)">
|
|
|
|
| 619 |
<p>{{ file['upload_date'] }} ({{ "%.2f" % (file['size'] / (1024 * 1024)) }} МБ)</p>
|
| 620 |
<a href="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/{{ file['path'] }}" class="btn download-btn" download="{{ file['filename'] }}">Скачать</a>
|
| 621 |
<form method="POST" style="margin-top: 10px;">
|
| 622 |
+
<input type="hidden" name="file_index" value="{{ loop.index0 }}">
|
| 623 |
<select name="target_folder">
|
| 624 |
<option value="">Переместить в...</option>
|
| 625 |
{% for f_name in current_folder['subfolders'] %}
|