mirror of
https://github.com/house-of-vanity/furumi.git
synced 2025-07-06 21:24:08 +00:00
It works
This commit is contained in:
@ -66,14 +66,15 @@ impl HTTP {
|
||||
.await?
|
||||
.json::<Vec<RemoteEntry>>()
|
||||
.await?;
|
||||
info!("Found {} entries into '{}'", resp.len(), path.display());
|
||||
debug!("Found {} entries into '{}'", resp.len(), path.display());
|
||||
Ok(resp)
|
||||
}
|
||||
|
||||
pub async fn read(&self, path: PathBuf, size: usize, offset: usize) -> Result<Vec<u8>, Error> {
|
||||
debug!("Reading path '{}/{}'", self.server, path.display());
|
||||
let mut headers = header::HeaderMap::new();
|
||||
let range = format!("bytes={}-{}", offset, { offset + size });
|
||||
let range = format!("bytes={}-{}", offset, { offset + size - 1 });
|
||||
info!("range = {:?}", range);
|
||||
headers.insert(
|
||||
header::RANGE,
|
||||
header::HeaderValue::from_str(range.as_str()).unwrap(),
|
||||
|
14
src/main.rs
14
src/main.rs
@ -3,10 +3,12 @@ use std::path::PathBuf;
|
||||
extern crate log;
|
||||
use env_logger::Env;
|
||||
use std::process;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
mod config;
|
||||
mod filesystem;
|
||||
mod http;
|
||||
use itertools::Itertools;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), std::io::Error> {
|
||||
@ -22,10 +24,20 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
error!("The mountpoint must be a directory");
|
||||
process::exit(0x0004);
|
||||
}
|
||||
let options = [
|
||||
"ro",
|
||||
"fsname=furumi-http",
|
||||
// "sync_read",
|
||||
"auto_unmount",
|
||||
"allow_other",
|
||||
].iter().join(",");
|
||||
|
||||
let memfs = filesystem::MemFS::new(&cfg);
|
||||
memfs.fetch_remote(PathBuf::from("/"), 1).await;
|
||||
polyfuse_tokio::mount(memfs, mountpoint, &[]).await?;
|
||||
polyfuse_tokio::mount(memfs, mountpoint, &[
|
||||
"-o".as_ref(),
|
||||
options.as_ref(),
|
||||
],).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user