Update dependencies (though the code won't build now)

parent 14e70140
Pipeline #120687691 failed with stage
in 6 minutes and 23 seconds
......@@ -6,10 +6,6 @@
# will have compiled files and executables
/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
......
This diff is collapsed.
......@@ -5,11 +5,12 @@ authors = ["Stavros Korokithakis <[email protected]>"]
[dependencies]
clap = "^2.30"
lazy_static = "^0.2"
dirs = "^2"
lazy_static = "^1"
log = "^0.4"
notify = "^4.0"
reqwest = "^0.8"
rouille = "^1.0"
reqwest = "^0"
rouille = "^3"
rustc-serialize = "^0.3"
simple_logger = "^0.5"
simple_logger = "^1"
xdg = "^2.1"
......@@ -4,6 +4,7 @@ extern crate clap;
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate dirs;
extern crate notify;
extern crate reqwest;
#[macro_use]
......@@ -17,7 +18,6 @@ mod views;
use log::Level;
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
use std::collections::HashMap;
use std::env;
use std::ffi::OsStr;
use std::fs;
use std::io;
......@@ -29,8 +29,8 @@ use std::thread;
use std::time::{Duration, Instant, SystemTime};
use views::start_api;
/// The time of the last filesystem event in the Hearth folder, or None if the files were already
/// added to IPFS.
// The time of the last filesystem event in the Hearth folder, or None if the files were already
// added to IPFS.
lazy_static! {
static ref LAST_EVENT_TIME: Mutex<Option<Instant>> = Mutex::new(None);
}
......@@ -49,7 +49,7 @@ lazy_static! {
lazy_static! {
static ref HEARTH_DIR: std::path::PathBuf = {
let mut dir = env::home_dir().expect("Could not get home directory.");
let mut dir = dirs::home_dir().expect("Could not get home directory.");
dir.push("Hearth");
dir
};
......@@ -152,9 +152,10 @@ fn notify_ipfs(fs_event: bool) {
debug!("Got event, fs_event={:?}", fs_event);
match last_event_time {
None => debug!("Last event time is None"),
Some(t) => debug!("Last event time is {:?}", t),
if last_event_time.is_none() {
debug!("Last event time is None");
} else {
debug!("Last event time is {:?}", last_event_time.unwrap());
}
if fs_event {
......@@ -293,13 +294,13 @@ fn cron_thread() {
fn files_changed(op: notify::Op, path: std::path::PathBuf) {
debug!("Got new event: {:?}, {:?}", op, path);
if op.intersects(
notify::op::CREATE |
notify::op::REMOVE |
notify::op::RENAME |
notify::op::WRITE |
notify::op::RESCAN |
notify::op::CLOSE_WRITE)
{
notify::op::CREATE
| notify::op::REMOVE
| notify::op::RENAME
| notify::op::WRITE
| notify::op::RESCAN
| notify::op::CLOSE_WRITE,
) {
notify_ipfs(true);
}
}
......@@ -349,13 +350,12 @@ fn main() {
(@arg debug: -d --debug "Print debugging information")
).get_matches();
simple_logger::init_with_level(
if matches.is_present("debug") {
Level::Debug
} else {
Level::Info
}
).unwrap();
simple_logger::init_with_level(if matches.is_present("debug") {
Level::Debug
} else {
Level::Info
})
.unwrap();
{
let mut eternum_key = ETERNUM_KEY.lock().unwrap();
......
use rouille;
use rouille::Response;
use kill_ipfs_and_exit;
use HTTP_INTERFACE;
use IPFS_HASHES;
use kill_ipfs_and_exit;
#[derive(RustcEncodable)]
struct ExitResponse {
......@@ -20,24 +20,24 @@ struct HashResponse {
pub fn start_api() {
rouille::start_server(HTTP_INTERFACE, move |request| {
router!(request,
(POST) (/api/exit/) => {
kill_ipfs_and_exit(0);
Response::json(&ExitResponse{result: "ok".to_owned()})
},
(GET) (/api/path/) => {
let path = request.get_param("path").unwrap_or("".to_string());
(POST) (/api/exit/) => {
kill_ipfs_and_exit(0);
Response::json(&ExitResponse{result: "ok".to_owned()})
},
(GET) (/api/path/) => {
let path = request.get_param("path").unwrap_or("".to_string());
let hashes = IPFS_HASHES.lock().unwrap();
match hashes.get(&path) {
Some(hash) => Response::json(&HashResponse{
hash: hash.to_string(),
path: path.to_string(),
result: "ok".to_owned()
}),
None => Response::empty_404(),
}
},
_ => rouille::Response::empty_404()
)
let hashes = IPFS_HASHES.lock().unwrap();
match hashes.get(&path) {
Some(hash) => Response::json(&HashResponse{
hash: hash.to_string(),
path: path.to_string(),
result: "ok".to_owned()
}),
None => Response::empty_404(),
}
},
_ => rouille::Response::empty_404()
)
});
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment