wehub-cloud-tpl-static-site-function
44fa265a3e
- buildCommand regenerates public/assets/big.bin (512MiB) at build time - gitignore the generated blob - add a download card at the top of the page, above status/upload
58 行
1.9 KiB
HTML
58 行
1.9 KiB
HTML
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>WeHub 上传下载 demo</title>
|
|
<link rel="stylesheet" href="/assets/style.css" />
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1>WeHub 上传 / 下载 demo</h1>
|
|
<p class="lede">
|
|
静态前端 + <code>/api/cloud/*</code> 函数。文件直传对象存储(presigned URL),
|
|
元信息(文件名 / 大小 / 类型 / 状态 / 时间)存 PostgreSQL。
|
|
</p>
|
|
|
|
<section class="card">
|
|
<h2>静态大文件下载</h2>
|
|
<p>
|
|
构建期生成的 512MiB <code>big.bin</code>(不进仓库,部署时生成)。点链接才会下载,用来产生静态下行。
|
|
</p>
|
|
<p><a class="btn primary" href="/assets/big.bin" download="big.bin">下载 512MiB big.bin</a></p>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>状态</h2>
|
|
<div id="status" class="status">加载中…</div>
|
|
<button id="refresh" type="button" class="btn">刷新状态</button>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>上传</h2>
|
|
<div class="upload-row">
|
|
<input id="file" type="file" />
|
|
<button id="upload" type="button" class="btn primary">上传</button>
|
|
</div>
|
|
<pre id="upload-out" class="out"></pre>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>已上传文件
|
|
<button id="reload" type="button" class="btn small">刷新列表</button>
|
|
</h2>
|
|
<table id="list">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th><th>文件名</th><th>类型</th><th>大小</th><th>状态</th><th>上传时间</th><th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
<pre id="list-out" class="out"></pre>
|
|
</section>
|
|
</main>
|
|
<script src="/assets/app.js"></script>
|
|
</body>
|
|
</html>
|