filesharing/views/download.pug
2022-08-27 00:46:04 +08:00

40 lines
1.4 KiB
Plaintext

doctype html
html(lang='zh')
head
meta(charset='UTF-8')
meta(http-equiv='X-UA-Compatible' content='IE=edge')
meta(name='viewport' content='width=device-width, initial-scale=1.0')
link(rel='icon' href='/favicon.ico' type='image/x-icon')
link(rel='stylesheet' href='/style.css')
title #{file.filename} | 文件下载
body
h1 文件下载
p
a(href='/') 返回首页
form(method='POST')
label 文件
label= file.filename
label 类型
label= file.mimetype
label 大小
label= file.size
|   字节
label 上传
label= moment(file.createdAt).fromNow()
label 热度
label= file.downloads
|   次下载
if file.password
label(for='password_input') 密码
input(id='password_input' name='password' type='password' autocomplete='off' required)
button(id='download_button' type='submit') 下载
if !file.password
- var mimetype = file.mimetype.split('/')[0]
- var src = '/file/' + file.md5
if mimetype == 'image'
p 预览
img(src=src)
if mimetype == 'audio'
p 预览
audio(controls src=src)