forked from nektro/andesite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlisting.hbs
More file actions
123 lines (123 loc) 路 8.14 KB
/
Copy pathlisting.hbs
File metadata and controls
123 lines (123 loc) 路 8.14 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Index of {{path}}</title>
<!---->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.7.5/semantic.min.css" integrity="sha256-S4n5rcKkPwT9YZGXPue8OorJ7GCPxBA5o/Z0ALWXyHs=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/file-icon-vectors@1.0.0/dist/file-icon-square-o.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro">
<link rel="stylesheet" href="{{base}}style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.7.5/semantic.min.js" integrity="sha256-x9fzgXT3ttK2cZF12FIafkDJzEqqLnaWcchT+Y/plJ4=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.1.0/tablesort.min.js" integrity="sha256-p3wukcf2d2jxbVnlqPDO9t4AAjnl42D2aIzrK4S0X6w=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.1.0/sorts/tablesort.number.min.js" integrity="sha256-ra1pWQ7MfuVIolZ/phcEXegs9m1ehXaCNI8cmc3gJEs=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.1.0/sorts/tablesort.filesize.min.js" integrity="sha256-qNYlSpvv2lsmkcarYkQBkUzVcHKaml/BHcGxcSNsyrU=" crossorigin="anonymous"></script>
<!---->
<style>
body { overflow-x: visible; }
body > div:not(.modals) { margin: 1em; }
table.table { font-family: 'Source Code Pro', 'Courier New', monospace; }
table.table tr td { white-space: nowrap; padding: .2em .7em !important; }
table.table tr td:nth-child(5) { text-align: right; }
#dlbox { background-color: #dedede; border-radius: .25em; padding: 1em; }
p code { background-color: #ccc; border-radius: .2em; padding: .25em; }
table tr td i.info.icon { cursor: pointer; }
.ui.basic.modal { width: 100vw; }
.ui.basic.modal h4 { margin: 0 1em; }
.ui.modal .content > div { margin: 1em 0; }
</style>
<script>
(function() {
$(document).ready(function() {
$("table th").click(function(e) {
localStorage.setItem("table_sort", Array.from(e.target.parentElement.children).indexOf(e.target).toString());
});
const ts = localStorage.getItem("table_sort");
if (ts !== null && ts.length > 0) {
document.querySelectorAll("table th")[parseInt(ts)].setAttribute("data-sort-default", "");
}
new Tablesort(document.querySelector("table"), {
descending: false,
});
const mel = document.querySelector(".modal .content").children;
$("table tr td i.info.icon").click(function(e) {
const f = e.target.parentElement.parentElement.children[3].firstElementChild.pathname;
const url = "{{base}}api/search?q="+f;
fetch(url).then(x => x.json()).then(x => {
if (x.count === 0) {
return
}
mel[0].parentElement.parentElement.children[1].textContent = x.results[0].path;
mel[0].children[0].children[1].value = x.results[0].hash_md5;
mel[1].children[0].children[1].value = x.results[0].hash_sha1;
mel[2].children[0].children[1].value = x.results[0].hash_sha256;
mel[3].children[0].children[1].value = x.results[0].hash_sha512;
mel[4].children[0].children[1].value = x.results[0].hash_sha3;
mel[5].children[0].children[1].value = x.results[0].hash_blake2b;
$(".ui.basic.modal").modal("show");
})
});
})
})();
</script>
</head>
<body class="page-listing">
<div class="ui main menu">
<div class="header item">Welcome, {{user.Name}}@{{user.Provider}}</div>
<div class="item"><a href="{{base}}">Home</a></div>
{{#if can_search}}
<div class="item"><a href="{{base}}search"><i class="search icon"></i> Search</a></div>
{{/if}}
{{#if admin}}
<div class="item"><a href="{{base}}admin">Admin Panel</a></div>
{{/if}}
{{#if user.PassKey}}
<div class="item"><a href="{{base}}logout">Logout</a></div>
{{/if}}
<div class="right item">Powered by <a href="https://github.com/nektro/andesite" target="_blank">Andesite</a> <code>{{version}}</code></div>
</div>
<div>
<h1 class="ui header">Index of {{path}}</h1>
<div class="ui divider"></div>
<table class="ui sortable compact table">
<thead>
<th class="collapsing" data-sort-method="number"></th>
{{#if can_search}}
<th class="collapsing" data-sort-method="none"></th>
{{/if}}
<th class="collapsing"></th>
<th class="collapsing">Name</th>
<th class="collapsing" data-sort-method="number">Last Modified</th>
<th class="collapsing" data-sort-method="filesize">Size</th>
<th data-sort-method="none"></th>
</thead>
<tbody>
<tr data-sort-method="none"><td></td><td></td><td></td><td><a href="../">Parent Directory</a></td><td></td><td></td><td></td></tr>
{{#each files}}
<tr><td>{{add_i @index 1}}</td>{{#if can_search}}<td>{{#if is_file}}<i class="info circle icon"></i>{{/if}}</td>{{/if}}<td data-sort="{{is_file}}_{{name}}"><span class="fiv-sqo fiv-icon-{{ext}}"></span></td><td><a href="{{url_name name}}">{{name}}</a></td><td data-sort="{{mod_raw}}">{{mod}}</td><td>{{size}}</td><td></td></tr>
{{/each}}
</tbody>
</table>
</div>
<div id="dlbox">
{{#if user.PassKey}}<p>Download the contents of the entire folder using your passkey: <code>{{user.PassKey}}</code> (<a href="{{base}}regen_passkey">Regenerate Key</a>)</p>{{/if}}
<p><code>wget -m -np -c -R "index.html*"{{#if user.PassKey}} --user-agent "AndesiteUser/{{user.PassKey}}"{{/if}} "{{host}}{{path}}"</code></p>
<p><code>rclone copy --http-url="{{host}}{{path}}" :http: ./ -P{{#if user.PassKey}} --user-agent "AndesiteUser/{{user.PassKey}}"{{/if}}</code></p>
</div>
<div class="ui basic modal">
<div class="ui icon header"><i class="hashtag icon"></i> File Details</div>
<h4></h4>
<div class="content">
<div><div class="ui fluid labeled input"><div class="ui label">MD5</div><input type="text" readonly=""></div></div>
<div><div class="ui fluid labeled input"><div class="ui label">SHA1</div><input type="text" readonly=""></div></div>
<div><div class="ui fluid labeled input"><div class="ui label">SHA256</div><input type="text" readonly=""></div></div>
<div><div class="ui fluid labeled input"><div class="ui label">SHA512</div><input type="text" readonly=""></div></div>
<div><div class="ui fluid labeled input"><div class="ui label">SHA3_512</div><input type="text" readonly=""></div></div>
<div><div class="ui fluid labeled input"><div class="ui label">Blake2b_512</div><input type="text" readonly=""></div></div>
</div>
</div>
</body>
</html>