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