Skip to content

Commit

Permalink
Bump 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Feb 1, 2022
1 parent db2a93b commit f5a621d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "onehistory"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
authors = ["Jiacai Liu <jiacai2050+1history@gmail.com>"]
description = "All your history in one place"
description = "All your history in one file"
homepage = "https://github.com/1History/1History"
repository = "https://github.com/1History/1History"
keywords = ["cli", "history", "backup", "browser"]
Expand Down
3 changes: 1 addition & 2 deletions src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ pub fn export_csv(csv_file: String, db_file: String) -> Result<()> {
let (start, end) = full_timerange();
debug!("start:{}, end:{}", start, end);

let db = Database::open(db_file).context("open 1history db")?;

let db = Database::open(db_file).context("open 1History DB")?;
let f = OpenOptions::new()
.create(true)
.write(true)
Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,20 @@ fn main() {
}

fn show() -> Result<()> {
let mut cnt = 0;
for f in detect_history_files() {
info!("found history_file {}", f);
cnt += 1;
info!("found:{}", f);
}
info!("Total:{cnt}");
Ok(())
}

fn backup(history_files: Vec<String>, db_file: String, dry_run: bool) -> Result<()> {
let (start, end) = full_timerange();
debug!("start:{}, end:{}", start, end);

let db = Database::open(db_file).context("open dst db")?;
let db = Database::open(db_file).context("open 1History DB")?;

let mut found = 0;
let mut total_affected = 0;
Expand Down
15 changes: 8 additions & 7 deletions src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::HashMap, fmt::Display};

use crate::types::{SourceName, VisitDetail};
use anyhow::{bail, Context, Result};
use log::info;
use log::debug;
use rusqlite::{named_params, Connection, OpenFlags, ToSql};

pub struct Source {
Expand Down Expand Up @@ -75,13 +75,13 @@ impl Source {

pub fn select(
&self,
inclusive_start: i64,
exclusive_end: i64,
start: i64,
end: i64,
) -> Result<Box<dyn Iterator<Item = VisitDetail>>> {
match self.name {
SourceName::Firefox => self.select_firefox(inclusive_start, exclusive_end),
SourceName::Safari => self.select_safari(inclusive_start, exclusive_end),
SourceName::Chrome => self.select_chrome(inclusive_start, exclusive_end),
SourceName::Firefox => self.select_firefox(start, end),
SourceName::Safari => self.select_safari(start, end),
SourceName::Chrome => self.select_chrome(start, end),
}
}

Expand Down Expand Up @@ -170,7 +170,8 @@ ORDER BY
T: PartialOrd + ToSql + Display,
{
let name = format!("{:?}", self.name());
info!("select from {name}, start:{start}, end:{end}");
debug!("select from {name}, start:{start}, end:{end}");

let mut stat = self.conn.prepare(sql_tmpl)?;
let rows = stat.query_map(
named_params! {
Expand Down
4 changes: 3 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ const OS_TYPE: &str = std::env::consts::OS;
lazy_static! {
pub static ref DEFAULT_DB_FILE: String = default_location("onehistory.db");
pub static ref DEFAULT_CSV_FILE: String = default_location(&format!("onehistory-{}.csv", unixepoch_as_ymd(tomorrow_midnight()-1)));

static ref DEFAULT_PROFILES: HashMap<&'static str, String> = {
let mut m = HashMap::new();
if let Some(home) = home_dir() {
// Google Chrome
m.insert(
"chrome-linux",
join_path(home.clone(), ".config/google-chrome/*/History"),
Expand All @@ -35,7 +37,7 @@ lazy_static! {
"AppData/Local/Google/Chrome/User Data/*/History",
),
);
// Firefox
// Mozilla Firefox
m.insert(
"firefox-linux",
join_path(home.clone(), ".mozilla/firefox/*/places.sqlite"),
Expand Down

0 comments on commit f5a621d

Please sign in to comment.