-
Notifications
You must be signed in to change notification settings - Fork 1
/
default_index.h
92 lines (76 loc) · 2.58 KB
/
default_index.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef _DEFAULT_INDEX_H_
#define _DEFAULT_INDEX_H_
const char* strDefaultIndex = R"(
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>NetDisk</title>
<style type="text/css">
body {
padding-top: 50px;
}
.starter-template {
padding: 40px 15px;
text-align: left;
}
@-ms-viewport {
width: device-width;
}
@-o-viewport {
width: device-width;
}
@viewport {
width: device-width;
}
</style>
<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="starter-template">
<h1>在线网盘</h1>
<p class="lead">文件目录</p>
<hr />
<p><a href="/">首页</a></p>
<hr />
{% if exists("filelist") %}
{% for file in filelist %}
{% if file.isDir == true %}
<p><input name="Fruit" type="checkbox" value="" /> <a href="{{file.fullPath}}">{{file.fileName}}</a></p>
{% else %}
<p><input name="Fruit" type="checkbox" value="" /> <a href="{{file.fullPath}}" download="{{file.fileName}}">{{file.fileName}}</a></p>
{% endif %}
{% endfor %}
{% endif %}
<form id="formElem">
<input type="file" name="file" accept="all/*">
<input type="submit" value="上传文件">
</form>
</div>
</div><!-- /.container -->
<script>
formElem.onsubmit = async (e) => {
e.preventDefault();
let res = await fetch('/post', {
method: 'POST',
body: new FormData(formElem)
});
console.log(await res.text());
location.reload(true)
};
</script>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
</body>
</html>
)";
#endif