This commit is contained in:
赵鑫 2022-09-04 19:49:22 +08:00
parent 35b84697cd
commit b1b2b29689
3 changed files with 13 additions and 13 deletions

View File

@ -4,13 +4,13 @@ html(lang='zh')
meta(charset='UTF-8') meta(charset='UTF-8')
meta(http-equiv='X-UA-Compatible' content='IE=edge') meta(http-equiv='X-UA-Compatible' content='IE=edge')
meta(name='viewport' content='width=device-width, initial-scale=1.0') meta(name='viewport' content='width=device-width, initial-scale=1.0')
link(rel='icon' href='/favicon.ico' type='image/x-icon') link(rel='icon' href='/share/favicon.ico' type='image/x-icon')
link(rel='stylesheet' href='/style.css') link(rel='stylesheet' href='/share/style.css')
title #{file.filename} | 文件下载 title #{file.filename} | 文件下载
body body
h1 文件下载 h1 文件下载
p p
a(href='/') 返回首页 a(href='/share') 返回首页
form(method='POST') form(method='POST')
label 文件 label 文件
label= file.filename label= file.filename
@ -29,7 +29,7 @@ html(lang='zh')
button(id='download_button' type='submit') 下载 button(id='download_button' type='submit') 下载
if !file.password if !file.password
- const mimetype = file.mimetype.split('/')[0] - const mimetype = file.mimetype.split('/')[0]
- const src = '/file/' + file.md5 - const src = '/share/file/' + file.md5
if mimetype == 'image' if mimetype == 'image'
p 预览 p 预览
img(src=src) img(src=src)

View File

@ -4,20 +4,20 @@ html(lang='zh')
meta(charset='UTF-8') meta(charset='UTF-8')
meta(http-equiv='X-UA-Compatible' content='IE=edge') meta(http-equiv='X-UA-Compatible' content='IE=edge')
meta(name='viewport' content='width=device-width, initial-scale=1.0') meta(name='viewport' content='width=device-width, initial-scale=1.0')
link(rel='icon' href='/favicon.ico' type='image/x-icon') link(rel='icon' href='/share/favicon.ico' type='image/x-icon')
link(rel='stylesheet' href='/style.css') link(rel='stylesheet' href='/share/style.css')
title 文件分享 title 文件分享
body body
h1 文件分享 h1 文件分享
p p
a(href='/upload') 我要上传 a(href='upload') 我要上传
ul ul
if filesharing.length==0 if filesharing.length==0
li 暂无文件 li 暂无文件
else else
for file in filesharing for file in filesharing
li li
a(href=`/download/${file.id}`)= file.filename a(href=`download/${file.id}`)= file.filename
if file.password if file.password
span  ㊙️ span  ㊙️
span.small  (#{moment(file.createdAt).fromNow()}, #{file.downloads} 次下载) span.small  (#{moment(file.createdAt).fromNow()}, #{file.downloads} 次下载)

View File

@ -4,13 +4,13 @@ html(lang='zh')
meta(charset='UTF-8') meta(charset='UTF-8')
meta(http-equiv='X-UA-Compatible' content='IE=edge') meta(http-equiv='X-UA-Compatible' content='IE=edge')
meta(name='viewport' content='width=device-width, initial-scale=1.0') meta(name='viewport' content='width=device-width, initial-scale=1.0')
link(rel='icon' href='/favicon.ico' type='image/x-icon') link(rel='icon' href='/share/favicon.ico' type='image/x-icon')
link(rel='stylesheet' href='/style.css') link(rel='stylesheet' href='/share/style.css')
title 文件上传 title 文件上传
body body
h1 文件上传 h1 文件上传
p p
a(href='/') 返回首页 a(href='/share') 返回首页
if file if file
section section
p p
@ -18,9 +18,9 @@ html(lang='zh')
var #{file.filename}   var #{file.filename}  
| 分享成功! | 分享成功!
p 链接   p 链接  
- const url = '/download/' + file.id - const url = 'download/' + file.id
a(href=url)= url a(href=url)= url
form(method='POST' action='/upload' enctype='multipart/form-data') form(method='POST' action='upload' enctype='multipart/form-data')
label(for='file_input') 文件 label(for='file_input') 文件
input(id='file_input' name='file' type='file' required) input(id='file_input' name='file' type='file' required)
label(for='password_input') 密码 label(for='password_input') 密码