完成资源页面

This commit is contained in:
2026-05-21 00:31:30 +00:00
parent 78557a6ffa
commit 55f01abd74
5 changed files with 113 additions and 25 deletions

View File

@@ -0,0 +1,30 @@
<html>
<head>
<title>绿坝娘资源小站 (仮) | {{ title }}</title>
<link rel="icon" type="image/png" sizes="128x128" href="/static/src/img/logo.png">
</head>
<body>
<a href="/">返回主页</a>
<br>
<h1>Index of /</h1>
<hr>
<div id="content">
</div>
<hr>
</body>
</html>
<script>
fetch("https://greendam.ww3.tw/api/files/list/")
.then(res => res.json())
.then (data => {
data.forEach(item => {
console.log('ID', item.id);
console.log('Name', item.filename);
console.log('URL', item.url_path);
let contentDocment = `<a href="https://greendam.ww3.tw/resources/${item.filename}">${item.filename}</a><br>`
document.getElementById("content").innerHTML += contentDocment
})
})
</script>

View File

@@ -0,0 +1,29 @@
<html>
<head>
<title>绿坝娘资源小站 (仮) | {{ name }}</title>
</head>
<body>
<a href="/resources">返回上级</a>
<br>
<h1>Index of /{{ name }}</h1>
<hr>
<div id="content">
</div>
<hr>
</body>
</html>
<script>
fetch("https://greendam.ww3.tw/api/files/list/{{ name }}/")
.then(res => res.json())
.then (data => {
data.forEach(item => {
console.log('ID', item.id);
console.log('Name', item.filename);
console.log('URL', item.url_path);
let contentDocment = `<a href="${item.url_path}">${item.filename}</a><br>`
document.getElementById("content").innerHTML += contentDocment
})
})
</script>