mirror of
https://github.com/BioArchLinux/bioarchlinux-packages.git
synced 2025-03-10 06:24:00 +00:00
feat(log): add 404 page
This commit is contained in:
parent
e56207fff1
commit
8a14506771
2 changed files with 6 additions and 3 deletions
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Format datetime in locale format [github#1](https://github.com/imlonghao/archlinuxcn-packages/pull/1)
|
||||
- Support Sentry error tracking
|
||||
- 404 page for log not found
|
||||
|
||||
## [0.2.3] - 2022-01-23
|
||||
|
||||
|
|
|
@ -239,9 +239,11 @@ async fn get_pkg_log(
|
|||
.await
|
||||
.unwrap();
|
||||
let logdir: String = rows[0].get("logdir");
|
||||
let contents =
|
||||
std::fs::read_to_string(format!("/home/lilydjwg/.lilac/log/{}/{}.log", logdir, name))
|
||||
.unwrap();
|
||||
let filename = format!("/home/lilydjwg/.lilac/log/{}/{}.log", logdir, name);
|
||||
let contents = match std::fs::read_to_string(&filename) {
|
||||
Ok(x) => x,
|
||||
Err(_) => return HttpResponse::NotFound().body(format!("Log {} not exist", &filename)),
|
||||
};
|
||||
let converted = ansi_to_html::convert(&contents, true, false).unwrap();
|
||||
let html = format!("{}<code>{}</code>", STYLE_HTML, converted);
|
||||
HttpResponse::Ok()
|
||||
|
|
Loading…
Add table
Reference in a new issue