attempt rendering blank
parent
1e540ece8b
commit
7a61fef41b
|
@ -5,7 +5,7 @@ port = 8282
|
|||
# Please enable this if you are using nginx (if you aren't, please do)
|
||||
# This should speed up file serving a decent amount.
|
||||
# TODO: benchmarks
|
||||
nginx_sendfile = false
|
||||
nginx_sendfile = true
|
||||
|
||||
[database] # DATABASE DATABASE JUST LIVING IN THE DATABASE WOOAH
|
||||
# What SQL Backend to use
|
||||
|
|
|
@ -38,12 +38,9 @@ Deleted files should no longer show up in most stats generated, since storing th
|
|||
|
||||
### File Stats (Pick a individual file from a list, or even multiple?)
|
||||
|
||||
- File Stats `file{file=hUMZCp.jpg filesize=2345677 filetype=jpg views=123, expiry=11111111}`
|
||||
- Total Views on file `file_views{file="bleh.txt"}`
|
||||
|
||||
- Total Bandwidth per file `file_bandwidth{file="bleh.txt" mimetype="text/plain"}`
|
||||
- Total Views on file `file_views{file="bleh.txt", mimetype="text/plain"}`
|
||||
- Total Bandwidth per file `file_bandwidth{file="bleh.txt", mimetype="text/plain"}`
|
||||
- File Size `filesize{file=hUMZCp.jpg}`
|
||||
- File Mimetype `filetype{file="hUMZCp.jpg"} "text/plain"`
|
||||
|
||||
### Malicious/Error Stats
|
||||
|
||||
|
|
|
@ -160,12 +160,13 @@ async fn serve_file(req: &mut Request, res: &mut Response) {
|
|||
|
||||
if nginxsendfile {
|
||||
// Add the content-type header.
|
||||
res.add_header("Content-Type", mimetype, true).unwrap();
|
||||
res.add_header("Content-Type", mimetype, false).unwrap();
|
||||
|
||||
// Add the header, and we're done.
|
||||
// X-Accel-Redirect lets nginx serve the file directly, instead of us doing all that hard work.
|
||||
let xsend = "/files/".to_string() + &filename.to_string();
|
||||
res.add_header("X-Accel-Redirect", xsend, true).unwrap();
|
||||
res.render("");
|
||||
} else {
|
||||
// If nginx sendfile is disabled, we need to render the file directly
|
||||
let filepath = "files/".to_string() + &filename.to_string();
|
||||
|
|
Loading…
Reference in New Issue