Multiple enhancements and bugfixes

!Breaking change! - The updated version will not be able to read your old database file

Major improvements:
- Added editable pastas
- Added private pastas
- Added line numbers
- Added support for wide mode (1080p instead of 720p)
- Added syntax highlighting support
- Added read-only mode
- Added built-in help page
- Added option to remove logo, change title and footer text

Minor improvements:
- Improved looks in pure html mode
- Removed link to GitHub repo from navbar
- Broke up 7km long main.rs file into smaller modules
- Moved water.css into a template instead of serving it as an external resource
- Made Save button a bit bigger
- Updated README.MD

Bugfixes:
- Fixed a bug where an incorrect animal ID in a request would cause a crash
- Fixed a bug where an empty or corrupt JSON database would cause a crash
This commit is contained in:
Daniel Szabo 2022-06-03 17:24:34 +01:00
parent 1c873d23b5
commit 4cc737731a
27 changed files with 1343 additions and 494 deletions

View file

@ -3,13 +3,17 @@ use std::fmt;
use chrono::{DateTime, Datelike, NaiveDateTime, Timelike, Utc};
use serde::{Deserialize, Serialize};
use crate::to_animal_names;
use crate::util::animalnumbers::to_animal_names;
use crate::util::syntaxhighlighter::html_highlight;
#[derive(Serialize, Deserialize)]
pub struct Pasta {
pub id: u64,
pub content: String,
pub file: String,
pub extension: String,
pub private: bool,
pub editable: bool,
pub created: i64,
pub expiration: i64,
pub pasta_type: String,
@ -46,6 +50,14 @@ impl Pasta {
)
}
}
pub fn content_syntax_highlighted(&self) -> String {
html_highlight(&self.content, &self.extension)
}
pub fn content_not_highlighted(&self) -> String {
html_highlight(&self.content, "txt")
}
}
impl fmt::Display for Pasta {