Getting ready for 1.2.0 release: many smaller requests implemented
- Implements #7 - Implements #42 and therefore #64 - Improved #53 - Implements #59 - Implements #61 - Implements #63 - Implements #80 - Implements #84 - Added Info page - Removed Help page - Bumped version number to 1.2.0 - Fixed a bug where wide mode was still 720px wide - Created FUNDING.yml - Reorganised arguments in README.MD and documented new options - Updated SECURITY.MD - Added display of last read time and read count - Increased default width to 800px to make UI less cluttered - Reorganised index page - New, better attach file button I want to spend some time testing these changes and let everyone have a look at them before tagging and releasing new artifacts.
This commit is contained in:
parent
769901c895
commit
44b55ae08e
22 changed files with 977 additions and 327 deletions
|
@ -1,6 +1,8 @@
|
|||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use crate::args::ARGS;
|
||||
use linkify::{LinkFinder, LinkKind};
|
||||
use qrcode_generator::QrCodeEcc;
|
||||
use std::fs;
|
||||
|
||||
use crate::{dbio, Pasta};
|
||||
|
@ -16,8 +18,16 @@ pub fn remove_expired(pastas: &mut Vec<Pasta>) {
|
|||
} as i64;
|
||||
|
||||
pastas.retain(|p| {
|
||||
// expiration is `never` or not reached
|
||||
if p.expiration == 0 || p.expiration > timenow {
|
||||
// keep if:
|
||||
// expiration is `never` or not reached
|
||||
// AND
|
||||
// read count is less than burn limit, or no limit set
|
||||
// AND
|
||||
// has been read in the last N days where N is the arg --gc-days OR N is 0 (no GC)
|
||||
if (p.expiration == 0 || p.expiration > timenow)
|
||||
&& (p.read_count < p.burn_after_reads || p.burn_after_reads == 0)
|
||||
&& (p.last_read_days_ago() < ARGS.gc_days || ARGS.gc_days == 0)
|
||||
{
|
||||
// keep
|
||||
true
|
||||
} else {
|
||||
|
@ -45,6 +55,10 @@ pub fn remove_expired(pastas: &mut Vec<Pasta>) {
|
|||
dbio::save_to_file(pastas);
|
||||
}
|
||||
|
||||
pub fn string_to_qr_svg(str: &str) -> String {
|
||||
qrcode_generator::to_svg_to_string(str, QrCodeEcc::Low, 512, None::<&str>).unwrap()
|
||||
}
|
||||
|
||||
pub fn is_valid_url(url: &str) -> bool {
|
||||
let finder = LinkFinder::new();
|
||||
let spans: Vec<_> = finder.spans(url).collect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue