Spaces:
BG5
/
Sleeping

ssh / templates /files.html
BG5's picture
Create files.html
fcbf538 verified
raw
history blame
1.13 kB
<!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>