Spaces:
Sleeping
Sleeping
File size: 1,127 Bytes
fcbf538 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Uploaded Files</title>
<style>
ul {
list-style-type: none;
}
li {
cursor: pointer;
margin: 5px 0;
}
</style>
</head>
<body>
<h1>Uploaded Files</h1>
<ul>
{% if current_path %}
<li onclick="location.href='{{ url_for('list_files', path=current_path.rsplit('/', 1)[0]) }}'">.. (Go Up)</li>
{% endif %}
{% for file in files %}
<li onclick="openItem('{{ file }}')">{{ file }}</li>
{% endfor %}
</ul>
<a href="/">Back to Shell</a>
<script>
function openItem(item) {
const currentPath = "{{ current_path }}";
const newPath = currentPath ? currentPath + '/' + item : item;
const isDir = item.includes('.'); // 简单判断是否为文件
if (isDir) {
location.href = '/files/' + newPath;
} else {
location.href = '/files/' + currentPath + '/' + item;
}
}
</script>
</body>
</html>
|